Class: IBM::Cloud::SDK::VPC::Instances

Inherits:
VPCCollection show all
Defined in:
lib/ibm/cloud/sdk/vpc/instances.rb

Overview

Work with multiple VM instances.

Instance Attribute Summary

Attributes included from IBM::Cloud::SDKHTTP::BaseHTTPMixin

#endpoint

Attributes inherited from IBM::Cloud::SDKHTTP::BaseCollection

#connection, #endpoint, #logger, #token

Instance Method Summary collapse

Methods inherited from VPCCollection

#count, #has_count?

Methods included from VpcHTTP

#metadata

Methods included from IBM::Cloud::SDKHTTP::BaseHTTPMixin

#adhoc, #delete, #get, #metadata, #patch, #post, #put, #unchecked_response, #url

Methods inherited from IBM::Cloud::SDKHTTP::BaseCollection

#all, #create, #data, #fetch, #reset_params

Constructor Details

#initialize(parent) ⇒ Instances

Returns a new instance of Instances.



15
16
17
# File 'lib/ibm/cloud/sdk/vpc/instances.rb', line 15

def initialize(parent)
  super(parent, 'instances', child_class: Instance)
end

Instance Method Details

#params(start: nil, limit: nil, name: nil, vpc_id: nil, vpc_crn: nil, vpc_name: nil) ⇒ BaseCollection

A chainable method to set query filters on the collection.

Examples:

vpc.images.params(limit: 1).all


Parameters:

  • (defaults to: nil)

    A server-supplied token determining what resource to start the page on.

  • (defaults to: nil)

    The number of resources to return on a page allowed values are between 1 and 100

  • (defaults to: nil)

    Filters the collection to resources with the exact specified name

  • (defaults to: nil)

    Filters the collection to resources in the VPC with the specified identifier

  • (defaults to: nil)

    Filters the collection to resources in the VPC with the specified CRN

  • (defaults to: nil)

    Filters the collection to resources in the VPC with the exact specified name

Returns:

  • This class with the param instance variable set.



29
30
31
32
33
34
35
36
# File 'lib/ibm/cloud/sdk/vpc/instances.rb', line 29

def params(start: nil, limit: nil, name: nil, vpc_id: nil, vpc_crn: nil, vpc_name: nil)
  super(start: start, limit: limit)
  @params['name'] = name if name
  @params['vpc.id'] = vpc_id if vpc_id
  @params['vpc.crn'] = vpc_crn if vpc_crn
  @params['vpc.name'] = vpc_name if vpc_name
  self
end