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

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

Overview

Work with multiple VM instances.

Instance Attribute Summary

Attributes inherited from BaseVPC

#connection, #endpoint, #logger

Instance Method Summary collapse

Methods inherited from BaseCollection

#all, #count, #create, #data, #fetch, #has_count?

Methods inherited from BaseVPC

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

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:

  • start (String) (defaults to: nil)

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

  • limit (Integer) (defaults to: nil)

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

  • name (String) (defaults to: nil)

    Filters the collection to resources with the exact specified name

  • vpc_id (String) (defaults to: nil)

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

  • vpc_crn (String) (defaults to: nil)

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

  • vpc_name (String) (defaults to: nil)

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

Returns:

  • (BaseCollection)

    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