Class: Aws::AutoScaling::Resource
- Inherits:
-
Object
- Object
- Aws::AutoScaling::Resource
- Defined in:
- gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb
Overview
This class provides a resource oriented interface for AutoScaling. To create a resource object:
resource = Aws::AutoScaling::Resource.new(region: 'us-west-2')
You can supply a client object with custom configuration that will be used for all resource operations.
If you do not pass :client, a default client will be constructed.
client = Aws::AutoScaling::Client.new(region: 'us-west-2')
resource = Aws::AutoScaling::Resource.new(client: client)
Actions collapse
-
#create_group(options = {}) ⇒ AutoScalingGroup
-
#create_launch_configuration(options = {}) ⇒ LaunchConfiguration
Associations collapse
-
#activities(options = {}) ⇒ Activity::Collection
-
#activity(id) ⇒ Activity
-
#group(name) ⇒ AutoScalingGroup
-
#groups(options = {}) ⇒ AutoScalingGroup::Collection
-
#instances(options = {}) ⇒ Instance::Collection
-
#launch_configuration(name) ⇒ LaunchConfiguration
-
#launch_configurations(options = {}) ⇒ LaunchConfiguration::Collection
-
#policies(options = {}) ⇒ ScalingPolicy::Collection
-
#policy(name) ⇒ ScalingPolicy
-
#scheduled_action(name) ⇒ ScheduledAction
-
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
-
#tags(options = {}) ⇒ Tag::Collection
Instance Method Summary collapse
-
#client ⇒ Client
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
Instance Method Details
#activities(options = {}) ⇒ Activity::Collection
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 892 def activities( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_scaling_activities() end resp.each_page do |page| batch = [] page.data.activities.each do |a| batch << Activity.new( id: a.activity_id, data: a, client: @client ) end y.yield(batch) end end Activity::Collection.new(batches) end |
#activity(id) ⇒ Activity
914 915 916 917 918 919 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 914 def activity(id) Activity.new( id: id, client: @client ) end |
#client ⇒ Client
32 33 34 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 32 def client @client end |
#create_group(options = {}) ⇒ AutoScalingGroup
557 558 559 560 561 562 563 564 565 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 557 def create_group( = {}) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_auto_scaling_group() end AutoScalingGroup.new( name: [:auto_scaling_group_name], client: @client ) end |
#create_launch_configuration(options = {}) ⇒ LaunchConfiguration
816 817 818 819 820 821 822 823 824 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 816 def create_launch_configuration( = {}) Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.create_launch_configuration() end LaunchConfiguration.new( name: [:launch_configuration_name], client: @client ) end |
#group(name) ⇒ AutoScalingGroup
923 924 925 926 927 928 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 923 def group(name) AutoScalingGroup.new( name: name, client: @client ) end |
#groups(options = {}) ⇒ AutoScalingGroup::Collection
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 956 def groups( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_auto_scaling_groups() end resp.each_page do |page| batch = [] page.data.auto_scaling_groups.each do |a| batch << AutoScalingGroup.new( name: a.auto_scaling_group_name, data: a, client: @client ) end y.yield(batch) end end AutoScalingGroup::Collection.new(batches) end |
#instances(options = {}) ⇒ Instance::Collection
989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 989 def instances( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_auto_scaling_instances() end resp.each_page do |page| batch = [] page.data.auto_scaling_instances.each do |a| batch << Instance.new( group_name: a.auto_scaling_group_name, id: a.instance_id, data: a, client: @client ) end y.yield(batch) end end Instance::Collection.new(batches) end |
#launch_configuration(name) ⇒ LaunchConfiguration
1012 1013 1014 1015 1016 1017 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1012 def launch_configuration(name) LaunchConfiguration.new( name: name, client: @client ) end |
#launch_configurations(options = {}) ⇒ LaunchConfiguration::Collection
1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1031 def launch_configurations( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_launch_configurations() end resp.each_page do |page| batch = [] page.data.launch_configurations.each do |l| batch << LaunchConfiguration.new( name: l.launch_configuration_name, data: l, client: @client ) end y.yield(batch) end end LaunchConfiguration::Collection.new(batches) end |
#policies(options = {}) ⇒ ScalingPolicy::Collection
1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1072 def policies( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_policies() end resp.each_page do |page| batch = [] page.data.scaling_policies.each do |s| batch << ScalingPolicy.new( name: s.policy_name, data: s, client: @client ) end y.yield(batch) end end ScalingPolicy::Collection.new(batches) end |
#policy(name) ⇒ ScalingPolicy
1094 1095 1096 1097 1098 1099 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1094 def policy(name) ScalingPolicy.new( name: name, client: @client ) end |
#scheduled_action(name) ⇒ ScheduledAction
1103 1104 1105 1106 1107 1108 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1103 def scheduled_action(name) ScheduledAction.new( name: name, client: @client ) end |
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1134 def scheduled_actions( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.describe_scheduled_actions() end resp.each_page do |page| batch = [] page.data.scheduled_update_group_actions.each do |s| batch << ScheduledAction.new( name: s.scheduled_action_name, data: s, client: @client ) end y.yield(batch) end end ScheduledAction::Collection.new(batches) end |
#tags(options = {}) ⇒ Tag::Collection
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1169 def ( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.() end resp.each_page do |page| batch = [] page.data..each do |t| batch << Tag.new( key: t.key, resource_id: t.resource_id, resource_type: t.resource_type, data: t, client: @client ) end y.yield(batch) end end Tag::Collection.new(batches) end |