-
Notifications
You must be signed in to change notification settings - Fork 12
/
assetFilters-create.go
75 lines (72 loc) · 2.88 KB
/
assetFilters-create.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package armmediaservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/mediaservices/resource-manager/Microsoft.Media/stable/2022-08-01/examples/assetFilters-create.json
func ExampleAssetFiltersClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armmediaservices.NewAssetFiltersClient("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := client.CreateOrUpdate(ctx, "contoso", "contosomedia", "ClimbingMountRainer", "newAssetFilter", armmediaservices.AssetFilter{
Properties: &armmediaservices.MediaFilterProperties{
FirstQuality: &armmediaservices.FirstQuality{
Bitrate: to.Ptr[int32](128000),
},
PresentationTimeRange: &armmediaservices.PresentationTimeRange{
EndTimestamp: to.Ptr[int64](170000000),
ForceEndTimestamp: to.Ptr(false),
LiveBackoffDuration: to.Ptr[int64](0),
PresentationWindowDuration: to.Ptr[int64](9223372036854775000),
StartTimestamp: to.Ptr[int64](0),
Timescale: to.Ptr[int64](10000000),
},
Tracks: []*armmediaservices.FilterTrackSelection{
{
TrackSelections: []*armmediaservices.FilterTrackPropertyCondition{
{
Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual),
Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeType),
Value: to.Ptr("Audio"),
},
{
Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationNotEqual),
Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeLanguage),
Value: to.Ptr("en"),
},
{
Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationNotEqual),
Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeFourCC),
Value: to.Ptr("EC-3"),
}},
},
{
TrackSelections: []*armmediaservices.FilterTrackPropertyCondition{
{
Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual),
Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeType),
Value: to.Ptr("Video"),
},
{
Operation: to.Ptr(armmediaservices.FilterTrackPropertyCompareOperationEqual),
Property: to.Ptr(armmediaservices.FilterTrackPropertyTypeBitrate),
Value: to.Ptr("3000000-5000000"),
}},
}},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// TODO: use response item
_ = res
}