/
assetFilter.go
400 lines (349 loc) · 15.9 KB
/
assetFilter.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package media
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an Azure Media Asset Filter.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/media"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("media-resources"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
// Name: pulumi.String("examplestoracc"),
// ResourceGroupName: example.Name,
// Location: example.Location,
// AccountTier: pulumi.String("Standard"),
// AccountReplicationType: pulumi.String("GRS"),
// })
// if err != nil {
// return err
// }
// exampleServiceAccount, err := media.NewServiceAccount(ctx, "example", &media.ServiceAccountArgs{
// Name: pulumi.String("examplemediaacc"),
// Location: example.Location,
// ResourceGroupName: example.Name,
// StorageAccounts: media.ServiceAccountStorageAccountArray{
// &media.ServiceAccountStorageAccountArgs{
// Id: exampleAccount.ID(),
// IsPrimary: pulumi.Bool(true),
// },
// },
// })
// if err != nil {
// return err
// }
// exampleAsset, err := media.NewAsset(ctx, "example", &media.AssetArgs{
// Name: pulumi.String("Asset1"),
// ResourceGroupName: example.Name,
// MediaServicesAccountName: exampleServiceAccount.Name,
// Description: pulumi.String("Asset description"),
// })
// if err != nil {
// return err
// }
// _, err = media.NewAssetFilter(ctx, "example", &media.AssetFilterArgs{
// Name: pulumi.String("Filter1"),
// AssetId: exampleAsset.ID(),
// FirstQualityBitrate: pulumi.Int(128000),
// PresentationTimeRange: &media.AssetFilterPresentationTimeRangeArgs{
// StartInUnits: pulumi.Int(0),
// EndInUnits: pulumi.Int(15),
// PresentationWindowInUnits: pulumi.Int(90),
// LiveBackoffInUnits: pulumi.Int(0),
// UnitTimescaleInMiliseconds: pulumi.Int(1000),
// ForceEnd: pulumi.Bool(false),
// },
// TrackSelections: media.AssetFilterTrackSelectionArray{
// &media.AssetFilterTrackSelectionArgs{
// Conditions: media.AssetFilterTrackSelectionConditionArray{
// &media.AssetFilterTrackSelectionConditionArgs{
// Property: pulumi.String("Type"),
// Operation: pulumi.String("Equal"),
// Value: pulumi.String("Audio"),
// },
// &media.AssetFilterTrackSelectionConditionArgs{
// Property: pulumi.String("Language"),
// Operation: pulumi.String("NotEqual"),
// Value: pulumi.String("en"),
// },
// &media.AssetFilterTrackSelectionConditionArgs{
// Property: pulumi.String("FourCC"),
// Operation: pulumi.String("NotEqual"),
// Value: pulumi.String("EC-3"),
// },
// },
// },
// &media.AssetFilterTrackSelectionArgs{
// Conditions: media.AssetFilterTrackSelectionConditionArray{
// &media.AssetFilterTrackSelectionConditionArgs{
// Property: pulumi.String("Type"),
// Operation: pulumi.String("Equal"),
// Value: pulumi.String("Video"),
// },
// &media.AssetFilterTrackSelectionConditionArgs{
// Property: pulumi.String("Bitrate"),
// Operation: pulumi.String("Equal"),
// Value: pulumi.String("3000000-5000000"),
// },
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Asset Filters can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:media/assetFilter:AssetFilter example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Media/mediaServices/account1/assets/asset1/assetFilters/filter1
// ```
type AssetFilter struct {
pulumi.CustomResourceState
// The Asset ID for which the Asset Filter should be created. Changing this forces a new Asset Filter to be created.
AssetId pulumi.StringOutput `pulumi:"assetId"`
// The first quality bitrate. Sets the first video track to appear in the Live Streaming playlist to allow HLS native players to start downloading from this quality level at the beginning.
FirstQualityBitrate pulumi.IntPtrOutput `pulumi:"firstQualityBitrate"`
// The name which should be used for this Asset Filter. Changing this forces a new Asset Filter to be created.
Name pulumi.StringOutput `pulumi:"name"`
// A `presentationTimeRange` block as defined below.
PresentationTimeRange AssetFilterPresentationTimeRangePtrOutput `pulumi:"presentationTimeRange"`
// One or more `trackSelection` blocks as defined below.
TrackSelections AssetFilterTrackSelectionArrayOutput `pulumi:"trackSelections"`
}
// NewAssetFilter registers a new resource with the given unique name, arguments, and options.
func NewAssetFilter(ctx *pulumi.Context,
name string, args *AssetFilterArgs, opts ...pulumi.ResourceOption) (*AssetFilter, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AssetId == nil {
return nil, errors.New("invalid value for required argument 'AssetId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource AssetFilter
err := ctx.RegisterResource("azure:media/assetFilter:AssetFilter", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAssetFilter gets an existing AssetFilter resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetAssetFilter(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AssetFilterState, opts ...pulumi.ResourceOption) (*AssetFilter, error) {
var resource AssetFilter
err := ctx.ReadResource("azure:media/assetFilter:AssetFilter", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AssetFilter resources.
type assetFilterState struct {
// The Asset ID for which the Asset Filter should be created. Changing this forces a new Asset Filter to be created.
AssetId *string `pulumi:"assetId"`
// The first quality bitrate. Sets the first video track to appear in the Live Streaming playlist to allow HLS native players to start downloading from this quality level at the beginning.
FirstQualityBitrate *int `pulumi:"firstQualityBitrate"`
// The name which should be used for this Asset Filter. Changing this forces a new Asset Filter to be created.
Name *string `pulumi:"name"`
// A `presentationTimeRange` block as defined below.
PresentationTimeRange *AssetFilterPresentationTimeRange `pulumi:"presentationTimeRange"`
// One or more `trackSelection` blocks as defined below.
TrackSelections []AssetFilterTrackSelection `pulumi:"trackSelections"`
}
type AssetFilterState struct {
// The Asset ID for which the Asset Filter should be created. Changing this forces a new Asset Filter to be created.
AssetId pulumi.StringPtrInput
// The first quality bitrate. Sets the first video track to appear in the Live Streaming playlist to allow HLS native players to start downloading from this quality level at the beginning.
FirstQualityBitrate pulumi.IntPtrInput
// The name which should be used for this Asset Filter. Changing this forces a new Asset Filter to be created.
Name pulumi.StringPtrInput
// A `presentationTimeRange` block as defined below.
PresentationTimeRange AssetFilterPresentationTimeRangePtrInput
// One or more `trackSelection` blocks as defined below.
TrackSelections AssetFilterTrackSelectionArrayInput
}
func (AssetFilterState) ElementType() reflect.Type {
return reflect.TypeOf((*assetFilterState)(nil)).Elem()
}
type assetFilterArgs struct {
// The Asset ID for which the Asset Filter should be created. Changing this forces a new Asset Filter to be created.
AssetId string `pulumi:"assetId"`
// The first quality bitrate. Sets the first video track to appear in the Live Streaming playlist to allow HLS native players to start downloading from this quality level at the beginning.
FirstQualityBitrate *int `pulumi:"firstQualityBitrate"`
// The name which should be used for this Asset Filter. Changing this forces a new Asset Filter to be created.
Name *string `pulumi:"name"`
// A `presentationTimeRange` block as defined below.
PresentationTimeRange *AssetFilterPresentationTimeRange `pulumi:"presentationTimeRange"`
// One or more `trackSelection` blocks as defined below.
TrackSelections []AssetFilterTrackSelection `pulumi:"trackSelections"`
}
// The set of arguments for constructing a AssetFilter resource.
type AssetFilterArgs struct {
// The Asset ID for which the Asset Filter should be created. Changing this forces a new Asset Filter to be created.
AssetId pulumi.StringInput
// The first quality bitrate. Sets the first video track to appear in the Live Streaming playlist to allow HLS native players to start downloading from this quality level at the beginning.
FirstQualityBitrate pulumi.IntPtrInput
// The name which should be used for this Asset Filter. Changing this forces a new Asset Filter to be created.
Name pulumi.StringPtrInput
// A `presentationTimeRange` block as defined below.
PresentationTimeRange AssetFilterPresentationTimeRangePtrInput
// One or more `trackSelection` blocks as defined below.
TrackSelections AssetFilterTrackSelectionArrayInput
}
func (AssetFilterArgs) ElementType() reflect.Type {
return reflect.TypeOf((*assetFilterArgs)(nil)).Elem()
}
type AssetFilterInput interface {
pulumi.Input
ToAssetFilterOutput() AssetFilterOutput
ToAssetFilterOutputWithContext(ctx context.Context) AssetFilterOutput
}
func (*AssetFilter) ElementType() reflect.Type {
return reflect.TypeOf((**AssetFilter)(nil)).Elem()
}
func (i *AssetFilter) ToAssetFilterOutput() AssetFilterOutput {
return i.ToAssetFilterOutputWithContext(context.Background())
}
func (i *AssetFilter) ToAssetFilterOutputWithContext(ctx context.Context) AssetFilterOutput {
return pulumi.ToOutputWithContext(ctx, i).(AssetFilterOutput)
}
// AssetFilterArrayInput is an input type that accepts AssetFilterArray and AssetFilterArrayOutput values.
// You can construct a concrete instance of `AssetFilterArrayInput` via:
//
// AssetFilterArray{ AssetFilterArgs{...} }
type AssetFilterArrayInput interface {
pulumi.Input
ToAssetFilterArrayOutput() AssetFilterArrayOutput
ToAssetFilterArrayOutputWithContext(context.Context) AssetFilterArrayOutput
}
type AssetFilterArray []AssetFilterInput
func (AssetFilterArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AssetFilter)(nil)).Elem()
}
func (i AssetFilterArray) ToAssetFilterArrayOutput() AssetFilterArrayOutput {
return i.ToAssetFilterArrayOutputWithContext(context.Background())
}
func (i AssetFilterArray) ToAssetFilterArrayOutputWithContext(ctx context.Context) AssetFilterArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AssetFilterArrayOutput)
}
// AssetFilterMapInput is an input type that accepts AssetFilterMap and AssetFilterMapOutput values.
// You can construct a concrete instance of `AssetFilterMapInput` via:
//
// AssetFilterMap{ "key": AssetFilterArgs{...} }
type AssetFilterMapInput interface {
pulumi.Input
ToAssetFilterMapOutput() AssetFilterMapOutput
ToAssetFilterMapOutputWithContext(context.Context) AssetFilterMapOutput
}
type AssetFilterMap map[string]AssetFilterInput
func (AssetFilterMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AssetFilter)(nil)).Elem()
}
func (i AssetFilterMap) ToAssetFilterMapOutput() AssetFilterMapOutput {
return i.ToAssetFilterMapOutputWithContext(context.Background())
}
func (i AssetFilterMap) ToAssetFilterMapOutputWithContext(ctx context.Context) AssetFilterMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AssetFilterMapOutput)
}
type AssetFilterOutput struct{ *pulumi.OutputState }
func (AssetFilterOutput) ElementType() reflect.Type {
return reflect.TypeOf((**AssetFilter)(nil)).Elem()
}
func (o AssetFilterOutput) ToAssetFilterOutput() AssetFilterOutput {
return o
}
func (o AssetFilterOutput) ToAssetFilterOutputWithContext(ctx context.Context) AssetFilterOutput {
return o
}
// The Asset ID for which the Asset Filter should be created. Changing this forces a new Asset Filter to be created.
func (o AssetFilterOutput) AssetId() pulumi.StringOutput {
return o.ApplyT(func(v *AssetFilter) pulumi.StringOutput { return v.AssetId }).(pulumi.StringOutput)
}
// The first quality bitrate. Sets the first video track to appear in the Live Streaming playlist to allow HLS native players to start downloading from this quality level at the beginning.
func (o AssetFilterOutput) FirstQualityBitrate() pulumi.IntPtrOutput {
return o.ApplyT(func(v *AssetFilter) pulumi.IntPtrOutput { return v.FirstQualityBitrate }).(pulumi.IntPtrOutput)
}
// The name which should be used for this Asset Filter. Changing this forces a new Asset Filter to be created.
func (o AssetFilterOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *AssetFilter) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// A `presentationTimeRange` block as defined below.
func (o AssetFilterOutput) PresentationTimeRange() AssetFilterPresentationTimeRangePtrOutput {
return o.ApplyT(func(v *AssetFilter) AssetFilterPresentationTimeRangePtrOutput { return v.PresentationTimeRange }).(AssetFilterPresentationTimeRangePtrOutput)
}
// One or more `trackSelection` blocks as defined below.
func (o AssetFilterOutput) TrackSelections() AssetFilterTrackSelectionArrayOutput {
return o.ApplyT(func(v *AssetFilter) AssetFilterTrackSelectionArrayOutput { return v.TrackSelections }).(AssetFilterTrackSelectionArrayOutput)
}
type AssetFilterArrayOutput struct{ *pulumi.OutputState }
func (AssetFilterArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*AssetFilter)(nil)).Elem()
}
func (o AssetFilterArrayOutput) ToAssetFilterArrayOutput() AssetFilterArrayOutput {
return o
}
func (o AssetFilterArrayOutput) ToAssetFilterArrayOutputWithContext(ctx context.Context) AssetFilterArrayOutput {
return o
}
func (o AssetFilterArrayOutput) Index(i pulumi.IntInput) AssetFilterOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *AssetFilter {
return vs[0].([]*AssetFilter)[vs[1].(int)]
}).(AssetFilterOutput)
}
type AssetFilterMapOutput struct{ *pulumi.OutputState }
func (AssetFilterMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*AssetFilter)(nil)).Elem()
}
func (o AssetFilterMapOutput) ToAssetFilterMapOutput() AssetFilterMapOutput {
return o
}
func (o AssetFilterMapOutput) ToAssetFilterMapOutputWithContext(ctx context.Context) AssetFilterMapOutput {
return o
}
func (o AssetFilterMapOutput) MapIndex(k pulumi.StringInput) AssetFilterOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *AssetFilter {
return vs[0].(map[string]*AssetFilter)[vs[1].(string)]
}).(AssetFilterOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AssetFilterInput)(nil)).Elem(), &AssetFilter{})
pulumi.RegisterInputType(reflect.TypeOf((*AssetFilterArrayInput)(nil)).Elem(), AssetFilterArray{})
pulumi.RegisterInputType(reflect.TypeOf((*AssetFilterMapInput)(nil)).Elem(), AssetFilterMap{})
pulumi.RegisterOutputType(AssetFilterOutput{})
pulumi.RegisterOutputType(AssetFilterArrayOutput{})
pulumi.RegisterOutputType(AssetFilterMapOutput{})
}