github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/batch/schedulingPolicy.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package batch 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides a Batch Scheduling Policy resource. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/batch" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := batch.NewSchedulingPolicy(ctx, "example", &batch.SchedulingPolicyArgs{ 32 // Name: pulumi.String("example"), 33 // FairSharePolicy: &batch.SchedulingPolicyFairSharePolicyArgs{ 34 // ComputeReservation: pulumi.Int(1), 35 // ShareDecaySeconds: pulumi.Int(3600), 36 // ShareDistributions: batch.SchedulingPolicyFairSharePolicyShareDistributionArray{ 37 // &batch.SchedulingPolicyFairSharePolicyShareDistributionArgs{ 38 // ShareIdentifier: pulumi.String("A1*"), 39 // WeightFactor: pulumi.Float64(0.1), 40 // }, 41 // &batch.SchedulingPolicyFairSharePolicyShareDistributionArgs{ 42 // ShareIdentifier: pulumi.String("A2"), 43 // WeightFactor: pulumi.Float64(0.2), 44 // }, 45 // }, 46 // }, 47 // Tags: pulumi.StringMap{ 48 // "Name": pulumi.String("Example Batch Scheduling Policy"), 49 // }, 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // return nil 55 // }) 56 // } 57 // 58 // ``` 59 // <!--End PulumiCodeChooser --> 60 // 61 // ## Import 62 // 63 // Using `pulumi import`, import Batch Scheduling Policy using the `arn`. For example: 64 // 65 // ```sh 66 // $ pulumi import aws:batch/schedulingPolicy:SchedulingPolicy test_policy arn:aws:batch:us-east-1:123456789012:scheduling-policy/sample 67 // ``` 68 type SchedulingPolicy struct { 69 pulumi.CustomResourceState 70 71 // The Amazon Resource Name of the scheduling policy. 72 Arn pulumi.StringOutput `pulumi:"arn"` 73 FairSharePolicy SchedulingPolicyFairSharePolicyPtrOutput `pulumi:"fairSharePolicy"` 74 // Specifies the name of the scheduling policy. 75 Name pulumi.StringOutput `pulumi:"name"` 76 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 77 Tags pulumi.StringMapOutput `pulumi:"tags"` 78 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 79 // 80 // Deprecated: Please use `tags` instead. 81 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 82 } 83 84 // NewSchedulingPolicy registers a new resource with the given unique name, arguments, and options. 85 func NewSchedulingPolicy(ctx *pulumi.Context, 86 name string, args *SchedulingPolicyArgs, opts ...pulumi.ResourceOption) (*SchedulingPolicy, error) { 87 if args == nil { 88 args = &SchedulingPolicyArgs{} 89 } 90 91 opts = internal.PkgResourceDefaultOpts(opts) 92 var resource SchedulingPolicy 93 err := ctx.RegisterResource("aws:batch/schedulingPolicy:SchedulingPolicy", name, args, &resource, opts...) 94 if err != nil { 95 return nil, err 96 } 97 return &resource, nil 98 } 99 100 // GetSchedulingPolicy gets an existing SchedulingPolicy resource's state with the given name, ID, and optional 101 // state properties that are used to uniquely qualify the lookup (nil if not required). 102 func GetSchedulingPolicy(ctx *pulumi.Context, 103 name string, id pulumi.IDInput, state *SchedulingPolicyState, opts ...pulumi.ResourceOption) (*SchedulingPolicy, error) { 104 var resource SchedulingPolicy 105 err := ctx.ReadResource("aws:batch/schedulingPolicy:SchedulingPolicy", name, id, state, &resource, opts...) 106 if err != nil { 107 return nil, err 108 } 109 return &resource, nil 110 } 111 112 // Input properties used for looking up and filtering SchedulingPolicy resources. 113 type schedulingPolicyState struct { 114 // The Amazon Resource Name of the scheduling policy. 115 Arn *string `pulumi:"arn"` 116 FairSharePolicy *SchedulingPolicyFairSharePolicy `pulumi:"fairSharePolicy"` 117 // Specifies the name of the scheduling policy. 118 Name *string `pulumi:"name"` 119 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 120 Tags map[string]string `pulumi:"tags"` 121 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 122 // 123 // Deprecated: Please use `tags` instead. 124 TagsAll map[string]string `pulumi:"tagsAll"` 125 } 126 127 type SchedulingPolicyState struct { 128 // The Amazon Resource Name of the scheduling policy. 129 Arn pulumi.StringPtrInput 130 FairSharePolicy SchedulingPolicyFairSharePolicyPtrInput 131 // Specifies the name of the scheduling policy. 132 Name pulumi.StringPtrInput 133 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 134 Tags pulumi.StringMapInput 135 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 136 // 137 // Deprecated: Please use `tags` instead. 138 TagsAll pulumi.StringMapInput 139 } 140 141 func (SchedulingPolicyState) ElementType() reflect.Type { 142 return reflect.TypeOf((*schedulingPolicyState)(nil)).Elem() 143 } 144 145 type schedulingPolicyArgs struct { 146 FairSharePolicy *SchedulingPolicyFairSharePolicy `pulumi:"fairSharePolicy"` 147 // Specifies the name of the scheduling policy. 148 Name *string `pulumi:"name"` 149 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 150 Tags map[string]string `pulumi:"tags"` 151 } 152 153 // The set of arguments for constructing a SchedulingPolicy resource. 154 type SchedulingPolicyArgs struct { 155 FairSharePolicy SchedulingPolicyFairSharePolicyPtrInput 156 // Specifies the name of the scheduling policy. 157 Name pulumi.StringPtrInput 158 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 159 Tags pulumi.StringMapInput 160 } 161 162 func (SchedulingPolicyArgs) ElementType() reflect.Type { 163 return reflect.TypeOf((*schedulingPolicyArgs)(nil)).Elem() 164 } 165 166 type SchedulingPolicyInput interface { 167 pulumi.Input 168 169 ToSchedulingPolicyOutput() SchedulingPolicyOutput 170 ToSchedulingPolicyOutputWithContext(ctx context.Context) SchedulingPolicyOutput 171 } 172 173 func (*SchedulingPolicy) ElementType() reflect.Type { 174 return reflect.TypeOf((**SchedulingPolicy)(nil)).Elem() 175 } 176 177 func (i *SchedulingPolicy) ToSchedulingPolicyOutput() SchedulingPolicyOutput { 178 return i.ToSchedulingPolicyOutputWithContext(context.Background()) 179 } 180 181 func (i *SchedulingPolicy) ToSchedulingPolicyOutputWithContext(ctx context.Context) SchedulingPolicyOutput { 182 return pulumi.ToOutputWithContext(ctx, i).(SchedulingPolicyOutput) 183 } 184 185 // SchedulingPolicyArrayInput is an input type that accepts SchedulingPolicyArray and SchedulingPolicyArrayOutput values. 186 // You can construct a concrete instance of `SchedulingPolicyArrayInput` via: 187 // 188 // SchedulingPolicyArray{ SchedulingPolicyArgs{...} } 189 type SchedulingPolicyArrayInput interface { 190 pulumi.Input 191 192 ToSchedulingPolicyArrayOutput() SchedulingPolicyArrayOutput 193 ToSchedulingPolicyArrayOutputWithContext(context.Context) SchedulingPolicyArrayOutput 194 } 195 196 type SchedulingPolicyArray []SchedulingPolicyInput 197 198 func (SchedulingPolicyArray) ElementType() reflect.Type { 199 return reflect.TypeOf((*[]*SchedulingPolicy)(nil)).Elem() 200 } 201 202 func (i SchedulingPolicyArray) ToSchedulingPolicyArrayOutput() SchedulingPolicyArrayOutput { 203 return i.ToSchedulingPolicyArrayOutputWithContext(context.Background()) 204 } 205 206 func (i SchedulingPolicyArray) ToSchedulingPolicyArrayOutputWithContext(ctx context.Context) SchedulingPolicyArrayOutput { 207 return pulumi.ToOutputWithContext(ctx, i).(SchedulingPolicyArrayOutput) 208 } 209 210 // SchedulingPolicyMapInput is an input type that accepts SchedulingPolicyMap and SchedulingPolicyMapOutput values. 211 // You can construct a concrete instance of `SchedulingPolicyMapInput` via: 212 // 213 // SchedulingPolicyMap{ "key": SchedulingPolicyArgs{...} } 214 type SchedulingPolicyMapInput interface { 215 pulumi.Input 216 217 ToSchedulingPolicyMapOutput() SchedulingPolicyMapOutput 218 ToSchedulingPolicyMapOutputWithContext(context.Context) SchedulingPolicyMapOutput 219 } 220 221 type SchedulingPolicyMap map[string]SchedulingPolicyInput 222 223 func (SchedulingPolicyMap) ElementType() reflect.Type { 224 return reflect.TypeOf((*map[string]*SchedulingPolicy)(nil)).Elem() 225 } 226 227 func (i SchedulingPolicyMap) ToSchedulingPolicyMapOutput() SchedulingPolicyMapOutput { 228 return i.ToSchedulingPolicyMapOutputWithContext(context.Background()) 229 } 230 231 func (i SchedulingPolicyMap) ToSchedulingPolicyMapOutputWithContext(ctx context.Context) SchedulingPolicyMapOutput { 232 return pulumi.ToOutputWithContext(ctx, i).(SchedulingPolicyMapOutput) 233 } 234 235 type SchedulingPolicyOutput struct{ *pulumi.OutputState } 236 237 func (SchedulingPolicyOutput) ElementType() reflect.Type { 238 return reflect.TypeOf((**SchedulingPolicy)(nil)).Elem() 239 } 240 241 func (o SchedulingPolicyOutput) ToSchedulingPolicyOutput() SchedulingPolicyOutput { 242 return o 243 } 244 245 func (o SchedulingPolicyOutput) ToSchedulingPolicyOutputWithContext(ctx context.Context) SchedulingPolicyOutput { 246 return o 247 } 248 249 // The Amazon Resource Name of the scheduling policy. 250 func (o SchedulingPolicyOutput) Arn() pulumi.StringOutput { 251 return o.ApplyT(func(v *SchedulingPolicy) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 252 } 253 254 func (o SchedulingPolicyOutput) FairSharePolicy() SchedulingPolicyFairSharePolicyPtrOutput { 255 return o.ApplyT(func(v *SchedulingPolicy) SchedulingPolicyFairSharePolicyPtrOutput { return v.FairSharePolicy }).(SchedulingPolicyFairSharePolicyPtrOutput) 256 } 257 258 // Specifies the name of the scheduling policy. 259 func (o SchedulingPolicyOutput) Name() pulumi.StringOutput { 260 return o.ApplyT(func(v *SchedulingPolicy) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 261 } 262 263 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 264 func (o SchedulingPolicyOutput) Tags() pulumi.StringMapOutput { 265 return o.ApplyT(func(v *SchedulingPolicy) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 266 } 267 268 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 269 // 270 // Deprecated: Please use `tags` instead. 271 func (o SchedulingPolicyOutput) TagsAll() pulumi.StringMapOutput { 272 return o.ApplyT(func(v *SchedulingPolicy) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 273 } 274 275 type SchedulingPolicyArrayOutput struct{ *pulumi.OutputState } 276 277 func (SchedulingPolicyArrayOutput) ElementType() reflect.Type { 278 return reflect.TypeOf((*[]*SchedulingPolicy)(nil)).Elem() 279 } 280 281 func (o SchedulingPolicyArrayOutput) ToSchedulingPolicyArrayOutput() SchedulingPolicyArrayOutput { 282 return o 283 } 284 285 func (o SchedulingPolicyArrayOutput) ToSchedulingPolicyArrayOutputWithContext(ctx context.Context) SchedulingPolicyArrayOutput { 286 return o 287 } 288 289 func (o SchedulingPolicyArrayOutput) Index(i pulumi.IntInput) SchedulingPolicyOutput { 290 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SchedulingPolicy { 291 return vs[0].([]*SchedulingPolicy)[vs[1].(int)] 292 }).(SchedulingPolicyOutput) 293 } 294 295 type SchedulingPolicyMapOutput struct{ *pulumi.OutputState } 296 297 func (SchedulingPolicyMapOutput) ElementType() reflect.Type { 298 return reflect.TypeOf((*map[string]*SchedulingPolicy)(nil)).Elem() 299 } 300 301 func (o SchedulingPolicyMapOutput) ToSchedulingPolicyMapOutput() SchedulingPolicyMapOutput { 302 return o 303 } 304 305 func (o SchedulingPolicyMapOutput) ToSchedulingPolicyMapOutputWithContext(ctx context.Context) SchedulingPolicyMapOutput { 306 return o 307 } 308 309 func (o SchedulingPolicyMapOutput) MapIndex(k pulumi.StringInput) SchedulingPolicyOutput { 310 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SchedulingPolicy { 311 return vs[0].(map[string]*SchedulingPolicy)[vs[1].(string)] 312 }).(SchedulingPolicyOutput) 313 } 314 315 func init() { 316 pulumi.RegisterInputType(reflect.TypeOf((*SchedulingPolicyInput)(nil)).Elem(), &SchedulingPolicy{}) 317 pulumi.RegisterInputType(reflect.TypeOf((*SchedulingPolicyArrayInput)(nil)).Elem(), SchedulingPolicyArray{}) 318 pulumi.RegisterInputType(reflect.TypeOf((*SchedulingPolicyMapInput)(nil)).Elem(), SchedulingPolicyMap{}) 319 pulumi.RegisterOutputType(SchedulingPolicyOutput{}) 320 pulumi.RegisterOutputType(SchedulingPolicyArrayOutput{}) 321 pulumi.RegisterOutputType(SchedulingPolicyMapOutput{}) 322 }