You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Organizations::Client

Inherits:
Seahorse::Client::Base show all
Includes:
ClientStubs
Defined in:
gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

API Operations collapse

Instance Method Summary collapse

Methods included from ClientStubs

#stub_data, #stub_responses

Methods inherited from Seahorse::Client::Base

add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(*args) ⇒ Client

Returns a new instance of Client

Parameters:

  • options (Hash)

    a customizable set of options



152
153
154
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 152

def initialize(*args)
  super
end

Instance Method Details

#accept_handshake(params = {}) ⇒ Types::AcceptHandshakeResponse

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.

  • 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 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 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.

Examples:

Example: 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.

resp = client.accept_handshake({
  handshake_id: "h-examplehandshakeid111", 
})

resp.to_h outputs the following:
{
  handshake: {
    action: "INVITE", 
    arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
    expiration_timestamp: Time.parse("20170228T1215Z"), 
    id: "h-examplehandshakeid111", 
    parties: [
      {
        id: "o-exampleorgid", 
        type: "ORGANIZATION", 
      }, 
      {
        id: "juan@example.com", 
        type: "EMAIL", 
      }, 
    ], 
    requested_timestamp: Time.parse("20170214T1215Z"), 
    resources: [
      {
        resources: [
          {
            type: "MASTER_EMAIL", 
            value: "bill@amazon.com", 
          }, 
          {
            type: "MASTER_NAME", 
            value: "Org Master Account", 
          }, 
          {
            type: "ORGANIZATION_FEATURE_SET", 
            value: "ALL", 
          }, 
        ], 
        type: "ORGANIZATION", 
        value: "o-exampleorgid", 
      }, 
      {
        type: "ACCOUNT", 
        value: "222222222222", 
      }, 
    ], 
    state: "ACCEPTED", 
  }, 
}

Request syntax with placeholder values


resp = client.accept_handshake({
  handshake_id: "HandshakeId", # required
})

Response structure


resp.handshake.id #=> String
resp.handshake.arn #=> String
resp.handshake.parties #=> Array
resp.handshake.parties[0].id #=> String
resp.handshake.parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshake.state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshake.requested_timestamp #=> Time
resp.handshake.expiration_timestamp #=> Time
resp.handshake.action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshake.resources #=> Array
resp.handshake.resources[0].value #=> String
resp.handshake.resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshake.resources[0].resources #=> Types::HandshakeResources

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :handshake_id (required, String)

    The unique identifier (ID) of the handshake that you want to accept.

    The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lower-case letters or digits.

Returns:

See Also:



279
280
281
282
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 279

def accept_handshake(params = {}, options = {})
  req = build_request(:accept_handshake, params)
  req.send_request(options)
end

#attach_policy(params = {}) ⇒ Object

resp = client.attach_policy({ policy_id: "p-examplepolicyid111", target_id: "333333333333", })

Examples:

Request syntax with placeholder values


