github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/licensemanager/licenseConfiguration.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 licensemanager
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a License Manager license configuration resource.
    16  //
    17  // > **Note:** Removing the `licenseCount` attribute is not supported by the License Manager API.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/licensemanager"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := licensemanager.NewLicenseConfiguration(ctx, "example", &licensemanager.LicenseConfigurationArgs{
    35  //				Name:                  pulumi.String("Example"),
    36  //				Description:           pulumi.String("Example"),
    37  //				LicenseCount:          pulumi.Int(10),
    38  //				LicenseCountHardLimit: pulumi.Bool(true),
    39  //				LicenseCountingType:   pulumi.String("Socket"),
    40  //				LicenseRules: pulumi.StringArray{
    41  //					pulumi.String("#minimumSockets=2"),
    42  //				},
    43  //				Tags: pulumi.StringMap{
    44  //					"foo": pulumi.String("barr"),
    45  //				},
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Rules
    58  //
    59  // License rules should be in the format of `#RuleType=RuleValue`. Supported rule types:
    60  //
    61  // * `minimumVcpus` - Resource must have minimum vCPU count in order to use the license. Default: 1
    62  // * `maximumVcpus` - Resource must have maximum vCPU count in order to use the license. Default: unbounded, limit: 10000
    63  // * `minimumCores` - Resource must have minimum core count in order to use the license. Default: 1
    64  // * `maximumCores` - Resource must have maximum core count in order to use the license. Default: unbounded, limit: 10000
    65  // * `minimumSockets` - Resource must have minimum socket count in order to use the license. Default: 1
    66  // * `maximumSockets` - Resource must have maximum socket count in order to use the license. Default: unbounded, limit: 10000
    67  // * `allowedTenancy` - Defines where the license can be used. If set, restricts license usage to selected tenancies. Specify a comma delimited list of `EC2-Default`, `EC2-DedicatedHost`, `EC2-DedicatedInstance`
    68  //
    69  // ## Import
    70  //
    71  // Using `pulumi import`, import license configurations using the `id`. For example:
    72  //
    73  // ```sh
    74  // $ pulumi import aws:licensemanager/licenseConfiguration:LicenseConfiguration example arn:aws:license-manager:eu-west-1:123456789012:license-configuration:lic-0123456789abcdef0123456789abcdef
    75  // ```
    76  type LicenseConfiguration struct {
    77  	pulumi.CustomResourceState
    78  
    79  	// The license configuration ARN.
    80  	Arn pulumi.StringOutput `pulumi:"arn"`
    81  	// Description of the license configuration.
    82  	Description pulumi.StringPtrOutput `pulumi:"description"`
    83  	// Number of licenses managed by the license configuration.
    84  	LicenseCount pulumi.IntPtrOutput `pulumi:"licenseCount"`
    85  	// Sets the number of available licenses as a hard limit.
    86  	LicenseCountHardLimit pulumi.BoolPtrOutput `pulumi:"licenseCountHardLimit"`
    87  	// Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
    88  	LicenseCountingType pulumi.StringOutput `pulumi:"licenseCountingType"`
    89  	// Array of configured License Manager rules.
    90  	LicenseRules pulumi.StringArrayOutput `pulumi:"licenseRules"`
    91  	// Name of the license configuration.
    92  	Name pulumi.StringOutput `pulumi:"name"`
    93  	// Account ID of the owner of the license configuration.
    94  	OwnerAccountId pulumi.StringOutput `pulumi:"ownerAccountId"`
    95  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    96  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    97  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    98  	//
    99  	// Deprecated: Please use `tags` instead.
   100  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   101  }
   102  
   103  // NewLicenseConfiguration registers a new resource with the given unique name, arguments, and options.
   104  func NewLicenseConfiguration(ctx *pulumi.Context,
   105  	name string, args *LicenseConfigurationArgs, opts ...pulumi.ResourceOption) (*LicenseConfiguration, error) {
   106  	if args == nil {
   107  		return nil, errors.New("missing one or more required arguments")
   108  	}
   109  
   110  	if args.LicenseCountingType == nil {
   111  		return nil, errors.New("invalid value for required argument 'LicenseCountingType'")
   112  	}
   113  	opts = internal.PkgResourceDefaultOpts(opts)
   114  	var resource LicenseConfiguration
   115  	err := ctx.RegisterResource("aws:licensemanager/licenseConfiguration:LicenseConfiguration", name, args, &resource, opts...)
   116  	if err != nil {
   117  		return nil, err
   118  	}
   119  	return &resource, nil
   120  }
   121  
   122  // GetLicenseConfiguration gets an existing LicenseConfiguration resource's state with the given name, ID, and optional
   123  // state properties that are used to uniquely qualify the lookup (nil if not required).
   124  func GetLicenseConfiguration(ctx *pulumi.Context,
   125  	name string, id pulumi.IDInput, state *LicenseConfigurationState, opts ...pulumi.ResourceOption) (*LicenseConfiguration, error) {
   126  	var resource LicenseConfiguration
   127  	err := ctx.ReadResource("aws:licensemanager/licenseConfiguration:LicenseConfiguration", name, id, state, &resource, opts...)
   128  	if err != nil {
   129  		return nil, err
   130  	}
   131  	return &resource, nil
   132  }
   133  
   134  // Input properties used for looking up and filtering LicenseConfiguration resources.
   135  type licenseConfigurationState struct {
   136  	// The license configuration ARN.
   137  	Arn *string `pulumi:"arn"`
   138  	// Description of the license configuration.
   139  	Description *string `pulumi:"description"`
   140  	// Number of licenses managed by the license configuration.
   141  	LicenseCount *int `pulumi:"licenseCount"`
   142  	// Sets the number of available licenses as a hard limit.
   143  	LicenseCountHardLimit *bool `pulumi:"licenseCountHardLimit"`
   144  	// Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
   145  	LicenseCountingType *string `pulumi:"licenseCountingType"`
   146  	// Array of configured License Manager rules.
   147  	LicenseRules []string `pulumi:"licenseRules"`
   148  	// Name of the license configuration.
   149  	Name *string `pulumi:"name"`
   150  	// Account ID of the owner of the license configuration.
   151  	OwnerAccountId *string `pulumi:"ownerAccountId"`
   152  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   153  	Tags map[string]string `pulumi:"tags"`
   154  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   155  	//
   156  	// Deprecated: Please use `tags` instead.
   157  	TagsAll map[string]string `pulumi:"tagsAll"`
   158  }
   159  
   160  type LicenseConfigurationState struct {
   161  	// The license configuration ARN.
   162  	Arn pulumi.StringPtrInput
   163  	// Description of the license configuration.
   164  	Description pulumi.StringPtrInput
   165  	// Number of licenses managed by the license configuration.
   166  	LicenseCount pulumi.IntPtrInput
   167  	// Sets the number of available licenses as a hard limit.
   168  	LicenseCountHardLimit pulumi.BoolPtrInput
   169  	// Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
   170  	LicenseCountingType pulumi.StringPtrInput
   171  	// Array of configured License Manager rules.
   172  	LicenseRules pulumi.StringArrayInput
   173  	// Name of the license configuration.
   174  	Name pulumi.StringPtrInput
   175  	// Account ID of the owner of the license configuration.
   176  	OwnerAccountId pulumi.StringPtrInput
   177  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   178  	Tags pulumi.StringMapInput
   179  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   180  	//
   181  	// Deprecated: Please use `tags` instead.
   182  	TagsAll pulumi.StringMapInput
   183  }
   184  
   185  func (LicenseConfigurationState) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*licenseConfigurationState)(nil)).Elem()
   187  }
   188  
   189  type licenseConfigurationArgs struct {
   190  	// Description of the license configuration.
   191  	Description *string `pulumi:"description"`
   192  	// Number of licenses managed by the license configuration.
   193  	LicenseCount *int `pulumi:"licenseCount"`
   194  	// Sets the number of available licenses as a hard limit.
   195  	LicenseCountHardLimit *bool `pulumi:"licenseCountHardLimit"`
   196  	// Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
   197  	LicenseCountingType string `pulumi:"licenseCountingType"`
   198  	// Array of configured License Manager rules.
   199  	LicenseRules []string `pulumi:"licenseRules"`
   200  	// Name of the license configuration.
   201  	Name *string `pulumi:"name"`
   202  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   203  	Tags map[string]string `pulumi:"tags"`
   204  }
   205  
   206  // The set of arguments for constructing a LicenseConfiguration resource.
   207  type LicenseConfigurationArgs struct {
   208  	// Description of the license configuration.
   209  	Description pulumi.StringPtrInput
   210  	// Number of licenses managed by the license configuration.
   211  	LicenseCount pulumi.IntPtrInput
   212  	// Sets the number of available licenses as a hard limit.
   213  	LicenseCountHardLimit pulumi.BoolPtrInput
   214  	// Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
   215  	LicenseCountingType pulumi.StringInput
   216  	// Array of configured License Manager rules.
   217  	LicenseRules pulumi.StringArrayInput
   218  	// Name of the license configuration.
   219  	Name pulumi.StringPtrInput
   220  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   221  	Tags pulumi.StringMapInput
   222  }
   223  
   224  func (LicenseConfigurationArgs) ElementType() reflect.Type {
   225  	return reflect.TypeOf((*licenseConfigurationArgs)(nil)).Elem()
   226  }
   227  
   228  type LicenseConfigurationInput interface {
   229  	pulumi.Input
   230  
   231  	ToLicenseConfigurationOutput() LicenseConfigurationOutput
   232  	ToLicenseConfigurationOutputWithContext(ctx context.Context) LicenseConfigurationOutput
   233  }
   234  
   235  func (*LicenseConfiguration) ElementType() reflect.Type {
   236  	return reflect.TypeOf((**LicenseConfiguration)(nil)).Elem()
   237  }
   238  
   239  func (i *LicenseConfiguration) ToLicenseConfigurationOutput() LicenseConfigurationOutput {
   240  	return i.ToLicenseConfigurationOutputWithContext(context.Background())
   241  }
   242  
   243  func (i *LicenseConfiguration) ToLicenseConfigurationOutputWithContext(ctx context.Context) LicenseConfigurationOutput {
   244  	return pulumi.ToOutputWithContext(ctx, i).(LicenseConfigurationOutput)
   245  }
   246  
   247  // LicenseConfigurationArrayInput is an input type that accepts LicenseConfigurationArray and LicenseConfigurationArrayOutput values.
   248  // You can construct a concrete instance of `LicenseConfigurationArrayInput` via:
   249  //
   250  //	LicenseConfigurationArray{ LicenseConfigurationArgs{...} }
   251  type LicenseConfigurationArrayInput interface {
   252  	pulumi.Input
   253  
   254  	ToLicenseConfigurationArrayOutput() LicenseConfigurationArrayOutput
   255  	ToLicenseConfigurationArrayOutputWithContext(context.Context) LicenseConfigurationArrayOutput
   256  }
   257  
   258  type LicenseConfigurationArray []LicenseConfigurationInput
   259  
   260  func (LicenseConfigurationArray) ElementType() reflect.Type {
   261  	return reflect.TypeOf((*[]*LicenseConfiguration)(nil)).Elem()
   262  }
   263  
   264  func (i LicenseConfigurationArray) ToLicenseConfigurationArrayOutput() LicenseConfigurationArrayOutput {
   265  	return i.ToLicenseConfigurationArrayOutputWithContext(context.Background())
   266  }
   267  
   268  func (i LicenseConfigurationArray) ToLicenseConfigurationArrayOutputWithContext(ctx context.Context) LicenseConfigurationArrayOutput {
   269  	return pulumi.ToOutputWithContext(ctx, i).(LicenseConfigurationArrayOutput)
   270  }
   271  
   272  // LicenseConfigurationMapInput is an input type that accepts LicenseConfigurationMap and LicenseConfigurationMapOutput values.
   273  // You can construct a concrete instance of `LicenseConfigurationMapInput` via:
   274  //
   275  //	LicenseConfigurationMap{ "key": LicenseConfigurationArgs{...} }
   276  type LicenseConfigurationMapInput interface {
   277  	pulumi.Input
   278  
   279  	ToLicenseConfigurationMapOutput() LicenseConfigurationMapOutput
   280  	ToLicenseConfigurationMapOutputWithContext(context.Context) LicenseConfigurationMapOutput
   281  }
   282  
   283  type LicenseConfigurationMap map[string]LicenseConfigurationInput
   284  
   285  func (LicenseConfigurationMap) ElementType() reflect.Type {
   286  	return reflect.TypeOf((*map[string]*LicenseConfiguration)(nil)).Elem()
   287  }
   288  
   289  func (i LicenseConfigurationMap) ToLicenseConfigurationMapOutput() LicenseConfigurationMapOutput {
   290  	return i.ToLicenseConfigurationMapOutputWithContext(context.Background())
   291  }
   292  
   293  func (i LicenseConfigurationMap) ToLicenseConfigurationMapOutputWithContext(ctx context.Context) LicenseConfigurationMapOutput {
   294  	return pulumi.ToOutputWithContext(ctx, i).(LicenseConfigurationMapOutput)
   295  }
   296  
   297  type LicenseConfigurationOutput struct{ *pulumi.OutputState }
   298  
   299  func (LicenseConfigurationOutput) ElementType() reflect.Type {
   300  	return reflect.TypeOf((**LicenseConfiguration)(nil)).Elem()
   301  }
   302  
   303  func (o LicenseConfigurationOutput) ToLicenseConfigurationOutput() LicenseConfigurationOutput {
   304  	return o
   305  }
   306  
   307  func (o LicenseConfigurationOutput) ToLicenseConfigurationOutputWithContext(ctx context.Context) LicenseConfigurationOutput {
   308  	return o
   309  }
   310  
   311  // The license configuration ARN.
   312  func (o LicenseConfigurationOutput) Arn() pulumi.StringOutput {
   313  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   314  }
   315  
   316  // Description of the license configuration.
   317  func (o LicenseConfigurationOutput) Description() pulumi.StringPtrOutput {
   318  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   319  }
   320  
   321  // Number of licenses managed by the license configuration.
   322  func (o LicenseConfigurationOutput) LicenseCount() pulumi.IntPtrOutput {
   323  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.IntPtrOutput { return v.LicenseCount }).(pulumi.IntPtrOutput)
   324  }
   325  
   326  // Sets the number of available licenses as a hard limit.
   327  func (o LicenseConfigurationOutput) LicenseCountHardLimit() pulumi.BoolPtrOutput {
   328  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.BoolPtrOutput { return v.LicenseCountHardLimit }).(pulumi.BoolPtrOutput)
   329  }
   330  
   331  // Dimension to use to track license inventory. Specify either `vCPU`, `Instance`, `Core` or `Socket`.
   332  func (o LicenseConfigurationOutput) LicenseCountingType() pulumi.StringOutput {
   333  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringOutput { return v.LicenseCountingType }).(pulumi.StringOutput)
   334  }
   335  
   336  // Array of configured License Manager rules.
   337  func (o LicenseConfigurationOutput) LicenseRules() pulumi.StringArrayOutput {
   338  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringArrayOutput { return v.LicenseRules }).(pulumi.StringArrayOutput)
   339  }
   340  
   341  // Name of the license configuration.
   342  func (o LicenseConfigurationOutput) Name() pulumi.StringOutput {
   343  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   344  }
   345  
   346  // Account ID of the owner of the license configuration.
   347  func (o LicenseConfigurationOutput) OwnerAccountId() pulumi.StringOutput {
   348  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringOutput { return v.OwnerAccountId }).(pulumi.StringOutput)
   349  }
   350  
   351  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   352  func (o LicenseConfigurationOutput) Tags() pulumi.StringMapOutput {
   353  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   354  }
   355  
   356  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   357  //
   358  // Deprecated: Please use `tags` instead.
   359  func (o LicenseConfigurationOutput) TagsAll() pulumi.StringMapOutput {
   360  	return o.ApplyT(func(v *LicenseConfiguration) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   361  }
   362  
   363  type LicenseConfigurationArrayOutput struct{ *pulumi.OutputState }
   364  
   365  func (LicenseConfigurationArrayOutput) ElementType() reflect.Type {
   366  	return reflect.TypeOf((*[]*LicenseConfiguration)(nil)).Elem()
   367  }
   368  
   369  func (o LicenseConfigurationArrayOutput) ToLicenseConfigurationArrayOutput() LicenseConfigurationArrayOutput {
   370  	return o
   371  }
   372  
   373  func (o LicenseConfigurationArrayOutput) ToLicenseConfigurationArrayOutputWithContext(ctx context.Context) LicenseConfigurationArrayOutput {
   374  	return o
   375  }
   376  
   377  func (o LicenseConfigurationArrayOutput) Index(i pulumi.IntInput) LicenseConfigurationOutput {
   378  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LicenseConfiguration {
   379  		return vs[0].([]*LicenseConfiguration)[vs[1].(int)]
   380  	}).(LicenseConfigurationOutput)
   381  }
   382  
   383  type LicenseConfigurationMapOutput struct{ *pulumi.OutputState }
   384  
   385  func (LicenseConfigurationMapOutput) ElementType() reflect.Type {
   386  	return reflect.TypeOf((*map[string]*LicenseConfiguration)(nil)).Elem()
   387  }
   388  
   389  func (o LicenseConfigurationMapOutput) ToLicenseConfigurationMapOutput() LicenseConfigurationMapOutput {
   390  	return o
   391  }
   392  
   393  func (o LicenseConfigurationMapOutput) ToLicenseConfigurationMapOutputWithContext(ctx context.Context) LicenseConfigurationMapOutput {
   394  	return o
   395  }
   396  
   397  func (o LicenseConfigurationMapOutput) MapIndex(k pulumi.StringInput) LicenseConfigurationOutput {
   398  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LicenseConfiguration {
   399  		return vs[0].(map[string]*LicenseConfiguration)[vs[1].(string)]
   400  	}).(LicenseConfigurationOutput)
   401  }
   402  
   403  func init() {
   404  	pulumi.RegisterInputType(reflect.TypeOf((*LicenseConfigurationInput)(nil)).Elem(), &LicenseConfiguration{})
   405  	pulumi.RegisterInputType(reflect.TypeOf((*LicenseConfigurationArrayInput)(nil)).Elem(), LicenseConfigurationArray{})
   406  	pulumi.RegisterInputType(reflect.TypeOf((*LicenseConfigurationMapInput)(nil)).Elem(), LicenseConfigurationMap{})
   407  	pulumi.RegisterOutputType(LicenseConfigurationOutput{})
   408  	pulumi.RegisterOutputType(LicenseConfigurationArrayOutput{})
   409  	pulumi.RegisterOutputType(LicenseConfigurationMapOutput{})
   410  }