Class: Fog::Identity::OpenStack::V2::Ec2Credential

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

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#create, #initialize, #update

Constructor Details

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

Instance Method Details

#destroyObject



14
15
16
17
18
19
# File 'lib/fog/identity/openstack/v2/models/ec2_credential.rb', line 14

def destroy
  requires :access
  requires :user_id
  service.delete_ec2_credential user_id, access
  true
end

#saveObject

Raises:

  • (Fog::Errors::Error)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/identity/openstack/v2/models/ec2_credential.rb', line 21

def save
  raise Fog::Errors::Error, 'Existing credentials cannot be altered' if access

  self.user_id ||= user.id
  self.tenant_id ||= user.tenant_id

  requires :user_id, :tenant_id

  data = service.create_ec2_credential user_id, tenant_id

  merge_attributes(data.body['credential'])

  true
end