# CertificatesApi

All URIs are relative to *<https://api.ionos.com>*

| Method                                                   | HTTP request                                                | Description                     |
| -------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------- |
| [**certificates\_delete**](#certificates_delete)         | **DELETE** /certificatemanager/certificates/{certificateId} | Delete a Certificate by ID      |
| [**certificates\_get**](#certificates_get)               | **GET** /certificatemanager/certificates                    | Get Certificates                |
| [**certificates\_get\_by\_id**](#certificates_get_by_id) | **GET** /certificatemanager/certificates/{certificateId}    | Get a Certificate by ID         |
| [**certificates\_patch**](#certificates_patch)           | **PATCH** /certificatemanager/certificates/{certificateId}  | Update a Certificate Name by ID |
| [**certificates\_post**](#certificates_post)             | **POST** /certificatemanager/certificates                   | Add a New Certificate           |

## certificates\_delete

> certificates\_delete(certificate\_id)

Delete a Certificate by ID

Deletes a certificate specified by its ID.

### Examples

```ruby
require 'time'
require 'ionoscloud-cert-manager'
# setup authorization
IonoscloudCertManager.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudCertManager::CertificatesApi.new
certificate_id = 'certificate_id_example' # String | 

begin
  # Delete a Certificate by ID
  api_instance.certificates_delete(certificate_id)
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_delete: #{e}"
end
```

#### Using the certificates\_delete\_with\_http\_info variant

This returns an Array which contains the response data (`nil` in this case), status code and headers.

> \<Array(nil, Integer, Hash)> certificates\_delete\_with\_http\_info(certificate\_id)

```ruby
begin
  # Delete a Certificate by ID
  data, status_code, headers = api_instance.certificates_delete_with_http_info(certificate_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => nil
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_delete_with_http_info: #{e}"
end
```

### Parameters

| Name                | Type       | Description | Notes |
| ------------------- | ---------- | ----------- | ----- |
| **certificate\_id** | **String** |             |       |

### Return type

nil (empty response body)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: Not defined

## certificates\_get

> certificates\_get(opts)

Get Certificates

Retrieves all available certificates.

### Examples

```ruby
require 'time'
require 'ionoscloud-cert-manager'
# setup authorization
IonoscloudCertManager.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudCertManager::CertificatesApi.new
opts = {
  offset: 'offset_example', # String | 'Limit' and 'Offset' are optional; you can use these filter parameters to retrieve only part of the results obtained by a request.  Offset is the first element (from the complete list of elements) to be included in the response.
  limit: 'limit_example' # String | 'Limit' and 'Offset' are optional; you can use these filter parameters to retrieve only part of the results of a query.  If both 'Offset' and 'Limit'are specified, the offset lines are skipped before counting the returned limit lines.
}

begin
  # Get Certificates
  result = api_instance.certificates_get(opts)
  p result
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_get: #{e}"
end
```

#### Using the certificates\_get\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> certificates\_get\_with\_http\_info(opts)

```ruby
begin
  # Get Certificates
  data, status_code, headers = api_instance.certificates_get_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CertificateCollectionDto>
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_get_with_http_info: #{e}"
end
```

### Parameters

| Name       | Type       | Description                                                                                                                                                                                                                               | Notes       |
| ---------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| **offset** | **String** | 'Limit' and 'Offset' are optional; you can use these filter parameters to retrieve only part of the results obtained by a request. Offset is the first element (from the complete list of elements) to be included in the response.       | \[optional] |
| **limit**  | **String** | 'Limit' and 'Offset' are optional; you can use these filter parameters to retrieve only part of the results of a query. If both 'Offset' and 'Limit'are specified, the offset lines are skipped before counting the returned limit lines. | \[optional] |

### Return type

[**CertificateCollectionDto**](https://github.com/ionos-cloud/sdk-ruby-cert-manager/blob/master/docs/api/CertificateCollectionDto.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## certificates\_get\_by\_id

> certificates\_get\_by\_id(certificate\_id)

Get a Certificate by ID

Retrieves a certificate specified by its ID.

### Examples

```ruby
require 'time'
require 'ionoscloud-cert-manager'
# setup authorization
IonoscloudCertManager.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudCertManager::CertificatesApi.new
certificate_id = 'certificate_id_example' # String | 

begin
  # Get a Certificate by ID
  result = api_instance.certificates_get_by_id(certificate_id)
  p result
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_get_by_id: #{e}"
end
```

#### Using the certificates\_get\_by\_id\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> certificates\_get\_by\_id\_with\_http\_info(certificate\_id)

```ruby
begin
  # Get a Certificate by ID
  data, status_code, headers = api_instance.certificates_get_by_id_with_http_info(certificate_id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CertificateDto>
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_get_by_id_with_http_info: #{e}"
end
```

### Parameters

| Name                | Type       | Description | Notes |
| ------------------- | ---------- | ----------- | ----- |
| **certificate\_id** | **String** |             |       |

### Return type

[**CertificateDto**](https://github.com/ionos-cloud/sdk-ruby-cert-manager/blob/master/docs/api/CertificateDto.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## certificates\_patch

> certificates\_patch(certificate\_id, certificate\_patch\_dto)

Update a Certificate Name by ID

Updates the name of the specified certificate.

### Examples

```ruby
require 'time'
require 'ionoscloud-cert-manager'
# setup authorization
IonoscloudCertManager.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudCertManager::CertificatesApi.new
certificate_id = 'certificate_id_example' # String | 
certificate_patch_dto = IonoscloudCertManager::CertificatePatchDto.new({properties: IonoscloudCertManager::CertificatePatchPropertiesDto.new({name: 'My Certificate'})}) # CertificatePatchDto | 

begin
  # Update a Certificate Name by ID
  result = api_instance.certificates_patch(certificate_id, certificate_patch_dto)
  p result
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_patch: #{e}"
end
```

#### Using the certificates\_patch\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> certificates\_patch\_with\_http\_info(certificate\_id, certificate\_patch\_dto)

```ruby
begin
  # Update a Certificate Name by ID
  data, status_code, headers = api_instance.certificates_patch_with_http_info(certificate_id, certificate_patch_dto)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CertificateDto>
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_patch_with_http_info: #{e}"
end
```

### Parameters

| Name                        | Type                                                                                                                        | Description | Notes |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----------- | ----- |
| **certificate\_id**         | **String**                                                                                                                  |             |       |
| **certificate\_patch\_dto** | [**CertificatePatchDto**](https://github.com/ionos-cloud/sdk-ruby-cert-manager/blob/master/docs/api/CertificatePatchDto.md) |             |       |

### Return type

[**CertificateDto**](https://github.com/ionos-cloud/sdk-ruby-cert-manager/blob/master/docs/api/CertificateDto.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## certificates\_post

> certificates\_post(certificate\_post\_dto)

Add a New Certificate

Adds a new PEM (Privacy Enhanced Mail) file that is used to store SSL certificates and their associated private keys.

### Examples

```ruby
require 'time'
require 'ionoscloud-cert-manager'
# setup authorization
IonoscloudCertManager.configure do |config|
  # Configure HTTP basic authorization: basicAuth
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: tokenAuth
  config.api_key['Authorization'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['Authorization'] = 'Bearer'
end

api_instance = IonoscloudCertManager::CertificatesApi.new
certificate_post_dto = IonoscloudCertManager::CertificatePostDto.new({properties: IonoscloudCertManager::CertificatePostPropertiesDto.new({name: 'My Certificate', certificate: '-----BEGIN CERTIFICATE-----MIIE5TCCAs2gAwIBAgIBATANBgkqhkiG9w0BAQsFADA2MQswCQYDVQQGEwJSTzEK-----END CERTIFICATE-----', certificate_chain: '-----BEGIN CERTIFICATE-----MIIDoTCCAokCFDrAUWffdxWJVz2Axl9lp/4xiUteMA0GCSqGSIb3DQEBCwUAMIGG-----END CERTIFICATE-----', private_key: '-----BEGIN RSA PRIVATE KEY-----MIIJKQIBAAKCAgEAzDehfqWBr+9q0pxwCDDRph7QSPiMbkDGaGKc+Fd2h3doT8Li-----END RSA PRIVATE KEY-----'})}) # CertificatePostDto | 

begin
  # Add a New Certificate
  result = api_instance.certificates_post(certificate_post_dto)
  p result
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_post: #{e}"
end
```

#### Using the certificates\_post\_with\_http\_info variant

This returns an Array which contains the response data, status code and headers.

> \<Array(, Integer, Hash)> certificates\_post\_with\_http\_info(certificate\_post\_dto)

```ruby
begin
  # Add a New Certificate
  data, status_code, headers = api_instance.certificates_post_with_http_info(certificate_post_dto)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <CertificateDto>
rescue IonoscloudCertManager::ApiError => e
  puts "Error when calling CertificatesApi->certificates_post_with_http_info: #{e}"
end
```

### Parameters

| Name                       | Type                                                                                                                      | Description | Notes |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ----------- | ----- |
| **certificate\_post\_dto** | [**CertificatePostDto**](https://github.com/ionos-cloud/sdk-ruby-cert-manager/blob/master/docs/api/CertificatePostDto.md) |             |       |

### Return type

[**CertificateDto**](https://github.com/ionos-cloud/sdk-ruby-cert-manager/blob/master/docs/api/CertificateDto.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json
