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

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

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:



201
202
203
# File 'lib/openai/resources/admin/organization/certificates.rb', line 201

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:



160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/openai/resources/admin/organization/certificates.rb', line 160

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:



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

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:



185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/openai/resources/admin/organization/certificates.rb', line 185

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:



138
139
140
141
142
143
144
145
146
# File 'lib/openai/resources/admin/organization/certificates.rb', line 138

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>

Some parameter documentations has been truncated, see Models::Admin::Organization::CertificateListParams for more details.

List uploaded certificates for this organization.

Parameters:

  • after (String)

    A cursor for use in pagination. ‘after` is an object ID that defines your place

  • limit (Integer)

    A limit on the number of objects to be returned. Limit can range between 1 and 1

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

    Sort order by the ‘created_at` timestamp of the objects. `asc` for ascending ord

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

Returns:

See Also:



111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/openai/resources/admin/organization/certificates.rb', line 111

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

Some parameter documentations has been truncated, see Models::Admin::Organization::CertificateRetrieveParams for more details.

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:



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

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:



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/openai/resources/admin/organization/certificates.rb', line 81

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