Class: OpenAI::Resources::Admin::Organization::Projects::ServiceAccounts::APIKeys

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/admin/organization/projects/service_accounts/api_keys.rb,
sig/openai/resources/admin/organization/projects/service_accounts/api_keys.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ APIKeys

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

Parameters:



51
52
53
# File 'lib/openai/resources/admin/organization/projects/service_accounts/api_keys.rb', line 51

def initialize(client:)
  @client = client
end

Instance Method Details

#create(service_account_id, project_id:, name: nil, scopes: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Projects::ServiceAccounts::APIKeyCreateResponse

Creates an API key for a service account in the project.

Parameters:

  • service_account_id (String)

    Path param: The ID of the service account.

  • project_id (String)

    Path param: The ID of the project.

  • name (String)

    Body param: API key name.

  • scopes (Array<String>)

    Body param: API key scopes.

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/openai/resources/admin/organization/projects/service_accounts/api_keys.rb', line 27

def create(, params)
  parsed, options =
    OpenAI::Admin::Organization::Projects::ServiceAccounts::APIKeyCreateParams.dump_request(params)
  project_id =
    parsed.delete(:project_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: [
      "organization/projects/%1$s/service_accounts/%2$s/api_keys",
      project_id,
      
    ],
    body: parsed,
    model: OpenAI::Models::Admin::Organization::Projects::ServiceAccounts::APIKeyCreateResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end