github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/servicecatalog/portfolioShare.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 servicecatalog 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 // Manages a Service Catalog Portfolio Share. Shares the specified portfolio with the specified account or organization node. You can share portfolios to an organization, an organizational unit, or a specific account. 16 // 17 // If the portfolio share with the specified account or organization node already exists, using this resource to re-create the share will have no effect and will not return an error. You can then use this resource to update the share. 18 // 19 // > **NOTE:** Shares to an organization node can only be created by the management account of an organization or by a delegated administrator. If a delegated admin is de-registered, they can no longer create portfolio shares. 20 // 21 // > **NOTE:** AWSOrganizationsAccess must be enabled in order to create a portfolio share to an organization node. 22 // 23 // > **NOTE:** You can't share a shared resource, including portfolios that contain a shared product. 24 // 25 // ## Example Usage 26 // 27 // ### Basic Usage 28 // 29 // <!--Start PulumiCodeChooser --> 30 // ```go 31 // package main 32 // 33 // import ( 34 // 35 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/servicecatalog" 36 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 37 // 38 // ) 39 // 40 // func main() { 41 // pulumi.Run(func(ctx *pulumi.Context) error { 42 // _, err := servicecatalog.NewPortfolioShare(ctx, "example", &servicecatalog.PortfolioShareArgs{ 43 // PrincipalId: pulumi.String("012128675309"), 44 // PortfolioId: pulumi.Any(exampleAwsServicecatalogPortfolio.Id), 45 // Type: pulumi.String("ACCOUNT"), 46 // }) 47 // if err != nil { 48 // return err 49 // } 50 // return nil 51 // }) 52 // } 53 // 54 // ``` 55 // <!--End PulumiCodeChooser --> 56 // 57 // ## Import 58 // 59 // Using `pulumi import`, import `aws_servicecatalog_portfolio_share` using the portfolio share ID. For example: 60 // 61 // ```sh 62 // $ pulumi import aws:servicecatalog/portfolioShare:PortfolioShare example port-12344321:ACCOUNT:123456789012 63 // ``` 64 type PortfolioShare struct { 65 pulumi.CustomResourceState 66 67 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 68 AcceptLanguage pulumi.StringPtrOutput `pulumi:"acceptLanguage"` 69 // Whether the shared portfolio is imported by the recipient account. If the recipient is organizational, the share is automatically imported, and the field is always set to true. 70 Accepted pulumi.BoolOutput `pulumi:"accepted"` 71 // Portfolio identifier. 72 PortfolioId pulumi.StringOutput `pulumi:"portfolioId"` 73 // Identifier of the principal with whom you will share the portfolio. Valid values AWS account IDs and ARNs of AWS Organizations and organizational units. 74 PrincipalId pulumi.StringOutput `pulumi:"principalId"` 75 // Enables or disables Principal sharing when creating the portfolio share. If this flag is not provided, principal sharing is disabled. 76 SharePrincipals pulumi.BoolPtrOutput `pulumi:"sharePrincipals"` 77 // Whether to enable sharing of `servicecatalog.TagOption` resources when creating the portfolio share. 78 ShareTagOptions pulumi.BoolPtrOutput `pulumi:"shareTagOptions"` 79 // Type of portfolio share. Valid values are `ACCOUNT` (an external account), `ORGANIZATION` (a share to every account in an organization), `ORGANIZATIONAL_UNIT`, `ORGANIZATION_MEMBER_ACCOUNT` (a share to an account in an organization). 80 // 81 // The following arguments are optional: 82 Type pulumi.StringOutput `pulumi:"type"` 83 // Whether to wait (up to the timeout) for the share to be accepted. Organizational shares are automatically accepted. 84 WaitForAcceptance pulumi.BoolPtrOutput `pulumi:"waitForAcceptance"` 85 } 86 87 // NewPortfolioShare registers a new resource with the given unique name, arguments, and options. 88 func NewPortfolioShare(ctx *pulumi.Context, 89 name string, args *PortfolioShareArgs, opts ...pulumi.ResourceOption) (*PortfolioShare, error) { 90 if args == nil { 91 return nil, errors.New("missing one or more required arguments") 92 } 93 94 if args.PortfolioId == nil { 95 return nil, errors.New("invalid value for required argument 'PortfolioId'") 96 } 97 if args.PrincipalId == nil { 98 return nil, errors.New("invalid value for required argument 'PrincipalId'") 99 } 100 if args.Type == nil { 101 return nil, errors.New("invalid value for required argument 'Type'") 102 } 103 opts = internal.PkgResourceDefaultOpts(opts) 104 var resource PortfolioShare 105 err := ctx.RegisterResource("aws:servicecatalog/portfolioShare:PortfolioShare", name, args, &resource, opts...) 106 if err != nil { 107 return nil, err 108 } 109 return &resource, nil 110 } 111 112 // GetPortfolioShare gets an existing PortfolioShare resource's state with the given name, ID, and optional 113 // state properties that are used to uniquely qualify the lookup (nil if not required). 114 func GetPortfolioShare(ctx *pulumi.Context, 115 name string, id pulumi.IDInput, state *PortfolioShareState, opts ...pulumi.ResourceOption) (*PortfolioShare, error) { 116 var resource PortfolioShare 117 err := ctx.ReadResource("aws:servicecatalog/portfolioShare:PortfolioShare", name, id, state, &resource, opts...) 118 if err != nil { 119 return nil, err 120 } 121 return &resource, nil 122 } 123 124 // Input properties used for looking up and filtering PortfolioShare resources. 125 type portfolioShareState struct { 126 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 127 AcceptLanguage *string `pulumi:"acceptLanguage"` 128 // Whether the shared portfolio is imported by the recipient account. If the recipient is organizational, the share is automatically imported, and the field is always set to true. 129 Accepted *bool `pulumi:"accepted"` 130 // Portfolio identifier. 131 PortfolioId *string `pulumi:"portfolioId"` 132 // Identifier of the principal with whom you will share the portfolio. Valid values AWS account IDs and ARNs of AWS Organizations and organizational units. 133 PrincipalId *string `pulumi:"principalId"` 134 // Enables or disables Principal sharing when creating the portfolio share. If this flag is not provided, principal sharing is disabled. 135 SharePrincipals *bool `pulumi:"sharePrincipals"` 136 // Whether to enable sharing of `servicecatalog.TagOption` resources when creating the portfolio share. 137 ShareTagOptions *bool `pulumi:"shareTagOptions"` 138 // Type of portfolio share. Valid values are `ACCOUNT` (an external account), `ORGANIZATION` (a share to every account in an organization), `ORGANIZATIONAL_UNIT`, `ORGANIZATION_MEMBER_ACCOUNT` (a share to an account in an organization). 139 // 140 // The following arguments are optional: 141 Type *string `pulumi:"type"` 142 // Whether to wait (up to the timeout) for the share to be accepted. Organizational shares are automatically accepted. 143 WaitForAcceptance *bool `pulumi:"waitForAcceptance"` 144 } 145 146 type PortfolioShareState struct { 147 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 148 AcceptLanguage pulumi.StringPtrInput 149 // Whether the shared portfolio is imported by the recipient account. If the recipient is organizational, the share is automatically imported, and the field is always set to true. 150 Accepted pulumi.BoolPtrInput 151 // Portfolio identifier. 152 PortfolioId pulumi.StringPtrInput 153 // Identifier of the principal with whom you will share the portfolio. Valid values AWS account IDs and ARNs of AWS Organizations and organizational units. 154 PrincipalId pulumi.StringPtrInput 155 // Enables or disables Principal sharing when creating the portfolio share. If this flag is not provided, principal sharing is disabled. 156 SharePrincipals pulumi.BoolPtrInput 157 // Whether to enable sharing of `servicecatalog.TagOption` resources when creating the portfolio share. 158 ShareTagOptions pulumi.BoolPtrInput 159 // Type of portfolio share. Valid values are `ACCOUNT` (an external account), `ORGANIZATION` (a share to every account in an organization), `ORGANIZATIONAL_UNIT`, `ORGANIZATION_MEMBER_ACCOUNT` (a share to an account in an organization). 160 // 161 // The following arguments are optional: 162 Type pulumi.StringPtrInput 163 // Whether to wait (up to the timeout) for the share to be accepted. Organizational shares are automatically accepted. 164 WaitForAcceptance pulumi.BoolPtrInput 165 } 166 167 func (PortfolioShareState) ElementType() reflect.Type { 168 return reflect.TypeOf((*portfolioShareState)(nil)).Elem() 169 } 170 171 type portfolioShareArgs struct { 172 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 173 AcceptLanguage *string `pulumi:"acceptLanguage"` 174 // Portfolio identifier. 175 PortfolioId string `pulumi:"portfolioId"` 176 // Identifier of the principal with whom you will share the portfolio. Valid values AWS account IDs and ARNs of AWS Organizations and organizational units. 177 PrincipalId string `pulumi:"principalId"` 178 // Enables or disables Principal sharing when creating the portfolio share. If this flag is not provided, principal sharing is disabled. 179 SharePrincipals *bool `pulumi:"sharePrincipals"` 180 // Whether to enable sharing of `servicecatalog.TagOption` resources when creating the portfolio share. 181 ShareTagOptions *bool `pulumi:"shareTagOptions"` 182 // Type of portfolio share. Valid values are `ACCOUNT` (an external account), `ORGANIZATION` (a share to every account in an organization), `ORGANIZATIONAL_UNIT`, `ORGANIZATION_MEMBER_ACCOUNT` (a share to an account in an organization). 183 // 184 // The following arguments are optional: 185 Type string `pulumi:"type"` 186 // Whether to wait (up to the timeout) for the share to be accepted. Organizational shares are automatically accepted. 187 WaitForAcceptance *bool `pulumi:"waitForAcceptance"` 188 } 189 190 // The set of arguments for constructing a PortfolioShare resource. 191 type PortfolioShareArgs struct { 192 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 193 AcceptLanguage pulumi.StringPtrInput 194 // Portfolio identifier. 195 PortfolioId pulumi.StringInput 196 // Identifier of the principal with whom you will share the portfolio. Valid values AWS account IDs and ARNs of AWS Organizations and organizational units. 197 PrincipalId pulumi.StringInput 198 // Enables or disables Principal sharing when creating the portfolio share. If this flag is not provided, principal sharing is disabled. 199 SharePrincipals pulumi.BoolPtrInput 200 // Whether to enable sharing of `servicecatalog.TagOption` resources when creating the portfolio share. 201 ShareTagOptions pulumi.BoolPtrInput 202 // Type of portfolio share. Valid values are `ACCOUNT` (an external account), `ORGANIZATION` (a share to every account in an organization), `ORGANIZATIONAL_UNIT`, `ORGANIZATION_MEMBER_ACCOUNT` (a share to an account in an organization). 203 // 204 // The following arguments are optional: 205 Type pulumi.StringInput 206 // Whether to wait (up to the timeout) for the share to be accepted. Organizational shares are automatically accepted. 207 WaitForAcceptance pulumi.BoolPtrInput 208 } 209 210 func (PortfolioShareArgs) ElementType() reflect.Type { 211 return reflect.TypeOf((*portfolioShareArgs)(nil)).Elem() 212 } 213 214 type PortfolioShareInput interface { 215 pulumi.Input 216 217 ToPortfolioShareOutput() PortfolioShareOutput 218 ToPortfolioShareOutputWithContext(ctx context.Context) PortfolioShareOutput 219 } 220 221 func (*PortfolioShare) ElementType() reflect.Type { 222 return reflect.TypeOf((**PortfolioShare)(nil)).Elem() 223 } 224 225 func (i *PortfolioShare) ToPortfolioShareOutput() PortfolioShareOutput { 226 return i.ToPortfolioShareOutputWithContext(context.Background()) 227 } 228 229 func (i *PortfolioShare) ToPortfolioShareOutputWithContext(ctx context.Context) PortfolioShareOutput { 230 return pulumi.ToOutputWithContext(ctx, i).(PortfolioShareOutput) 231 } 232 233 // PortfolioShareArrayInput is an input type that accepts PortfolioShareArray and PortfolioShareArrayOutput values. 234 // You can construct a concrete instance of `PortfolioShareArrayInput` via: 235 // 236 // PortfolioShareArray{ PortfolioShareArgs{...} } 237 type PortfolioShareArrayInput interface { 238 pulumi.Input 239 240 ToPortfolioShareArrayOutput() PortfolioShareArrayOutput 241 ToPortfolioShareArrayOutputWithContext(context.Context) PortfolioShareArrayOutput 242 } 243 244 type PortfolioShareArray []PortfolioShareInput 245 246 func (PortfolioShareArray) ElementType() reflect.Type { 247 return reflect.TypeOf((*[]*PortfolioShare)(nil)).Elem() 248 } 249 250 func (i PortfolioShareArray) ToPortfolioShareArrayOutput() PortfolioShareArrayOutput { 251 return i.ToPortfolioShareArrayOutputWithContext(context.Background()) 252 } 253 254 func (i PortfolioShareArray) ToPortfolioShareArrayOutputWithContext(ctx context.Context) PortfolioShareArrayOutput { 255 return pulumi.ToOutputWithContext(ctx, i).(PortfolioShareArrayOutput) 256 } 257 258 // PortfolioShareMapInput is an input type that accepts PortfolioShareMap and PortfolioShareMapOutput values. 259 // You can construct a concrete instance of `PortfolioShareMapInput` via: 260 // 261 // PortfolioShareMap{ "key": PortfolioShareArgs{...} } 262 type PortfolioShareMapInput interface { 263 pulumi.Input 264 265 ToPortfolioShareMapOutput() PortfolioShareMapOutput 266 ToPortfolioShareMapOutputWithContext(context.Context) PortfolioShareMapOutput 267 } 268 269 type PortfolioShareMap map[string]PortfolioShareInput 270 271 func (PortfolioShareMap) ElementType() reflect.Type { 272 return reflect.TypeOf((*map[string]*PortfolioShare)(nil)).Elem() 273 } 274 275 func (i PortfolioShareMap) ToPortfolioShareMapOutput() PortfolioShareMapOutput { 276 return i.ToPortfolioShareMapOutputWithContext(context.Background()) 277 } 278 279 func (i PortfolioShareMap) ToPortfolioShareMapOutputWithContext(ctx context.Context) PortfolioShareMapOutput { 280 return pulumi.ToOutputWithContext(ctx, i).(PortfolioShareMapOutput) 281 } 282 283 type PortfolioShareOutput struct{ *pulumi.OutputState } 284 285 func (PortfolioShareOutput) ElementType() reflect.Type { 286 return reflect.TypeOf((**PortfolioShare)(nil)).Elem() 287 } 288 289 func (o PortfolioShareOutput) ToPortfolioShareOutput() PortfolioShareOutput { 290 return o 291 } 292 293 func (o PortfolioShareOutput) ToPortfolioShareOutputWithContext(ctx context.Context) PortfolioShareOutput { 294 return o 295 } 296 297 // Language code. Valid values: `en` (English), `jp` (Japanese), `zh` (Chinese). Default value is `en`. 298 func (o PortfolioShareOutput) AcceptLanguage() pulumi.StringPtrOutput { 299 return o.ApplyT(func(v *PortfolioShare) pulumi.StringPtrOutput { return v.AcceptLanguage }).(pulumi.StringPtrOutput) 300 } 301 302 // Whether the shared portfolio is imported by the recipient account. If the recipient is organizational, the share is automatically imported, and the field is always set to true. 303 func (o PortfolioShareOutput) Accepted() pulumi.BoolOutput { 304 return o.ApplyT(func(v *PortfolioShare) pulumi.BoolOutput { return v.Accepted }).(pulumi.BoolOutput) 305 } 306 307 // Portfolio identifier. 308 func (o PortfolioShareOutput) PortfolioId() pulumi.StringOutput { 309 return o.ApplyT(func(v *PortfolioShare) pulumi.StringOutput { return v.PortfolioId }).(pulumi.StringOutput) 310 } 311 312 // Identifier of the principal with whom you will share the portfolio. Valid values AWS account IDs and ARNs of AWS Organizations and organizational units. 313 func (o PortfolioShareOutput) PrincipalId() pulumi.StringOutput { 314 return o.ApplyT(func(v *PortfolioShare) pulumi.StringOutput { return v.PrincipalId }).(pulumi.StringOutput) 315 } 316 317 // Enables or disables Principal sharing when creating the portfolio share. If this flag is not provided, principal sharing is disabled. 318 func (o PortfolioShareOutput) SharePrincipals() pulumi.BoolPtrOutput { 319 return o.ApplyT(func(v *PortfolioShare) pulumi.BoolPtrOutput { return v.SharePrincipals }).(pulumi.BoolPtrOutput) 320 } 321 322 // Whether to enable sharing of `servicecatalog.TagOption` resources when creating the portfolio share. 323 func (o PortfolioShareOutput) ShareTagOptions() pulumi.BoolPtrOutput { 324 return o.ApplyT(func(v *PortfolioShare) pulumi.BoolPtrOutput { return v.ShareTagOptions }).(pulumi.BoolPtrOutput) 325 } 326 327 // Type of portfolio share. Valid values are `ACCOUNT` (an external account), `ORGANIZATION` (a share to every account in an organization), `ORGANIZATIONAL_UNIT`, `ORGANIZATION_MEMBER_ACCOUNT` (a share to an account in an organization). 328 // 329 // The following arguments are optional: 330 func (o PortfolioShareOutput) Type() pulumi.StringOutput { 331 return o.ApplyT(func(v *PortfolioShare) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput) 332 } 333 334 // Whether to wait (up to the timeout) for the share to be accepted. Organizational shares are automatically accepted. 335 func (o PortfolioShareOutput) WaitForAcceptance() pulumi.BoolPtrOutput { 336 return o.ApplyT(func(v *PortfolioShare) pulumi.BoolPtrOutput { return v.WaitForAcceptance }).(pulumi.BoolPtrOutput) 337 } 338 339 type PortfolioShareArrayOutput struct{ *pulumi.OutputState } 340 341 func (PortfolioShareArrayOutput) ElementType() reflect.Type { 342 return reflect.TypeOf((*[]*PortfolioShare)(nil)).Elem() 343 } 344 345 func (o PortfolioShareArrayOutput) ToPortfolioShareArrayOutput() PortfolioShareArrayOutput { 346 return o 347 } 348 349 func (o PortfolioShareArrayOutput) ToPortfolioShareArrayOutputWithContext(ctx context.Context) PortfolioShareArrayOutput { 350 return o 351 } 352 353 func (o PortfolioShareArrayOutput) Index(i pulumi.IntInput) PortfolioShareOutput { 354 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PortfolioShare { 355 return vs[0].([]*PortfolioShare)[vs[1].(int)] 356 }).(PortfolioShareOutput) 357 } 358 359 type PortfolioShareMapOutput struct{ *pulumi.OutputState } 360 361 func (PortfolioShareMapOutput) ElementType() reflect.Type { 362 return reflect.TypeOf((*map[string]*PortfolioShare)(nil)).Elem() 363 } 364 365 func (o PortfolioShareMapOutput) ToPortfolioShareMapOutput() PortfolioShareMapOutput { 366 return o 367 } 368 369 func (o PortfolioShareMapOutput) ToPortfolioShareMapOutputWithContext(ctx context.Context) PortfolioShareMapOutput { 370 return o 371 } 372 373 func (o PortfolioShareMapOutput) MapIndex(k pulumi.StringInput) PortfolioShareOutput { 374 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PortfolioShare { 375 return vs[0].(map[string]*PortfolioShare)[vs[1].(string)] 376 }).(PortfolioShareOutput) 377 } 378 379 func init() { 380 pulumi.RegisterInputType(reflect.TypeOf((*PortfolioShareInput)(nil)).Elem(), &PortfolioShare{}) 381 pulumi.RegisterInputType(reflect.TypeOf((*PortfolioShareArrayInput)(nil)).Elem(), PortfolioShareArray{}) 382 pulumi.RegisterInputType(reflect.TypeOf((*PortfolioShareMapInput)(nil)).Elem(), PortfolioShareMap{}) 383 pulumi.RegisterOutputType(PortfolioShareOutput{}) 384 pulumi.RegisterOutputType(PortfolioShareArrayOutput{}) 385 pulumi.RegisterOutputType(PortfolioShareMapOutput{}) 386 }