Class: Anthropic::Resources::Beta::Organization::ExternalKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/organization/external_keys.rb,
sig/anthropic/resources/beta/organization/external_keys.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ExternalKeys

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ExternalKeys.

Parameters:



165
166
167
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 165

def initialize(client:)
  @client = client
end

Instance Method Details

#create(provider_config:, display_name: nil, geo: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaExternalKey

Create an external key config owned by the caller's organization.

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 23

def create(params)
  parsed, options = Anthropic::Beta::Organization::ExternalKeyCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/organizations/external_keys?beta=true",
    body: parsed,
    model: Anthropic::Beta::Organization::BetaExternalKey,
    options: options
  )
end

#delete(external_key_id, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::ExternalKeyDeleteResponse

Delete an external key config.

The request is rejected if any workspace still references this config.

Parameters:

  • external_key_id (String)

    ID of the External Key.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



128
129
130
131
132
133
134
135
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 128

def delete(external_key_id, params = {})
  @client.request(
    method: :delete,
    path: ["v1/organizations/external_keys/%1$s?beta=true", external_key_id],
    model: Anthropic::Models::Beta::Organization::ExternalKeyDeleteResponse,
    options: params[:request_options]
  )
end

#list(limit: nil, page: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::Organization::BetaExternalKey>

List external key configs in the caller's organization.

Results are ordered by creation time (newest first). Use the next_page cursor from the response to fetch subsequent pages.

Parameters:

  • limit (Integer)

    Number of results per page.

  • page (String, nil)

    Opaque cursor from a previous response's next_page.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 102

def list(params = {})
  parsed, options = Anthropic::Beta::Organization::ExternalKeyListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/organizations/external_keys?beta=true",
    query: query,
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::Organization::BetaExternalKey,
    options: options
  )
end

#retrieve(external_key_id, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaExternalKey

Retrieve a single external key config in the caller's organization by ID.

Parameters:

  • external_key_id (String)

    ID of the External Key.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



45
46
47
48
49
50
51
52
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 45

def retrieve(external_key_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/organizations/external_keys/%1$s?beta=true", external_key_id],
    model: Anthropic::Beta::Organization::BetaExternalKey,
    options: params[:request_options]
  )
end

#update(external_key_id, display_name: nil, geo: nil, provider_config: nil, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::BetaExternalKey

Partially update an external key config. Omitted fields are left unchanged.

display_name is always editable. geo and provider_config cannot be changed once any workspace references this config, because previously encrypted data requires the original key identity to decrypt.

Parameters:

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 75

def update(external_key_id, params = {})
  parsed, options = Anthropic::Beta::Organization::ExternalKeyUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/organizations/external_keys/%1$s?beta=true", external_key_id],
    body: parsed,
    model: Anthropic::Beta::Organization::BetaExternalKey,
    options: options
  )
end

#validate(external_key_id, request_options: {}) ⇒ Anthropic::Models::Beta::Organization::ExternalKeyValidateResponse

Validate an external key config against the customer's KMS.

Anthropic performs an encrypt/decrypt roundtrip against the configured KMS key and waits up to 30 seconds for the result. The response status is success if the roundtrip succeeded, or failure with an error message if it failed or timed out.

Parameters:

  • external_key_id (String)

    ID of the External Key.

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



153
154
155
156
157
158
159
160
# File 'lib/anthropic/resources/beta/organization/external_keys.rb', line 153

def validate(external_key_id, params = {})
  @client.request(
    method: :post,
    path: ["v1/organizations/external_keys/%1$s/validate?beta=true", external_key_id],
    model: Anthropic::Models::Beta::Organization::ExternalKeyValidateResponse,
    options: params[:request_options]
  )
end