# Fastly::TlsPrivateKeysApi ```ruby require 'fastly' api_instance = Fastly::TlsPrivateKeysApi.new ``` ## Methods > [!NOTE] > All URIs are relative to `https://api.fastly.com` Method | HTTP request | Description ------ | ------------ | ----------- [**create_tls_key**](TlsPrivateKeysApi.md#create_tls_key) | **POST** /tls/private_keys | Create a TLS private key [**delete_tls_key**](TlsPrivateKeysApi.md#delete_tls_key) | **DELETE** /tls/private_keys/{tls_private_key_id} | Delete a TLS private key [**get_tls_key**](TlsPrivateKeysApi.md#get_tls_key) | **GET** /tls/private_keys/{tls_private_key_id} | Get a TLS private key [**list_tls_keys**](TlsPrivateKeysApi.md#list_tls_keys) | **GET** /tls/private_keys | List TLS private keys ## `create_tls_key()` ```ruby create_tls_key(opts): # Create a TLS private key ``` Create a TLS private key. ### Examples ```ruby api_instance = Fastly::TlsPrivateKeysApi.new opts = { tls_private_key: Fastly::TlsPrivateKey.new, # TlsPrivateKey | } begin # Create a TLS private key result = api_instance.create_tls_key(opts) p result rescue Fastly::ApiError => e puts "Error when calling TlsPrivateKeysApi->create_tls_key: #{e}" end ``` ### Options | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **tls_private_key** | [**TlsPrivateKey**](TlsPrivateKey.md) | | [optional] | ### Return type [**TlsPrivateKeyResponse**](TlsPrivateKeyResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) ## `delete_tls_key()` ```ruby delete_tls_key(opts) # Delete a TLS private key ``` Destroy a TLS private key. Only private keys not already matched to any certificates can be deleted. ### Examples ```ruby api_instance = Fastly::TlsPrivateKeysApi.new opts = { tls_private_key_id: 'tls_private_key_id_example', # String | Alphanumeric string identifying a private Key. } begin # Delete a TLS private key api_instance.delete_tls_key(opts) rescue Fastly::ApiError => e puts "Error when calling TlsPrivateKeysApi->delete_tls_key: #{e}" end ``` ### Options | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **tls_private_key_id** | **String** | Alphanumeric string identifying a private Key. | | ### Return type nil (empty response body) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) ## `get_tls_key()` ```ruby get_tls_key(opts): # Get a TLS private key ``` Show a TLS private key. ### Examples ```ruby api_instance = Fastly::TlsPrivateKeysApi.new opts = { tls_private_key_id: 'tls_private_key_id_example', # String | Alphanumeric string identifying a private Key. } begin # Get a TLS private key result = api_instance.get_tls_key(opts) p result rescue Fastly::ApiError => e puts "Error when calling TlsPrivateKeysApi->get_tls_key: #{e}" end ``` ### Options | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **tls_private_key_id** | **String** | Alphanumeric string identifying a private Key. | | ### Return type [**TlsPrivateKeyResponse**](TlsPrivateKeyResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) ## `list_tls_keys()` ```ruby list_tls_keys(opts): # List TLS private keys ``` List all TLS private keys. ### Examples ```ruby api_instance = Fastly::TlsPrivateKeysApi.new opts = { filter_in_use: 'filter_in_use_example', # String | Limit the returned keys to those without any matching TLS certificates. The only valid value is false. page_number: 1, # Integer | Current page. page_size: 20, # Integer | Number of records per page. } begin # List TLS private keys result = api_instance.list_tls_keys(opts) p result rescue Fastly::ApiError => e puts "Error when calling TlsPrivateKeysApi->list_tls_keys: #{e}" end ``` ### Options | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **filter_in_use** | **String** | Limit the returned keys to those without any matching TLS certificates. The only valid value is false. | [optional] | | **page_number** | **Integer** | Current page. | [optional] | | **page_size** | **Integer** | Number of records per page. | [optional][default to 20] | ### Return type [**TlsPrivateKeysResponse**](TlsPrivateKeysResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)