Class: Telnyx::Resources::Storage::Kvs
- Inherits:
-
Object
- Object
- Telnyx::Resources::Storage::Kvs
- Defined in:
- lib/telnyx/resources/storage/kvs.rb,
lib/telnyx/resources/storage/kvs/keys.rb,
sig/telnyx/resources/storage/kvs.rbs,
sig/telnyx/resources/storage/kvs/keys.rbs
Overview
Manage KV storage namespaces
Defined Under Namespace
Classes: Keys
Instance Attribute Summary collapse
-
#keys ⇒ Telnyx::Resources::Storage::Kvs::Keys
readonly
Read and write keys within a KV namespace.
Instance Method Summary collapse
-
#create(name:, request_options: {}) ⇒ Telnyx::Models::Storage::KvNamespaceResponseWrapper
Creates a new KV namespace.
-
#delete(id, request_options: {}) ⇒ Telnyx::Models::Storage::KvNamespaceResponseWrapper
Deletes a KV namespace and all of the keys it contains.
-
#initialize(client:) ⇒ Kvs
constructor
private
A new instance of Kvs.
-
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Storage::KvNamespace>
Lists the KV namespaces for the authenticated user's organization.
-
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::Storage::KvNamespaceResponseWrapper
Retrieves a KV namespace by its ID, including its provisioning status.
Constructor Details
#initialize(client:) ⇒ Kvs
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 Kvs.
108 109 110 111 |
# File 'lib/telnyx/resources/storage/kvs.rb', line 108 def initialize(client:) @client = client @keys = Telnyx::Resources::Storage::Kvs::Keys.new(client: client) end |
Instance Attribute Details
#keys ⇒ Telnyx::Resources::Storage::Kvs::Keys (readonly)
Read and write keys within a KV namespace
10 11 12 |
# File 'lib/telnyx/resources/storage/kvs.rb', line 10 def keys @keys end |
Instance Method Details
#create(name:, request_options: {}) ⇒ Telnyx::Models::Storage::KvNamespaceResponseWrapper
Creates a new KV namespace. Provisioning is asynchronous: the namespace is
returned with status pending and becomes usable once it reaches
provision_ok.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/telnyx/resources/storage/kvs.rb', line 25 def create(params) parsed, = Telnyx::Storage::KvCreateParams.dump_request(params) @client.request( method: :post, path: "storage/kvs", body: parsed, model: Telnyx::Storage::KvNamespaceResponseWrapper, options: ) end |
#delete(id, request_options: {}) ⇒ Telnyx::Models::Storage::KvNamespaceResponseWrapper
Deletes a KV namespace and all of the keys it contains. Deletion is
asynchronous: the namespace is returned with status deleting. Deleting a
namespace whose deletion is already in progress returns a 409.
96 97 98 99 100 101 102 103 |
# File 'lib/telnyx/resources/storage/kvs.rb', line 96 def delete(id, params = {}) @client.request( method: :delete, path: ["storage/kvs/%1$s", id], model: Telnyx::Storage::KvNamespaceResponseWrapper, options: params[:request_options] ) end |
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Storage::KvNamespace>
Lists the KV namespaces for the authenticated user's organization. Results use
page-based pagination (page[number]/page[size]).
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/telnyx/resources/storage/kvs.rb', line 70 def list(params = {}) parsed, = Telnyx::Storage::KvListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "storage/kvs", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::Storage::KvNamespace, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::Storage::KvNamespaceResponseWrapper
Retrieves a KV namespace by its ID, including its provisioning status.
47 48 49 50 51 52 53 54 |
# File 'lib/telnyx/resources/storage/kvs.rb', line 47 def retrieve(id, params = {}) @client.request( method: :get, path: ["storage/kvs/%1$s", id], model: Telnyx::Storage::KvNamespaceResponseWrapper, options: params[:request_options] ) end |