Class: Command

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

Direct Known Subclasses

InfisicalSDK::InfisicalCommands

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
# File 'lib/schemas.rb', line 838

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    get_secret:              d["getSecret"] ? GetSecretOptions.from_dynamic!(d["getSecret"]) : nil,
    list_secrets:            d["listSecrets"] ? ListSecretsOptions.from_dynamic!(d["listSecrets"]) : nil,
    create_secret:           d["createSecret"] ? CreateSecretOptions.from_dynamic!(d["createSecret"]) : nil,
    update_secret:           d["updateSecret"] ? UpdateSecretOptions.from_dynamic!(d["updateSecret"]) : nil,
    delete_secret:           d["deleteSecret"] ? DeleteSecretOptions.from_dynamic!(d["deleteSecret"]) : nil,
    create_symmetric_key:    d["createSymmetricKey"] ? ArbitraryOptions.from_dynamic!(d["createSymmetricKey"]) : nil,
    encrypt_symmetric:       d["encryptSymmetric"] ? EncryptSymmetricOptions.from_dynamic!(d["encryptSymmetric"]) : nil,
    decrypt_symmetric:       d["decryptSymmetric"] ? DecryptSymmetricOptions.from_dynamic!(d["decryptSymmetric"]) : nil,
    universal_auth_login:    d["universalAuthLogin"] ? UniversalAuthLoginClass.from_dynamic!(d["universalAuthLogin"]) : nil,
    kubernetes_auth_login:   d["kubernetesAuthLogin"] ? KubernetesAuthLoginClass.from_dynamic!(d["kubernetesAuthLogin"]) : nil,
    azure_auth_login:        d["azureAuthLogin"] ? AzureAuthLoginClass.from_dynamic!(d["azureAuthLogin"]) : nil,
    gcp_id_token_auth_login: d["gcpIdTokenAuthLogin"] ? GcpIDTokenAuthLoginClass.from_dynamic!(d["gcpIdTokenAuthLogin"]) : nil,
    gcp_iam_auth_login:      d["gcpIamAuthLogin"] ? GcpIamAuthLoginClass.from_dynamic!(d["gcpIamAuthLogin"]) : nil,
    aws_iam_auth_login:      d["awsIamAuthLogin"] ? AwsIamAuthLoginClass.from_dynamic!(d["awsIamAuthLogin"]) : nil,
  )
end

.from_json!(json) ⇒ Object



858
859
860
# File 'lib/schemas.rb', line 858

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

Instance Method Details

#to_dynamicObject



862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
# File 'lib/schemas.rb', line 862

def to_dynamic
  {
    "getSecret"           => get_secret&.to_dynamic,
    "listSecrets"         => list_secrets&.to_dynamic,
    "createSecret"        => create_secret&.to_dynamic,
    "updateSecret"        => update_secret&.to_dynamic,
    "deleteSecret"        => delete_secret&.to_dynamic,
    "createSymmetricKey"  => create_symmetric_key&.to_dynamic,
    "encryptSymmetric"    => encrypt_symmetric&.to_dynamic,
    "decryptSymmetric"    => decrypt_symmetric&.to_dynamic,
    "universalAuthLogin"  => &.to_dynamic,
    "kubernetesAuthLogin" => &.to_dynamic,
    "azureAuthLogin"      => &.to_dynamic,
    "gcpIdTokenAuthLogin" => &.to_dynamic,
    "gcpIamAuthLogin"     => &.to_dynamic,
    "awsIamAuthLogin"     => &.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



881
882
883
# File 'lib/schemas.rb', line 881

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