Class: SecretsCommand

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Overview

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve a secret by the provided identifier

Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Retrieve secrets by the provided identifiers

Returns: [SecretsResponse](bitwarden::secrets_manager::secrets::SecretsResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Creates a new secret in the provided organization using the given data

Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Lists all secret identifiers of the given organization, to then retrieve each secret, use ‘CreateSecret`

Returns: [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Updates an existing secret with the provided ID using the given data

Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse)

> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones

Returns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
# File 'lib/schemas.rb', line 1165

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    get:        d["get"] ? SecretGetRequest.from_dynamic!(d["get"]) : nil,
    get_by_ids: d["getByIds"] ? SecretsGetRequest.from_dynamic!(d["getByIds"]) : nil,
    create:     d["create"] ? SecretCreateRequest.from_dynamic!(d["create"]) : nil,
    list:       d["list"] ? SecretIdentifiersRequest.from_dynamic!(d["list"]) : nil,
    update:     d["update"] ? SecretPutRequest.from_dynamic!(d["update"]) : nil,
    delete:     d["delete"] ? SecretsDeleteRequest.from_dynamic!(d["delete"]) : nil,
  )
end

.from_json!(json) ⇒ Object



1177
1178
1179
# File 'lib/schemas.rb', line 1177

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
# File 'lib/schemas.rb', line 1181

def to_dynamic
  {
    "get"      => get&.to_dynamic,
    "getByIds" => get_by_ids&.to_dynamic,
    "create"   => create&.to_dynamic,
    "list"     => list&.to_dynamic,
    "update"   => update&.to_dynamic,
    "delete"   => delete&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



1192
1193
1194
# File 'lib/schemas.rb', line 1192

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end