resp = client.attach_policy({
  policy_id: "PolicyId", # required
  target_id: "PolicyTargetId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



402
403
404
405
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 402

def attach_policy(params = {}, options = {})
  req = build_request(:attach_policy, params)
  req.send_request(options)
end

#cancel_handshake(params = {}) ⇒ Object

resp = client.cancel_handshake({ handshake_id: "h-examplehandshakeid111", })

resp.to_h outputs the following: { handshake: { action: "INVITE", arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", expiration_timestamp: Time.parse("20170228T1215Z"), id: "h-examplehandshakeid111", parties: [ { id: "o-exampleorgid", type: "ORGANIZATION", }, { id: "susan@example.com", type: "EMAIL", }, ], requested_timestamp: Time.parse("20170214T1215Z"), resources: [ { resources: [ { type: "MASTER_EMAIL", value: "bill@example.com", }, { type: "MASTER_NAME", value: "Master Account", }, { type: "ORGANIZATION_FEATURE_SET", value: "CONSOLIDATED_BILLING", }, ], type: "ORGANIZATION", value: "o-exampleorgid", }, { type: "ACCOUNT", value: "222222222222", }, { type: "NOTES", value: "This is a request for Susan's account to join Bob's organization.", }, ], state: "CANCELED", }, }

Examples:

Request syntax with placeholder values


resp = client.cancel_handshake({
  handshake_id: "HandshakeId", # required
})

Response structure


resp.handshake.id #=> String
resp.handshake.arn #=> String
resp.handshake.parties #=> Array
resp.handshake.parties[0].id #=> String
resp.handshake.parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshake.state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshake.requested_timestamp #=> Time
resp.handshake.expiration_timestamp #=> Time
resp.handshake.action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshake.resources #=> Array
resp.handshake.resources[0].value #=> String
resp.handshake.resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshake.resources[0].resources #=> Types::HandshakeResources

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



519
520
521
522
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 519

def cancel_handshake(params = {}, options = {})
  req = build_request(:cancel_handshake, params)
  req.send_request(options)
end

#create_account(params = {}) ⇒ Object

resp = client.create_account({ account_name: "Production Account", email: "susan@example.com", })

resp.to_h outputs the following: { create_account_status: { id: "car-examplecreateaccountrequestid111", state: "IN_PROGRESS", }, }

Examples:

Request syntax with placeholder values


resp = client.({
  email: "Email", # required
  account_name: "AccountName", # required
  role_name: "RoleName",
  iam_user_access_to_billing: "ALLOW", # accepts ALLOW, DENY
})

Response structure


resp..id #=> String
resp.. #=> String
resp..state #=> String, one of "IN_PROGRESS", "SUCCEEDED", "FAILED"
resp..requested_timestamp #=> Time
resp..completed_timestamp #=> Time
resp.. #=> String
resp..failure_reason #=> String, one of "ACCOUNT_LIMIT_EXCEEDED", "EMAIL_ALREADY_EXISTS", "INVALID_ADDRESS", "INVALID_EMAIL", "INTERNAL_FAILURE"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



666
667
668
669
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 666

def (params = {}, options = {})
  req = build_request(:create_account, params)
  req.send_request(options)
end

#create_organization(params = {}) ⇒ Object

resp = client.create_organization({ feature_set: "CONSOLIDATED_BILLING", })

resp.to_h outputs the following: { organization: { arn: "arn:aws:organizations::111111111111:organization/o-exampleorgid", available_policy_types: [ ], feature_set: "CONSOLIDATED_BILLING", id: "o-exampleorgid", master_account_arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", master_account_email: "bill@example.com", master_account_id: "111111111111", }, }

Examples:

Request syntax with placeholder values


resp = client.create_organization({
  feature_set: "ALL", # accepts ALL, CONSOLIDATED_BILLING
})

Response structure


resp.organization.id #=> String
resp.organization.arn #=> String
resp.organization.feature_set #=> String, one of "ALL", "CONSOLIDATED_BILLING"
resp.organization. #=> String
resp.organization. #=> String
resp.organization. #=> String
resp.organization.available_policy_types #=> Array
resp.organization.available_policy_types[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.organization.available_policy_types[0].status #=> String, one of "ENABLED", "PENDING_ENABLE", "PENDING_DISABLE"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



789
790
791
792
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 789

def create_organization(params = {}, options = {})
  req = build_request(:create_organization, params)
  req.send_request(options)
end

#create_organizational_unit(params = {}) ⇒ Object

resp = client.create_organizational_unit({ name: "AccountingOU", parent_id: "r-examplerootid111", })

resp.to_h outputs the following: { organizational_unit: { arn: "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", id: "ou-examplerootid111-exampleouid111", name: "AccountingOU", }, }

Examples:

Request syntax with placeholder values


resp = client.create_organizational_unit({
  parent_id: "ParentId", # required
  name: "OrganizationalUnitName", # required
})

Response structure


resp.organizational_unit.id #=> String
resp.organizational_unit.arn #=> String
resp.organizational_unit.name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



875
876
877
878
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 875

def create_organizational_unit(params = {}, options = {})
  req = build_request(:create_organizational_unit, params)
  req.send_request(options)
end

#create_policy(params = {}) ⇒ Object

resp = client.create_policy({ content: "\\"Version\\":\\"2012-10-17\\",\\"Statement\\":{\\"Effect\\":\\"Allow\\",\\"Action\\":\\"s3:*\\"}", description: "Enables admins of attached accounts to delegate all S3 permissions", name: "AllowAllS3Actions", type: "SERVICE_CONTROL_POLICY", })

resp.to_h outputs the following: { policy: { content: "\"Version\":\"2012-10-17\",\"Statement\":{\"Effect\":\"Allow\",\"Action\":\"s3:*\"}", policy_summary: { arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", description: "Allows delegation of all S3 actions", name: "AllowAllS3Actions", type: "SERVICE_CONTROL_POLICY", }, }, }

Examples:

Request syntax with placeholder values


resp = client.create_policy({
  content: "PolicyContent", # required
  description: "PolicyDescription", # required
  name: "PolicyName", # required
  type: "SERVICE_CONTROL_POLICY", # required, accepts SERVICE_CONTROL_POLICY
})

Response structure


resp.policy.policy_summary.id #=> String
resp.policy.policy_summary.arn #=> String
resp.policy.policy_summary.name #=> String
resp.policy.policy_summary.description #=> String
resp.policy.policy_summary.type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.policy.policy_summary.aws_managed #=> Boolean
resp.policy.content #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



981
982
983
984
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 981

def create_policy(params = {}, options = {})
  req = build_request(:create_policy, params)
  req.send_request(options)
end

#decline_handshake(params = {}) ⇒ Types::DeclineHandshakeResponse

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.

Examples:

Example: 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:

resp = client.decline_handshake({
  handshake_id: "h-examplehandshakeid111", 
})

resp.to_h outputs the following:
{
  handshake: {
    action: "INVITE", 
    arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
    expiration_timestamp: Time.parse("2016-12-15T19:27:58Z"), 
    id: "h-examplehandshakeid111", 
    parties: [
      {
        id: "222222222222", 
        type: "ACCOUNT", 
      }, 
      {
        id: "o-exampleorgid", 
        type: "ORGANIZATION", 
      }, 
    ], 
    requested_timestamp: Time.parse("2016-11-30T19:27:58Z"), 
    resources: [
      {
        resources: [
          {
            type: "MASTER_EMAIL", 
            value: "bill@example.com", 
          }, 
          {
            type: "MASTER_NAME", 
            value: "Master Account", 
          }, 
        ], 
        type: "ORGANIZATION", 
        value: "o-exampleorgid", 
      }, 
      {
        type: "ACCOUNT", 
        value: "222222222222", 
      }, 
      {
        type: "NOTES", 
        value: "This is an invitation to Susan's account to join the Bill's organization.", 
      }, 
    ], 
    state: "DECLINED", 
  }, 
}

Request syntax with placeholder values


resp = client.decline_handshake({
  handshake_id: "HandshakeId", # required
})

Response structure


resp.handshake.id #=> String
resp.handshake.arn #=> String
resp.handshake.parties #=> Array
resp.handshake.parties[0].id #=> String
resp.handshake.parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshake.state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshake.requested_timestamp #=> Time
resp.handshake.expiration_timestamp #=> Time
resp.handshake.action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshake.resources #=> Array
resp.handshake.resources[0].value #=> String
resp.handshake.resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshake.resources[0].resources #=> Types::HandshakeResources

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :handshake_id (required, String)

    The unique identifier (ID) of the handshake that you want to decline. You can get the ID from the ListHandshakesForAccount operation.

    The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lower-case letters or digits.

Returns:

See Also:



1093
1094
1095
1096
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1093

def decline_handshake(params = {}, options = {})
  req = build_request(:decline_handshake, params)
  req.send_request(options)
end

#delete_organization(params = {}) ⇒ Struct

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

If you create any accounts using Organizations operations or the Organizations console, you can't remove those accounts from the organization, which means that you can't delete the organization.

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1112
1113
1114
1115
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1112

def delete_organization(params = {}, options = {})
  req = build_request(:delete_organization, params)
  req.send_request(options)
end

#delete_organizational_unit(params = {}) ⇒ Object

resp = client.delete_organizational_unit({ organizational_unit_id: "ou-examplerootid111-exampleouid111", })

Examples:

Request syntax with placeholder values


resp = client.delete_organizational_unit({
  organizational_unit_id: "OrganizationalUnitId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



1161
1162
1163
1164
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1161

def delete_organizational_unit(params = {}, options = {})
  req = build_request(:delete_organizational_unit, params)
  req.send_request(options)
end

#delete_policy(params = {}) ⇒ Object

resp = client.delete_policy({ policy_id: "p-examplepolicyid111", })

Examples:

Request syntax with placeholder values


resp = client.delete_policy({
  policy_id: "PolicyId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

See Also:



1208
1209
1210
1211
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1208

def delete_policy(params = {}, options = {})
  req = build_request(:delete_policy, params)
  req.send_request(options)
end

#describe_account(params = {}) ⇒ Types::DescribeAccountResponse

Retrieves Organizations-related information about the specified account.

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

Examples:

Example: To get the details about an account


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

resp = client.({
  account_id: "555555555555", 
})

resp.to_h outputs the following:
{
  account: {
    arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/555555555555", 
    email: "anika@example.com", 
    id: "555555555555", 
    name: "Beta Account", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  account_id: "AccountId", # required
})

Response structure


resp..id #=> String
resp..arn #=> String
resp..email #=> String
resp..name #=> String
resp..status #=> String, one of "ACTIVE", "SUSPENDED"
resp..joined_method #=> String, one of "INVITED", "CREATED"
resp..joined_timestamp #=> Time

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The unique identifier (ID) of the AWS account that you want information about. You can get the ID from the ListAccounts or ListAccountsForParent operations.

    The regex pattern for an account ID string requires exactly 12 digits.

Returns:

See Also:



1274
1275
1276
1277
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1274

def (params = {}, options = {})
  req = build_request(:describe_account, params)
  req.send_request(options)
end

#describe_create_account_status(params = {}) ⇒ Types::DescribeCreateAccountStatusResponse

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

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

Examples:

Example: 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":

resp = client.({
  create_account_request_id: "car-exampleaccountcreationrequestid", 
})

resp.to_h outputs the following:
{
  create_account_status: {
    account_id: "333333333333", 
    id: "car-exampleaccountcreationrequestid", 
    state: "SUCCEEDED", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  create_account_request_id: "CreateAccountRequestId", # required
})

Response structure


resp..id #=> String
resp.. #=> String
resp..state #=> String, one of "IN_PROGRESS", "SUCCEEDED", "FAILED"
resp..requested_timestamp #=> Time
resp..completed_timestamp #=> Time
resp.. #=> String
resp..failure_reason #=> String, one of "ACCOUNT_LIMIT_EXCEEDED", "EMAIL_ALREADY_EXISTS", "INVALID_ADDRESS", "INVALID_EMAIL", "INTERNAL_FAILURE"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :create_account_request_id (required, String)

    Specifies the operationId that uniquely identifies the request. You can get the ID from the response to an earlier CreateAccount request, or from the ListCreateAccountStatus operation.

    The regex pattern for an create account request ID string requires "car-" followed by from 8 to 32 lower-case letters or digits.

Returns:

See Also:



1340
1341
1342
1343
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1340

def (params = {}, options = {})
  req = build_request(:describe_create_account_status, params)
  req.send_request(options)
end

#describe_handshake(params = {}) ⇒ Types::DescribeHandshakeResponse

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.

Examples:

Example: 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":

resp = client.describe_handshake({
  handshake_id: "h-examplehandshakeid111", 
})

resp.to_h outputs the following:
{
  handshake: {
    action: "INVITE", 
    arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
    expiration_timestamp: Time.parse("2016-11-30T17:24:58.046Z"), 
    id: "h-examplehandshakeid111", 
    parties: [
      {
        id: "o-exampleorgid", 
        type: "ORGANIZATION", 
      }, 
      {
        id: "333333333333", 
        type: "ACCOUNT", 
      }, 
    ], 
    requested_timestamp: Time.parse("2016-11-30T17:24:58.046Z"), 
    resources: [
      {
        resources: [
          {
            type: "MASTER_EMAIL", 
            value: "bill@example.com", 
          }, 
          {
            type: "MASTER_NAME", 
            value: "Master Account", 
          }, 
        ], 
        type: "ORGANIZATION", 
        value: "o-exampleorgid", 
      }, 
      {
        type: "ACCOUNT", 
        value: "333333333333", 
      }, 
    ], 
    state: "OPEN", 
  }, 
}

Request syntax with placeholder values


resp = client.describe_handshake({
  handshake_id: "HandshakeId", # required
})

Response structure


resp.handshake.id #=> String
resp.handshake.arn #=> String
resp.handshake.parties #=> Array
resp.handshake.parties[0].id #=> String
resp.handshake.parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshake.state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshake.requested_timestamp #=> Time
resp.handshake.expiration_timestamp #=> Time
resp.handshake.action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshake.resources #=> Array
resp.handshake.resources[0].value #=> String
resp.handshake.resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshake.resources[0].resources #=> Types::HandshakeResources

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :handshake_id (required, String)

    The unique identifier (ID) of the handshake that you want information about. You can get the ID from the original call to InviteAccountToOrganization, or from a call to ListHandshakesForAccount or ListHandshakesForOrganization.

    The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lower-case letters or digits.

Returns:

See Also:



1449
1450
1451
1452
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1449

def describe_handshake(params = {}, options = {})
  req = build_request(:describe_handshake, params)
  req.send_request(options)
end

#describe_organization(params = {}) ⇒ Types::DescribeOrganizationResponse

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

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

Examples:

Example: To get information about an organization


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

resp = client.describe_organization({
})

resp.to_h outputs the following:
{
  organization: {
    arn: "arn:aws:organizations::111111111111:organization/o-exampleorgid", 
    available_policy_types: [
      {
        status: "ENABLED", 
        type: "SERVICE_CONTROL_POLICY", 
      }, 
    ], 
    feature_set: "ALL", 
    id: "o-exampleorgid", 
    master_account_arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", 
    master_account_email: "bill@example.com", 
  }, 
}

Response structure


resp.organization.id #=> String
resp.organization.arn #=> String
resp.organization.feature_set #=> String, one of "ALL", "CONSOLIDATED_BILLING"
resp.organization. #=> String
resp.organization. #=> String
resp.organization. #=> String
resp.organization.available_policy_types #=> Array
resp.organization.available_policy_types[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.organization.available_policy_types[0].status #=> String, one of "ENABLED", "PENDING_ENABLE", "PENDING_DISABLE"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



1504
1505
1506
1507
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1504

def describe_organization(params = {}, options = {})
  req = build_request(:describe_organization, params)
  req.send_request(options)
end

#describe_organizational_unit(params = {}) ⇒ Types::DescribeOrganizationalUnitResponse

Retrieves information about an organizational unit (OU).

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

Examples:

Example: To get information about an organizational unit


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

resp = client.describe_organizational_unit({
  organizational_unit_id: "ou-examplerootid111-exampleouid111", 
})

resp.to_h outputs the following:
{
  organizational_unit: {
    arn: "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", 
    id: "ou-examplerootid111-exampleouid111", 
    name: "Accounting Group", 
  }, 
}

Request syntax with placeholder values


resp = client.describe_organizational_unit({
  organizational_unit_id: "OrganizationalUnitId", # required
})

Response structure


resp.organizational_unit.id #=> String
resp.organizational_unit.arn #=> String
resp.organizational_unit.name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :organizational_unit_id (required, String)

    The unique identifier (ID) of the organizational unit that you want details about. You can get the ID from the ListOrganizationalUnitsForParent operation.

    The regex pattern for an organizational unit ID string requires "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that contains the OU) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

Returns:

See Also:



1566
1567
1568
1569
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1566

def describe_organizational_unit(params = {}, options = {})
  req = build_request(:describe_organizational_unit, params)
  req.send_request(options)
end

#describe_policy(params = {}) ⇒ Types::DescribePolicyResponse

Retrieves information about a policy.

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

Examples:

Example: To get information about a policy


# The following example shows how to request information about a policy:/n/n

resp = client.describe_policy({
  policy_id: "p-examplepolicyid111", 
})

resp.to_h outputs the following:
{
  policy: {
    content: "{\\n  \\\"Version\\\": \\\"2012-10-17\\\",\\n  \\\"Statement\\\": [\\n    {\\n      \\\"Effect\\\": \\\"Allow\\\",\\n      \\\"Action\\\": \\\"*\\\",\\n      \\\"Resource\\\": \\\"*\\\"\\n    }\\n  ]\\n}", 
    policy_summary: {
      arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", 
      aws_managed: false, 
      description: "Enables admins to delegate S3 permissions", 
      id: "p-examplepolicyid111", 
      name: "AllowAllS3Actions", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
  }, 
}

Request syntax with placeholder values


resp = client.describe_policy({
  policy_id: "PolicyId", # required
})

Response structure


resp.policy.policy_summary.id #=> String
resp.policy.policy_summary.arn #=> String
resp.policy.policy_summary.name #=> String
resp.policy.policy_summary.description #=> String
resp.policy.policy_summary.type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.policy.policy_summary.aws_managed #=> Boolean
resp.policy.content #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_id (required, String)

    The unique identifier (ID) of the policy that you want details about. You can get the ID from the ListPolicies or ListPoliciesForTarget operations.

    The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

Returns:

See Also:



1636
1637
1638
1639
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1636

def describe_policy(params = {}, options = {})
  req = build_request(:describe_policy, params)
  req.send_request(options)
end

#detach_policy(params = {}) ⇒ Struct

Detaches a policy from a target root, organizational unit, 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. 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.

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

Examples:

Example: To detach a policy from a root, OU, or account


# The following example shows how to detach a policy from an OU:/n/n

resp = client.detach_policy({
  policy_id: "p-examplepolicyid111", 
  target_id: "ou-examplerootid111-exampleouid111", 
})

Request syntax with placeholder values


resp = client.detach_policy({
  policy_id: "PolicyId", # required
  target_id: "PolicyTargetId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_id (required, String)

    The unique identifier (ID) of the policy you want to detach. You can get the ID from the ListPolicies or ListPoliciesForTarget operations.

    The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

  • :target_id (required, String)

    The unique identifier (ID) of the root, OU, or account from which you want to detach the policy. You can get the ID from the ListRoots, ListOrganizationalUnitsForParent, or ListAccounts operations.

    The regex pattern for a target ID string requires one of the following:

    • Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits.

    • Account: a string that consists of exactly 12 digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



1721
1722
1723
1724
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1721

def detach_policy(params = {}, options = {})
  req = build_request(:detach_policy, params)
  req.send_request(options)
end

#disable_policy_type(params = {}) ⇒ Types::DisablePolicyTypeResponse

Disables an organizational control policy type in a root. A poicy 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 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.

Examples:

Example: 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

resp = client.disable_policy_type({
  policy_type: "SERVICE_CONTROL_POLICY", 
  root_id: "r-examplerootid111", 
})

resp.to_h outputs the following:
{
  root: {
    arn: "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111", 
    id: "r-examplerootid111", 
    name: "Root", 
    policy_types: [
    ], 
  }, 
}

Request syntax with placeholder values


resp = client.disable_policy_type({
  root_id: "RootId", # required
  policy_type: "SERVICE_CONTROL_POLICY", # required, accepts SERVICE_CONTROL_POLICY
})

Response structure


resp.root.id #=> String
resp.root.arn #=> String
resp.root.name #=> String
resp.root.policy_types #=> Array
resp.root.policy_types[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.root.policy_types[0].status #=> String, one of "ENABLED", "PENDING_ENABLE", "PENDING_DISABLE"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :root_id (required, String)

    The unique identifier (ID) of the root in which you want to disable a policy type. You can get the ID from the ListPolicies operation.

    The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lower-case letters or digits.

  • :policy_type (required, String)

    The policy type that you want to disable in this root.

Returns:

See Also:



1795
1796
1797
1798
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1795

def disable_policy_type(params = {}, options = {})
  req = build_request(:disable_policy_type, params)
  req.send_request(options)
end

#enable_all_features(params = {}) ⇒ Types::EnableAllFeaturesResponse

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 in the AWS Organizations User Guide.

This operation is required only for organizations that were created explicitly with only the consolidated billing features enabled, or that were migrated from a Consolidated Billing account family to Organizations. 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 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.

Examples:

Example: 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

resp = client.enable_all_features({
})

resp.to_h outputs the following:
{
  handshake: {
    action: "ENABLE_ALL_FEATURES", 
    arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/enable_all_features/h-examplehandshakeid111", 
    expiration_timestamp: Time.parse("2017-02-28T09:35:40.05Z"), 
    id: "h-examplehandshakeid111", 
    parties: [
      {
        id: "o-exampleorgid", 
        type: "ORGANIZATION", 
      }, 
    ], 
    requested_timestamp: Time.parse("2017-02-13T09:35:40.05Z"), 
    resources: [
      {
        type: "ORGANIZATION", 
        value: "o-exampleorgid", 
      }, 
    ], 
    state: "REQUESTED", 
  }, 
}

Response structure


resp.handshake.id #=> String
resp.handshake.arn #=> String
resp.handshake.parties #=> Array
resp.handshake.parties[0].id #=> String
resp.handshake.parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshake.state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshake.requested_timestamp #=> Time
resp.handshake.expiration_timestamp #=> Time
resp.handshake.action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshake.resources #=> Array
resp.handshake.resources[0].value #=> String
resp.handshake.resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshake.resources[0].resources #=> Types::HandshakeResources

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

See Also:



1891
1892
1893
1894
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1891

def enable_all_features(params = {}, options = {})
  req = build_request(:enable_all_features, params)
  req.send_request(options)
end

#enable_policy_type(params = {}) ⇒ Types::EnablePolicyTypeResponse

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 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.

Examples:

Example: 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

resp = client.enable_policy_type({
  policy_type: "SERVICE_CONTROL_POLICY", 
  root_id: "r-examplerootid111", 
})

resp.to_h outputs the following:
{
  root: {
    arn: "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111", 
    id: "r-examplerootid111", 
    name: "Root", 
    policy_types: [
      {
        status: "ENABLED", 
        type: "SERVICE_CONTROL_POLICY", 
      }, 
    ], 
  }, 
}

Request syntax with placeholder values


resp = client.enable_policy_type({
  root_id: "RootId", # required
  policy_type: "SERVICE_CONTROL_POLICY", # required, accepts SERVICE_CONTROL_POLICY
})

Response structure


resp.root.id #=> String
resp.root.arn #=> String
resp.root.name #=> String
resp.root.policy_types #=> Array
resp.root.policy_types[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.root.policy_types[0].status #=> String, one of "ENABLED", "PENDING_ENABLE", "PENDING_DISABLE"

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :root_id (required, String)

    The unique identifier (ID) of the root in which you want to enable a policy type. You can get the ID from the ListRoots operation.

    The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lower-case letters or digits.

  • :policy_type (required, String)

    The policy type that you want to enable.

Returns:

See Also:



1967
1968
1969
1970
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 1967

def enable_policy_type(params = {}, options = {})
  req = build_request(:enable_policy_type, params)
  req.send_request(options)
end

#invite_account_to_organization(params = {}) ⇒ Types::InviteAccountToOrganizationResponse

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 reseller as the master account. For example, if your organization's master account was created by Amazon Internet Services Pvt. Ltd (AISPL), an AWS reseller in India, then you can only invite other AISPL accounts to your organization. You can't combine accounts from AISPL and AWS. For more information, see Consolidated Billing in India.

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

Examples:

Example: 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.

resp = client.({
  notes: "This is a request for Juan's account to join Bill's organization", 
  target: {
    id: "juan@example.com", 
    type: "EMAIL", 
  }, 
})

resp.to_h outputs the following:
{
  handshake: {
    action: "INVITE", 
    arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
    expiration_timestamp: Time.parse("2017-02-16T09:36:05.02Z"), 
    id: "h-examplehandshakeid111", 
    parties: [
      {
        id: "o-exampleorgid", 
        type: "ORGANIZATION", 
      }, 
      {
        id: "juan@example.com", 
        type: "EMAIL", 
      }, 
    ], 
    requested_timestamp: Time.parse("2017-02-01T09:36:05.02Z"), 
    resources: [
      {
        resources: [
          {
            type: "MASTER_EMAIL", 
            value: "bill@amazon.com", 
          }, 
          {
            type: "MASTER_NAME", 
            value: "Org Master Account", 
          }, 
          {
            type: "ORGANIZATION_FEATURE_SET", 
            value: "FULL", 
          }, 
        ], 
        type: "ORGANIZATION", 
        value: "o-exampleorgid", 
      }, 
      {
        type: "EMAIL", 
        value: "juan@example.com", 
      }, 
    ], 
    state: "OPEN", 
  }, 
}

Request syntax with placeholder values


resp = client.({
  target: { # required
    id: "HandshakePartyId",
    type: "ACCOUNT", # accepts ACCOUNT, ORGANIZATION, EMAIL
  },
  notes: "HandshakeNotes",
})

Response structure


resp.handshake.id #=> String
resp.handshake.arn #=> String
resp.handshake.parties #=> Array
resp.handshake.parties[0].id #=> String
resp.handshake.parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshake.state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshake.requested_timestamp #=> Time
resp.handshake.expiration_timestamp #=> Time
resp.handshake.action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshake.resources #=> Array
resp.handshake.resources[0].value #=> String
resp.handshake.resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshake.resources[0].resources #=> Types::HandshakeResources

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :target (required, Types::HandshakeParty)

    The identifier (ID) of the AWS account that you want to invite to join your organization. This is a JSON object that contains the following elements:

    \{ "Type": "ACCOUNT", "Id": "< account id number >" \}

    If you use the AWS CLI, you can submit this as a single string, similar to the following example:

    --target id=123456789012,type=ACCOUNT

    If you specify "Type": "ACCOUNT", then you must provide the AWS account ID number as the Id. If you specify "Type": "EMAIL", then you must specify the email address that is associated with the account.

    --target id=bill@example.com,type=EMAIL

  • :notes (String)

    Additional information that you want to include in the generated email to the recipient account owner.

Returns:

See Also:



2108
2109
2110
2111
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2108

def (params = {}, options = {})
  req = build_request(:invite_account_to_organization, params)
  req.send_request(options)
end

#leave_organization(params = {}) ⇒ Struct

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.

  • If you created the account using the AWS Organizations console, the Organizations API, or the Organizations CLI commands, then you cannot remove the account.

  • 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 in the AWS Billing and Cost Management User Guide.

Examples:

Example: To leave an organization as a member account


# TThe following example shows how to remove your member account from an organization:

resp = client.leave_organization({
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Returns:

  • (Struct)

    Returns an empty response.

See Also:



2154
2155
2156
2157
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2154

def leave_organization(params = {}, options = {})
  req = build_request(:leave_organization, params)
  req.send_request(options)
end

#list_accounts(params = {}) ⇒ Types::ListAccountsResponse

Lists all the accounts in the organization. To request only the accounts in a root or OU, use the ListAccountsForParent operation instead.

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

Examples:

Example: 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:

resp = client.list_accounts({
})

resp.to_h outputs the following:
{
  accounts: [
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111", 
      email: "bill@example.com", 
      id: "111111111111", 
      joined_method: "INVITED", 
      joined_timestamp: Time.parse("20161215T193015Z"), 
      name: "Master Account", 
      status: "ACTIVE", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/222222222222", 
      email: "alice@example.com", 
      id: "222222222222", 
      joined_method: "INVITED", 
      joined_timestamp: Time.parse("20161215T210221Z"), 
      name: "Developer Account", 
      status: "ACTIVE", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/333333333333", 
      email: "juan@example.com", 
      id: "333333333333", 
      joined_method: "INVITED", 
      joined_timestamp: Time.parse("20161215T210347Z"), 
      name: "Test Account", 
      status: "ACTIVE", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/444444444444", 
      email: "anika@example.com", 
      id: "444444444444", 
      joined_method: "INVITED", 
      joined_timestamp: Time.parse("20161215T210332Z"), 
      name: "Production Account", 
      status: "ACTIVE", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_accounts({
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.accounts #=> Array
resp.accounts[0].id #=> String
resp.accounts[0].arn #=> String
resp.accounts[0].email #=> String
resp.accounts[0].name #=> String
resp.accounts[0].status #=> String, one of "ACTIVE", "SUSPENDED"
resp.accounts[0].joined_method #=> String, one of "INVITED", "CREATED"
resp.accounts[0].joined_timestamp #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2262
2263
2264
2265
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2262

def list_accounts(params = {}, options = {})
  req = build_request(:list_accounts, params)
  req.send_request(options)
end

#list_accounts_for_parent(params = {}) ⇒ Types::ListAccountsForParentResponse

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.

Examples:

Example: 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

resp = client.list_accounts_for_parent({
  parent_id: "ou-examplerootid111-exampleouid111", 
})

resp.to_h outputs the following:
{
  accounts: [
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/333333333333", 
      email: "juan@example.com", 
      id: "333333333333", 
      joined_method: "INVITED", 
      joined_timestamp: Time.parse(1481835795.536), 
      name: "Development Account", 
      status: "ACTIVE", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/444444444444", 
      email: "anika@example.com", 
      id: "444444444444", 
      joined_method: "INVITED", 
      joined_timestamp: Time.parse(1481835812.143), 
      name: "Test Account", 
      status: "ACTIVE", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_accounts_for_parent({
  parent_id: "ParentId", # required
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.accounts #=> Array
resp.accounts[0].id #=> String
resp.accounts[0].arn #=> String
resp.accounts[0].email #=> String
resp.accounts[0].name #=> String
resp.accounts[0].status #=> String, one of "ACTIVE", "SUSPENDED"
resp.accounts[0].joined_method #=> String, one of "INVITED", "CREATED"
resp.accounts[0].joined_timestamp #=> Time
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :parent_id (required, String)

    The unique identifier (ID) for the parent root or organization unit (OU) whose accounts you want to list.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2358
2359
2360
2361
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2358

def list_accounts_for_parent(params = {}, options = {})
  req = build_request(:list_accounts_for_parent, params)
  req.send_request(options)
end

#list_children(params = {}) ⇒ Types::ListChildrenResponse

Lists all of the 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.

Examples:

Example: 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

resp = client.list_children({
  child_type: "ORGANIZATIONAL_UNIT", 
  parent_id: "ou-examplerootid111-exampleouid111", 
})

resp.to_h outputs the following:
{
  children: [
    {
      id: "ou-examplerootid111-exampleouid111", 
      type: "ORGANIZATIONAL_UNIT", 
    }, 
    {
      id: "ou-examplerootid111-exampleouid222", 
      type: "ORGANIZATIONAL_UNIT", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_children({
  parent_id: "ParentId", # required
  child_type: "ACCOUNT", # required, accepts ACCOUNT, ORGANIZATIONAL_UNIT
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.children #=> Array
resp.children[0].id #=> String
resp.children[0].type #=> String, one of "ACCOUNT", "ORGANIZATIONAL_UNIT"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :parent_id (required, String)

    The unique identifier (ID) for the parent root or OU whose children you want to list.

    The regex pattern for a parent ID string requires one of the following:

    • Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

  • :child_type (required, String)

    Filters the output to include only the specified child type.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2456
2457
2458
2459
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2456

def list_children(params = {}, options = {})
  req = build_request(:list_children, params)
  req.send_request(options)
end

#list_create_account_status(params = {}) ⇒ Types::ListCreateAccountStatusResponse

Lists the account creation requests that match the specified status that is currently being tracked for the organization.

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

Examples:

Example: 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:

resp = client.({
  states: [
    "SUCCEEDED", 
  ], 
})

resp.to_h outputs the following:
{
  create_account_statuses: [
    {
      account_id: "444444444444", 
      account_name: "Developer Test Account", 
      completed_timestamp: Time.parse("2017-01-15T13:45:23.6Z"), 
      id: "car-exampleaccountcreationrequestid1", 
      requested_timestamp: Time.parse("2017-01-15T13:45:23.01Z"), 
      state: "SUCCEEDED", 
    }, 
  ], 
}

Example: 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:

resp = client.({
  states: [
    "IN_PROGRESS", 
  ], 
})

resp.to_h outputs the following:
{
  create_account_statuses: [
    {
      account_name: "Production Account", 
      id: "car-exampleaccountcreationrequestid2", 
      requested_timestamp: Time.parse("2017-01-15T13:45:23.01Z"), 
      state: "IN_PROGRESS", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.({
  states: ["IN_PROGRESS"], # accepts IN_PROGRESS, SUCCEEDED, FAILED
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp. #=> Array
resp.[0].id #=> String
resp.[0]. #=> String
resp.[0].state #=> String, one of "IN_PROGRESS", "SUCCEEDED", "FAILED"
resp.[0].requested_timestamp #=> Time
resp.[0].completed_timestamp #=> Time
resp.[0]. #=> String
resp.[0].failure_reason #=> String, one of "ACCOUNT_LIMIT_EXCEEDED", "EMAIL_ALREADY_EXISTS", "INVALID_ADDRESS", "INVALID_EMAIL", "INTERNAL_FAILURE"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :states (Array<String>)

    A list of one or more states that you want included in the response. If this parameter is not present, then all requests are included in the response.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2566
2567
2568
2569
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2566

def (params = {}, options = {})
  req = build_request(:list_create_account_status, params)
  req.send_request(options)
end

#list_handshakes_for_account(params = {}) ⇒ Types::ListHandshakesForAccountResponse

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.

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

Examples:

Example: To retrieve a list of the handshakes sent to an account


# The following example shows you how to get a list of handshakes that are associated with the account of the credentials used to call the operation:

resp = client.({
})

resp.to_h outputs the following:
{
  handshakes: [
    {
      action: "INVITE", 
      arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
      expiration_timestamp: Time.parse("2017-01-28T14:35:23.3Z"), 
      id: "h-examplehandshakeid111", 
      parties: [
        {
          id: "o-exampleorgid", 
          type: "ORGANIZATION", 
        }, 
        {
          id: "juan@example.com", 
          type: "EMAIL", 
        }, 
      ], 
      requested_timestamp: Time.parse("2017-01-13T14:35:23.3Z"), 
      resources: [
        {
          resources: [
            {
              type: "MASTER_EMAIL", 
              value: "bill@amazon.com", 
            }, 
            {
              type: "MASTER_NAME", 
              value: "Org Master Account", 
            }, 
            {
              type: "ORGANIZATION_FEATURE_SET", 
              value: "FULL", 
            }, 
          ], 
          type: "ORGANIZATION", 
          value: "o-exampleorgid", 
        }, 
        {
          type: "EMAIL", 
          value: "juan@example.com", 
        }, 
      ], 
      state: "OPEN", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.({
  filter: {
    action_type: "INVITE", # accepts INVITE, ENABLE_ALL_FEATURES, APPROVE_ALL_FEATURES
    parent_handshake_id: "HandshakeId",
  },
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.handshakes #=> Array
resp.handshakes[0].id #=> String
resp.handshakes[0].arn #=> String
resp.handshakes[0].parties #=> Array
resp.handshakes[0].parties[0].id #=> String
resp.handshakes[0].parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshakes[0].state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshakes[0].requested_timestamp #=> Time
resp.handshakes[0].expiration_timestamp #=> Time
resp.handshakes[0].action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshakes[0].resources #=> Array
resp.handshakes[0].resources[0].value #=> String
resp.handshakes[0].resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshakes[0].resources[0].resources #=> Types::HandshakeResources
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :filter (Types::HandshakeFilter)

    Filters the handshakes that you want included in the response. The default is all types. Use the ActionType element to limit the output to only a specified type, such as INVITE, ENABLE-FULL-CONTROL, or APPROVE-FULL-CONTROL. Alternatively, for the ENABLE-FULL-CONTROL handshake that generates a separate child handshake for each member account, you can specify ParentHandshakeId to see only the handshakes that were generated by that parent request.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2701
2702
2703
2704
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2701

def (params = {}, options = {})
  req = build_request(:list_handshakes_for_account, params)
  req.send_request(options)
end

#list_handshakes_for_organization(params = {}) ⇒ Types::ListHandshakesForOrganizationResponse

Lists the handshakes that are associated with the organization that the requesting user is part of. The ListHandshakesForOrganization operation returns a list of handshake structures. Each structure contains details and status about a handshake.

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.

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

Examples:

Example: To retrieve a list of the handshakes associated with an organization


# The following example shows you how to get a list of handshakes associated with the current organization:

resp = client.list_handshakes_for_organization({
})

resp.to_h outputs the following:
{
  handshakes: [
    {
      action: "INVITE", 
      arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
      expiration_timestamp: Time.parse("2017-01-28T14:35:23.3Z"), 
      id: "h-examplehandshakeid111", 
      parties: [
        {
          id: "o-exampleorgid", 
          type: "ORGANIZATION", 
        }, 
        {
          id: "juan@example.com", 
          type: "EMAIL", 
        }, 
      ], 
      requested_timestamp: Time.parse("2017-01-13T14:35:23.3Z"), 
      resources: [
        {
          resources: [
            {
              type: "MASTER_EMAIL", 
              value: "bill@amazon.com", 
            }, 
            {
              type: "MASTER_NAME", 
              value: "Org Master Account", 
            }, 
            {
              type: "ORGANIZATION_FEATURE_SET", 
              value: "FULL", 
            }, 
          ], 
          type: "ORGANIZATION", 
          value: "o-exampleorgid", 
        }, 
        {
          type: "EMAIL", 
          value: "juan@example.com", 
        }, 
      ], 
      state: "OPEN", 
    }, 
    {
      action: "INVITE", 
      arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
      expiration_timestamp: Time.parse("2017-01-28T14:35:23.3Z"), 
      id: "h-examplehandshakeid222", 
      parties: [
        {
          id: "o-exampleorgid", 
          type: "ORGANIZATION", 
        }, 
        {
          id: "anika@example.com", 
          type: "EMAIL", 
        }, 
      ], 
      requested_timestamp: Time.parse("2017-01-13T14:35:23.3Z"), 
      resources: [
        {
          resources: [
            {
              type: "MASTER_EMAIL", 
              value: "bill@example.com", 
            }, 
            {
              type: "MASTER_NAME", 
              value: "Master Account", 
            }, 
          ], 
          type: "ORGANIZATION", 
          value: "o-exampleorgid", 
        }, 
        {
          type: "EMAIL", 
          value: "anika@example.com", 
        }, 
        {
          type: "NOTES", 
          value: "This is an invitation to Anika's account to join Bill's organization.", 
        }, 
      ], 
      state: "ACCEPTED", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_handshakes_for_organization({
  filter: {
    action_type: "INVITE", # accepts INVITE, ENABLE_ALL_FEATURES, APPROVE_ALL_FEATURES
    parent_handshake_id: "HandshakeId",
  },
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.handshakes #=> Array
resp.handshakes[0].id #=> String
resp.handshakes[0].arn #=> String
resp.handshakes[0].parties #=> Array
resp.handshakes[0].parties[0].id #=> String
resp.handshakes[0].parties[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "EMAIL"
resp.handshakes[0].state #=> String, one of "REQUESTED", "OPEN", "CANCELED", "ACCEPTED", "DECLINED", "EXPIRED"
resp.handshakes[0].requested_timestamp #=> Time
resp.handshakes[0].expiration_timestamp #=> Time
resp.handshakes[0].action #=> String, one of "INVITE", "ENABLE_ALL_FEATURES", "APPROVE_ALL_FEATURES"
resp.handshakes[0].resources #=> Array
resp.handshakes[0].resources[0].value #=> String
resp.handshakes[0].resources[0].type #=> String, one of "ACCOUNT", "ORGANIZATION", "ORGANIZATION_FEATURE_SET", "EMAIL", "MASTER_EMAIL", "MASTER_NAME", "NOTES", "PARENT_HANDSHAKE"
resp.handshakes[0].resources[0].resources #=> Types::HandshakeResources
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :filter (Types::HandshakeFilter)

    A filter of the handshakes that you want included in the response. The default is all types. Use the ActionType element to limit the output to only a specified type, such as INVITE, ENABLE-ALL-FEATURES, or APPROVE-ALL-FEATURES. Alternatively, for the ENABLE-ALL-FEATURES handshake that generates a separate child handshake for each member account, you can specify the ParentHandshakeId to see only the handshakes that were generated by that parent request.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2881
2882
2883
2884
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2881

def list_handshakes_for_organization(params = {}, options = {})
  req = build_request(:list_handshakes_for_organization, params)
  req.send_request(options)
end

#list_organizational_units_for_parent(params = {}) ⇒ Types::ListOrganizationalUnitsForParentResponse

Lists the organizational units (OUs) in a parent organizational unit or root.

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

Examples:

Example: To retrieve a list of all of the child OUs in a parent root or OU


# The following example shows how to get a list of OUs in a specified root:/n/n

resp = client.list_organizational_units_for_parent({
  parent_id: "r-examplerootid111", 
})

resp.to_h outputs the following:
{
  organizational_units: [
    {
      arn: "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examlerootid111-exampleouid111", 
      id: "ou-examplerootid111-exampleouid111", 
      name: "Development", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examlerootid111-exampleouid222", 
      id: "ou-examplerootid111-exampleouid222", 
      name: "Production", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_organizational_units_for_parent({
  parent_id: "ParentId", # required
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.organizational_units #=> Array
resp.organizational_units[0].id #=> String
resp.organizational_units[0].arn #=> String
resp.organizational_units[0].name #=> String
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :parent_id (required, String)

    The unique identifier (ID) of the root or OU whose child OUs you want to list.

    The regex pattern for a parent ID string requires one of the following:

    • Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



2979
2980
2981
2982
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 2979

def list_organizational_units_for_parent(params = {}, options = {})
  req = build_request(:list_organizational_units_for_parent, params)
  req.send_request(options)
end

#list_parents(params = {}) ⇒ Types::ListParentsResponse

Lists the root or organizational units (OUs) that serve as the immediate parent of the specified child OU or account. This operation, along with ListChildren enables you to traverse the tree structure that makes up this root.

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

In the current release, a child can have only a single parent.

Examples:

Example: To retrieve a list of all of the parents of a child OU or account


# The following example shows how to list the root or OUs that contain account 444444444444:/n/n

resp = client.list_parents({
  child_id: "444444444444", 
})

resp.to_h outputs the following:
{
  parents: [
    {
      id: "ou-examplerootid111-exampleouid111", 
      type: "ORGANIZATIONAL_UNIT", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_parents({
  child_id: "ChildId", # required
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.parents #=> Array
resp.parents[0].id #=> String
resp.parents[0].type #=> String, one of "ROOT", "ORGANIZATIONAL_UNIT"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :child_id (required, String)

    The unique identifier (ID) of the OU or account whose parent containers you want to list. Do not specify a root.

    The regex pattern for a child ID string requires one of the following:

    • Account: a string that consists of exactly 12 digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that contains the OU) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



3075
3076
3077
3078
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3075

def list_parents(params = {}, options = {})
  req = build_request(:list_parents, params)
  req.send_request(options)
end

#list_policies(params = {}) ⇒ Types::ListPoliciesResponse

Retrieves the list of all policies in an organization of a specified type.

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

Examples:

Example: To retrieve a list policies in the organization


# The following example shows how to get a list of service control policies (SCPs):/n/n

resp = client.list_policies({
  filter: "SERVICE_CONTROL_POLICY", 
})

resp.to_h outputs the following:
{
  policies: [
    {
      arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", 
      aws_managed: false, 
      description: "Enables account admins to delegate permissions for any S3 actions to users and roles in their accounts.", 
      id: "p-examplepolicyid111", 
      name: "AllowAllS3Actions", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid222", 
      aws_managed: false, 
      description: "Enables account admins to delegate permissions for any EC2 actions to users and roles in their accounts.", 
      id: "p-examplepolicyid222", 
      name: "AllowAllEC2Actions", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
    {
      arn: "arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess", 
      aws_managed: true, 
      description: "Allows access to every operation", 
      id: "p-FullAWSAccess", 
      name: "FullAWSAccess", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_policies({
  filter: "SERVICE_CONTROL_POLICY", # required, accepts SERVICE_CONTROL_POLICY
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.policies #=> Array
resp.policies[0].id #=> String
resp.policies[0].arn #=> String
resp.policies[0].name #=> String
resp.policies[0].description #=> String
resp.policies[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.policies[0].aws_managed #=> Boolean
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :filter (required, String)

    Specifies the type of policy that you want to include in the response.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



3174
3175
3176
3177
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3174

def list_policies(params = {}, options = {})
  req = build_request(:list_policies, params)
  req.send_request(options)
end

#list_policies_for_target(params = {}) ⇒ Types::ListPoliciesForTargetResponse

Lists the policies that are directly attached to the specified target root, organizational unit (OU), or account. You must specify the policy type that you want included in the returned list.

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

Examples:

Example: To retrieve a list policies attached to a root, OU, or account


# The following example shows how to get a list of all service control policies (SCPs) of the type specified by the Filter parameter, that are directly attached to an account. The returned list does not include policies that apply to the account because of inheritance from its location in an OU hierarchy:/n/n

resp = client.list_policies_for_target({
  filter: "SERVICE_CONTROL_POLICY", 
  target_id: "444444444444", 
})

resp.to_h outputs the following:
{
  policies: [
    {
      arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid222", 
      aws_managed: false, 
      description: "Enables account admins to delegate permissions for any EC2 actions to users and roles in their accounts.", 
      id: "p-examplepolicyid222", 
      name: "AllowAllEC2Actions", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_policies_for_target({
  target_id: "PolicyTargetId", # required
  filter: "SERVICE_CONTROL_POLICY", # required, accepts SERVICE_CONTROL_POLICY
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.policies #=> Array
resp.policies[0].id #=> String
resp.policies[0].arn #=> String
resp.policies[0].name #=> String
resp.policies[0].description #=> String
resp.policies[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.policies[0].aws_managed #=> Boolean
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :target_id (required, String)

    The unique identifier (ID) of the root, organizational unit, or account whose policies you want to list.

    The regex pattern for a target ID string requires one of the following:

    • Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits.

    • Account: a string that consists of exactly 12 digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

  • :filter (required, String)

    The type of policy that you want to include in the returned list.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



3281
3282
3283
3284
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3281

def list_policies_for_target(params = {}, options = {})
  req = build_request(:list_policies_for_target, params)
  req.send_request(options)
end

#list_roots(params = {}) ⇒ Types::ListRootsResponse

Lists the roots that are defined in the current organization.

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

Examples:

Example: To retrieve a list of roots in the organization


# The following example shows how to get the list of the roots in the current organization:/n/n

resp = client.list_roots({
})

resp.to_h outputs the following:
{
  roots: [
    {
      arn: "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111", 
      id: "r-examplerootid111", 
      name: "Root", 
      policy_types: [
        {
          status: "ENABLED", 
          type: "SERVICE_CONTROL_POLICY", 
        }, 
      ], 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_roots({
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.roots #=> Array
resp.roots[0].id #=> String
resp.roots[0].arn #=> String
resp.roots[0].name #=> String
resp.roots[0].policy_types #=> Array
resp.roots[0].policy_types[0].type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.roots[0].policy_types[0].status #=> String, one of "ENABLED", "PENDING_ENABLE", "PENDING_DISABLE"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



3361
3362
3363
3364
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3361

def list_roots(params = {}, options = {})
  req = build_request(:list_roots, params)
  req.send_request(options)
end

#list_targets_for_policy(params = {}) ⇒ Types::ListTargetsForPolicyResponse

Lists all the roots, OUs, and accounts to which the specified policy is attached.

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

Examples:

Example: To retrieve a list of roots, OUs, and accounts to which a policy is attached


# The following example shows how to get the list of roots, OUs, and accounts to which the specified policy is attached:/n/n

resp = client.list_targets_for_policy({
  policy_id: "p-FullAWSAccess", 
})

resp.to_h outputs the following:
{
  targets: [
    {
      arn: "arn:aws:organizations::111111111111:root/o-exampleorgid/r-examplerootid111", 
      name: "Root", 
      target_id: "r-examplerootid111", 
      type: "ROOT", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:account/o-exampleorgid/333333333333;", 
      name: "Developer Test Account", 
      target_id: "333333333333", 
      type: "ACCOUNT", 
    }, 
    {
      arn: "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", 
      name: "Accounting", 
      target_id: "ou-examplerootid111-exampleouid111", 
      type: "ORGANIZATIONAL_UNIT", 
    }, 
  ], 
}

Request syntax with placeholder values


resp = client.list_targets_for_policy({
  policy_id: "PolicyId", # required
  next_token: "NextToken",
  max_results: 1,
})

Response structure


resp.targets #=> Array
resp.targets[0].target_id #=> String
resp.targets[0].arn #=> String
resp.targets[0].name #=> String
resp.targets[0].type #=> String, one of "ACCOUNT", "ORGANIZATIONAL_UNIT", "ROOT"
resp.next_token #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_id (required, String)

    The unique identifier (ID) of the policy for which you want to know its attachments.

    The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

  • :next_token (String)

    Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

  • :max_results (Integer) — default: Optional

    Use this to limit the number of results you want included in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Returns:

See Also:



3460
3461
3462
3463
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3460

def list_targets_for_policy(params = {}, options = {})
  req = build_request(:list_targets_for_policy, params)
  req.send_request(options)
end

#move_account(params = {}) ⇒ Struct

Moves an account from its current source parent root or OU to the specified destination parent root or OU.

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

Examples:

Example: To move an OU or account to another OU or the root


# The following example shows how to move a member account from the root to an OU:/n/n

resp = client.({
  account_id: "333333333333", 
  destination_parent_id: "ou-examplerootid111-exampleouid111", 
  source_parent_id: "r-examplerootid111", 
})

Request syntax with placeholder values


resp = client.({
  account_id: "AccountId", # required
  source_parent_id: "ParentId", # required
  destination_parent_id: "ParentId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The unique identifier (ID) of the account that you want to move.

    The regex pattern for an account ID string requires exactly 12 digits.

  • :source_parent_id (required, String)

    The unique identifier (ID) of the root or organizational unit that you want to move the account from.

    The regex pattern for a parent ID string requires one of the following:

    • Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

  • :destination_parent_id (required, String)

    The unique identifier (ID) of the root or organizational unit that you want to move the account to.

    The regex pattern for a parent ID string requires one of the following:

    • Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits.

    • Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3544
3545
3546
3547
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3544

def (params = {}, options = {})
  req = build_request(:move_account, params)
  req.send_request(options)
end

#remove_account_from_organization(params = {}) ⇒ Struct

Removes the specified account from the organization.

The removed account becomes a stand-alone account that is not a member of any organization. It is no longer subject to any policies and is responsible for its own bill payments. The organization's master account is no longer charged for any expenses accrued by the member account after it is removed from the organization.

This operation can be called only from the organization's master account. Member accounts can remove themselves with LeaveOrganization instead.

  • You can remove only accounts that were created outside your organization and invited to join. If you created the account using the AWS Organizations console, the Organizations API, or the Organizations CLI commands, then you cannot remove the account.

  • You can remove a member account only after you enable IAM user access to billing in the member account. For more information, see Activating Access to the Billing and Cost Management Console in the AWS Billing and Cost Management User Guide.

Examples:

Example: To remove an account from an organization as the master account


# The following example shows you how to remove an account from an organization:

resp = client.({
  account_id: "333333333333", 
})

Request syntax with placeholder values


resp = client.({
  account_id: "AccountId", # required
})

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :account_id (required, String)

    The unique identifier (ID) of the member account that you want to remove from the organization.

    The regex pattern for an account ID string requires exactly 12 digits.

Returns:

  • (Struct)

    Returns an empty response.

See Also:



3607
3608
3609
3610
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3607

def (params = {}, options = {})
  req = build_request(:remove_account_from_organization, params)
  req.send_request(options)
end

#update_organizational_unit(params = {}) ⇒ Types::UpdateOrganizationalUnitResponse

Renames the specified organizational unit (OU). The ID and ARN do not change. The child OUs and accounts remain in place, and any attached policies of the OU remain attached.

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

Examples:

Example: To rename an organizational unit


# The following example shows how to rename an OU. The output confirms the new name:/n/n

resp = client.update_organizational_unit({
  name: "AccountingOU", 
  organizational_unit_id: "ou-examplerootid111-exampleouid111", 
})

resp.to_h outputs the following:
{
  organizational_unit: {
    arn: "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111", 
    id: "ou-examplerootid111-exampleouid111", 
    name: "AccountingOU", 
  }, 
}

Request syntax with placeholder values


resp = client.update_organizational_unit({
  organizational_unit_id: "OrganizationalUnitId", # required
  name: "OrganizationalUnitName",
})

Response structure


resp.organizational_unit.id #=> String
resp.organizational_unit.arn #=> String
resp.organizational_unit.name #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :organizational_unit_id (required, String)

    The unique identifier (ID) of the OU that you want to rename. You can get the ID from the ListOrganizationalUnitsForParent operation.

    The regex pattern for an organizational unit ID string requires "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that contains the OU) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.

  • :name (String)

    The new name that you want to assign to the OU.

    The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

Returns:

See Also:



3682
3683
3684
3685
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3682

def update_organizational_unit(params = {}, options = {})
  req = build_request(:update_organizational_unit, params)
  req.send_request(options)
end

#update_policy(params = {}) ⇒ Types::UpdatePolicyResponse

Updates an existing policy with a new name, description, or content. If any parameter is not supplied, that value remains unchanged. Note that you cannot change a policy's type.

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

Examples:

Example: To update the details of a policy


# The following example shows how to rename a policy and give it a new description and new content. The output confirms the new name and description text:/n/n

resp = client.update_policy({
  description: "This description replaces the original.", 
  name: "Renamed-Policy", 
  policy_id: "p-examplepolicyid111", 
})

resp.to_h outputs the following:
{
  policy: {
    content: "{ \"Version\": \"2012-10-17\", \"Statement\": { \"Effect\": \"Allow\", \"Action\": \"ec2:*\", \"Resource\": \"*\" } }", 
    policy_summary: {
      arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", 
      aws_managed: false, 
      description: "This description replaces the original.", 
      id: "p-examplepolicyid111", 
      name: "Renamed-Policy", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
  }, 
}

Example: To update the content of a policy


# The following example shows how to replace the JSON text of the SCP from the preceding example with a new JSON policy text string that allows S3 actions instead of EC2 actions:/n/n

resp = client.update_policy({
  content: "{ \\\"Version\\\": \\\"2012-10-17\\\", \\\"Statement\\\": {\\\"Effect\\\": \\\"Allow\\\", \\\"Action\\\": \\\"s3:*\\\", \\\"Resource\\\": \\\"*\\\" } }", 
  policy_id: "p-examplepolicyid111", 
})

resp.to_h outputs the following:
{
  policy: {
    content: "{ \\\"Version\\\": \\\"2012-10-17\\\", \\\"Statement\\\": { \\\"Effect\\\": \\\"Allow\\\", \\\"Action\\\": \\\"s3:*\\\", \\\"Resource\\\": \\\"*\\\" } }", 
    policy_summary: {
      arn: "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111", 
      aws_managed: false, 
      description: "This description replaces the original.", 
      id: "p-examplepolicyid111", 
      name: "Renamed-Policy", 
      type: "SERVICE_CONTROL_POLICY", 
    }, 
  }, 
}

Request syntax with placeholder values


resp = client.update_policy({
  policy_id: "PolicyId", # required
  name: "PolicyName",
  description: "PolicyDescription",
  content: "PolicyContent",
})

Response structure


resp.policy.policy_summary.id #=> String
resp.policy.policy_summary.arn #=> String
resp.policy.policy_summary.name #=> String
resp.policy.policy_summary.description #=> String
resp.policy.policy_summary.type #=> String, one of "SERVICE_CONTROL_POLICY"
resp.policy.policy_summary.aws_managed #=> Boolean
resp.policy.content #=> String

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :policy_id (required, String)

    The unique identifier (ID) of the policy that you want to update.

    The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

  • :name (String)

    If provided, the new name for the policy.

    The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

  • :description (String)

    If provided, the new description for the policy.

  • :content (String)

    If provided, the new content for the policy. The text must be correctly formatted JSON that complies with the syntax for the policy's type. For more information, see Service Control Policy Syntax in the AWS Organizations User Guide.

Returns:

See Also:



3804
3805
3806
3807
# File 'gems/aws-sdk-organizations/lib/aws-sdk-organizations/client.rb', line 3804

def update_policy(params = {}, options = {})
  req = build_request(:update_policy, params)
  req.send_request(options)
end