Class: Fog::Identity::OpenStack::Ec2Credential
- Defined in:
- lib/fog/openstack/models/identity/ec2_credential.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes) ⇒ Ec2Credential
constructor
A new instance of Ec2Credential.
- #save ⇒ Object
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
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 |