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)

> Requires Authentication > Requires using an Access Token for login Retrieve the secrets accessible by the authenticated machine account Optionally, provide the last synced date to assess whether any changes have occurred If changes are detected, retrieves all the secrets accessible by the authenticated machine account

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
# File 'lib/schemas.rb', line 1307

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,
    sync:       d["sync"] ? SecretsSyncRequest.from_dynamic!(d["sync"]) : nil,
  )
end

.from_json!(json) ⇒ Object



1320
1321
1322
# File 'lib/schemas.rb', line 1320

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

Instance Method Details

#to_dynamicObject



1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
# File 'lib/schemas.rb', line 1324

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,
    "sync"     => sync&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



1336
1337
1338
# File 'lib/schemas.rb', line 1336

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