Class: Fog::OpenStack::Collection

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/openstack/models/collection.rb

Direct Known Subclasses

Baremetal::OpenStack::ChassisCollection, Baremetal::OpenStack::Drivers, Baremetal::OpenStack::Nodes, Baremetal::OpenStack::Ports, Compute::OpenStack::Addresses, Compute::OpenStack::Aggregates, Compute::OpenStack::AvailabilityZones, Compute::OpenStack::Flavors, Compute::OpenStack::Hosts, Compute::OpenStack::Images, Compute::OpenStack::KeyPairs, Compute::OpenStack::Metadata, Compute::OpenStack::Networks, Compute::OpenStack::SecurityGroupRules, Compute::OpenStack::SecurityGroups, Compute::OpenStack::Servers, Compute::OpenStack::Services, Compute::OpenStack::Snapshots, Compute::OpenStack::Tenants, Compute::OpenStack::Volumes, Identity::OpenStack::V2::Ec2Credentials, Identity::OpenStack::V2::Roles, Identity::OpenStack::V2::Tenants, Identity::OpenStack::V2::Users, Identity::OpenStack::V3::Domains, Identity::OpenStack::V3::Endpoints, Identity::OpenStack::V3::Groups, Identity::OpenStack::V3::OsCredentials, Identity::OpenStack::V3::Policies, Identity::OpenStack::V3::Projects, Identity::OpenStack::V3::RoleAssignments, Identity::OpenStack::V3::Roles, Identity::OpenStack::V3::Services, Identity::OpenStack::V3::Tokens, Identity::OpenStack::V3::Users, Image::OpenStack::V1::Images, Image::OpenStack::V2::Images, Metering::OpenStack::Resources, Network::OpenStack::FloatingIps, Network::OpenStack::LbHealthMonitors, Network::OpenStack::LbMembers, Network::OpenStack::LbPools, Network::OpenStack::LbVips, Network::OpenStack::Networks, Network::OpenStack::Ports, Network::OpenStack::Routers, Network::OpenStack::SecurityGroupRules, Network::OpenStack::SecurityGroups, Network::OpenStack::Subnets, Fog::Openstack::Planning::Plans, Fog::Openstack::Planning::Roles, Fog::Orchestration::OpenStack::Events, Fog::Orchestration::OpenStack::ResourceSchemas, Fog::Orchestration::OpenStack::Resources, Fog::Orchestration::OpenStack::Stacks, Fog::Orchestration::OpenStack::Templates, Storage::OpenStack::Directories, Storage::OpenStack::Files, Volume::OpenStack::V1::AvailabilityZones, Volume::OpenStack::V1::Transfers, Volume::OpenStack::V1::VolumeTypes, Volume::OpenStack::V1::Volumes, Volume::OpenStack::V2::AvailabilityZones, Volume::OpenStack::V2::Transfers, Volume::OpenStack::V2::VolumeTypes, Volume::OpenStack::V2::Volumes

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#responseObject

It’s important to store the whole response, it contains e.g. important info about whether there is another page of data.



8
9
10
# File 'lib/fog/openstack/models/collection.rb', line 8

def response
  @response
end

Instance Method Details

#all(options = {}) ⇒ Object

Returns detailed list of records



23
24
25
# File 'lib/fog/openstack/models/collection.rb', line 23

def all(options = {})
  raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :all is not implemented')
end

#destroy(uuid) ⇒ Object

Destroys record given record’s UUID



40
41
42
# File 'lib/fog/openstack/models/collection.rb', line 40

def destroy(uuid)
  raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :destroy is not implemented')
end

#get(uuid) ⇒ Object Also known as: find_by_id

Gets record given record’s UUID



34
35
36
# File 'lib/fog/openstack/models/collection.rb', line 34

def get(uuid)
  raise Fog::OpenStack::Errors::InterfaceNotImplemented.new('Method :get is not implemented')
end

#load_response(response, index = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/fog/openstack/models/collection.rb', line 10

def load_response(response, index = nil)
  # Delete it index if it's there, so we don't store response with data twice, but we store only metadata
  objects = index ? response.body.delete(index) : response.body

  clear && objects.each { |object| self << new(object) }
  self.response = response
  self
end

#summary(options = {}) ⇒ Object

Returns non detailed list of records, usually just subset of attributes, which makes this call more effective. Not all openstack services support non detailed list, so it delegates to :all by default.



29
30
31
# File 'lib/fog/openstack/models/collection.rb', line 29

def summary(options = {})
  all(options)
end