AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

Organizations

import "github.com/aws/aws-sdk-go/service/organizations"

type Organizations struct { *client.Client }

Organizations provides the API operation methods for making requests to AWS Organizations. See this package's package overview docs for details on the service.

Organizations methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

Client

Type: *client.Client

Method

AcceptHandshake

func (c *Organizations) AcceptHandshake(input *AcceptHandshakeInput) (*AcceptHandshakeOutput, error)

AcceptHandshake API operation for AWS Organizations.

Sends a response to the originator of a handshake agreeing to the action proposed by the handshake request.

This operation can be called only by the following principals when they also have the relevant IAM permissions:

  • Invitation to join or Approve all features request handshakes: only a principal from the member account.

The user who calls the API for an invitation to join must have the organizations:AcceptHandshake

permission. If you enabled all features in the organization, then the user must also have the iam:CreateServiceLinkedRole permission so that Organizations can create the required service-linked role named AWSServiceRoleForOrganizations. For more information, see AWS Organizations and Service-Linked Roles (http://docs.aws.amazon.com/organizations/latest/userguide/orgs_integration_services.html#orgs_integration_service-linked-roles) in the AWS Organizations User Guide.
  • Enable all features final confirmation handshake: only a principal from the master account.

For more information about invitations, see Inviting an AWS Account to Join

Your Organization (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_invites.html) in the AWS Organizations User Guide. For more information about requests to enable all features in the organization, see Enabling All Features in Your Organization (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html) in the AWS Organizations User Guide.

After you accept a handshake, it continues to appear in the results of relevant APIs for only 30 days. After that it is deleted.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation AcceptHandshake for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeHandshakeConstraintViolationException "HandshakeConstraintViolationException" The requested operation would violate the constraint identified in the reason code.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. Note that deleted and closed accounts still count toward your limit.

If you get this exception immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • ALREADY_IN_AN_ORGANIZATION: The handshake request is invalid because the invited account is already a member of an organization.

  • ORGANIZATION_ALREADY_HAS_ALL_FEATURES: The handshake request is invalid because the organization has already enabled all features.

  • INVITE_DISABLED_DURING_ENABLE_ALL_FEATURES: You can't issue new invitations to join an organization while it's in the process of enabling all features. You can resume inviting accounts after you finalize the process when all accounts have agreed to the change.

  • PAYMENT_INSTRUMENT_REQUIRED: You can't complete the operation with an account that doesn't have a payment instrument, such as a credit card, associated with it.

  • ORGANIZATION_FROM_DIFFERENT_SELLER_OF_RECORD: The request failed because the account is from a different marketplace than the accounts in the organization. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be from the same marketplace.

  • ORGANIZATION_MEMBERSHIP_CHANGE_RATE_LIMIT_EXCEEDED: You attempted to change the membership of an account too quickly after its previous change.

  • ErrCodeHandshakeNotFoundException "HandshakeNotFoundException" We can't find a handshake with the HandshakeId that you specified.

  • ErrCodeInvalidHandshakeTransitionException "InvalidHandshakeTransitionException" You can't perform the operation on the handshake in its current state. For example, you can't cancel a handshake that was already accepted or accept a handshake that was already declined.

  • ErrCodeHandshakeAlreadyInStateException "HandshakeAlreadyInStateException" The specified handshake is already in the requested state. For example, you can't accept a handshake that was already accepted.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.
  • ErrCodeAccessDeniedForDependencyException "AccessDeniedForDependencyException" The operation that you attempted requires you to have the iam:CreateServiceLinkedRole so that AWS Organizations can create the required service-linked role. You don't have that permission.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/AcceptHandshake

Example

Organizations AcceptHandshake shared00

To accept a handshake from another account

Bill is the owner of an organization, and he invites Juan's account (222222222222) to join his organization. The following example shows Juan's account accepting the handshake and thus agreeing to the invitation.

{ svc := organizations.New(session.New()) input := &organizations.AcceptHandshakeInput{ HandshakeId: aws.String("h-examplehandshakeid111"), } result, err := svc.AcceptHandshake(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeHandshakeConstraintViolationException: fmt.Println(organizations.ErrCodeHandshakeConstraintViolationException, aerr.Error()) case organizations.ErrCodeHandshakeNotFoundException: fmt.Println(organizations.ErrCodeHandshakeNotFoundException, aerr.Error()) case organizations.ErrCodeInvalidHandshakeTransitionException: fmt.Println(organizations.ErrCodeInvalidHandshakeTransitionException, aerr.Error()) case organizations.ErrCodeHandshakeAlreadyInStateException: fmt.Println(organizations.ErrCodeHandshakeAlreadyInStateException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) case organizations.ErrCodeAccessDeniedForDependencyException: fmt.Println(organizations.ErrCodeAccessDeniedForDependencyException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

AcceptHandshakeRequest

func (c *Organizations) AcceptHandshakeRequest(input *AcceptHandshakeInput) (req *request.Request, output *AcceptHandshakeOutput)

AcceptHandshakeRequest generates a "aws/request.Request" representing the client's request for the AcceptHandshake operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AcceptHandshake for more information on using the AcceptHandshake API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AcceptHandshakeRequest method. req, resp := client.AcceptHandshakeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/AcceptHandshake

AcceptHandshakeWithContext

func (c *Organizations) AcceptHandshakeWithContext(ctx aws.Context, input *AcceptHandshakeInput, opts ...request.Option) (*AcceptHandshakeOutput, error)

AcceptHandshakeWithContext is the same as AcceptHandshake with the addition of the ability to pass a context and additional request options.

See AcceptHandshake for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

AttachPolicy

func (c *Organizations) AttachPolicy(input *AttachPolicyInput) (*AttachPolicyOutput, error)

AttachPolicy API operation for AWS Organizations.

Attaches a policy to a root, an organizational unit (OU), or an individual account. How the policy affects accounts depends on the type of policy:

  • Service control policy (SCP) - An SCP specifies what permissions can be delegated to users in affected member accounts. The scope of influence for a policy depends on what you attach the policy to:

If you attach an SCP to a root, it affects all accounts in the organization.

If you attach an SCP to an OU, it affects all accounts in that OU and in

any child OUs.

If you attach the policy directly to an account, then it affects only that

account.

SCPs are JSON policies that specify the maximum permissions for an organization

or organizational unit (OU). When you attach one SCP to a higher level root or OU, and you also attach a different SCP to a child OU or to an account, the child policy can further restrict only the permissions that pass through the parent filter and are available to the child. An SCP that is attached to a child cannot grant a permission that is not already granted by the parent. For example, imagine that the parent SCP allows permissions A, B, C, D, and E. The child SCP allows C, D, E, F, and G. The result is that the accounts affected by the child SCP are allowed to use only C, D, and E. They cannot use A or B because they were filtered out by the child OU. They also cannot use F and G because they were filtered out by the parent OU. They cannot be granted back by the child SCP; child SCPs can only filter the permissions they receive from the parent SCP.

AWS Organizations attaches a default SCP named "FullAWSAccess to every root,

OU, and account. This default SCP allows all services and actions, enabling any new child OU or account to inherit the permissions of the parent root or OU. If you detach the default policy, you must replace it with a policy that specifies the permissions that you want to allow in that OU or account.

For more information about how Organizations policies permissions work, see

Using Service Control Policies (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scp.html) in the AWS Organizations User Guide.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation AttachPolicy for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeDuplicatePolicyAttachmentException "DuplicatePolicyAttachmentException" The selected policy is already attached to the specified target.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodePolicyNotFoundException "PolicyNotFoundException" We can't find a policy with the PolicyId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTargetNotFoundException "TargetNotFoundException" We can't find a root, OU, or account with the TargetId that you specified.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/AttachPolicy

Examples

Organizations AttachPolicy shared00

To attach a policy to an OU

The following example shows how to attach a service control policy (SCP) to an OU:

{ svc := organizations.New(session.New()) input := &organizations.AttachPolicyInput{ PolicyId: aws.String("p-examplepolicyid111"), TargetId: aws.String("ou-examplerootid111-exampleouid111"), } result, err := svc.AttachPolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeDuplicatePolicyAttachmentException: fmt.Println(organizations.ErrCodeDuplicatePolicyAttachmentException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyNotFoundException: fmt.Println(organizations.ErrCodePolicyNotFoundException, aerr.Error()) case organizations.ErrCodePolicyTypeNotEnabledException: fmt.Println(organizations.ErrCodePolicyTypeNotEnabledException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTargetNotFoundException: fmt.Println(organizations.ErrCodeTargetNotFoundException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
Organizations AttachPolicy shared01

To attach a policy to an account

The following example shows how to attach a service control policy (SCP) to an account:

{ svc := organizations.New(session.New()) input := &organizations.AttachPolicyInput{ PolicyId: aws.String("p-examplepolicyid111"), TargetId: aws.String("333333333333"), } result, err := svc.AttachPolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeDuplicatePolicyAttachmentException: fmt.Println(organizations.ErrCodeDuplicatePolicyAttachmentException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyNotFoundException: fmt.Println(organizations.ErrCodePolicyNotFoundException, aerr.Error()) case organizations.ErrCodePolicyTypeNotEnabledException: fmt.Println(organizations.ErrCodePolicyTypeNotEnabledException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTargetNotFoundException: fmt.Println(organizations.ErrCodeTargetNotFoundException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

AttachPolicyRequest

func (c *Organizations) AttachPolicyRequest(input *AttachPolicyInput) (req *request.Request, output *AttachPolicyOutput)

AttachPolicyRequest generates a "aws/request.Request" representing the client's request for the AttachPolicy operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AttachPolicy for more information on using the AttachPolicy API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AttachPolicyRequest method. req, resp := client.AttachPolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/AttachPolicy

AttachPolicyWithContext

func (c *Organizations) AttachPolicyWithContext(ctx aws.Context, input *AttachPolicyInput, opts ...request.Option) (*AttachPolicyOutput, error)

AttachPolicyWithContext is the same as AttachPolicy with the addition of the ability to pass a context and additional request options.

See AttachPolicy for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CancelHandshake

func (c *Organizations) CancelHandshake(input *CancelHandshakeInput) (*CancelHandshakeOutput, error)

CancelHandshake API operation for AWS Organizations.

Cancels a handshake. Canceling a handshake sets the handshake state to CANCELED.

This operation can be called only from the account that originated the handshake. The recipient of the handshake can't cancel it, but can use DeclineHandshake instead. After a handshake is canceled, the recipient can no longer respond to that handshake.

After you cancel a handshake, it continues to appear in the results of relevant APIs for only 30 days. After that it is deleted.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation CancelHandshake for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeHandshakeNotFoundException "HandshakeNotFoundException" We can't find a handshake with the HandshakeId that you specified.

  • ErrCodeInvalidHandshakeTransitionException "InvalidHandshakeTransitionException" You can't perform the operation on the handshake in its current state. For example, you can't cancel a handshake that was already accepted or accept a handshake that was already declined.

  • ErrCodeHandshakeAlreadyInStateException "HandshakeAlreadyInStateException" The specified handshake is already in the requested state. For example, you can't accept a handshake that was already accepted.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CancelHandshake

Example

Organizations CancelHandshake shared00

To cancel a handshake sent to a member account

Bill previously sent an invitation to Susan's account to join his organization. He changes his mind and decides to cancel the invitation before Susan accepts it. The following example shows Bill's cancellation:

{ svc := organizations.New(session.New()) input := &organizations.CancelHandshakeInput{ HandshakeId: aws.String("h-examplehandshakeid111"), } result, err := svc.CancelHandshake(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeHandshakeNotFoundException: fmt.Println(organizations.ErrCodeHandshakeNotFoundException, aerr.Error()) case organizations.ErrCodeInvalidHandshakeTransitionException: fmt.Println(organizations.ErrCodeInvalidHandshakeTransitionException, aerr.Error()) case organizations.ErrCodeHandshakeAlreadyInStateException: fmt.Println(organizations.ErrCodeHandshakeAlreadyInStateException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CancelHandshakeRequest

func (c *Organizations) CancelHandshakeRequest(input *CancelHandshakeInput) (req *request.Request, output *CancelHandshakeOutput)

CancelHandshakeRequest generates a "aws/request.Request" representing the client's request for the CancelHandshake operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CancelHandshake for more information on using the CancelHandshake API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CancelHandshakeRequest method. req, resp := client.CancelHandshakeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CancelHandshake

CancelHandshakeWithContext

func (c *Organizations) CancelHandshakeWithContext(ctx aws.Context, input *CancelHandshakeInput, opts ...request.Option) (*CancelHandshakeOutput, error)

CancelHandshakeWithContext is the same as CancelHandshake with the addition of the ability to pass a context and additional request options.

See CancelHandshake for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateAccount

func (c *Organizations) CreateAccount(input *CreateAccountInput) (*CreateAccountOutput, error)

CreateAccount API operation for AWS Organizations.

Creates an AWS account that is automatically a member of the organization whose credentials made the request. This is an asynchronous request that AWS performs in the background. Because CreateAccount operates asynchronously, it can return a successful completion message even though account initialization might still be in progress. You might need to wait a few minutes before you can successfully access the account. To check the status of the request, do one of the following:

  • Use the OperationId response element from this operation to provide as a parameter to the DescribeCreateAccountStatus operation.

The user who calls the API to create an account must have the organizations:CreateAccountpermission. If you enabled all features in the organization, AWS Organizations will create the required service-linked role named AWSServiceRoleForOrganizations. For more information, see AWS Organizations and Service-Linked Roles (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html#orgs_integrate_services-using_slrs)in the AWS Organizations User Guide.

AWS Organizations preconfigures the new member account with a role (named OrganizationAccountAccessRoleby default) that grants users in the master account administrator permissions in the new member account. Principals in the master account can assume the role. AWS Organizations clones the company name and address information for the new account from the organization's master account.

This operation can be called only from the organization's master account.

For more information about creating accounts, see Creating an AWS Account in Your Organization (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_create.html)in the AWS Organizations User Guide.

When you create an account in an organization using the AWS Organizations console, API, or CLI commands, the information required for the account to operate as a standalone account, such as a payment method and signing the end user license agreement (EULA) is not automatically collected. If you must remove an account from your organization later, you can do so only after you provide the missing information. Follow the steps at To leave an organization as a member account (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_remove.html#leave-without-all-info) in the AWS Organizations User Guide.

If you get an exception that indicates that you exceeded your account limits for the organization, contact AWS Support (https://console.aws.amazon.com/support/home#/).

If you get an exception that indicates that the operation failed because your organization is still initializing, wait one hour and then try again. If the error persists, contact AWS Support (https://console.aws.amazon.com/support/home#/).

Using CreateAccount to create multiple temporary accounts isn't recommended. You can only close an account from the Billing and Cost Management Console, and you must be signed in as the root user. For information on the requirements and process for closing an account, see Closing an AWS Account (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_close.html) in the AWS Organizations User Guide.

When you create a member account with this operation, you can choose whether to create the account with the IAM User and Role Access to Billing Information switch enabled. If you enable it, IAM users and roles that have appropriate permissions can view billing information for the account. If you disable it, only the account root user can access billing information. For information about how to disable this switch for an account, see Granting Access to Your Billing Information and Tools (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/grantaccess.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation CreateAccount for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeFinalizingOrganizationException "FinalizingOrganizationException" AWS Organizations couldn't perform the operation because your organization hasn't finished initializing. This can take up to an hour. Try again later. If after one hour you continue to receive this error, contact AWS Support

(https://console.aws.amazon.com/support/home#/).
  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreateAccount

Example

Organizations CreateAccount shared00

To create a new account that is automatically part of the organization

The owner of an organization creates a member account in the organization. The following example shows that when the organization owner creates the member account, the account is preconfigured with the name "Production Account" and an owner email address of susan@example.com. An IAM role is automatically created using the default name because the roleName parameter is not used. AWS Organizations sends Susan a "Welcome to AWS" email:

{ svc := organizations.New(session.New()) input := &organizations.CreateAccountInput{ AccountName: aws.String("Production Account"), Email: aws.String("susan@example.com"), } result, err := svc.CreateAccount(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeFinalizingOrganizationException: fmt.Println(organizations.ErrCodeFinalizingOrganizationException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateAccountRequest

func (c *Organizations) CreateAccountRequest(input *CreateAccountInput) (req *request.Request, output *CreateAccountOutput)

CreateAccountRequest generates a "aws/request.Request" representing the client's request for the CreateAccount operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateAccount for more information on using the CreateAccount API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateAccountRequest method. req, resp := client.CreateAccountRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreateAccount

CreateAccountWithContext

func (c *Organizations) CreateAccountWithContext(ctx aws.Context, input *CreateAccountInput, opts ...request.Option) (*CreateAccountOutput, error)

CreateAccountWithContext is the same as CreateAccount with the addition of the ability to pass a context and additional request options.

See CreateAccount for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateOrganization

func (c *Organizations) CreateOrganization(input *CreateOrganizationInput) (*CreateOrganizationOutput, error)

CreateOrganization API operation for AWS Organizations.

Creates an AWS organization. The account whose user is calling the CreateOrganization operation automatically becomes the master account (https://docs.aws.amazon.com/IAM/latest/UserGuide/orgs_getting-started_concepts.html#account) of the new organization.

This operation must be called using credentials from the account that is to become the new organization's master account. The principal must also have the relevant IAM permissions.

By default (or if you set the FeatureSet parameter to ALL), the new organization is created with all features enabled and service control policies automatically enabled in the root. If you instead choose to create the organization supporting only the consolidated billing features by setting the FeatureSet parameter to CONSOLIDATED_BILLING", then no policy types are enabled by default and you cannot use organization policies.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation CreateOrganization for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAlreadyInOrganizationException "AlreadyInOrganizationException" This account is already a member of an organization. An account can belong to only one organization at a time.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.
  • ErrCodeAccessDeniedForDependencyException "AccessDeniedForDependencyException" The operation that you attempted requires you to have the iam:CreateServiceLinkedRole so that AWS Organizations can create the required service-linked role. You don't have that permission.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreateOrganization

Examples

Organizations CreateOrganization shared00

To create a new organization with all features enabled

Bill wants to create an organization using credentials from account 111111111111. The following example shows that the account becomes the master account in the new organization. Because he does not specify a feature set, the new organization defaults to all features enabled and service control policies enabled on the root:

{ svc := organizations.New(session.New()) input := &organizations.CreateOrganizationInput{} result, err := svc.CreateOrganization(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAlreadyInOrganizationException: fmt.Println(organizations.ErrCodeAlreadyInOrganizationException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) case organizations.ErrCodeAccessDeniedForDependencyException: fmt.Println(organizations.ErrCodeAccessDeniedForDependencyException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
Organizations CreateOrganization shared01

To create a new organization with consolidated billing features only

In the following example, Bill creates an organization using credentials from account 111111111111, and configures the organization to support only the consolidated billing feature set:

{ svc := organizations.New(session.New()) input := &organizations.CreateOrganizationInput{ FeatureSet: aws.String("CONSOLIDATED_BILLING"), } result, err := svc.CreateOrganization(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAlreadyInOrganizationException: fmt.Println(organizations.ErrCodeAlreadyInOrganizationException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) case organizations.ErrCodeAccessDeniedForDependencyException: fmt.Println(organizations.ErrCodeAccessDeniedForDependencyException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateOrganizationRequest

func (c *Organizations) CreateOrganizationRequest(input *CreateOrganizationInput) (req *request.Request, output *CreateOrganizationOutput)

CreateOrganizationRequest generates a "aws/request.Request" representing the client's request for the CreateOrganization operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateOrganization for more information on using the CreateOrganization API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateOrganizationRequest method. req, resp := client.CreateOrganizationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreateOrganization

CreateOrganizationWithContext

func (c *Organizations) CreateOrganizationWithContext(ctx aws.Context, input *CreateOrganizationInput, opts ...request.Option) (*CreateOrganizationOutput, error)

CreateOrganizationWithContext is the same as CreateOrganization with the addition of the ability to pass a context and additional request options.

See CreateOrganization for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateOrganizationalUnit

func (c *Organizations) CreateOrganizationalUnit(input *CreateOrganizationalUnitInput) (*CreateOrganizationalUnitOutput, error)

CreateOrganizationalUnit API operation for AWS Organizations.

Creates an organizational unit (OU) within a root or parent OU. An OU is a container for accounts that enables you to organize your accounts to apply policies according to your business requirements. The number of levels deep that you can nest OUs is dependent upon the policy types enabled for that root. For service control policies, the limit is five.

For more information about OUs, see Managing Organizational Units (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_ous.html) in the AWS Organizations User Guide.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation CreateOrganizationalUnit for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeDuplicateOrganizationalUnitException "DuplicateOrganizationalUnitException" An OU with the same name already exists.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeParentNotFoundException "ParentNotFoundException" We can't find a root or OU with the ParentId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreateOrganizationalUnit

Example

Organizations CreateOrganizationalUnit shared00

To create a new organization unit

The following example shows how to create an OU that is named AccountingOU. The new OU is directly under the root.:

{ svc := organizations.New(session.New()) input := &organizations.CreateOrganizationalUnitInput{ Name: aws.String("AccountingOU"), ParentId: aws.String("r-examplerootid111"), } result, err := svc.CreateOrganizationalUnit(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeDuplicateOrganizationalUnitException: fmt.Println(organizations.ErrCodeDuplicateOrganizationalUnitException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeParentNotFoundException: fmt.Println(organizations.ErrCodeParentNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateOrganizationalUnitRequest

func (c *Organizations) CreateOrganizationalUnitRequest(input *CreateOrganizationalUnitInput) (req *request.Request, output *CreateOrganizationalUnitOutput)

CreateOrganizationalUnitRequest generates a "aws/request.Request" representing the client's request for the CreateOrganizationalUnit operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateOrganizationalUnit for more information on using the CreateOrganizationalUnit API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateOrganizationalUnitRequest method. req, resp := client.CreateOrganizationalUnitRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreateOrganizationalUnit

CreateOrganizationalUnitWithContext

func (c *Organizations) CreateOrganizationalUnitWithContext(ctx aws.Context, input *CreateOrganizationalUnitInput, opts ...request.Option) (*CreateOrganizationalUnitOutput, error)

CreateOrganizationalUnitWithContext is the same as CreateOrganizationalUnit with the addition of the ability to pass a context and additional request options.

See CreateOrganizationalUnit for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreatePolicy

func (c *Organizations) CreatePolicy(input *CreatePolicyInput) (*CreatePolicyOutput, error)

CreatePolicy API operation for AWS Organizations.

Creates a policy of a specified type that you can attach to a root, an organizational unit (OU), or an individual AWS account.

For more information about policies and their use, see Managing Organization Policies (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies.html).

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation CreatePolicy for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeDuplicatePolicyException "DuplicatePolicyException" A policy with the same name already exists.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreatePolicy

Example

Organizations CreatePolicy shared00

To create a service control policy

The following example shows how to create a service control policy (SCP) that is named AllowAllS3Actions. The JSON string in the content parameter specifies the content in the policy. The parameter string is escaped with backslashes to ensure that the embedded double quotes in the JSON policy are treated as literals in the parameter, which itself is surrounded by double quotes:

{ svc := organizations.New(session.New()) input := &organizations.CreatePolicyInput{ Content: aws.String("{\\\"Version\\\":\\\"2012-10-17\\\",\\\"Statement\\\":{\\\"Effect\\\":\\\"Allow\\\",\\\"Action\\\":\\\"s3:*\\\"}}"), Description: aws.String("Enables admins of attached accounts to delegate all S3 permissions"), Name: aws.String("AllowAllS3Actions"), Type: aws.String("SERVICE_CONTROL_POLICY"), } result, err := svc.CreatePolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeDuplicatePolicyException: fmt.Println(organizations.ErrCodeDuplicatePolicyException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeMalformedPolicyDocumentException: fmt.Println(organizations.ErrCodeMalformedPolicyDocumentException, aerr.Error()) case organizations.ErrCodePolicyTypeNotAvailableForOrganizationException: fmt.Println(organizations.ErrCodePolicyTypeNotAvailableForOrganizationException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreatePolicyRequest

func (c *Organizations) CreatePolicyRequest(input *CreatePolicyInput) (req *request.Request, output *CreatePolicyOutput)

CreatePolicyRequest generates a "aws/request.Request" representing the client's request for the CreatePolicy operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreatePolicy for more information on using the CreatePolicy API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreatePolicyRequest method. req, resp := client.CreatePolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/CreatePolicy

CreatePolicyWithContext

func (c *Organizations) CreatePolicyWithContext(ctx aws.Context, input *CreatePolicyInput, opts ...request.Option) (*CreatePolicyOutput, error)

CreatePolicyWithContext is the same as CreatePolicy with the addition of the ability to pass a context and additional request options.

See CreatePolicy for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeclineHandshake

func (c *Organizations) DeclineHandshake(input *DeclineHandshakeInput) (*DeclineHandshakeOutput, error)

DeclineHandshake API operation for AWS Organizations.

Declines a handshake request. This sets the handshake state to DECLINED and effectively deactivates the request.

This operation can be called only from the account that received the handshake. The originator of the handshake can use CancelHandshake instead. The originator can't reactivate a declined request, but can re-initiate the process with a new handshake request.

After you decline a handshake, it continues to appear in the results of relevant APIs for only 30 days. After that it is deleted.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DeclineHandshake for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeHandshakeNotFoundException "HandshakeNotFoundException" We can't find a handshake with the HandshakeId that you specified.

  • ErrCodeInvalidHandshakeTransitionException "InvalidHandshakeTransitionException" You can't perform the operation on the handshake in its current state. For example, you can't cancel a handshake that was already accepted or accept a handshake that was already declined.

  • ErrCodeHandshakeAlreadyInStateException "HandshakeAlreadyInStateException" The specified handshake is already in the requested state. For example, you can't accept a handshake that was already accepted.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeclineHandshake

Example

Organizations DeclineHandshake shared00

To decline a handshake sent from the master account

The following example shows Susan declining an invitation to join Bill's organization. The DeclineHandshake operation returns a handshake object, showing that the state is now DECLINED:

{ svc := organizations.New(session.New()) input := &organizations.DeclineHandshakeInput{ HandshakeId: aws.String("h-examplehandshakeid111"), } result, err := svc.DeclineHandshake(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeHandshakeNotFoundException: fmt.Println(organizations.ErrCodeHandshakeNotFoundException, aerr.Error()) case organizations.ErrCodeInvalidHandshakeTransitionException: fmt.Println(organizations.ErrCodeInvalidHandshakeTransitionException, aerr.Error()) case organizations.ErrCodeHandshakeAlreadyInStateException: fmt.Println(organizations.ErrCodeHandshakeAlreadyInStateException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeclineHandshakeRequest

func (c *Organizations) DeclineHandshakeRequest(input *DeclineHandshakeInput) (req *request.Request, output *DeclineHandshakeOutput)

DeclineHandshakeRequest generates a "aws/request.Request" representing the client's request for the DeclineHandshake operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeclineHandshake for more information on using the DeclineHandshake API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeclineHandshakeRequest method. req, resp := client.DeclineHandshakeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeclineHandshake

DeclineHandshakeWithContext

func (c *Organizations) DeclineHandshakeWithContext(ctx aws.Context, input *DeclineHandshakeInput, opts ...request.Option) (*DeclineHandshakeOutput, error)

DeclineHandshakeWithContext is the same as DeclineHandshake with the addition of the ability to pass a context and additional request options.

See DeclineHandshake for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteOrganization

func (c *Organizations) DeleteOrganization(input *DeleteOrganizationInput) (*DeleteOrganizationOutput, error)

DeleteOrganization API operation for AWS Organizations.

Deletes the organization. You can delete an organization only by using credentials from the master account. The organization must be empty of member accounts.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DeleteOrganization for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeOrganizationNotEmptyException "OrganizationNotEmptyException" The organization isn't empty. To delete an organization, you must first remove all accounts except the master account, delete all OUs, and delete all policies.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeleteOrganization

DeleteOrganizationRequest

func (c *Organizations) DeleteOrganizationRequest(input *DeleteOrganizationInput) (req *request.Request, output *DeleteOrganizationOutput)

DeleteOrganizationRequest generates a "aws/request.Request" representing the client's request for the DeleteOrganization operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteOrganization for more information on using the DeleteOrganization API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteOrganizationRequest method. req, resp := client.DeleteOrganizationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeleteOrganization

DeleteOrganizationWithContext

func (c *Organizations) DeleteOrganizationWithContext(ctx aws.Context, input *DeleteOrganizationInput, opts ...request.Option) (*DeleteOrganizationOutput, error)

DeleteOrganizationWithContext is the same as DeleteOrganization with the addition of the ability to pass a context and additional request options.

See DeleteOrganization for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteOrganizationalUnit

func (c *Organizations) DeleteOrganizationalUnit(input *DeleteOrganizationalUnitInput) (*DeleteOrganizationalUnitOutput, error)

DeleteOrganizationalUnit API operation for AWS Organizations.

Deletes an organizational unit (OU) from a root or another OU. You must first remove all accounts and child OUs from the OU that you want to delete.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DeleteOrganizationalUnit for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeOrganizationalUnitNotEmptyException "OrganizationalUnitNotEmptyException" The specified OU is not empty. Move all accounts to another root or to other OUs, remove all child OUs, and try the operation again.

  • ErrCodeOrganizationalUnitNotFoundException "OrganizationalUnitNotFoundException" We can't find an OU with the OrganizationalUnitId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeleteOrganizationalUnit

Example

Organizations DeleteOrganizationalUnit shared00

To delete an organization unit

The following example shows how to delete an OU. The example assumes that you previously removed all accounts and other OUs from the OU:

{ svc := organizations.New(session.New()) input := &organizations.DeleteOrganizationalUnitInput{ OrganizationalUnitId: aws.String("ou-examplerootid111-exampleouid111"), } result, err := svc.DeleteOrganizationalUnit(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeOrganizationalUnitNotEmptyException: fmt.Println(organizations.ErrCodeOrganizationalUnitNotEmptyException, aerr.Error()) case organizations.ErrCodeOrganizationalUnitNotFoundException: fmt.Println(organizations.ErrCodeOrganizationalUnitNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteOrganizationalUnitRequest

func (c *Organizations) DeleteOrganizationalUnitRequest(input *DeleteOrganizationalUnitInput) (req *request.Request, output *DeleteOrganizationalUnitOutput)

DeleteOrganizationalUnitRequest generates a "aws/request.Request" representing the client's request for the DeleteOrganizationalUnit operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteOrganizationalUnit for more information on using the DeleteOrganizationalUnit API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteOrganizationalUnitRequest method. req, resp := client.DeleteOrganizationalUnitRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeleteOrganizationalUnit

DeleteOrganizationalUnitWithContext

func (c *Organizations) DeleteOrganizationalUnitWithContext(ctx aws.Context, input *DeleteOrganizationalUnitInput, opts ...request.Option) (*DeleteOrganizationalUnitOutput, error)

DeleteOrganizationalUnitWithContext is the same as DeleteOrganizationalUnit with the addition of the ability to pass a context and additional request options.

See DeleteOrganizationalUnit for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeletePolicy

func (c *Organizations) DeletePolicy(input *DeletePolicyInput) (*DeletePolicyOutput, error)

DeletePolicy API operation for AWS Organizations.

Deletes the specified policy from your organization. Before you perform this operation, you must first detach the policy from all organizational units (OUs), roots, and accounts.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DeletePolicy for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodePolicyInUseException "PolicyInUseException" The policy is attached to one or more entities. You must detach it from all roots, OUs, and accounts before performing this operation.

  • ErrCodePolicyNotFoundException "PolicyNotFoundException" We can't find a policy with the PolicyId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeletePolicy

Example

Organizations DeletePolicy shared00

To delete a policy

The following example shows how to delete a policy from an organization. The example assumes that you previously detached the policy from all entities:

{ svc := organizations.New(session.New()) input := &organizations.DeletePolicyInput{ PolicyId: aws.String("p-examplepolicyid111"), } result, err := svc.DeletePolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyInUseException: fmt.Println(organizations.ErrCodePolicyInUseException, aerr.Error()) case organizations.ErrCodePolicyNotFoundException: fmt.Println(organizations.ErrCodePolicyNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeletePolicyRequest

func (c *Organizations) DeletePolicyRequest(input *DeletePolicyInput) (req *request.Request, output *DeletePolicyOutput)

DeletePolicyRequest generates a "aws/request.Request" representing the client's request for the DeletePolicy operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeletePolicy for more information on using the DeletePolicy API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeletePolicyRequest method. req, resp := client.DeletePolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DeletePolicy

DeletePolicyWithContext

func (c *Organizations) DeletePolicyWithContext(ctx aws.Context, input *DeletePolicyInput, opts ...request.Option) (*DeletePolicyOutput, error)

DeletePolicyWithContext is the same as DeletePolicy with the addition of the ability to pass a context and additional request options.

See DeletePolicy for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeAccount

func (c *Organizations) DescribeAccount(input *DescribeAccountInput) (*DescribeAccountOutput, error)

DescribeAccount API operation for AWS Organizations.

Retrieves Organizations-related information about the specified account.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DescribeAccount for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAccountNotFoundException "AccountNotFoundException" We can't find an AWS account with the AccountId that you specified, or the account whose credentials you used to make this request isn't a member of an organization.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeAccount

Example

Organizations DescribeAccount shared00

To get the details about an account

The following example shows a user in the master account (111111111111) asking for details about account 555555555555:

{ svc := organizations.New(session.New()) input := &organizations.DescribeAccountInput{ AccountId: aws.String("555555555555"), } result, err := svc.DescribeAccount(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAccountNotFoundException: fmt.Println(organizations.ErrCodeAccountNotFoundException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeAccountRequest

func (c *Organizations) DescribeAccountRequest(input *DescribeAccountInput) (req *request.Request, output *DescribeAccountOutput)

DescribeAccountRequest generates a "aws/request.Request" representing the client's request for the DescribeAccount operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeAccount for more information on using the DescribeAccount API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeAccountRequest method. req, resp := client.DescribeAccountRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeAccount

DescribeAccountWithContext

func (c *Organizations) DescribeAccountWithContext(ctx aws.Context, input *DescribeAccountInput, opts ...request.Option) (*DescribeAccountOutput, error)

DescribeAccountWithContext is the same as DescribeAccount with the addition of the ability to pass a context and additional request options.

See DescribeAccount for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeCreateAccountStatus

func (c *Organizations) DescribeCreateAccountStatus(input *DescribeCreateAccountStatusInput) (*DescribeCreateAccountStatusOutput, error)

DescribeCreateAccountStatus API operation for AWS Organizations.

Retrieves the current status of an asynchronous request to create an account.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DescribeCreateAccountStatus for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeCreateAccountStatusNotFoundException "CreateAccountStatusNotFoundException" We can't find an create account request with the CreateAccountRequestId that you specified.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeCreateAccountStatus

Example

Organizations DescribeCreateAccountStatus shared00

To get information about a request to create an account

The following example shows how to request the status about a previous request to create an account in an organization. This operation can be called only by a principal from the organization's master account. In the example, the specified "createAccountRequestId" comes from the response of the original call to "CreateAccount":

{ svc := organizations.New(session.New()) input := &organizations.DescribeCreateAccountStatusInput{ CreateAccountRequestId: aws.String("car-exampleaccountcreationrequestid"), } result, err := svc.DescribeCreateAccountStatus(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeCreateAccountStatusNotFoundException: fmt.Println(organizations.ErrCodeCreateAccountStatusNotFoundException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeCreateAccountStatusRequest

func (c *Organizations) DescribeCreateAccountStatusRequest(input *DescribeCreateAccountStatusInput) (req *request.Request, output *DescribeCreateAccountStatusOutput)

DescribeCreateAccountStatusRequest generates a "aws/request.Request" representing the client's request for the DescribeCreateAccountStatus operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeCreateAccountStatus for more information on using the DescribeCreateAccountStatus API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeCreateAccountStatusRequest method. req, resp := client.DescribeCreateAccountStatusRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeCreateAccountStatus

DescribeCreateAccountStatusWithContext

func (c *Organizations) DescribeCreateAccountStatusWithContext(ctx aws.Context, input *DescribeCreateAccountStatusInput, opts ...request.Option) (*DescribeCreateAccountStatusOutput, error)

DescribeCreateAccountStatusWithContext is the same as DescribeCreateAccountStatus with the addition of the ability to pass a context and additional request options.

See DescribeCreateAccountStatus for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeHandshake

func (c *Organizations) DescribeHandshake(input *DescribeHandshakeInput) (*DescribeHandshakeOutput, error)

DescribeHandshake API operation for AWS Organizations.

Retrieves information about a previously requested handshake. The handshake ID comes from the response to the original InviteAccountToOrganization operation that generated the handshake.

You can access handshakes that are ACCEPTED, DECLINED, or CANCELED for only 30 days after they change to that state. They are then deleted and no longer accessible.

This operation can be called from any account in the organization.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DescribeHandshake for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeHandshakeNotFoundException "HandshakeNotFoundException" We can't find a handshake with the HandshakeId that you specified.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeHandshake

Example

Organizations DescribeHandshake shared00

To get information about a handshake

The following example shows you how to request details about a handshake. The handshake ID comes either from the original call to "InviteAccountToOrganization", or from a call to "ListHandshakesForAccount" or "ListHandshakesForOrganization":

{ svc := organizations.New(session.New()) input := &organizations.DescribeHandshakeInput{ HandshakeId: aws.String("h-examplehandshakeid111"), } result, err := svc.DescribeHandshake(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeHandshakeNotFoundException: fmt.Println(organizations.ErrCodeHandshakeNotFoundException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeHandshakeRequest

func (c *Organizations) DescribeHandshakeRequest(input *DescribeHandshakeInput) (req *request.Request, output *DescribeHandshakeOutput)

DescribeHandshakeRequest generates a "aws/request.Request" representing the client's request for the DescribeHandshake operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeHandshake for more information on using the DescribeHandshake API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeHandshakeRequest method. req, resp := client.DescribeHandshakeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeHandshake

DescribeHandshakeWithContext

func (c *Organizations) DescribeHandshakeWithContext(ctx aws.Context, input *DescribeHandshakeInput, opts ...request.Option) (*DescribeHandshakeOutput, error)

DescribeHandshakeWithContext is the same as DescribeHandshake with the addition of the ability to pass a context and additional request options.

See DescribeHandshake for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeOrganization

func (c *Organizations) DescribeOrganization(input *DescribeOrganizationInput) (*DescribeOrganizationOutput, error)

DescribeOrganization API operation for AWS Organizations.

Retrieves information about the organization that the user's account belongs to.

This operation can be called from any account in the organization.

Even if a policy type is shown as available in the organization, it can be disabled separately at the root level with DisablePolicyType. Use ListRoots to see the status of policy types for a specified root.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DescribeOrganization for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeOrganization

Example

Organizations DescribeOrganization shared00

To get information about an organization

The following example shows how to request information about the current user's organization:/n/n

{ svc := organizations.New(session.New()) input := &organizations.DescribeOrganizationInput{} result, err := svc.DescribeOrganization(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeOrganizationRequest

func (c *Organizations) DescribeOrganizationRequest(input *DescribeOrganizationInput) (req *request.Request, output *DescribeOrganizationOutput)

DescribeOrganizationRequest generates a "aws/request.Request" representing the client's request for the DescribeOrganization operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeOrganization for more information on using the DescribeOrganization API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeOrganizationRequest method. req, resp := client.DescribeOrganizationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeOrganization

DescribeOrganizationWithContext

func (c *Organizations) DescribeOrganizationWithContext(ctx aws.Context, input *DescribeOrganizationInput, opts ...request.Option) (*DescribeOrganizationOutput, error)

DescribeOrganizationWithContext is the same as DescribeOrganization with the addition of the ability to pass a context and additional request options.

See DescribeOrganization for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeOrganizationalUnit

func (c *Organizations) DescribeOrganizationalUnit(input *DescribeOrganizationalUnitInput) (*DescribeOrganizationalUnitOutput, error)

DescribeOrganizationalUnit API operation for AWS Organizations.

Retrieves information about an organizational unit (OU).

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DescribeOrganizationalUnit for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeOrganizationalUnitNotFoundException "OrganizationalUnitNotFoundException" We can't find an OU with the OrganizationalUnitId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeOrganizationalUnit

Example

Organizations DescribeOrganizationalUnit shared00

To get information about an organizational unit

The following example shows how to request details about an OU:/n/n

{ svc := organizations.New(session.New()) input := &organizations.DescribeOrganizationalUnitInput{ OrganizationalUnitId: aws.String("ou-examplerootid111-exampleouid111"), } result, err := svc.DescribeOrganizationalUnit(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeOrganizationalUnitNotFoundException: fmt.Println(organizations.ErrCodeOrganizationalUnitNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeOrganizationalUnitRequest

func (c *Organizations) DescribeOrganizationalUnitRequest(input *DescribeOrganizationalUnitInput) (req *request.Request, output *DescribeOrganizationalUnitOutput)

DescribeOrganizationalUnitRequest generates a "aws/request.Request" representing the client's request for the DescribeOrganizationalUnit operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeOrganizationalUnit for more information on using the DescribeOrganizationalUnit API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeOrganizationalUnitRequest method. req, resp := client.DescribeOrganizationalUnitRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribeOrganizationalUnit

DescribeOrganizationalUnitWithContext

func (c *Organizations) DescribeOrganizationalUnitWithContext(ctx aws.Context, input *DescribeOrganizationalUnitInput, opts ...request.Option) (*DescribeOrganizationalUnitOutput, error)

DescribeOrganizationalUnitWithContext is the same as DescribeOrganizationalUnit with the addition of the ability to pass a context and additional request options.

See DescribeOrganizationalUnit for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribePolicy

func (c *Organizations) DescribePolicy(input *DescribePolicyInput) (*DescribePolicyOutput, error)

DescribePolicy API operation for AWS Organizations.

Retrieves information about a policy.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DescribePolicy for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodePolicyNotFoundException "PolicyNotFoundException" We can't find a policy with the PolicyId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribePolicy

Example

Organizations DescribePolicy shared00

To get information about a policy

The following example shows how to request information about a policy:/n/n

{ svc := organizations.New(session.New()) input := &organizations.DescribePolicyInput{ PolicyId: aws.String("p-examplepolicyid111"), } result, err := svc.DescribePolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyNotFoundException: fmt.Println(organizations.ErrCodePolicyNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribePolicyRequest

func (c *Organizations) DescribePolicyRequest(input *DescribePolicyInput) (req *request.Request, output *DescribePolicyOutput)

DescribePolicyRequest generates a "aws/request.Request" representing the client's request for the DescribePolicy operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribePolicy for more information on using the DescribePolicy API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribePolicyRequest method. req, resp := client.DescribePolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DescribePolicy

DescribePolicyWithContext

func (c *Organizations) DescribePolicyWithContext(ctx aws.Context, input *DescribePolicyInput, opts ...request.Option) (*DescribePolicyOutput, error)

DescribePolicyWithContext is the same as DescribePolicy with the addition of the ability to pass a context and additional request options.

See DescribePolicy for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DetachPolicy

func (c *Organizations) DetachPolicy(input *DetachPolicyInput) (*DetachPolicyOutput, error)

DetachPolicy API operation for AWS Organizations.

Detaches a policy from a target root, organizational unit (OU), or account. If the policy being detached is a service control policy (SCP), the changes to permissions for IAM users and roles in affected accounts are immediate.

Note: Every root, OU, and account must have at least one SCP attached. If you want to replace the default FullAWSAccess policy with one that limits the permissions that can be delegated, then you must attach the replacement policy before you can remove the default one. This is the authorization strategy of whitelisting (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_about-scps.html#orgs_policies_whitelist). If you instead attach a second SCP and leave the FullAWSAccess SCP still attached, and specify "Effect": "Deny" in the second SCP to override the "Effect": "Allow" in the FullAWSAccess policy (or any other attached SCP), then you are using the authorization strategy of blacklisting (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_about-scps.html#orgs_policies_blacklist).

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DetachPolicy for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodePolicyNotAttachedException "PolicyNotAttachedException" The policy isn't attached to the specified target in the specified root.

  • ErrCodePolicyNotFoundException "PolicyNotFoundException" We can't find a policy with the PolicyId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTargetNotFoundException "TargetNotFoundException" We can't find a root, OU, or account with the TargetId that you specified.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DetachPolicy

Example

Organizations DetachPolicy shared00

To detach a policy from a root, OU, or account

The following example shows how to detach a policy from an OU:/n/n

{ svc := organizations.New(session.New()) input := &organizations.DetachPolicyInput{ PolicyId: aws.String("p-examplepolicyid111"), TargetId: aws.String("ou-examplerootid111-exampleouid111"), } result, err := svc.DetachPolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyNotAttachedException: fmt.Println(organizations.ErrCodePolicyNotAttachedException, aerr.Error()) case organizations.ErrCodePolicyNotFoundException: fmt.Println(organizations.ErrCodePolicyNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTargetNotFoundException: fmt.Println(organizations.ErrCodeTargetNotFoundException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DetachPolicyRequest

func (c *Organizations) DetachPolicyRequest(input *DetachPolicyInput) (req *request.Request, output *DetachPolicyOutput)

DetachPolicyRequest generates a "aws/request.Request" representing the client's request for the DetachPolicy operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DetachPolicy for more information on using the DetachPolicy API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DetachPolicyRequest method. req, resp := client.DetachPolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DetachPolicy

DetachPolicyWithContext

func (c *Organizations) DetachPolicyWithContext(ctx aws.Context, input *DetachPolicyInput, opts ...request.Option) (*DetachPolicyOutput, error)

DetachPolicyWithContext is the same as DetachPolicy with the addition of the ability to pass a context and additional request options.

See DetachPolicy for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DisableAWSServiceAccess

func (c *Organizations) DisableAWSServiceAccess(input *DisableAWSServiceAccessInput) (*DisableAWSServiceAccessOutput, error)

DisableAWSServiceAccess API operation for AWS Organizations.

Disables the integration of an AWS service (the service that is specified by ServicePrincipal) with AWS Organizations. When you disable integration, the specified service no longer can create a service-linked role (https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html) in new accounts in your organization. This means the service can't perform operations on your behalf on any new accounts in your organization. The service can still perform operations in older accounts until the service completes its clean-up from AWS Organizations.

We recommend that you disable integration between AWS Organizations and the specified AWS service by using the console or commands that are provided by the specified service. Doing so ensures that the other service is aware that it can clean up any resources that are required only for the integration. How the service cleans up its resources in the organization's accounts depends on that service. For more information, see the documentation for the other AWS service.

After you perform the DisableAWSServiceAccessoperation, the specified service can no longer perform operations in your organization's accounts unless the operations are explicitly permitted by the IAM policies that are attached to your roles.

For more information about integrating other services with AWS Organizations, including the list of services that work with Organizations, see Integrating AWS Organizations with Other AWS Services (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html)in the AWS Organizations User Guide

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DisableAWSServiceAccess for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DisableAWSServiceAccess

DisableAWSServiceAccessRequest

func (c *Organizations) DisableAWSServiceAccessRequest(input *DisableAWSServiceAccessInput) (req *request.Request, output *DisableAWSServiceAccessOutput)

DisableAWSServiceAccessRequest generates a "aws/request.Request" representing the client's request for the DisableAWSServiceAccess operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DisableAWSServiceAccess for more information on using the DisableAWSServiceAccess API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DisableAWSServiceAccessRequest method. req, resp := client.DisableAWSServiceAccessRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DisableAWSServiceAccess

DisableAWSServiceAccessWithContext

func (c *Organizations) DisableAWSServiceAccessWithContext(ctx aws.Context, input *DisableAWSServiceAccessInput, opts ...request.Option) (*DisableAWSServiceAccessOutput, error)

DisableAWSServiceAccessWithContext is the same as DisableAWSServiceAccess with the addition of the ability to pass a context and additional request options.

See DisableAWSServiceAccess for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DisablePolicyType

func (c *Organizations) DisablePolicyType(input *DisablePolicyTypeInput) (*DisablePolicyTypeOutput, error)

DisablePolicyType API operation for AWS Organizations.

Disables an organizational control policy type in a root. A policy of a certain type can be attached to entities in a root only if that type is enabled in the root. After you perform this operation, you no longer can attach policies of the specified type to that root or to any organizational unit (OU) or account in that root. You can undo this by using the EnablePolicyType operation.

This operation can be called only from the organization's master account.

If you disable a policy type for a root, it still shows as enabled for the organization if all features are enabled in that organization. Use ListRoots to see the status of policy types for a specified root. Use DescribeOrganization to see the status of policy types in the organization.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation DisablePolicyType for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeRootNotFoundException "RootNotFoundException" We can't find a root with the RootId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DisablePolicyType

Example

Organizations DisablePolicyType shared00

To disable a policy type in a root

The following example shows how to disable the service control policy (SCP) policy type in a root. The response shows that the PolicyTypes response element no longer includes SERVICE_CONTROL_POLICY:/n/n

{ svc := organizations.New(session.New()) input := &organizations.DisablePolicyTypeInput{ PolicyType: aws.String("SERVICE_CONTROL_POLICY"), RootId: aws.String("r-examplerootid111"), } result, err := svc.DisablePolicyType(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyTypeNotEnabledException: fmt.Println(organizations.ErrCodePolicyTypeNotEnabledException, aerr.Error()) case organizations.ErrCodeRootNotFoundException: fmt.Println(organizations.ErrCodeRootNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DisablePolicyTypeRequest

func (c *Organizations) DisablePolicyTypeRequest(input *DisablePolicyTypeInput) (req *request.Request, output *DisablePolicyTypeOutput)

DisablePolicyTypeRequest generates a "aws/request.Request" representing the client's request for the DisablePolicyType operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DisablePolicyType for more information on using the DisablePolicyType API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DisablePolicyTypeRequest method. req, resp := client.DisablePolicyTypeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/DisablePolicyType

DisablePolicyTypeWithContext

func (c *Organizations) DisablePolicyTypeWithContext(ctx aws.Context, input *DisablePolicyTypeInput, opts ...request.Option) (*DisablePolicyTypeOutput, error)

DisablePolicyTypeWithContext is the same as DisablePolicyType with the addition of the ability to pass a context and additional request options.

See DisablePolicyType for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

EnableAWSServiceAccess

func (c *Organizations) EnableAWSServiceAccess(input *EnableAWSServiceAccessInput) (*EnableAWSServiceAccessOutput, error)

EnableAWSServiceAccess API operation for AWS Organizations.

Enables the integration of an AWS service (the service that is specified by ServicePrincipal) with AWS Organizations. When you enable integration, you allow the specified service to create a service-linked role (https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html) in all the accounts in your organization. This allows the service to perform operations on your behalf in your organization and its accounts.

We recommend that you enable integration between AWS Organizations and the specified AWS service by using the console or commands that are provided by the specified service. Doing so ensures that the service is aware that it can create the resources that are required for the integration. How the service creates those resources in the organization's accounts depends on that service. For more information, see the documentation for the other AWS service.

For more information about enabling services to integrate with AWS Organizations, see Integrating AWS Organizations with Other AWS Services (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html) in the AWS Organizations User Guide.

This operation can be called only from the organization's master account and only if the organization has enabled all features (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html).

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation EnableAWSServiceAccess for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/EnableAWSServiceAccess

EnableAWSServiceAccessRequest

func (c *Organizations) EnableAWSServiceAccessRequest(input *EnableAWSServiceAccessInput) (req *request.Request, output *EnableAWSServiceAccessOutput)

EnableAWSServiceAccessRequest generates a "aws/request.Request" representing the client's request for the EnableAWSServiceAccess operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See EnableAWSServiceAccess for more information on using the EnableAWSServiceAccess API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the EnableAWSServiceAccessRequest method. req, resp := client.EnableAWSServiceAccessRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/EnableAWSServiceAccess

EnableAWSServiceAccessWithContext

func (c *Organizations) EnableAWSServiceAccessWithContext(ctx aws.Context, input *EnableAWSServiceAccessInput, opts ...request.Option) (*EnableAWSServiceAccessOutput, error)

EnableAWSServiceAccessWithContext is the same as EnableAWSServiceAccess with the addition of the ability to pass a context and additional request options.

See EnableAWSServiceAccess for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

EnableAllFeatures

func (c *Organizations) EnableAllFeatures(input *EnableAllFeaturesInput) (*EnableAllFeaturesOutput, error)

EnableAllFeatures API operation for AWS Organizations.

Enables all features in an organization. This enables the use of organization policies that can restrict the services and actions that can be called in each account. Until you enable all features, you have access only to consolidated billing, and you can't use any of the advanced account administration features that AWS Organizations supports. For more information, see Enabling All Features in Your Organization (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html) in the AWS Organizations User Guide.

This operation is required only for organizations that were created explicitly with only the consolidated billing features enabled. Calling this operation sends a handshake to every invited account in the organization. The feature set change can be finalized and the additional features enabled only after all administrators in the invited accounts approve the change by accepting the handshake.

After you enable all features, you can separately enable or disable individual policy types in a root using EnablePolicyType and DisablePolicyType. To see the status of policy types in a root, use ListRoots.

After all invited member accounts accept the handshake, you finalize the feature set change by accepting the handshake that contains "Action": "ENABLE_ALL_FEATURES". This completes the change.

After you enable all features in your organization, the master account in the organization can apply policies on all member accounts. These policies can restrict what users and even administrators in those accounts can do. The master account can apply policies that prevent accounts from leaving the organization. Ensure that your account administrators are aware of this.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation EnableAllFeatures for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeHandshakeConstraintViolationException "HandshakeConstraintViolationException" The requested operation would violate the constraint identified in the reason code.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. Note that deleted and closed accounts still count toward your limit.

If you get this exception immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • ALREADY_IN_AN_ORGANIZATION: The handshake request is invalid because the invited account is already a member of an organization.

  • ORGANIZATION_ALREADY_HAS_ALL_FEATURES: The handshake request is invalid because the organization has already enabled all features.

  • INVITE_DISABLED_DURING_ENABLE_ALL_FEATURES: You can't issue new invitations to join an organization while it's in the process of enabling all features. You can resume inviting accounts after you finalize the process when all accounts have agreed to the change.

  • PAYMENT_INSTRUMENT_REQUIRED: You can't complete the operation with an account that doesn't have a payment instrument, such as a credit card, associated with it.

  • ORGANIZATION_FROM_DIFFERENT_SELLER_OF_RECORD: The request failed because the account is from a different marketplace than the accounts in the organization. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be from the same marketplace.

  • ORGANIZATION_MEMBERSHIP_CHANGE_RATE_LIMIT_EXCEEDED: You attempted to change the membership of an account too quickly after its previous change.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/EnableAllFeatures

Example

Organizations EnableAllFeatures shared00

To enable all features in an organization

This example shows the administrator asking all the invited accounts in the organization to approve enabling all features in the organization. AWS Organizations sends an email to the address that is registered with every invited member account asking the owner to approve the change by accepting the handshake that is sent. After all invited member accounts accept the handshake, the organization administrator can finalize the change to enable all features, and those with appropriate permissions can create policies and apply them to roots, OUs, and accounts:/n/n

{ svc := organizations.New(session.New()) input := &organizations.EnableAllFeaturesInput{} result, err := svc.EnableAllFeatures(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeHandshakeConstraintViolationException: fmt.Println(organizations.ErrCodeHandshakeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

EnableAllFeaturesRequest

func (c *Organizations) EnableAllFeaturesRequest(input *EnableAllFeaturesInput) (req *request.Request, output *EnableAllFeaturesOutput)

EnableAllFeaturesRequest generates a "aws/request.Request" representing the client's request for the EnableAllFeatures operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See EnableAllFeatures for more information on using the EnableAllFeatures API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the EnableAllFeaturesRequest method. req, resp := client.EnableAllFeaturesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/EnableAllFeatures

EnableAllFeaturesWithContext

func (c *Organizations) EnableAllFeaturesWithContext(ctx aws.Context, input *EnableAllFeaturesInput, opts ...request.Option) (*EnableAllFeaturesOutput, error)

EnableAllFeaturesWithContext is the same as EnableAllFeatures with the addition of the ability to pass a context and additional request options.

See EnableAllFeatures for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

EnablePolicyType

func (c *Organizations) EnablePolicyType(input *EnablePolicyTypeInput) (*EnablePolicyTypeOutput, error)

EnablePolicyType API operation for AWS Organizations.

Enables a policy type in a root. After you enable a policy type in a root, you can attach policies of that type to the root, any organizational unit (OU), or account in that root. You can undo this by using the DisablePolicyType operation.

This operation can be called only from the organization's master account.

You can enable a policy type in a root only if that policy type is available in the organization. Use DescribeOrganization to view the status of available policy types in the organization.

To view the status of policy type in a root, use ListRoots.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation EnablePolicyType for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodePolicyTypeAlreadyEnabledException "PolicyTypeAlreadyEnabledException" The specified policy type is already enabled in the specified root.

  • ErrCodeRootNotFoundException "RootNotFoundException" We can't find a root with the RootId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/EnablePolicyType

Example

Organizations EnablePolicyType shared00

To enable a policy type in a root

The following example shows how to enable the service control policy (SCP) policy type in a root. The output shows a root object with a PolicyTypes response element showing that SCPs are now enabled:/n/n

{ svc := organizations.New(session.New()) input := &organizations.EnablePolicyTypeInput{ PolicyType: aws.String("SERVICE_CONTROL_POLICY"), RootId: aws.String("r-examplerootid111"), } result, err := svc.EnablePolicyType(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodePolicyTypeAlreadyEnabledException: fmt.Println(organizations.ErrCodePolicyTypeAlreadyEnabledException, aerr.Error()) case organizations.ErrCodeRootNotFoundException: fmt.Println(organizations.ErrCodeRootNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) case organizations.ErrCodePolicyTypeNotAvailableForOrganizationException: fmt.Println(organizations.ErrCodePolicyTypeNotAvailableForOrganizationException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

EnablePolicyTypeRequest

func (c *Organizations) EnablePolicyTypeRequest(input *EnablePolicyTypeInput) (req *request.Request, output *EnablePolicyTypeOutput)

EnablePolicyTypeRequest generates a "aws/request.Request" representing the client's request for the EnablePolicyType operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See EnablePolicyType for more information on using the EnablePolicyType API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the EnablePolicyTypeRequest method. req, resp := client.EnablePolicyTypeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/EnablePolicyType

EnablePolicyTypeWithContext

func (c *Organizations) EnablePolicyTypeWithContext(ctx aws.Context, input *EnablePolicyTypeInput, opts ...request.Option) (*EnablePolicyTypeOutput, error)

EnablePolicyTypeWithContext is the same as EnablePolicyType with the addition of the ability to pass a context and additional request options.

See EnablePolicyType for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

InviteAccountToOrganization

func (c *Organizations) InviteAccountToOrganization(input *InviteAccountToOrganizationInput) (*InviteAccountToOrganizationOutput, error)

InviteAccountToOrganization API operation for AWS Organizations.

Sends an invitation to another account to join your organization as a member account. Organizations sends email on your behalf to the email address that is associated with the other account's owner. The invitation is implemented as a Handshake whose details are in the response.

You can invite AWS accounts only from the same seller as the master account. For example, if your organization's master account was created by Amazon Internet Services Pvt. Ltd (AISPL), an AWS seller in India, then you can only invite other AISPL accounts to your organization. You can't combine accounts from AISPL and AWS, or any other AWS seller. For more information, see Consolidated Billing in India (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/useconsolidatedbilliing-India.html).

If you receive an exception that indicates that you exceeded your account limits for the organization or that the operation failed because your organization is still initializing, wait one hour and then try again. If the error persists after an hour, then contact AWS Customer Support (https://console.aws.amazon.com/support/home#/).

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation InviteAccountToOrganization for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeHandshakeConstraintViolationException "HandshakeConstraintViolationException" The requested operation would violate the constraint identified in the reason code.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. Note that deleted and closed accounts still count toward your limit.

If you get this exception immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • ALREADY_IN_AN_ORGANIZATION: The handshake request is invalid because the invited account is already a member of an organization.

  • ORGANIZATION_ALREADY_HAS_ALL_FEATURES: The handshake request is invalid because the organization has already enabled all features.

  • INVITE_DISABLED_DURING_ENABLE_ALL_FEATURES: You can't issue new invitations to join an organization while it's in the process of enabling all features. You can resume inviting accounts after you finalize the process when all accounts have agreed to the change.

  • PAYMENT_INSTRUMENT_REQUIRED: You can't complete the operation with an account that doesn't have a payment instrument, such as a credit card, associated with it.

  • ORGANIZATION_FROM_DIFFERENT_SELLER_OF_RECORD: The request failed because the account is from a different marketplace than the accounts in the organization. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be from the same marketplace.

  • ORGANIZATION_MEMBERSHIP_CHANGE_RATE_LIMIT_EXCEEDED: You attempted to change the membership of an account too quickly after its previous change.

  • ErrCodeDuplicateHandshakeException "DuplicateHandshakeException" A handshake with the same action and target already exists. For example, if you invited an account to join your organization, the invited account might already have a pending invitation from this organization. If you intend to resend an invitation to an account, ensure that existing handshakes that might be considered duplicates are canceled or declined.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeFinalizingOrganizationException "FinalizingOrganizationException" AWS Organizations couldn't perform the operation because your organization hasn't finished initializing. This can take up to an hour. Try again later. If after one hour you continue to receive this error, contact AWS Support

(https://console.aws.amazon.com/support/home#/).
  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/InviteAccountToOrganization

Example

Organizations InviteAccountToOrganization shared00

To invite an account to join an organization

The following example shows the admin of the master account owned by bill@example.com inviting the account owned by juan@example.com to join an organization.

{ svc := organizations.New(session.New()) input := &organizations.InviteAccountToOrganizationInput{ Notes: aws.String("This is a request for Juan's account to join Bill's organization"), Target: &organizations.HandshakeParty{ Id: aws.String("juan@example.com"), Type: aws.String("EMAIL"), }, } result, err := svc.InviteAccountToOrganization(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeAccountOwnerNotVerifiedException: fmt.Println(organizations.ErrCodeAccountOwnerNotVerifiedException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeHandshakeConstraintViolationException: fmt.Println(organizations.ErrCodeHandshakeConstraintViolationException, aerr.Error()) case organizations.ErrCodeDuplicateHandshakeException: fmt.Println(organizations.ErrCodeDuplicateHandshakeException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeFinalizingOrganizationException: fmt.Println(organizations.ErrCodeFinalizingOrganizationException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

InviteAccountToOrganizationRequest

func (c *Organizations) InviteAccountToOrganizationRequest(input *InviteAccountToOrganizationInput) (req *request.Request, output *InviteAccountToOrganizationOutput)

InviteAccountToOrganizationRequest generates a "aws/request.Request" representing the client's request for the InviteAccountToOrganization operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See InviteAccountToOrganization for more information on using the InviteAccountToOrganization API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the InviteAccountToOrganizationRequest method. req, resp := client.InviteAccountToOrganizationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/InviteAccountToOrganization

InviteAccountToOrganizationWithContext

func (c *Organizations) InviteAccountToOrganizationWithContext(ctx aws.Context, input *InviteAccountToOrganizationInput, opts ...request.Option) (*InviteAccountToOrganizationOutput, error)

InviteAccountToOrganizationWithContext is the same as InviteAccountToOrganization with the addition of the ability to pass a context and additional request options.

See InviteAccountToOrganization for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

LeaveOrganization

func (c *Organizations) LeaveOrganization(input *LeaveOrganizationInput) (*LeaveOrganizationOutput, error)

LeaveOrganization API operation for AWS Organizations.

Removes a member account from its parent organization. This version of the operation is performed by the account that wants to leave. To remove a member account as a user in the master account, use RemoveAccountFromOrganization instead.

This operation can be called only from a member account in the organization.

The master account in an organization with all features enabled can set service control policies (SCPs) that can restrict what administrators of member accounts can do, including preventing them from successfully calling LeaveOrganization and leaving the organization.

You can leave an organization as a member account only if the account is configured with the information required to operate as a standalone account. When you create an account in an organization using the AWS Organizations console, API, or CLI commands, the information required of standalone accounts is not automatically collected. For each account that you want to make standalone, you must accept the End User License Agreement (EULA), choose a support plan, provide and verify the required contact information, and provide a current payment method. AWS uses the payment method to charge for any billable (not free tier) AWS activity that occurs while the account is not attached to an organization. Follow the steps at To leave an organization when all required account information has not yet been provided (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_accounts_remove.html#leave-without-all-info) in the AWS Organizations User Guide.

You can leave an organization only after you enable IAM user access to billing in your account. For more information, see Activating Access to the Billing and Cost Management Console (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/grantaccess.html#ControllingAccessWebsite-Activate) in the AWS Billing and Cost Management User Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation LeaveOrganization for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAccountNotFoundException "AccountNotFoundException" We can't find an AWS account with the AccountId that you specified, or the account whose credentials you used to make this request isn't a member of an organization.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConcurrentModificationException "ConcurrentModificationException" The target of the operation is currently being modified by a different request. Try again later.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeMasterCannotLeaveOrganizationException "MasterCannotLeaveOrganizationException" You can't remove a master account from an organization. If you want the master account to become a member account in another organization, you must first delete the current organization of the master account.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/LeaveOrganization

Example

Organizations LeaveOrganization shared00

To leave an organization as a member account

TThe following example shows how to remove your member account from an organization:

{ svc := organizations.New(session.New()) input := &organizations.LeaveOrganizationInput{} result, err := svc.LeaveOrganization(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAccountNotFoundException: fmt.Println(organizations.ErrCodeAccountNotFoundException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeConcurrentModificationException: fmt.Println(organizations.ErrCodeConcurrentModificationException, aerr.Error()) case organizations.ErrCodeConstraintViolationException: fmt.Println(organizations.ErrCodeConstraintViolationException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeMasterCannotLeaveOrganizationException: fmt.Println(organizations.ErrCodeMasterCannotLeaveOrganizationException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

LeaveOrganizationRequest

func (c *Organizations) LeaveOrganizationRequest(input *LeaveOrganizationInput) (req *request.Request, output *LeaveOrganizationOutput)

LeaveOrganizationRequest generates a "aws/request.Request" representing the client's request for the LeaveOrganization operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See LeaveOrganization for more information on using the LeaveOrganization API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the LeaveOrganizationRequest method. req, resp := client.LeaveOrganizationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/LeaveOrganization

LeaveOrganizationWithContext

func (c *Organizations) LeaveOrganizationWithContext(ctx aws.Context, input *LeaveOrganizationInput, opts ...request.Option) (*LeaveOrganizationOutput, error)

LeaveOrganizationWithContext is the same as LeaveOrganization with the addition of the ability to pass a context and additional request options.

See LeaveOrganization for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListAWSServiceAccessForOrganization

func (c *Organizations) ListAWSServiceAccessForOrganization(input *ListAWSServiceAccessForOrganizationInput) (*ListAWSServiceAccessForOrganizationOutput, error)

ListAWSServiceAccessForOrganization API operation for AWS Organizations.

Returns a list of the AWS services that you enabled to integrate with your organization. After a service on this list creates the resources that it requires for the integration, it can perform operations on your organization and its accounts.

For more information about integrating other services with AWS Organizations, including the list of services that currently work with Organizations, see Integrating AWS Organizations with Other AWS Services (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services.html) in the AWS Organizations User Guide.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation ListAWSServiceAccessForOrganization for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeConstraintViolationException "ConstraintViolationException" Performing this operation violates a minimum or maximum value limit. For example, attempting to removing the last service control policy (SCP) from an OU or root, inviting or creating too many accounts to the organization, or attaching too many policies to an account, OU, or root. This exception includes a reason that contains additional information about the violated limit.

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • ACCOUNT_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the limit on the number of accounts in an organization. If you need more accounts, contactAWS Support (https://console.aws.amazon.com/support/home#/) to request an increase in your limit.

Or the number of invitations that you tried to send would cause you to exceed the limit of accounts in your organization. Send fewer invitations or contact AWS Support to request an increase in the number of accounts. Deleted and closed accounts still count toward your limit. If you get receive this exception when running a command immediately after creating the organization, wait one hour and try again. If after an hour it continues to fail with this error, contact AWS Support (https://console.aws.amazon.com/support/home#/).
  • HANDSHAKE_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of handshakes that you can send in one day.

  • OU_NUMBER_LIMIT_EXCEEDED: You attempted to exceed the number of OUs that you can have in an organization.

  • OU_DEPTH_LIMIT_EXCEEDED: You attempted to create an OU tree that is too many levels deep.

  • ORGANIZATION_NOT_IN_ALL_FEATURES_MODE: You attempted to perform an operation that requires the organization to be configured to support all features. An organization that supports only consolidated billing features can't perform this operation.

  • POLICY_NUMBER_LIMIT_EXCEEDED. You attempted to exceed the number of policies that you can have in an organization.

  • MAX_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to exceed the number of policies of a certain type that can be attached to an entity at one time.

  • MIN_POLICY_TYPE_ATTACHMENT_LIMIT_EXCEEDED: You attempted to detach a policy from an entity that would cause the entity to have fewer than the minimum number of policies of a certain type required.

  • ACCOUNT_CREATION_RATE_LIMIT_EXCEEDED: You attempted to exceed the number of accounts that you can create in one day.

  • MASTER_ACCOUNT_ADDRESS_DOES_NOT_MATCH_MARKETPLACE: To create an account in this organization, you first must migrate the organization's master account to the marketplace that corresponds to the master account's address. For example, accounts with India addresses must be associated with the AISPL marketplace. All accounts in an organization must be associated with the same marketplace.

  • MASTER_ACCOUNT_MISSING_CONTACT_INFO: To complete this operation, you must first provide contact a valid address and phone number for the master account. Then try the operation again.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListAWSServiceAccessForOrganization

ListAWSServiceAccessForOrganizationPages

func (c *Organizations) ListAWSServiceAccessForOrganizationPages(input *ListAWSServiceAccessForOrganizationInput, fn func(*ListAWSServiceAccessForOrganizationOutput, bool) bool) error

ListAWSServiceAccessForOrganizationPages iterates over the pages of a ListAWSServiceAccessForOrganization operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListAWSServiceAccessForOrganization method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListAWSServiceAccessForOrganization operation. pageNum := 0 err := client.ListAWSServiceAccessForOrganizationPages(params, func(page *ListAWSServiceAccessForOrganizationOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

ListAWSServiceAccessForOrganizationPagesWithContext

func (c *Organizations) ListAWSServiceAccessForOrganizationPagesWithContext(ctx aws.Context, input *ListAWSServiceAccessForOrganizationInput, fn func(*ListAWSServiceAccessForOrganizationOutput, bool) bool, opts ...request.Option) error

ListAWSServiceAccessForOrganizationPagesWithContext same as ListAWSServiceAccessForOrganizationPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListAWSServiceAccessForOrganizationRequest

func (c *Organizations) ListAWSServiceAccessForOrganizationRequest(input *ListAWSServiceAccessForOrganizationInput) (req *request.Request, output *ListAWSServiceAccessForOrganizationOutput)

ListAWSServiceAccessForOrganizationRequest generates a "aws/request.Request" representing the client's request for the ListAWSServiceAccessForOrganization operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListAWSServiceAccessForOrganization for more information on using the ListAWSServiceAccessForOrganization API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ListAWSServiceAccessForOrganizationRequest method. req, resp := client.ListAWSServiceAccessForOrganizationRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListAWSServiceAccessForOrganization

ListAWSServiceAccessForOrganizationWithContext

func (c *Organizations) ListAWSServiceAccessForOrganizationWithContext(ctx aws.Context, input *ListAWSServiceAccessForOrganizationInput, opts ...request.Option) (*ListAWSServiceAccessForOrganizationOutput, error)

ListAWSServiceAccessForOrganizationWithContext is the same as ListAWSServiceAccessForOrganization with the addition of the ability to pass a context and additional request options.

See ListAWSServiceAccessForOrganization for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListAccounts

func (c *Organizations) ListAccounts(input *ListAccountsInput) (*ListAccountsOutput, error)

ListAccounts API operation for AWS Organizations.

Lists all the accounts in the organization. To request only the accounts in a specified root or organizational unit (OU), use the ListAccountsForParent operation instead.

Always check the NextToken response parameter for a null value when calling a List* operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is nullonly when there are no more results to display.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation ListAccounts for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListAccounts

Example

Organizations ListAccounts shared00

To retrieve a list of all of the accounts in an organization

The following example shows you how to request a list of the accounts in an organization:

{ svc := organizations.New(session.New()) input := &organizations.ListAccountsInput{} result, err := svc.ListAccounts(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ListAccountsForParent

func (c *Organizations) ListAccountsForParent(input *ListAccountsForParentInput) (*ListAccountsForParentOutput, error)

ListAccountsForParent API operation for AWS Organizations.

Lists the accounts in an organization that are contained by the specified target root or organizational unit (OU). If you specify the root, you get a list of all the accounts that are not in any OU. If you specify an OU, you get a list of all the accounts in only that OU, and not in any child OUs. To get a list of all accounts in the organization, use the ListAccounts operation.

Always check the NextToken response parameter for a null value when calling a List* operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is nullonly when there are no more results to display.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation ListAccountsForParent for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeParentNotFoundException "ParentNotFoundException" We can't find a root or OU with the ParentId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListAccountsForParent

Example

Organizations ListAccountsForParent shared00

To retrieve a list of all of the accounts in a root or OU

The following example shows how to request a list of the accounts in an OU:/n/n

{ svc := organizations.New(session.New()) input := &organizations.ListAccountsForParentInput{ ParentId: aws.String("ou-examplerootid111-exampleouid111"), } result, err := svc.ListAccountsForParent(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeParentNotFoundException: fmt.Println(organizations.ErrCodeParentNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ListAccountsForParentPages

func (c *Organizations) ListAccountsForParentPages(input *ListAccountsForParentInput, fn func(*ListAccountsForParentOutput, bool) bool) error

ListAccountsForParentPages iterates over the pages of a ListAccountsForParent operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListAccountsForParent method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListAccountsForParent operation. pageNum := 0 err := client.ListAccountsForParentPages(params, func(page *ListAccountsForParentOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

ListAccountsForParentPagesWithContext

func (c *Organizations) ListAccountsForParentPagesWithContext(ctx aws.Context, input *ListAccountsForParentInput, fn func(*ListAccountsForParentOutput, bool) bool, opts ...request.Option) error

ListAccountsForParentPagesWithContext same as ListAccountsForParentPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListAccountsForParentRequest

func (c *Organizations) ListAccountsForParentRequest(input *ListAccountsForParentInput) (req *request.Request, output *ListAccountsForParentOutput)

ListAccountsForParentRequest generates a "aws/request.Request" representing the client's request for the ListAccountsForParent operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListAccountsForParent for more information on using the ListAccountsForParent API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ListAccountsForParentRequest method. req, resp := client.ListAccountsForParentRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListAccountsForParent

ListAccountsForParentWithContext

func (c *Organizations) ListAccountsForParentWithContext(ctx aws.Context, input *ListAccountsForParentInput, opts ...request.Option) (*ListAccountsForParentOutput, error)

ListAccountsForParentWithContext is the same as ListAccountsForParent with the addition of the ability to pass a context and additional request options.

See ListAccountsForParent for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListAccountsPages

func (c *Organizations) ListAccountsPages(input *ListAccountsInput, fn func(*ListAccountsOutput, bool) bool) error

ListAccountsPages iterates over the pages of a ListAccounts operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListAccounts method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListAccounts operation. pageNum := 0 err := client.ListAccountsPages(params, func(page *ListAccountsOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

ListAccountsPagesWithContext

func (c *Organizations) ListAccountsPagesWithContext(ctx aws.Context, input *ListAccountsInput, fn func(*ListAccountsOutput, bool) bool, opts ...request.Option) error

ListAccountsPagesWithContext same as ListAccountsPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListAccountsRequest

func (c *Organizations) ListAccountsRequest(input *ListAccountsInput) (req *request.Request, output *ListAccountsOutput)

ListAccountsRequest generates a "aws/request.Request" representing the client's request for the ListAccounts operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListAccounts for more information on using the ListAccounts API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ListAccountsRequest method. req, resp := client.ListAccountsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListAccounts

ListAccountsWithContext

func (c *Organizations) ListAccountsWithContext(ctx aws.Context, input *ListAccountsInput, opts ...request.Option) (*ListAccountsOutput, error)

ListAccountsWithContext is the same as ListAccounts with the addition of the ability to pass a context and additional request options.

See ListAccounts for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListChildren

func (c *Organizations) ListChildren(input *ListChildrenInput) (*ListChildrenOutput, error)

ListChildren API operation for AWS Organizations.

Lists all of the organizational units (OUs) or accounts that are contained in the specified parent OU or root. This operation, along with ListParents enables you to traverse the tree structure that makes up this root.

Always check the NextToken response parameter for a null value when calling a List* operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is nullonly when there are no more results to display.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation ListChildren for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeParentNotFoundException "ParentNotFoundException" We can't find a root or OU with the ParentId that you specified.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListChildren

Example

Organizations ListChildren shared00

To retrieve a list of all of the child accounts and OUs in a parent root or OU

The following example shows how to request a list of the child OUs in a parent root or OU:/n/n

{ svc := organizations.New(session.New()) input := &organizations.ListChildrenInput{ ChildType: aws.String("ORGANIZATIONAL_UNIT"), ParentId: aws.String("ou-examplerootid111-exampleouid111"), } result, err := svc.ListChildren(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeParentNotFoundException: fmt.Println(organizations.ErrCodeParentNotFoundException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ListChildrenPages

func (c *Organizations) ListChildrenPages(input *ListChildrenInput, fn func(*ListChildrenOutput, bool) bool) error

ListChildrenPages iterates over the pages of a ListChildren operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListChildren method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListChildren operation. pageNum := 0 err := client.ListChildrenPages(params, func(page *ListChildrenOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

ListChildrenPagesWithContext

func (c *Organizations) ListChildrenPagesWithContext(ctx aws.Context, input *ListChildrenInput, fn func(*ListChildrenOutput, bool) bool, opts ...request.Option) error

ListChildrenPagesWithContext same as ListChildrenPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListChildrenRequest

func (c *Organizations) ListChildrenRequest(input *ListChildrenInput) (req *request.Request, output *ListChildrenOutput)

ListChildrenRequest generates a "aws/request.Request" representing the client's request for the ListChildren operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListChildren for more information on using the ListChildren API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ListChildrenRequest method. req, resp := client.ListChildrenRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListChildren

ListChildrenWithContext

func (c *Organizations) ListChildrenWithContext(ctx aws.Context, input *ListChildrenInput, opts ...request.Option) (*ListChildrenOutput, error)

ListChildrenWithContext is the same as ListChildren with the addition of the ability to pass a context and additional request options.

See ListChildren for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListCreateAccountStatus

func (c *Organizations) ListCreateAccountStatus(input *ListCreateAccountStatusInput) (*ListCreateAccountStatusOutput, error)

ListCreateAccountStatus API operation for AWS Organizations.

Lists the account creation requests that match the specified status that is currently being tracked for the organization.

Always check the NextToken response parameter for a null value when calling a List* operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is nullonly when there are no more results to display.

This operation can be called only from the organization's master account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Organizations's API operation ListCreateAccountStatus for usage and error information.

Returned Error Codes:

  • ErrCodeAccessDeniedException "AccessDeniedException" You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions. For more information, see Access Management (https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html) in the IAM User Guide.

  • ErrCodeAWSOrganizationsNotInUseException "AWSOrganizationsNotInUseException" Your account isn't a member of an organization. To make this request, you must use the credentials of an account that belongs to an organization.

  • ErrCodeInvalidInputException "InvalidInputException" The requested operation failed because you provided invalid values for one or more of the request parameters. This exception includes a reason that contains additional information about the violated limit:

Some of the reasons in the following list might not be applicable to this specific API or operation:
  • IMMUTABLE_POLICY: You specified a policy that is managed by AWS and can't be modified.

  • INPUT_REQUIRED: You must include a value for all required parameters.

  • INVALID_ENUM: You specified a value that isn't valid for that parameter.

  • INVALID_FULL_NAME_TARGET: You specified a full name that contains invalid characters.

  • INVALID_LIST_MEMBER: You provided a list to a parameter that contains at least one invalid value.

  • INVALID_PARTY_TYPE_TARGET: You specified the wrong type of entity (account, organization, or email) as a party.

  • INVALID_PAGINATION_TOKEN: Get the value for the NextToken parameter from the response to a previous call of the operation.

  • INVALID_PATTERN: You provided a value that doesn't match the required pattern.

  • INVALID_PATTERN_TARGET_ID: You specified a policy target ID that doesn't match the required pattern.

  • INVALID_ROLE_NAME: You provided a role name that isn't valid. A role name can't begin with the reserved prefix AWSServiceRoleFor.

  • INVALID_SYNTAX_ORGANIZATION_ARN: You specified an invalid Amazon Resource Name (ARN) for the organization.

  • INVALID_SYNTAX_POLICY_ID: You specified an invalid policy ID.

  • MAX_FILTER_LIMIT_EXCEEDED: You can specify only one filter parameter for the operation.

  • MAX_LENGTH_EXCEEDED: You provided a string parameter that is longer than allowed.

  • MAX_VALUE_EXCEEDED: You provided a numeric parameter that has a larger value than allowed.

  • MIN_LENGTH_EXCEEDED: You provided a string parameter that is shorter than allowed.

  • MIN_VALUE_EXCEEDED: You provided a numeric parameter that has a smaller value than allowed.

  • MOVING_ACCOUNT_BETWEEN_DIFFERENT_ROOTS: You can move an account only between entities in the same root.

  • ErrCodeServiceException "ServiceException" AWS Organizations can't complete your request because of an internal service error. Try again later.

  • ErrCodeTooManyRequestsException "TooManyRequestsException" You've sent too many requests in too short a period of time. The limit helps protect against denial-of-service attacks. Try again later.

For information on limits that affect Organizations, see Limits of AWS Organizations (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_reference_limits.html) in the AWS Organizations User Guide.

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListCreateAccountStatus

Examples

Organizations ListCreateAccountStatus shared00

To get a list of completed account creation requests made in the organization

The following example shows a user requesting a list of only the completed account creation requests made for the current organization:

{ svc := organizations.New(session.New()) input := &organizations.ListCreateAccountStatusInput{ States: []*string{ aws.String("SUCCEEDED"), }, } result, err := svc.ListCreateAccountStatus(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
Organizations ListCreateAccountStatus shared01

To get a list of all account creation requests made in the organization

The following example shows a user requesting a list of only the in-progress account creation requests made for the current organization:

{ svc := organizations.New(session.New()) input := &organizations.ListCreateAccountStatusInput{ States: []*string{ aws.String("IN_PROGRESS"), }, } result, err := svc.ListCreateAccountStatus(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case organizations.ErrCodeAccessDeniedException: fmt.Println(organizations.ErrCodeAccessDeniedException, aerr.Error()) case organizations.ErrCodeAWSOrganizationsNotInUseException: fmt.Println(organizations.ErrCodeAWSOrganizationsNotInUseException, aerr.Error()) case organizations.ErrCodeInvalidInputException: fmt.Println(organizations.ErrCodeInvalidInputException, aerr.Error()) case organizations.ErrCodeServiceException: fmt.Println(organizations.ErrCodeServiceException, aerr.Error()) case organizations.ErrCodeTooManyRequestsException: fmt.Println(organizations.ErrCodeTooManyRequestsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ListCreateAccountStatusPages

func (c *Organizations) ListCreateAccountStatusPages(input *ListCreateAccountStatusInput, fn func(*ListCreateAccountStatusOutput, bool) bool) error

ListCreateAccountStatusPages iterates over the pages of a ListCreateAccountStatus operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See ListCreateAccountStatus method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a ListCreateAccountStatus operation. pageNum := 0 err := client.ListCreateAccountStatusPages(params, func(page *ListCreateAccountStatusOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

ListCreateAccountStatusPagesWithContext

func (c *Organizations) ListCreateAccountStatusPagesWithContext(ctx aws.Context, input *ListCreateAccountStatusInput, fn func(*ListCreateAccountStatusOutput, bool) bool, opts ...request.Option) error

ListCreateAccountStatusPagesWithContext same as ListCreateAccountStatusPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListCreateAccountStatusRequest

func (c *Organizations) ListCreateAccountStatusRequest(input *ListCreateAccountStatusInput) (req *request.Request, output *ListCreateAccountStatusOutput)

ListCreateAccountStatusRequest generates a "aws/request.Request" representing the client's request for the ListCreateAccountStatus operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ListCreateAccountStatus for more information on using the ListCreateAccountStatus API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ListCreateAccountStatusRequest method. req, resp := client.ListCreateAccountStatusRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/ListCreateAccountStatus

ListCreateAccountStatusWithContext

func (c *Organizations) ListCreateAccountStatusWithContext(ctx aws.Context, input *ListCreateAccountStatusInput, opts ...request.Option) (*ListCreateAccountStatusOutput, error)

ListCreateAccountStatusWithContext is the same as ListCreateAccountStatus with the addition of the ability to pass a context and additional request options.

See ListCreateAccountStatus for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ListHandshakesForAccount

func (c *Organizations) ListHandshakesForAccount(input *ListHandshakesForAccountInput) (*ListHandshakesForAccountOutput, error)

ListHandshakesForAccount API operation for AWS Organizations.

Lists the current handshakes that are associated with the account of the requesting user.

Handshakes that are ACCEPTED, DECLINED, or CANCELED appear in the results of this API for only 30 days after changing to that state. After that they are deleted and no longer accessible.

Always check the NextToken response parameter for a null value when calling a List* operation. These operations can occasionally return an empty set of results even when there are