Class: Fog::OpenStack::Collection

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

Direct Known Subclasses

Baremetal::ChassisCollection, Baremetal::Drivers, Baremetal::Nodes, Baremetal::Ports, Fog::OpenStack::Compute::Addresses, Fog::OpenStack::Compute::Aggregates, Fog::OpenStack::Compute::AvailabilityZones, Fog::OpenStack::Compute::Flavors, Fog::OpenStack::Compute::Hosts, Fog::OpenStack::Compute::Images, Fog::OpenStack::Compute::KeyPairs, Fog::OpenStack::Compute::Metadata, Fog::OpenStack::Compute::Networks, Fog::OpenStack::Compute::OsInterfaces, Fog::OpenStack::Compute::SecurityGroupRules, Fog::OpenStack::Compute::SecurityGroups, Fog::OpenStack::Compute::ServerGroups, Fog::OpenStack::Compute::Servers, Fog::OpenStack::Compute::Services, Fog::OpenStack::Compute::Snapshots, Fog::OpenStack::Compute::Tenants, Fog::OpenStack::Compute::Volumes, Fog::OpenStack::ContainerInfra::BayModels, Fog::OpenStack::ContainerInfra::Bays, Fog::OpenStack::ContainerInfra::Certificates, Fog::OpenStack::ContainerInfra::ClusterTemplates, Fog::OpenStack::ContainerInfra::Clusters, DNS::V2::Pools, DNS::V2::Recordsets, DNS::V2::ZoneTransferAccepts, DNS::V2::ZoneTransferRequests, DNS::V2::Zones, Event::Events, Identity::V2::Ec2Credentials, Identity::V2::Roles, Identity::V2::Tenants, Identity::V2::Users, Identity::V3::Domains, Identity::V3::Endpoints, Identity::V3::Groups, Identity::V3::OsCredentials, Identity::V3::Policies, Identity::V3::Projects, Identity::V3::RoleAssignments, Identity::V3::Roles, Identity::V3::Services, Identity::V3::Tokens, Identity::V3::Users, Image::V1::Images, Image::V2::Images, Introspection::RulesCollection, KeyManager::Containers, KeyManager::Secrets, Metering::Events, Metering::Resources, Metric::Metrics, Metric::Resources, Monitoring::AlarmCounts, Monitoring::AlarmDefinitions, Monitoring::AlarmStates, Monitoring::Alarms, Monitoring::DimensionValues, Monitoring::Measurements, Monitoring::Metrics, Monitoring::NotificationMethods, Monitoring::Statistics, NFV::Vnfds, NFV::Vnfs, Network::Extensions, Network::FloatingIps, Network::IkePolicies, Network::IpsecPolicies, Network::IpsecSiteConnections, Network::LbHealthMonitors, Network::LbMembers, Network::LbPools, Network::LbVips, Network::NetworkIpAvailabilities, Network::Networks, Network::Ports, Network::RbacPolicies, Network::Routers, Network::SecurityGroupRules, Network::SecurityGroups, Network::SubnetPools, Network::Subnets, Network::VpnServices, Orchestration::Events, Orchestration::ResourceSchemas, Orchestration::Resources, Orchestration::Stacks, Orchestration::Templates, Planning::Plans, Planning::Roles, SharedFileSystem::AvailabilityZones, SharedFileSystem::Networks, SharedFileSystem::ShareAccessRules, SharedFileSystem::ShareExportLocations, SharedFileSystem::Shares, SharedFileSystem::Snapshots, Storage::Directories, Storage::Files, Volume::V1::AvailabilityZones, Volume::V1::Backups, Volume::V1::Snapshots, Volume::V1::Transfers, Volume::V1::VolumeTypes, Volume::V1::Volumes, Volume::V2::AvailabilityZones, Volume::V2::Backups, Volume::V2::Snapshots, Volume::V2::Transfers, Volume::V2::VolumeTypes, Volume::V2::Volumes, Volume::V3::AvailabilityZones, Volume::V3::Backups, Volume::V3::Snapshots, Volume::V3::Transfers, Volume::V3::VolumeTypes, Volume::V3::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