Class: OpenAI::Resources::Admin::Organization::Certificates

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Certificates

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

Parameters:



210
211
212
# File 'lib/openai/resources/admin/organization/certificates.rb', line 210

def initialize(client:)
  @client = client
end

Instance Method Details

#activate(certificate_ids:, request_options: {}) ⇒ OpenAI::Internal::Page<OpenAI::Models::Admin::Organization::CertificateActivateResponse>

Activate certificates at the organization level.

You can atomically and idempotently activate up to 10 certificates at a time.

Parameters:

Returns:

See Also:



169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/openai/resources/admin/organization/certificates.rb', line 169

def activate(params)
  parsed, options = OpenAI::Admin::Organization::CertificateActivateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "organization/certificates/activate",
    body: parsed,
    page: OpenAI::Internal::Page,
    model: OpenAI::Models::Admin::Organization::CertificateActivateResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#create(certificate:, name: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Certificate

Upload a certificate to the organization. This does not automatically activate the certificate.

Organizations can upload up to 50 certificates.

Parameters:

  • certificate (String) —

    The certificate content in PEM format

  • name (String) —

    An optional name for the certificate

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/openai/resources/admin/organization/certificates.rb', line 26

def create(params)
  parsed, options = OpenAI::Admin::Organization::CertificateCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "organization/certificates",
    body: parsed,
    model: OpenAI::Admin::Organization::Certificate,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#deactivate(certificate_ids:, request_options: {}) ⇒ OpenAI::Internal::Page<OpenAI::Models::Admin::Organization::CertificateDeactivateResponse>

Deactivate certificates at the organization level.

You can atomically and idempotently deactivate up to 10 certificates at a time.

Parameters:

Returns:

See Also:



194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/openai/resources/admin/organization/certificates.rb', line 194

def deactivate(params)
  parsed, options = OpenAI::Admin::Organization::CertificateDeactivateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "organization/certificates/deactivate",
    body: parsed,
    page: OpenAI::Internal::Page,
    model: OpenAI::Models::Admin::Organization::CertificateDeactivateResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#delete(certificate_id, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::CertificateDeleteResponse

Delete a certificate from the organization.

The certificate must be inactive for the organization and all projects.

Parameters:

  • certificate_id (String) —

    Unique ID of the certificate to delete.

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

Returns:

See Also:



147
148
149
150
151
152
153
154
155
# File 'lib/openai/resources/admin/organization/certificates.rb', line 147

def delete(certificate_id, params = {})
  @client.request(
    method: :delete,
    path: ["organization/certificates/%1$s", certificate_id],
    model: OpenAI::Models::Admin::Organization::CertificateDeleteResponse,
    security: {admin_api_key_auth: true},
    options: params[:request_options]
  )
end

#list(after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Admin::Organization::CertificateListResponse>

List uploaded certificates for this organization.

Parameters:

  • after (String) —

    A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

  • limit (Integer) —

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

  • order (Symbol, OpenAI::Models::Admin::Organization::CertificateListParams::Order) —

    Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

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

Returns:

See Also:



119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/openai/resources/admin/organization/certificates.rb', line 119

def list(params = {})
  parsed, options = OpenAI::Admin::Organization::CertificateListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "organization/certificates",
    query: query,
    page: OpenAI::Internal::ConversationCursorPage,
    model: OpenAI::Models::Admin::Organization::CertificateListResponse,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#retrieve(certificate_id, include: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Certificate

Get a certificate that has been uploaded to the organization.

You can get a certificate regardless of whether it is active or not.

Parameters:

Returns:

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/openai/resources/admin/organization/certificates.rb', line 56

def retrieve(certificate_id, params = {})
  parsed, options = OpenAI::Admin::Organization::CertificateRetrieveParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["organization/certificates/%1$s", certificate_id],
    query: query,
    model: OpenAI::Admin::Organization::Certificate,
    security: {admin_api_key_auth: true},
    options: options
  )
end

#update(certificate_id, name: nil, request_options: {}) ⇒ OpenAI::Models::Admin::Organization::Certificate

Modify a certificate. Note that only the name can be modified.

Parameters:

  • certificate_id (String) —

    Unique ID of the certificate to modify.

  • name (String) —

    The updated name for the certificate

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

Returns:

See Also:



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/openai/resources/admin/organization/certificates.rb', line 84

def update(certificate_id, params = {})
  parsed, options = OpenAI::Admin::Organization::CertificateUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["organization/certificates/%1$s", certificate_id],
    body: parsed,
    model: OpenAI::Admin::Organization::Certificate,
    security: {admin_api_key_auth: true},
    options: options
  )
end