You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::AutoScaling::Instance::Collection

Inherits:
Resources::Collection show all
Defined in:
gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb

Batch Actions collapse

Methods inherited from Resources::Collection

#each, #first, #limit, #size

Instance Method Details

#batch_attach(options = {}) ⇒ void

This method returns an undefined value.

Parameters:

  • options ({}) (defaults to: {})


321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb', line 321

def batch_attach(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:auto_scaling_group_name] = batch[0].group_name
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.attach_instances(params)
  end
  nil
end

#batch_detach(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_detach({
  should_decrement_desired_capacity: false, # required
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :should_decrement_desired_capacity (required, Boolean)

    If True, the Auto Scaling group decrements the desired capacity value by the number of instances detached.



346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb', line 346

def batch_detach(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:auto_scaling_group_name] = batch[0].group_name
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.detach_instances(params)
  end
  nil
end

#batch_enter_standby(options = {}) ⇒ void

This method returns an undefined value.

Examples:

Request syntax with placeholder values


instance.batch_enter_standby({
  should_decrement_desired_capacity: false, # required
})

Parameters:

  • options ({}) (defaults to: {})

Options Hash (options):

  • :should_decrement_desired_capacity (required, Boolean)

    Specifies whether the instances moved to Standby mode count as part of the Auto Scaling group's desired capacity. If set, the desired capacity for the Auto Scaling group decrements by the number of instances moved to Standby mode.



373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb', line 373

def batch_enter_standby(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:auto_scaling_group_name] = batch[0].group_name
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.enter_standby(params)
  end
  nil
end

#batch_exit_standby(options = {}) ⇒ void

This method returns an undefined value.

Parameters:

  • options ({}) (defaults to: {})


390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/instance.rb', line 390

def batch_exit_standby(options = {})
  batch_enum.each do |batch|
    params = Aws::Util.copy_hash(options)
    params[:auto_scaling_group_name] = batch[0].group_name
    params[:instance_ids] ||= []
    batch.each do |item|
      params[:instance_ids] << {
        id: item.id
      }
    end
    batch[0].client.exit_standby(params)
  end
  nil
end