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::ServerGroups, Compute::OpenStack::Servers, Compute::OpenStack::Services, Compute::OpenStack::Snapshots, Compute::OpenStack::Tenants, Compute::OpenStack::Volumes, DNS::OpenStack::V2::Recordsets, DNS::OpenStack::V2::Zones, 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, Introspection::OpenStack::RulesCollection, Metering::OpenStack::Events, Metering::OpenStack::Resources, Metric::OpenStack::Metrics, Metric::OpenStack::Resources, Monitoring::OpenStack::AlarmCounts, Monitoring::OpenStack::AlarmDefinitions, Monitoring::OpenStack::AlarmStates, Monitoring::OpenStack::Alarms, Monitoring::OpenStack::DimensionValues, Monitoring::OpenStack::Measurements, Monitoring::OpenStack::Metrics, Monitoring::OpenStack::NotificationMethods, Monitoring::OpenStack::Statistics, NFV::OpenStack::Vnfds, NFV::OpenStack::Vnfs, Network::OpenStack::Extensions, Network::OpenStack::FloatingIps, Network::OpenStack::IkePolicies, Network::OpenStack::IpsecPolicies, Network::OpenStack::IpsecSiteConnections, Network::OpenStack::LbHealthMonitors, Network::OpenStack::LbMembers, Network::OpenStack::LbPools, Network::OpenStack::LbVips, Network::OpenStack::Networks, Network::OpenStack::Ports, Network::OpenStack::RbacPolicies, Network::OpenStack::Routers, Network::OpenStack::SecurityGroupRules, Network::OpenStack::SecurityGroups, Network::OpenStack::Subnets, Network::OpenStack::VpnServices, 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, SharedFileSystem::OpenStack::Networks, SharedFileSystem::OpenStack::Shares, SharedFileSystem::OpenStack::Snapshots, Storage::OpenStack::Directories, Storage::OpenStack::Files, Volume::OpenStack::V1::AvailabilityZones, Volume::OpenStack::V1::Backups, Volume::OpenStack::V1::Snapshots, Volume::OpenStack::V1::Transfers, Volume::OpenStack::V1::VolumeTypes, Volume::OpenStack::V1::Volumes, Volume::OpenStack::V2::AvailabilityZones, Volume::OpenStack::V2::Backups, Volume::OpenStack::V2::Snapshots, 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


43
44
45
# File 'lib/fog/openstack/models/collection.rb', line 43

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

#find_by_id(uuid) ⇒ Object


38
39
40
# File 'lib/fog/openstack/models/collection.rb', line 38

def find_by_id(uuid)
  get(uuid)
end

#get(uuid) ⇒ Object

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