Class: Fog::Identity::OpenStack::Ec2Credential
- Inherits:
-
Model
- Object
- Model
- Fog::Identity::OpenStack::Ec2Credential
- Defined in:
- lib/fog/openstack/models/identity/ec2_credential.rb
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Ec2Credential
constructor
A new instance of Ec2Credential.
- #save ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Ec2Credential
Returns a new instance of Ec2Credential.
13 14 15 16 17 |
# File 'lib/fog/openstack/models/identity/ec2_credential.rb', line 13 def initialize(attributes) # Old 'connection' is renamed as service and should be used instead prepare_service_value(attributes) super end |
Instance Method Details
#destroy ⇒ Object
19 20 21 22 23 24 |
# File 'lib/fog/openstack/models/identity/ec2_credential.rb', line 19 def destroy requires :access requires :user_id service.delete_ec2_credential user_id, access true end |
#save ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fog/openstack/models/identity/ec2_credential.rb', line 26 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 |