github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/account.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 apigateway
     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 settings of an API Gateway Account. Settings is applied region-wide per `provider` block.
    15  //
    16  // > **Note:** As there is no API method for deleting account settings or resetting it to defaults, destroying this resource will keep your account settings intact
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    35  //				Statements: []iam.GetPolicyDocumentStatement{
    36  //					{
    37  //						Effect: pulumi.StringRef("Allow"),
    38  //						Principals: []iam.GetPolicyDocumentStatementPrincipal{
    39  //							{
    40  //								Type: "Service",
    41  //								Identifiers: []string{
    42  //									"apigateway.amazonaws.com",
    43  //								},
    44  //							},
    45  //						},
    46  //						Actions: []string{
    47  //							"sts:AssumeRole",
    48  //						},
    49  //					},
    50  //				},
    51  //			}, nil)
    52  //			if err != nil {
    53  //				return err
    54  //			}
    55  //			cloudwatchRole, err := iam.NewRole(ctx, "cloudwatch", &iam.RoleArgs{
    56  //				Name:             pulumi.String("api_gateway_cloudwatch_global"),
    57  //				AssumeRolePolicy: pulumi.String(assumeRole.Json),
    58  //			})
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			_, err = apigateway.NewAccount(ctx, "demo", &apigateway.AccountArgs{
    63  //				CloudwatchRoleArn: cloudwatchRole.Arn,
    64  //			})
    65  //			if err != nil {
    66  //				return err
    67  //			}
    68  //			cloudwatch, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    69  //				Statements: []iam.GetPolicyDocumentStatement{
    70  //					{
    71  //						Effect: pulumi.StringRef("Allow"),
    72  //						Actions: []string{
    73  //							"logs:CreateLogGroup",
    74  //							"logs:CreateLogStream",
    75  //							"logs:DescribeLogGroups",
    76  //							"logs:DescribeLogStreams",
    77  //							"logs:PutLogEvents",
    78  //							"logs:GetLogEvents",
    79  //							"logs:FilterLogEvents",
    80  //						},
    81  //						Resources: []string{
    82  //							"*",
    83  //						},
    84  //					},
    85  //				},
    86  //			}, nil)
    87  //			if err != nil {
    88  //				return err
    89  //			}
    90  //			_, err = iam.NewRolePolicy(ctx, "cloudwatch", &iam.RolePolicyArgs{
    91  //				Name:   pulumi.String("default"),
    92  //				Role:   cloudwatchRole.ID(),
    93  //				Policy: pulumi.String(cloudwatch.Json),
    94  //			})
    95  //			if err != nil {
    96  //				return err
    97  //			}
    98  //			return nil
    99  //		})
   100  //	}
   101  //
   102  // ```
   103  // <!--End PulumiCodeChooser -->
   104  //
   105  // ## Import
   106  //
   107  // Using `pulumi import`, import API Gateway Accounts using the word `api-gateway-account`. For example:
   108  //
   109  // ```sh
   110  // $ pulumi import aws:apigateway/account:Account demo api-gateway-account
   111  // ```
   112  type Account struct {
   113  	pulumi.CustomResourceState
   114  
   115  	// The version of the API keys used for the account.
   116  	ApiKeyVersion pulumi.StringOutput `pulumi:"apiKeyVersion"`
   117  	// ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more [in AWS Docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console). Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
   118  	CloudwatchRoleArn pulumi.StringPtrOutput `pulumi:"cloudwatchRoleArn"`
   119  	// A list of features supported for the account.
   120  	Features pulumi.StringArrayOutput `pulumi:"features"`
   121  	// Account-Level throttle settings. See exported fields below.
   122  	ThrottleSettings AccountThrottleSettingArrayOutput `pulumi:"throttleSettings"`
   123  }
   124  
   125  // NewAccount registers a new resource with the given unique name, arguments, and options.
   126  func NewAccount(ctx *pulumi.Context,
   127  	name string, args *AccountArgs, opts ...pulumi.ResourceOption) (*Account, error) {
   128  	if args == nil {
   129  		args = &AccountArgs{}
   130  	}
   131  
   132  	opts = internal.PkgResourceDefaultOpts(opts)
   133  	var resource Account
   134  	err := ctx.RegisterResource("aws:apigateway/account:Account", name, args, &resource, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return &resource, nil
   139  }
   140  
   141  // GetAccount gets an existing Account resource's state with the given name, ID, and optional
   142  // state properties that are used to uniquely qualify the lookup (nil if not required).
   143  func GetAccount(ctx *pulumi.Context,
   144  	name string, id pulumi.IDInput, state *AccountState, opts ...pulumi.ResourceOption) (*Account, error) {
   145  	var resource Account
   146  	err := ctx.ReadResource("aws:apigateway/account:Account", name, id, state, &resource, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return &resource, nil
   151  }
   152  
   153  // Input properties used for looking up and filtering Account resources.
   154  type accountState struct {
   155  	// The version of the API keys used for the account.
   156  	ApiKeyVersion *string `pulumi:"apiKeyVersion"`
   157  	// ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more [in AWS Docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console). Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
   158  	CloudwatchRoleArn *string `pulumi:"cloudwatchRoleArn"`
   159  	// A list of features supported for the account.
   160  	Features []string `pulumi:"features"`
   161  	// Account-Level throttle settings. See exported fields below.
   162  	ThrottleSettings []AccountThrottleSetting `pulumi:"throttleSettings"`
   163  }
   164  
   165  type AccountState struct {
   166  	// The version of the API keys used for the account.
   167  	ApiKeyVersion pulumi.StringPtrInput
   168  	// ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more [in AWS Docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console). Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
   169  	CloudwatchRoleArn pulumi.StringPtrInput
   170  	// A list of features supported for the account.
   171  	Features pulumi.StringArrayInput
   172  	// Account-Level throttle settings. See exported fields below.
   173  	ThrottleSettings AccountThrottleSettingArrayInput
   174  }
   175  
   176  func (AccountState) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*accountState)(nil)).Elem()
   178  }
   179  
   180  type accountArgs struct {
   181  	// ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more [in AWS Docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console). Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
   182  	CloudwatchRoleArn *string `pulumi:"cloudwatchRoleArn"`
   183  }
   184  
   185  // The set of arguments for constructing a Account resource.
   186  type AccountArgs struct {
   187  	// ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more [in AWS Docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console). Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
   188  	CloudwatchRoleArn pulumi.StringPtrInput
   189  }
   190  
   191  func (AccountArgs) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*accountArgs)(nil)).Elem()
   193  }
   194  
   195  type AccountInput interface {
   196  	pulumi.Input
   197  
   198  	ToAccountOutput() AccountOutput
   199  	ToAccountOutputWithContext(ctx context.Context) AccountOutput
   200  }
   201  
   202  func (*Account) ElementType() reflect.Type {
   203  	return reflect.TypeOf((**Account)(nil)).Elem()
   204  }
   205  
   206  func (i *Account) ToAccountOutput() AccountOutput {
   207  	return i.ToAccountOutputWithContext(context.Background())
   208  }
   209  
   210  func (i *Account) ToAccountOutputWithContext(ctx context.Context) AccountOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(AccountOutput)
   212  }
   213  
   214  // AccountArrayInput is an input type that accepts AccountArray and AccountArrayOutput values.
   215  // You can construct a concrete instance of `AccountArrayInput` via:
   216  //
   217  //	AccountArray{ AccountArgs{...} }
   218  type AccountArrayInput interface {
   219  	pulumi.Input
   220  
   221  	ToAccountArrayOutput() AccountArrayOutput
   222  	ToAccountArrayOutputWithContext(context.Context) AccountArrayOutput
   223  }
   224  
   225  type AccountArray []AccountInput
   226  
   227  func (AccountArray) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*[]*Account)(nil)).Elem()
   229  }
   230  
   231  func (i AccountArray) ToAccountArrayOutput() AccountArrayOutput {
   232  	return i.ToAccountArrayOutputWithContext(context.Background())
   233  }
   234  
   235  func (i AccountArray) ToAccountArrayOutputWithContext(ctx context.Context) AccountArrayOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(AccountArrayOutput)
   237  }
   238  
   239  // AccountMapInput is an input type that accepts AccountMap and AccountMapOutput values.
   240  // You can construct a concrete instance of `AccountMapInput` via:
   241  //
   242  //	AccountMap{ "key": AccountArgs{...} }
   243  type AccountMapInput interface {
   244  	pulumi.Input
   245  
   246  	ToAccountMapOutput() AccountMapOutput
   247  	ToAccountMapOutputWithContext(context.Context) AccountMapOutput
   248  }
   249  
   250  type AccountMap map[string]AccountInput
   251  
   252  func (AccountMap) ElementType() reflect.Type {
   253  	return reflect.TypeOf((*map[string]*Account)(nil)).Elem()
   254  }
   255  
   256  func (i AccountMap) ToAccountMapOutput() AccountMapOutput {
   257  	return i.ToAccountMapOutputWithContext(context.Background())
   258  }
   259  
   260  func (i AccountMap) ToAccountMapOutputWithContext(ctx context.Context) AccountMapOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(AccountMapOutput)
   262  }
   263  
   264  type AccountOutput struct{ *pulumi.OutputState }
   265  
   266  func (AccountOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((**Account)(nil)).Elem()
   268  }
   269  
   270  func (o AccountOutput) ToAccountOutput() AccountOutput {
   271  	return o
   272  }
   273  
   274  func (o AccountOutput) ToAccountOutputWithContext(ctx context.Context) AccountOutput {
   275  	return o
   276  }
   277  
   278  // The version of the API keys used for the account.
   279  func (o AccountOutput) ApiKeyVersion() pulumi.StringOutput {
   280  	return o.ApplyT(func(v *Account) pulumi.StringOutput { return v.ApiKeyVersion }).(pulumi.StringOutput)
   281  }
   282  
   283  // ARN of an IAM role for CloudWatch (to allow logging & monitoring). See more [in AWS Docs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-stage-settings.html#how-to-stage-settings-console). Logging & monitoring can be enabled/disabled and otherwise tuned on the API Gateway Stage level.
   284  func (o AccountOutput) CloudwatchRoleArn() pulumi.StringPtrOutput {
   285  	return o.ApplyT(func(v *Account) pulumi.StringPtrOutput { return v.CloudwatchRoleArn }).(pulumi.StringPtrOutput)
   286  }
   287  
   288  // A list of features supported for the account.
   289  func (o AccountOutput) Features() pulumi.StringArrayOutput {
   290  	return o.ApplyT(func(v *Account) pulumi.StringArrayOutput { return v.Features }).(pulumi.StringArrayOutput)
   291  }
   292  
   293  // Account-Level throttle settings. See exported fields below.
   294  func (o AccountOutput) ThrottleSettings() AccountThrottleSettingArrayOutput {
   295  	return o.ApplyT(func(v *Account) AccountThrottleSettingArrayOutput { return v.ThrottleSettings }).(AccountThrottleSettingArrayOutput)
   296  }
   297  
   298  type AccountArrayOutput struct{ *pulumi.OutputState }
   299  
   300  func (AccountArrayOutput) ElementType() reflect.Type {
   301  	return reflect.TypeOf((*[]*Account)(nil)).Elem()
   302  }
   303  
   304  func (o AccountArrayOutput) ToAccountArrayOutput() AccountArrayOutput {
   305  	return o
   306  }
   307  
   308  func (o AccountArrayOutput) ToAccountArrayOutputWithContext(ctx context.Context) AccountArrayOutput {
   309  	return o
   310  }
   311  
   312  func (o AccountArrayOutput) Index(i pulumi.IntInput) AccountOutput {
   313  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Account {
   314  		return vs[0].([]*Account)[vs[1].(int)]
   315  	}).(AccountOutput)
   316  }
   317  
   318  type AccountMapOutput struct{ *pulumi.OutputState }
   319  
   320  func (AccountMapOutput) ElementType() reflect.Type {
   321  	return reflect.TypeOf((*map[string]*Account)(nil)).Elem()
   322  }
   323  
   324  func (o AccountMapOutput) ToAccountMapOutput() AccountMapOutput {
   325  	return o
   326  }
   327  
   328  func (o AccountMapOutput) ToAccountMapOutputWithContext(ctx context.Context) AccountMapOutput {
   329  	return o
   330  }
   331  
   332  func (o AccountMapOutput) MapIndex(k pulumi.StringInput) AccountOutput {
   333  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Account {
   334  		return vs[0].(map[string]*Account)[vs[1].(string)]
   335  	}).(AccountOutput)
   336  }
   337  
   338  func init() {
   339  	pulumi.RegisterInputType(reflect.TypeOf((*AccountInput)(nil)).Elem(), &Account{})
   340  	pulumi.RegisterInputType(reflect.TypeOf((*AccountArrayInput)(nil)).Elem(), AccountArray{})
   341  	pulumi.RegisterInputType(reflect.TypeOf((*AccountMapInput)(nil)).Elem(), AccountMap{})
   342  	pulumi.RegisterOutputType(AccountOutput{})
   343  	pulumi.RegisterOutputType(AccountArrayOutput{})
   344  	pulumi.RegisterOutputType(AccountMapOutput{})
   345  }