Sha256: c6fef0b2ff89dfc89964e23d767b99eb4e8b5c0b13f3193b6dd004571b5bf2cc

Contents?: true

Size: 993 Bytes

Versions: 16

Compression:

Stored size: 993 Bytes

Contents

# Create a service account returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::UsersAPI.new

# there is a valid "role" in the system
ROLE_DATA_ID = ENV["ROLE_DATA_ID"]

body = DatadogAPIClient::V2::ServiceAccountCreateRequest.new({
  data: DatadogAPIClient::V2::ServiceAccountCreateData.new({
    type: DatadogAPIClient::V2::UsersType::USERS,
    attributes: DatadogAPIClient::V2::ServiceAccountCreateAttributes.new({
      name: "Test API Client",
      email: "Example-Create_a_service_account_returns_OK_response@datadoghq.com",
      service_account: true,
    }),
    relationships: DatadogAPIClient::V2::UserRelationships.new({
      roles: DatadogAPIClient::V2::RelationshipToRoles.new({
        data: [
          DatadogAPIClient::V2::RelationshipToRoleData.new({
            id: ROLE_DATA_ID,
            type: DatadogAPIClient::V2::RolesType::ROLES,
          }),
        ],
      }),
    }),
  }),
})
p api_instance.create_service_account(body)

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
datadog_api_client-2.6.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.5.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.4.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.3.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.2.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.1.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.0.2 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.0.1 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-2.0.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.11.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.10.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.9.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.8.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.7.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.6.0 examples/v2/users/CreateServiceAccount.rb
datadog_api_client-1.5.0 examples/v2/users/CreateServiceAccount.rb