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
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 876 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
898 899 900 901 902 903 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 898 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
549 550 551 552 553 554 555 556 557 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 549 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
808 809 810 811 812 813 814 815 816 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 808 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
907 908 909 910 911 912 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 907 def group(name) AutoScalingGroup.new( name: name, client: @client ) end |
#groups(options = {}) ⇒ AutoScalingGroup::Collection
940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 940 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
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 973 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
996 997 998 999 1000 1001 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 996 def launch_configuration(name) LaunchConfiguration.new( name: name, client: @client ) end |
#launch_configurations(options = {}) ⇒ LaunchConfiguration::Collection
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1015 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
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1056 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
1078 1079 1080 1081 1082 1083 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1078 def policy(name) ScalingPolicy.new( name: name, client: @client ) end |
#scheduled_action(name) ⇒ ScheduledAction
1087 1088 1089 1090 1091 1092 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1087 def scheduled_action(name) ScheduledAction.new( name: name, client: @client ) end |
#scheduled_actions(options = {}) ⇒ ScheduledAction::Collection
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1118 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
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 |
# File 'gems/aws-sdk-autoscaling/lib/aws-sdk-autoscaling/resource.rb', line 1153 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 |