Class: Cadenya::Resources::WorkspaceSecrets

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/resources/workspace_secrets.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ WorkspaceSecrets

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

Parameters:



171
172
173
# File 'lib/cadenya/resources/workspace_secrets.rb', line 171

def initialize(client:)
  @client = client
end

Instance Method Details

#create(workspace_id, metadata:, spec:, request_options: {}) ⇒ Cadenya::Models::WorkspaceSecret

Some parameter documentations has been truncated, see Models::WorkspaceSecretCreateParams for more details.

Creates a new workspace secret in the workspace

Parameters:

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
# File 'lib/cadenya/resources/workspace_secrets.rb', line 24

def create(workspace_id, params)
  parsed, options = Cadenya::WorkspaceSecretCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/workspaces/%1$s/workspace_secrets", workspace_id],
    body: parsed,
    model: Cadenya::WorkspaceSecret,
    options: options
  )
end

#delete(id, workspace_id:, request_options: {}) ⇒ nil

Deletes a workspace secret from the workspace

Parameters:

  • id (String)

    The secret to delete.

  • workspace_id (String)

    The workspace the secret belongs to.

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

Returns:

  • (nil)

See Also:



154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/cadenya/resources/workspace_secrets.rb', line 154

def delete(id, params)
  parsed, options = Cadenya::WorkspaceSecretDeleteParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/workspaces/%1$s/workspace_secrets/%2$s", workspace_id, id],
    model: NilClass,
    options: options
  )
end

#list(workspace_id, bundle_key: nil, cursor: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::WorkspaceSecret>

Lists all workspace secrets in the workspace

Parameters:

  • workspace_id (String)

    The workspace whose secrets will be listed.

  • bundle_key (String)

    Filter by bundle_key — return only resources owned by this bundle.

  • cursor (String)

    Pagination cursor from previous response

  • include_info (Boolean)

    When set to true you may use more of your alloted API rate-limit

  • limit (Integer)

    Maximum number of results to return

  • prefix (String)

    Filter expression (query param: prefix)

  • query (String)

    Free-form search query

  • sort_order (String)

    Sort order for results (asc or desc by creation time)

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

Returns:

See Also:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cadenya/resources/workspace_secrets.rb', line 124

def list(workspace_id, params = {})
  parsed, options = Cadenya::WorkspaceSecretListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/workspace_secrets", workspace_id],
    query: query.transform_keys(
      bundle_key: "bundleKey",
      include_info: "includeInfo",
      sort_order: "sortOrder"
    ),
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::WorkspaceSecret,
    options: options
  )
end

#retrieve(id, workspace_id:, request_options: {}) ⇒ Cadenya::Models::WorkspaceSecret

Retrieves a workspace secret by ID from the workspace

Parameters:

  • id (String)

    The secret to retrieve.

  • workspace_id (String)

    The workspace the secret belongs to.

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

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cadenya/resources/workspace_secrets.rb', line 48

def retrieve(id, params)
  parsed, options = Cadenya::WorkspaceSecretRetrieveParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/workspace_secrets/%2$s", workspace_id, id],
    model: Cadenya::WorkspaceSecret,
    options: options
  )
end

#update(id, workspace_id:, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::WorkspaceSecret

Some parameter documentations has been truncated, see Models::WorkspaceSecretUpdateParams for more details.

Updates a workspace secret in the workspace

Parameters:

Returns:

See Also:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cadenya/resources/workspace_secrets.rb', line 84

def update(id, params)
  parsed, options = Cadenya::WorkspaceSecretUpdateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["v1/workspaces/%1$s/workspace_secrets/%2$s", workspace_id, id],
    body: parsed,
    model: Cadenya::WorkspaceSecret,
    options: options
  )
end