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

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/openstack/models/identity_v3/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


41
42
43
44
45
46
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 41

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/openstack/models/identity_v3/os_credential.rb', line 20

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

#fingerprintObject


61
62
63
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 61

def fingerprint
  parsed_blob['fingerprint'] if blob
end

#nameObject


53
54
55
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 53

def name
  parsed_blob['name'] if blob
end

#parsed_blobObject


48
49
50
51
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 48

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

#private_keyObject


65
66
67
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 65

def private_key
  parsed_blob['private_key'] if blob
end

#public_keyObject


57
58
59
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 57

def public_key
  parsed_blob['public_key'] if blob
end

#saveObject


35
36
37
38
39
# File 'lib/fog/openstack/models/identity_v3/os_credential.rb', line 35

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

#to_sObject


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

def to_s
  self.name
end

#update(attr = nil) ⇒ Object


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

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