Class: AnsibleTowerClient::Credential

Inherits:
BaseModel show all
Defined in:
lib/ansible_tower_client/base_models/credential.rb

Constant Summary collapse

KIND_CHOICES =
{
  'ssh'        => 'Machine',
  'net'        => 'Network',
  'scm'        => 'Source Control',
  'aws'        => 'Amazon Web Services',
  'vmware'     => 'VMware vCenter',
  'satellite6' => 'Red Hat Satellite 6',
  'cloudforms' => 'Red Hat CloudForms',
  'gce'        => 'Google Compute Engine',
  'azure_rm'   => 'Microsoft Azure Resource Manager',
  'openstack'  => 'OpenStack',
  'rhv'        => 'Red Hat Virtualization',
  'insights'   => 'Insights',
  'tower'      => 'Ansible Tower',
}.invert

Instance Attribute Summary

Attributes inherited from BaseModel

#api, #raw_hash

Instance Method Summary collapse

Methods inherited from BaseModel

base_class, create, create!, #destroy, #destroy!, endpoint, #hashify, #initialize, #save, #save!, #update_attributes, #update_attributes!

Methods inherited from HashModel

#==, #[], #initialize, #inspect, #to_h, #to_json

Constructor Details

This class inherits a constructor from AnsibleTowerClient::BaseModel

Instance Method Details

#credential_typeObject



37
38
39
# File 'lib/ansible_tower_client/base_models/credential.rb', line 37

def credential_type
  @credential_type ||= api.credential_types.find(credential_type_id)
end

#kindObject



30
31
32
33
34
35
# File 'lib/ansible_tower_client/base_models/credential.rb', line 30

def kind
  @data['kind'] ||= begin
    kind = credential_type.kind
    kind == 'cloud' ? KIND_CHOICES[credential_type.name] : kind
  end.to_s
end

#override_raw_attributesObject



3
4
5
6
7
8
# File 'lib/ansible_tower_client/base_models/credential.rb', line 3

def override_raw_attributes
  {
    :organization    => :organization_id,
    :credential_type => :credential_type_id,
  }
end

#vault_passwordObject



41
42
43
44
45
46
# File 'lib/ansible_tower_client/base_models/credential.rb', line 41

def vault_password
  @data['vault_password'] ||= begin
    has_vault_password = respond_to?(:inputs) && inputs.respond_to?(:vault_password)
    (inputs.vault_password if has_vault_password).to_s
  end
end