Class: Fog::Identity::OpenStack::V3::OsCredential

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/identity/openstack/v3/models/os_credential.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#initialize

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#createObject



42
43
44
45
46
47
48
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 42

def create
  merge_attributes(
    service.create_os_credential(attributes).body['credential']
  )
  @parsed_blob = nil
  self
end

#destroyObject



20
21
22
23
24
25
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 20

def destroy
  requires :id
  service.delete_os_credential(id)
  @parsed_blob = nil
  true
end

#fingerprintObject



63
64
65
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 63

def fingerprint
  parsed_blob['fingerprint'] if blob
end

#nameObject



55
56
57
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 55

def name
  parsed_blob['name'] if blob
end

#parsed_blobObject



50
51
52
53
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 50

def parsed_blob
  @parsed_blob = ::JSON.parse(blob) unless @parsed_blob
  @parsed_blob
end

#private_keyObject



67
68
69
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 67

def private_key
  parsed_blob['private_key'] if blob
end

#public_keyObject



59
60
61
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 59

def public_key
  parsed_blob['public_key'] if blob
end

#saveObject



36
37
38
39
40
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 36

def save
  requires :blob, :type
  @parsed_blob = nil
  identity ? update : create
end

#to_sObject



16
17
18
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 16

def to_s
  name
end

#update(attr = nil) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/fog/identity/openstack/v3/models/os_credential.rb', line 27

def update(attr = nil)
  requires :id
  merge_attributes(
    service.update_os_credential(id, attr || attributes).body['credential']
  )
  @parsed_blob = nil
  self
end