hexsha
stringlengths
40
40
size
int64
2
1.01M
content
stringlengths
2
1.01M
avg_line_length
float64
1.5
100
max_line_length
int64
2
1k
alphanum_fraction
float64
0.25
1
915cabca4a0cf310877fcb96aea22b8bda7c5f14
2,535
#!/usr/bin/env rspec require 'spec_helper' module MCollective module DDL describe DataDDL do before :each do Cache.delete!(:ddl) rescue nil @ddl = DDL.new("rspec", :data, false) @ddl.metadata(:name => "name", :description => "description", :author => "author", :license => "license", :version => "version", :url => "url", :timeout => "timeout") end describe "#input" do it "should only allow 'query' as input for data plugins" do ddl = DDL.new("rspec", :data, false) ddl.dataquery(:description => "rspec") ddl.instance_variable_set("@current_entity", :query) ddl.instance_variable_set("@plugintype", :data) expect { ddl.input(:rspec, {}) }.to raise_error("The only valid input name for a data query is 'query'") end end describe "#dataquery_interface" do it "should return the correct data" do input = {:prompt => "Matcher", :description => "Augeas Matcher", :type => :string, :validation => /.+/, :maxlength => 0} output = {:description=>"rspec", :display_as=>"rspec", :default => nil} @ddl.instance_variable_set("@plugintype", :data) @ddl.dataquery(:description => "rspec") do @ddl.output :rspec, output @ddl.input :query, input end @ddl.dataquery_interface.should == {:description => "rspec", :input => {:query => input.merge(:optional => nil, :default => nil)}, :output => {:rspec => output}} end end describe "#dataquery" do it "should ensure a description is set" do expect { @ddl.dataquery({}) }.to raise_error("Data queries need a :description") end it "should ensure only one definition" do @ddl.dataquery(:description => "rspec") expect { @ddl.dataquery(:description => "rspec") }.to raise_error("Data queries can only have one definition") end it "should create the default structure" do @ddl.dataquery(:description => "rspec") @ddl.instance_variable_set("@plugintype", :data) @ddl.dataquery_interface.should == {:description => "rspec", :input => {}, :output => {}} end it "should call the block if given" do @ddl.dataquery(:description => "rspec") { @ddl.instance_variable_get("@current_entity").should == :data } end end end end end
38.409091
174
0.568442
e8ff2157b05cc8af0e3cdb676336c9bef18f84ad
2,699
require "active_record" require "active_support/lazy_load_hooks" module ActiveRecord module PGEnum KNOWN_VERSIONS = %w[4.1 4.2 5.0 5.1 5.2 6.0 6.1].map { |v| Gem::Version.new(v) } class << self attr_reader :enabled_version def install(version) @enabled_version = approximate_version(version) # Don't immediately fail if we don't yet support the current version. # There's at least a chance it could work. if !KNOWN_VERSIONS.include?(enabled_version) && enabled_version > KNOWN_VERSIONS.last @enabled_version = KNOWN_VERSIONS.last warn "[PGEnum] Current ActiveRecord version unsupported! Falling back to: #{enabled_version}" end initialize! end def register(patch, &block) monkeypatches[patch] = block end def detected_version approximate_version Gem.loaded_specs["activerecord"].version end private def monkeypatches @patches ||= {} end def initialize! require "active_record/pg_enum/command_recorder" require "active_record/pg_enum/postgresql_adapter" require "active_record/pg_enum/schema_statements" Dir[File.join(__dir__, "pg_enum", enabled_version.to_s, "*.rb")].each { |file| require file } monkeypatches.keys.each { |patch| monkeypatches.delete(patch).call } end def approximate_version(version) segments = version.respond_to?(:canonical_segments) ? version.canonical_segments : version.segments segments.pop while segments.any? { |s| String === s } segments.pop while segments.size > 2 segments.push(0) while segments.size < 2 Gem::Version.new segments.join(".") end end end end ActiveSupport.on_load(:active_record) do ActiveRecord::PGEnum.install Gem.loaded_specs["activerecord"].version end # Declare an enum attribute where the values map to strings enforced by PostgreSQL's # enumerated types. # # class Conversation < ActiveRecord::Base # include PGEnum(status: %i[active archived]) # end # # This is merely a wrapper over traditional enum syntax so that you can define # string-based enums with an array of values. def PGEnum(**definitions) values = definitions.values.map do |value| if value.is_a? Array keys = value.map(&:to_sym) values = value.map(&:to_s) Hash[keys.zip(values)] else value end end Module.new do define_singleton_method(:inspect) { %{ActiveRecord::PGEnum(#{definitions.keys.join(" ")})} } define_singleton_method :included do |klass| klass.enum Hash[definitions.keys.zip(values)] end end end
29.021505
107
0.674324
289708a68ba9d9eb29c81cc83a466cdb8e34ce7b
85
# frozen_string_literal: true class SoundType < BaseObject implements DoiItem end
14.166667
29
0.811765
87307b9819ffaa8f440a12cf448d1a16ea83d29f
366
module Fog module OpenStack class Monitoring class Real def create_metric_array(metrics_list) request( :body => Fog::JSON.encode(metrics_list), :expects => [204], :method => 'POST', :path => 'metrics' ) end end class Mock end end end end
18.3
55
0.480874
ff6b832894ad7271ddd6a7ff4aece2095a68a80b
594
Rails.application.routes.draw do devise_for :users, :controllers => { registrations: 'registrations' } # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :users, only:[:show] do resources :friendships, only:[:create,:destroy] resources :favorites , only:[:create,:destroy] end resources :games, only:[:index,:show] do resources :comments, only:[:new,:create] end resources :tags, only:[:show] resources :search, only: [:index, :create] resources :votes, only:[:create, :update] root "games#index" end
28.285714
101
0.703704
acce41bcf443105e03a6a8e566edbfb1e1e7868f
1,127
test_name 'C100297 - A resource triggered by a refresh that fails should be reported as a failure when using --detailed-exitcodes' do tag 'audit:high', 'audit:integration' # Service type interaction with --detailed-exitcodes manifest =<<EOS exec{'true': command => 'true', path => ['/bin', '/usr/bin'], } exec{'false': command => 'false', path => ['/bin', '/usr/bin'], refreshonly => true, subscribe => Exec['true'], } exec{'require_echo': command => 'echo "This should not happen due to a failed requirement."', path => ['/bin', '/usr/bin'], logoutput => true, require => Exec['false'], } EOS agents.each do |agent| step 'Apply manifest with fail on refresh. Ensure that this results in a failed dependency' do apply_manifest_on(agent, manifest, :expect_failures => true) do |res| assert_no_match(/require_echo.*returns: executed successfully/, res.stdout) assert_match(/require_echo.*Skipping because of failed dependencies/, res.stderr) unless agent['locale'] == 'ja' end end end end
30.459459
133
0.629991
218aabd3f008a16af0a515ca5132c83602017dea
6,271
# Represents a OpenShift Team. # @!attribute [r] name # @return [String] Name reserved for this team. # @!attribute [r] owner # @return [CloudUser] The {CloudUser} that owns this team. # @!attribute [r] pending_ops # @return [Array[PendingTeamOps]] List of {PendingTeamOps} that need to be performed on this team. class Team include Mongoid::Document include Mongoid::Timestamps include AccessControllable include AccessControlled include Membership class Member < ::Member end field :name, type: String #only settable via admin script field :maps_to, type: String, default: nil belongs_to :owner, class_name: CloudUser.name embeds_many :pending_ops, class_name: PendingTeamOps.name has_members default_role: :view member_as :team validates :name, presence: {message: "Name is required and cannot be blank"}, length: {maximum: 250, minimum: 2, message: "Team name must be a minimum of 2 and maximum of 250 characters."} validates_uniqueness_of :maps_to, message: "There is already a team that maps to this group.", allow_nil: true index({'owner_id' => 1, 'name' => 1}, {:unique => true}) create_indexes # Invoke save! with a rescue for a duplicate exception # # == Returns: # True if the domain was saved. def save_with_duplicate_check! self.save! rescue Moped::Errors::OperationFailure => e raise OpenShift::UserException.new("Team name '#{name}' is already in use. Please choose another.", -1, "name") if [11000, 11001].include?(e.details['code']) raise end # Hook to prevent accidental deletion of MongoID model before all related {Gear}s are removed before_destroy do |team| raise "Please call destroy_team to remove from all domains before deleting this team" if Domain.accessible(team).count > 0 end def destroy_team Domain.accessible(self).each do |d| d.remove_members(self) d.save! d.run_jobs end destroy end def scopes nil end def inherit_membership [as_member] end def self.accessible_criteria(to) # Find all accessible domains which also have teams as members # Select only the members field # Flatten the list of members # Limit to members of type 'team' # Select ids # Remove duplicates peer_team_ids = Domain.accessible(to).and({'members.t' => Team.member_type}).map(&:members).flatten(1).select {|m| m.type == 'team'}.map(&:_id).uniq if (to.is_a?(CloudUser) && !to.view_global_teams) # Return teams which would normally be accessible or peer teams self.or(super.selector, {:id.in => peer_team_ids}) else # Return teams which would normally be accessible, global or peer teams self.or(super.selector, {:id.in => peer_team_ids}, {:owner_id => nil}) end end def members_changed(added, removed, changed_roles, parent_op) pending_op = ChangeMembersTeamOp.new(members_added: added.presence, members_removed: removed.presence, roles_changed: changed_roles.presence) self.pending_ops.push pending_op end # Runs all jobs in "init" phase and stops at the first failure. # # IMPORTANT: When changing jobs, be sure to leave old jobs runnable so that pending_ops # that are inserted during a running upgrade can continue to complete. # # == Returns: # True on success or false on failure def run_jobs wait_ctr = 0 begin while self.pending_ops.count > 0 op = self.pending_ops.first # a stuck op could move to the completed state if its pending domains are deleted if op.completed? op.delete self.reload next end # store the op._id to load it later after a reload # this is required to prevent a reload from replacing it with another one based on position op_id = op._id # try to do an update on the pending_op state and continue ONLY if successful op_index = self.pending_ops.index(op) t_now = Time.now.to_i id_condition = {"_id" => self._id, "pending_ops.#{op_index}._id" => op_id} runnable_condition = {"$or" => [ # The op is not yet running {"pending_ops.#{op_index}.state" => "init" }, # The op is in the running state and has timed out { "pending_ops.#{op_index}.state" => "queued", "pending_ops.#{op_index}.queued_at" => {"$lt" => (t_now - run_jobs_queued_timeout)} } ]} queued_values = {"pending_ops.#{op_index}.state" => "queued", "pending_ops.#{op_index}.queued_at" => t_now} reset_values = {"pending_ops.#{op_index}.state" => "init", "pending_ops.#{op_index}.queued_at" => 0} retval = Team.where(id_condition.merge(runnable_condition)).update({"$set" => queued_values}) if retval["updatedExisting"] wait_ctr = 0 elsif wait_ctr < run_jobs_max_retries self.reload sleep run_jobs_retry_sleep wait_ctr += 1 next else raise OpenShift::LockUnavailableException.new("Unable to perform action on team object. Another operation is already running.", 171) end begin op.execute # reloading the op reloads the domain and then incorrectly reloads (potentially) # the op based on its position within the pending_ops list # hence, reloading the domain, and then fetching the op using the op_id stored earlier self.reload op = self.pending_ops.find_by(_id: op_id) op.close_op op.delete if op.completed? rescue Exception => op_ex # doing this in rescue instead of ensure so that the state change happens only in case of exceptions Team.where(id_condition.merge(queued_values)).update({"$set" => reset_values}) raise op_ex end end true rescue Exception => e Rails.logger.error e.message Rails.logger.error e.backtrace raise e end end def self.validation_map {name: -1} end def self.with_ids(ids) if ids.present? self.in(_id: ids) else [] end end private def run_jobs_max_retries; 10; end def run_jobs_retry_sleep; 5; end def run_jobs_queued_timeout; 30*60; end end
33.534759
161
0.665444
e9c94f09c999fb8e8f703f6f7b22cb2fcf3fa47a
6,589
# frozen_string_literal: true require 'spec_helper' RSpec.describe JiraConnect::SubscriptionsController do let_it_be(:installation) { create(:jira_connect_installation) } describe '#index' do before do request.headers['Accept'] = content_type get :index, params: { jwt: jwt } end let(:content_type) { 'text/html' } context 'without JWT' do let(:jwt) { nil } it 'returns 403' do expect(response).to have_gitlab_http_status(:forbidden) end end context 'with valid JWT' do let(:qsh) { Atlassian::Jwt.create_query_string_hash('https://gitlab.test/subscriptions', 'GET', 'https://gitlab.test') } let(:jwt) { Atlassian::Jwt.encode({ iss: installation.client_key, qsh: qsh }, installation.shared_secret) } it 'returns 200' do expect(response).to have_gitlab_http_status(:ok) end it 'removes X-Frame-Options to allow rendering in iframe' do expect(response.headers['X-Frame-Options']).to be_nil end context 'with JSON format' do let_it_be(:subscription) { create(:jira_connect_subscription, installation: installation) } let(:content_type) { 'application/json' } it 'renders the relevant data as JSON', :aggregate_failures do expect(json_response).to include('groups_path' => api_v4_groups_path(params: { min_access_level: Gitlab::Access::MAINTAINER, skip_groups: [subscription.namespace_id] })) expect(json_response).to include( 'subscriptions' => [ 'group' => { 'name' => subscription.namespace.name, 'avatar_url' => subscription.namespace.avatar_url, 'full_name' => subscription.namespace.full_name, 'description' => subscription.namespace.description }, 'created_at' => subscription.created_at.iso8601(3), 'unlink_path' => jira_connect_subscription_path(subscription) ] ) expect(json_response).to include('subscriptions_path' => jira_connect_subscriptions_path) end context 'when not signed in to GitLab' do it 'contains a login path' do expect(json_response).to include('login_path' => jira_connect_users_path) end end context 'when signed in to GitLab' do let(:user) { create(:user) } before do sign_in(user) get :index, params: { jwt: jwt } end it 'does not contain a login path' do expect(json_response).to include('login_path' => nil) end end context 'with context qsh' do # The JSON endpoint will be requested by frontend using a JWT that Atlassian provides via Javascript. # This JWT will likely use a context-qsh because Atlassian don't know for which endpoint it will be used. # Read more about context JWT here: https://developer.atlassian.com/cloud/jira/platform/understanding-jwt-for-connect-apps/ let(:qsh) { 'context-qsh' } specify do expect(response).to have_gitlab_http_status(:ok) end end end end end describe '#create' do let(:group) { create(:group) } let(:user) { create(:user) } before do group.add_maintainer(user) end subject { post :create, params: { jwt: jwt, namespace_path: group.path, format: :json } } context 'without JWT' do let(:jwt) { nil } it 'returns 403' do sign_in(user) subject expect(response).to have_gitlab_http_status(:forbidden) end end context 'with valid JWT' do let(:claims) { { iss: installation.client_key, sub: 1234, qsh: '123' } } let(:jwt) { Atlassian::Jwt.encode(claims, installation.shared_secret) } let(:jira_user) { { 'groups' => { 'items' => [{ 'name' => jira_group_name }] } } } let(:jira_group_name) { 'site-admins' } context 'signed in to GitLab' do before do sign_in(user) WebMock .stub_request(:get, "#{installation.base_url}/rest/api/3/user?accountId=1234&expand=groups") .to_return(body: jira_user.to_json, status: 200, headers: { 'Content-Type' => 'application/json' }) end context 'dev panel integration is available' do it 'creates a subscription' do expect { subject }.to change { installation.subscriptions.count }.from(0).to(1) end it 'returns 200' do subject expect(response).to have_gitlab_http_status(:ok) end end context 'when the Jira user is not a site-admin' do let(:jira_group_name) { 'some-other-group' } it 'returns forbidden' do subject expect(response).to have_gitlab_http_status(:forbidden) end end end context 'not signed in to GitLab' do it 'returns 401' do subject expect(response).to have_gitlab_http_status(:unauthorized) end end end end describe '#destroy' do let(:subscription) { create(:jira_connect_subscription, installation: installation) } let(:jira_user) { { 'groups' => { 'items' => [{ 'name' => jira_group_name }] } } } let(:jira_group_name) { 'site-admins' } before do WebMock .stub_request(:get, "#{installation.base_url}/rest/api/3/user?accountId=1234&expand=groups") .to_return(body: jira_user.to_json, status: 200, headers: { 'Content-Type' => 'application/json' }) delete :destroy, params: { jwt: jwt, id: subscription.id, format: :json } end context 'without JWT' do let(:jwt) { nil } it 'returns 403' do expect(response).to have_gitlab_http_status(:forbidden) end end context 'with valid JWT' do let(:claims) { { iss: installation.client_key, sub: 1234, qsh: '123' } } let(:jwt) { Atlassian::Jwt.encode(claims, installation.shared_secret) } it 'deletes the subscription' do expect { subscription.reload }.to raise_error ActiveRecord::RecordNotFound expect(response).to have_gitlab_http_status(:ok) end context 'when the Jira user is not a site admin' do let(:jira_group_name) { 'some-other-group' } it 'does not delete the subscription' do expect(response).to have_gitlab_http_status(:forbidden) expect { subscription.reload }.not_to raise_error end end end end end
32.141463
179
0.61633
6a78529173f97aadcce4420b4a775992e0ae6d13
1,320
require "rails_helper" <% module_namespacing do -%> RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:routing) %> do describe "routing" do <% unless options[:singleton] -%> it "routes to #index" do expect(get: "/<%= ns_table_name %>").to route_to("<%= ns_table_name %>#index") end <% end -%> it "routes to #new" do expect(get: "/<%= ns_table_name %>/new").to route_to("<%= ns_table_name %>#new") end it "routes to #show" do expect(get: "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#show", :id => "1") end it "routes to #edit" do expect(get: "/<%= ns_table_name %>/1/edit").to route_to("<%= ns_table_name %>#edit", :id => "1") end it "routes to #create" do expect(post: "/<%= ns_table_name %>").to route_to("<%= ns_table_name %>#create") end it "routes to #update via PUT" do expect(put: "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#update", :id => "1") end it "routes to #update via PATCH" do expect(patch: "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#update", :id => "1") end it "routes to #destroy" do expect(delete: "/<%= ns_table_name %>/1").to route_to("<%= ns_table_name %>#destroy", :id => "1") end end end <% end -%>
30.697674
103
0.578788
bb91c84f3ec65dd751d139ffb4a85effb0f07f2a
252
class ApplicationController < ActionController::API acts_as_token_authentication_handler_for User before_action :require_authentication! private def require_authentication! throw(:warden, scope: :user) unless current_user.presence end end
28
61
0.825397
08023ddb7b61e6cf116e5a62896be10ccf20c89c
2,696
class PgbouncerHelper < BaseHelper attr_reader :node def database_config(database) settings = node['gitlab']['pgbouncer']['databases'][database].to_hash # The recipe uses user and password for the auth_user option and the pg_auth file settings['auth_user'] = settings.delete('user') if settings.key?('user') settings.delete('password') if settings.key?('password') settings.map do |setting, value| "#{setting}=#{value}" end.join(' ').chomp end def pgbouncer_admin_config user = node['postgresql']['pgbouncer_user'] port = node['gitlab']['pgbouncer']['listen_port'] unix_socket_dir = node['gitlab']['pgbouncer']['data_directory'] "user=#{user} dbname=pgbouncer sslmode=disable port=#{port} host=#{unix_socket_dir}" end def pg_auth_users results = node['gitlab']['pgbouncer']['users'].to_hash node['gitlab']['pgbouncer']['databases'].each do |_db, settings| results[settings['user']] = { 'password' => settings['password'] } results[settings['user']]['auth_type'] = settings['auth_type'] if settings.key?('auth_type') end results end ## # Returns the auth_type prefix for the password field in the pgbouncer auth_file # https://www.pgbouncer.org/config.html#section-users # # +type+ - The auth_type that is being used # # Returns the proper prefix for the chosen auth_type, or nil by default. # This allows types such as plain or trust to be used. def pg_auth_type_prefix(type) case type.downcase when 'md5' 'md5' when 'scram-sha-256' 'SCRAM-SHA-256$' end end def create_pgbouncer_user?(db) # As part of https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2078 services are # being split to their own dedicated cookbooks, and attributes are being moved from # node['gitlab'][service_name] to node[service_name]. Until they've been moved, we # need to check both. if node['gitlab'].key?(db) node['gitlab'][db]['enable'] && !node['gitlab'][db]['pgbouncer_user'].nil? && !node['gitlab'][db]['pgbouncer_user_password'].nil? else # User info for Patroni are stored under `postgresql` key info_key = db == 'patroni' ? 'postgresql' : db node[db]['enable'] && !node[info_key]['pgbouncer_user'].nil? && !node[info_key]['pgbouncer_user_password'].nil? end end def public_attributes { 'gitlab' => { 'pgbouncer' => node['gitlab']['pgbouncer'].select do |key, value| %w(databases_ini databases_json listen_addr listen_port).include?(key) end } } end def running? OmnibusHelper.new(node).service_up?('pgbouncer') end end
33.283951
98
0.659125
7a5b4102efee9b90d9843e64f19d0e8d2035e094
434
# This migration comes from publify_core_engine (originally 20160108184201) class MoveLastConnectionToLastSignInAt < ActiveRecord::Migration[4.2] class User < ActiveRecord::Base end def up User.find_each do |user| user.update_attribute(:last_sign_in_at, user.last_connection) end end def down User.find_each do |user| user.update_attribute(:last_connection, user.last_sign_in_at) end end end
24.111111
75
0.751152
874b39f1e5944a4706f19547299839b3d7aaf8da
129
module QualityEnsurance class BundlerAuditEnsurance < BaseLintEnsurance def command 'bundle audit' end end end
16.125
49
0.736434
f8c2972181de54e8750cb8bcaac9ce4c20f4818e
554
Pod::Spec.new do |s| s.name = 'JCNavigator' s.version = '1.0.2' s.summary = 'A decoupled navigator framework of jumping between modules or apps for iOS development.' s.homepage = 'https://github.com/imjoych/JCNavigator' s.author = { 'ChenJianjun' => '[email protected]' } s.license = { :type => 'MIT', :file => 'LICENSE' } s.source = { :git => 'https://github.com/imjoych/JCNavigator.git', :tag => s.version.to_s } s.source_files = 'JCNavigator/*.{h,m}' s.requires_arc = true s.ios.deployment_target = '9.0' end
34.625
106
0.633574
ab7916481a299e5ec55ed6346e45fd7510915df9
92
json.partial! "meeting_follow_ups/meeting_follow_up", meeting_follow_up: @meeting_follow_up
46
91
0.869565
0368c625691107273620f182c66732c33488dfaf
607
class ArticleObserver < ActiveRecord::Observer def before_save(record) if (record.is_a?(Article) && record.save_version?) || record.is_a?(Comment) @event = Event.new @event.mode = case when record.is_a?(Comment) then 'comment' when record.new_record? then 'publish' else 'edit' end end end def after_save(record) if @event && record.is_a?(Article) @event.update_attributes :title => record.title, :body => record.body, :article => record, :user => record.updater, :site => record.site end end alias after_destroy after_save end
28.904762
142
0.652389
ac1151e6643ce09375c6525aa7d37bdaf2b00a47
2,211
# -*- encoding: utf-8 -*- # stub: activesupport 5.1.6 ruby lib Gem::Specification.new do |s| s.name = "activesupport".freeze s.version = "5.1.6" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.metadata = { "changelog_uri" => "https://github.com/rails/rails/blob/v5.1.6/activesupport/CHANGELOG.md", "source_code_uri" => "https://github.com/rails/rails/tree/v5.1.6/activesupport" } if s.respond_to? :metadata= s.require_paths = ["lib".freeze] s.authors = ["David Heinemeier Hansson".freeze] s.date = "2018-03-29" s.description = "A toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Rich support for multibyte strings, internationalization, time zones, and testing.".freeze s.email = "[email protected]".freeze s.homepage = "http://rubyonrails.org".freeze s.licenses = ["MIT".freeze] s.rdoc_options = ["--encoding".freeze, "UTF-8".freeze] s.required_ruby_version = Gem::Requirement.new(">= 2.2.2".freeze) s.rubygems_version = "2.7.8".freeze s.summary = "A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.".freeze s.installed_by_version = "2.7.8" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<i18n>.freeze, [">= 0.7", "< 2"]) s.add_runtime_dependency(%q<tzinfo>.freeze, ["~> 1.1"]) s.add_runtime_dependency(%q<minitest>.freeze, ["~> 5.1"]) s.add_runtime_dependency(%q<concurrent-ruby>.freeze, ["~> 1.0", ">= 1.0.2"]) else s.add_dependency(%q<i18n>.freeze, [">= 0.7", "< 2"]) s.add_dependency(%q<tzinfo>.freeze, ["~> 1.1"]) s.add_dependency(%q<minitest>.freeze, ["~> 5.1"]) s.add_dependency(%q<concurrent-ruby>.freeze, ["~> 1.0", ">= 1.0.2"]) end else s.add_dependency(%q<i18n>.freeze, [">= 0.7", "< 2"]) s.add_dependency(%q<tzinfo>.freeze, ["~> 1.1"]) s.add_dependency(%q<minitest>.freeze, ["~> 5.1"]) s.add_dependency(%q<concurrent-ruby>.freeze, ["~> 1.0", ">= 1.0.2"]) end end
49.133333
218
0.665762
ab9c567866f6d7d6b84d1286cd5c351980d1de26
227
# frozen_string_literal: true module Amadeus # A list of directions, as used in Busiest Travel Period module Direction # Airport ARRIVING = 'ARRIVING'.freeze # City DEPARTING = 'DEPARTING'.freeze end end
18.916667
58
0.704846
7ac9da0582f277a8291b7a9dc45dff3310ff954f
447
cask :v1 => 'owncloud' do version '1.7.0.1339' sha256 'baa848c46e0a1cc0e88cf78a2419bfdb7d55fd984100d9fe1babc4a97eb00d9a' url "https://download.owncloud.com/desktop/stable/ownCloud-#{version}.pkg" homepage 'http://owncloud.com' license :unknown pkg "ownCloud-#{version}.pkg" uninstall :pkgutil => [ 'com.ownCloud.client', 'com.owncCloud.finderPlugin', ] end
29.8
76
0.61745
f84b61a6bd945942f96abb026d9743456c875865
557
cask 'synology-cloud-station' do version '3.2-3487' sha256 'c2446bb15ce0e113253635a3457643c260f9c92cf9aec5e4d69b5d49c2592631' url "https://global.download.synology.com/download/Tools/CloudStation/#{version}/Mac/Installer/synology-cloud-station-#{version.sub(%r{.*-},'')}.dmg" name 'Synology Cloud Station' homepage 'https://www.synology.com/' license :gratis pkg "synology-cloud-station-#{version.sub(%r{.*-},'')}.pkg" uninstall :pkgutil => 'com.synology.CloudStation', :launchctl => 'com.synology.Synology Cloud Station' end
37.133333
151
0.723519
ed0b46502e859bf80330fa0a6bed57be0f57535d
1,246
# frozen_string_literal: true require 'rails_helper' describe HistogramPlotter do let(:course) do create(:course, slug: "Sage's/te,_st_(slug)", id: 1, start: 1.year.ago, end: 1.day.from_now) end let(:opts) { { existing_only: true, minimum_improvement: 1 } } let(:article) { create(:article) } let(:revision) do create(:revision, article: article, date: 1.day.ago, wp10: 70, wp10_previous: 1) end before do FileUtils.rm_rf "#{Rails.root}/public/assets/system" end after do FileUtils.rm_rf "#{Rails.root}/public/assets/system" end context 'when there is no article data' do it 'returns an empty CSV' do csv = described_class.csv(course: course) expect(File.readlines(csv).count).to eq(1) end end context 'when there is article data' do before do course.articles << article end it 'returns a CSV with article data for a course' do csv = described_class.csv(course: course) expect(File.readlines(csv).count).to eq(2) end it 'returns a CSV with article data for a campaign' do course.campaigns << Campaign.first csv = described_class.csv(campaign: Campaign.first) expect(File.readlines(csv).count).to eq(2) end end end
26.510638
96
0.674157
6ab38e7599f8992f8a361036e3d5be8ac7305235
222
require 'rubygems' require 'bundler/setup' require "minitest/reporters" reporter_options = { color: true } Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(reporter_options)] require 'minitest/autorun'
24.666667
85
0.792793
398d96d9b50e0d061d5f17b5958b6665ad01ea5f
7,149
#!/usr/bin/env ruby require 'json' require 'yaml' require 'puppet_litmus' require_relative '../lib/task_helper' def install_ssh_components(platform, container) case platform when %r{debian}, %r{ubuntu}, %r{cumulus} run_local_command("docker exec #{container} apt-get update") run_local_command("docker exec #{container} apt-get install -y openssh-server openssh-client") when %r{fedora} run_local_command("docker exec #{container} dnf clean all") run_local_command("docker exec #{container} dnf install -y sudo openssh-server openssh-clients") run_local_command("docker exec #{container} ssh-keygen -A") when %r{centos}, %r{^el-}, %r{eos}, %r{oracle}, %r{redhat}, %r{scientific} run_local_command("docker exec #{container} yum clean all") run_local_command("docker exec #{container} yum install -y sudo openssh-server openssh-clients") ssh_folder = run_local_command("docker exec #{container} ls /etc/ssh/") run_local_command("docker exec #{container} ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N \"\"") unless ssh_folder =~ %r{ssh_host_rsa_key} run_local_command("docker exec #{container} ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N \"\"") unless ssh_folder =~ %r{ssh_host_dsa_key} when %r{opensuse}, %r{sles} run_local_command("docker exec #{container} zypper -n in openssh") run_local_command("docker exec #{container} ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key") run_local_command("docker exec #{container} ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key") run_local_command("docker exec #{container} sed -ri \"s/^#?UsePAM .*/UsePAM no/\" /etc/ssh/sshd_config") when %r{archlinux} run_local_command("docker exec #{container} pacman --noconfirm -Sy archlinux-keyring") run_local_command("docker exec #{container} pacman --noconfirm -Syu") run_local_command("docker exec #{container} pacman -S --noconfirm openssh") run_local_command("docker exec #{container} ssh-keygen -A") run_local_command("docker exec #{container} sed -ri \"s/^#?UsePAM .*/UsePAM no/\" /etc/ssh/sshd_config") run_local_command("docker exec #{container} systemctl enable sshd") else raise "platform #{platform} not yet supported on docker" end # Make sshd directory, set root password run_local_command("docker exec #{container} mkdir -p /var/run/sshd") run_local_command("docker exec #{container} bash -c \"echo root:root | /usr/sbin/chpasswd\"") end def fix_ssh(platform, container) run_local_command("docker exec #{container} sed -ri \"s/^#?PermitRootLogin .*/PermitRootLogin yes/\" /etc/ssh/sshd_config") run_local_command("docker exec #{container} sed -ri \"s/^#?PasswordAuthentication .*/PasswordAuthentication yes/\" /etc/ssh/sshd_config") run_local_command("docker exec #{container} sed -ri \"s/^#?UseDNS .*/UseDNS no/\" /etc/ssh/sshd_config") run_local_command("docker exec #{container} sed -e \"/HostKey.*ssh_host_e.*_key/ s/^#*/#/\" -ri /etc/ssh/sshd_config") case platform when %r{debian}, %r{ubuntu} run_local_command("docker exec #{container} service ssh restart") when %r{centos}, %r{^el-}, %r{eos}, %r{fedora}, %r{oracle}, %r{redhat}, %r{scientific} if container !~ %r{7|8} run_local_command("docker exec #{container} service sshd restart") else run_local_command("docker exec -d #{container} /usr/sbin/sshd -D") end else raise "platform #{platform} not yet supported on docker" end end def provision(docker_platform, inventory_location) include PuppetLitmus::InventoryManipulation inventory_full_path = File.join(inventory_location, 'inventory.yaml') inventory_hash = get_inventory_hash(inventory_full_path) warn '!!! Using private port forwarding!!!' platform, version = docker_platform.split(':') front_facing_port = 2222 platform = platform.sub(%r{/}, '_') full_container_name = "#{platform}_#{version}-#{front_facing_port}" (front_facing_port..2230).each do |i| front_facing_port = i full_container_name = "#{platform}_#{version}-#{front_facing_port}" ports = "#{front_facing_port}->22" list_command = 'docker container ls -a' stdout, _stderr, _status = Open3.capture3(list_command) break unless stdout.include?(ports) raise 'All front facing ports are in use.' if front_facing_port == 2230 end deb_family_systemd_volume = if (docker_platform =~ %r{debian|ubuntu}) && (docker_platform !~ %r{debian8|ubuntu14}) '--volume /sys/fs/cgroup:/sys/fs/cgroup:ro' else '' end creation_command = "docker run -d -it #{deb_family_systemd_volume} --privileged -p #{front_facing_port}:22 --name #{full_container_name} #{docker_platform}" run_local_command(creation_command) install_ssh_components(platform, full_container_name) fix_ssh(platform, full_container_name) hostname = 'localhost' node = { 'name' => "#{hostname}:#{front_facing_port}", 'config' => { 'transport' => 'ssh', 'ssh' => { 'user' => 'root', 'password' => 'root', 'port' => front_facing_port, 'host-key-check' => false } }, 'facts' => { 'provisioner' => 'docker', 'container_name' => full_container_name, 'platform' => docker_platform } } group_name = 'ssh_nodes' add_node_to_group(inventory_hash, node, group_name) File.open(inventory_full_path, 'w') { |f| f.write inventory_hash.to_yaml } { status: 'ok', node_name: "#{hostname}:#{front_facing_port}", node: node } end def tear_down(node_name, inventory_location) include PuppetLitmus::InventoryManipulation inventory_full_path = File.join(inventory_location, 'inventory.yaml') raise "Unable to find '#{inventory_full_path}'" unless File.file?(inventory_full_path) inventory_hash = inventory_hash_from_inventory_file(inventory_full_path) node_facts = facts_from_node(inventory_hash, node_name) remove_docker = "docker rm -f #{node_facts['container_name']}" run_local_command(remove_docker) remove_node(inventory_hash, node_name) puts "Removed #{node_name}" File.open(inventory_full_path, 'w') { |f| f.write inventory_hash.to_yaml } { status: 'ok' } end params = JSON.parse(STDIN.read) platform = params['platform'] action = params['action'] node_name = params['node_name'] inventory_location = sanitise_inventory_location(params['inventory']) raise 'specify a node_name when tearing down' if action == 'tear_down' && node_name.nil? raise 'specify a platform when provisioning' if action == 'provision' && platform.nil? unless node_name.nil? ^ platform.nil? case action when 'tear_down' raise 'specify only a node_name, not platform, when tearing down' when 'provision' raise 'specify only a platform, not node_name, when provisioning' else raise 'specify only one of: node_name, platform' end end begin result = provision(platform, inventory_location) if action == 'provision' result = tear_down(node_name, inventory_location) if action == 'tear_down' puts result.to_json exit 0 rescue => e puts({ _error: { kind: 'facter_task/failure', msg: e.message } }.to_json) exit 1 end
50.702128
158
0.707651
61a951fac44c154379269afa010db14ce9ce7e45
873
module RspecLogFormatter module Analysis class PrettyPrinter def initialize(results) @results = results end def to_s results = @results.reject do |result| result[:fraction] == 0.0 end.first(10) header = if results.empty? "None of the specs were flaky" else "Top #{results.size} flakiest examples\n" end header + results.each_with_index.map do |result, i| title = " #{i+1}) #{result[:description]} -- #{(100.0*result[:fraction]).to_i}%#{cost_segment(result)}" failure_messages = result[:failure_messages].map { |fm| " * #{fm}" }.join("\n") title + "\n" + failure_messages end.join("\n") end def cost_segment(result) " (cost: #{result[:cost].round(2)}s)" if result[:cost] end end end end
28.16129
114
0.557847
2696f43509817cfadbbab6a5ed365d3f20e31fe9
1,766
module Pageflow class Membership < ApplicationRecord belongs_to :user belongs_to :entity, polymorphic: true belongs_to :entry, -> { where(pageflow_memberships: {entity_type: 'Pageflow::Entry'}) }, foreign_key: 'entity_id', optional: true belongs_to :account, -> { where(pageflow_memberships: {entity_type: 'Pageflow::Account'}) }, foreign_key: 'entity_id', optional: true validates :user, :entity, :role, presence: true validates :user_id, uniqueness: {scope: [:entity_type, :entity_id]} validate :account_membership_exists, if: :on_entry? validates :role, inclusion: {in: %w(previewer editor publisher manager)}, if: :on_entry? validates :role, inclusion: {in: %w(member previewer editor publisher manager)}, if: :on_account? scope :on_entries, -> { where(entity_type: 'Pageflow::Entry') } scope :on_accounts, -> { where(entity_type: 'Pageflow::Account') } scope :as_manager, -> { where(role: :manager) } scope :as_publisher_or_above, -> { where(role: %w(publisher manager)) } scope :as_previewer_or_above, -> { where(role: %w(previewer editor publisher manager)) } after_create do entity.increment!(:users_count) end after_destroy do entity.decrement!(:users_count) end private def account_membership_exists unless user.accounts.include?(entity.account) errors[:base] << 'Entry Membership misses presupposed Membership on account of entry' end end def on_entry? entity_type == 'Pageflow::Entry' end def on_account? entity_type == 'Pageflow::Account' end end end
32.109091
93
0.632503
7a5ea5f62bbe3ff043ad1dcaa1cf5329815cc06e
1,608
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20180323094156) do create_table "barbers", force: :cascade do |t| t.text "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "client", force: :cascade do |t| t.text "name" t.text "phone" t.text "datestamp" t.text "barber" t.text "color" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "clients", force: :cascade do |t| t.text "name" t.text "phone" t.text "datestamp" t.text "barber" t.text "color" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "contacts", force: :cascade do |t| t.text "name" t.text "email" t.text "phone" t.datetime "created_at", null: false t.datetime "updated_at", null: false end end
32.16
86
0.709577
bf363de4ca2dc009bc57003bffdb7ef302728a03
1,491
module Jets::Commands::Markdown class Creator cattr_accessor :mute def self.create_all clean new.create_all end def self.clean FileUtils.rm_rf("docs/_reference") FileUtils.rm_f("docs/reference.md") end def cli_classes Jets::Commands::Base.namespaced_commands.map do |full_command| # IE of full_command: dynamodb:generate Jets::CLI.new([full_command]).lookup(full_command) end.uniq end def create_all create_index cli_classes.each do |cli_class| # cli_class examples: # Jets::Commands::Main # Jets::Commands::Db # Jets::Commands::Dynamodb::Migrate cli_class.commands.each do |command| command_name = command.first page = Page.new(cli_class: cli_class, command_name: command_name) create_page(page) end end end def create_page(page) puts "Creating page: #{page.path}..." FileUtils.mkdir_p(File.dirname(page.path)) IO.write(page.path, page.doc) end def create_index create_include_reference page = Index.new FileUtils.mkdir_p(File.dirname(page.path)) puts "Creating index: #{page.path}" IO.write(page.path, page.doc) end def create_include_reference path = "docs/_includes/reference.md" IO.write(path, "Generic tool description. Please edit #{path} with a description.") unless File.exist?(path) end end end
25.706897
114
0.639168
bb3fc57b8c5d94e3db1b685c016aa216bcc23f17
6,148
require 'spec_helper' describe API::LdapGroupLinks, api: true do include ApiHelpers let(:owner) { create(:user) } let(:user) { create(:user) } let(:admin) { create(:admin) } let!(:group_with_ldap_links) do group = create(:group) group.ldap_group_links.create cn: 'ldap-group1', group_access: Gitlab::Access::MASTER, provider: 'ldap1' group.ldap_group_links.create cn: 'ldap-group2', group_access: Gitlab::Access::MASTER, provider: 'ldap2' group end before do group_with_ldap_links.add_owner owner group_with_ldap_links.add_user user, Gitlab::Access::DEVELOPER end describe "POST /groups/:id/ldap_group_links" do context "when unauthenticated" do it "returns authentication error" do post api("/groups/#{group_with_ldap_links.id}/ldap_group_links") expect(response.status).to eq 401 end end context "when a less priviledged user" do it "does not allow less priviledged user to add LDAP group link" do expect do post api("/groups/#{group_with_ldap_links.id}/ldap_group_links", user), cn: 'ldap-group4', group_access: GroupMember::GUEST end.not_to change { group_with_ldap_links.ldap_group_links.count } expect(response.status).to eq(403) end end context "when owner of the group" do it "returns ok and add ldap group link" do expect do post api("/groups/#{group_with_ldap_links.id}/ldap_group_links", owner), cn: 'ldap-group3', group_access: GroupMember::GUEST, provider: 'ldap3' end.to change { group_with_ldap_links.ldap_group_links.count }.by(1) expect(response.status).to eq(201) expect(json_response['cn']).to eq('ldap-group3') expect(json_response['group_access']).to eq(GroupMember::GUEST) expect(json_response['provider']).to eq('ldap3') end # TODO: Correct and activate this test once issue #329 is fixed xit "returns ok and add ldap group link even if no provider specified" do expect do post api("/groups/#{group_with_ldap_links.id}/ldap_group_links", owner), cn: 'ldap-group3', group_access: GroupMember::GUEST end.to change { group_with_ldap_links.ldap_group_links.count }.by(1) expect(response.status).to eq(201) expect(json_response['cn']).to eq('ldap-group3') expect(json_response['group_access']).to eq(GroupMember::GUEST) expect(json_response['provider']).to eq('ldapmain') end it "returns error if LDAP group link already exists" do post api("//groups/#{group_with_ldap_links.id}/ldap_group_links", owner), provider: 'ldap1', cn: 'ldap-group1', group_access: GroupMember::GUEST expect(response.status).to eq(409) end it "returns a 400 error when cn is not given" do post api("//groups/#{group_with_ldap_links.id}/ldap_group_links", owner), group_access: GroupMember::GUEST expect(response.status).to eq(400) end it "returns a 400 error when group access is not given" do post api("//groups/#{group_with_ldap_links.id}/ldap_group_links", owner), cn: 'ldap-group3' expect(response.status).to eq(400) end it "returns a 422 error when group access is not known" do post api("//groups/#{group_with_ldap_links.id}/ldap_group_links", owner), cn: 'ldap-group3', group_access: 11, provider: 'ldap1' expect(response.status).to eq(422) end end end describe 'DELETE /groups/:id/ldap_group_links/:cn' do context "when unauthenticated" do it "returns authentication error" do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap-group1") expect(response.status).to eq 401 end end context "when a less priviledged user" do it "does not remove the LDAP group link" do expect do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap-group1", user) end.not_to change { group_with_ldap_links.ldap_group_links.count } expect(response.status).to eq(403) end end context "when owner of the group" do it "removes ldap group link" do expect do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap-group1", owner) end.to change { group_with_ldap_links.ldap_group_links.count }.by(-1) expect(response.status).to eq(200) end it "returns 404 if LDAP group cn not used for a LDAP group link" do expect do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap-group1356", owner) end.not_to change { group_with_ldap_links.ldap_group_links.count } expect(response.status).to eq(404) end end end describe 'DELETE /groups/:id/ldap_group_links/:provider/:cn' do context "when unauthenticated" do it "returns authentication error" do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap2/ldap-group2") expect(response.status).to eq 401 end end context "when a less priviledged user" do it "does not remove the LDAP group link" do expect do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap2/ldap-group2", user) end.not_to change { group_with_ldap_links.ldap_group_links.count } expect(response.status).to eq(403) end end context "when owner of the group" do it "returns 404 if LDAP group cn not used for a LDAP group link for the specified provider" do expect do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap1/ldap-group2", owner) end.not_to change { group_with_ldap_links.ldap_group_links.count } expect(response.status).to eq(404) end it "removes ldap group link" do expect do delete api("/groups/#{group_with_ldap_links.id}/ldap_group_links/ldap2/ldap-group2", owner) end.to change { group_with_ldap_links.ldap_group_links.count }.by(-1) expect(response.status).to eq(200) end end end end
37.717791
152
0.675016
036f826357089c92373378982855eb1331af1171
1,440
require 'active_support' require 'active_support/core_ext' Dir["#{__dir__}/mask_type/*.rb"].each {|file| require file } module Maskdump class Mask DIR_PREFIX = "maskdump/mask_type".freeze def initialize(records, column_settings) @column_settings = column_settings @records = records end def mask @column_settings.each_with_object(@records) do |column_setting, arr| begin arr = mask_type_klass(column_setting).new(arr, column_setting[:name], column_setting[:mask][:args]).mask rescue Exception => e raise e.exception("Failed mask in `#{column_setting[:name]}'. #{e.message}") end end end private def mask_type_klass(column_setting) klass = File.join(DIR_PREFIX, column_setting[:mask][:type]).classify.safe_constantize klass ? klass : custom_mask_type_klass(column_setting[:mask][:type]) end def custom_mask_type_klass(method) paths = plugin_paths(method) raise "TODO" if paths.empty? require paths.first klass = plugin_path(method).classify.safe_constantize raise "TODO" unless klass klass end def plugin_paths(method) $LOAD_PATH.map do |load_path| path = File.join(load_path, plugin_path(method)) + ".rb" File.exist?(path) ? path : nil end.compact end def plugin_path(method) "#{DIR_PREFIX}/plugin/#{method}" end end end
27.692308
114
0.663889
28fb4d0b516dfed131d29628f39cf5ec00560b2c
658
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Testing class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. end end
32.9
82
0.764438
1c283e9f9e3bbb3fcac3b37d19ebc295fbcce51e
937
module VagrantPlugins module ChefZero module Action class Reconfig include VagrantPlugins::ChefZero::EnvHelpers include VagrantPlugins::ChefZero::ServerHelpers def initialize(app, env) @app = app if chef_zero_enabled?(env) @key = get_key_path(env) set_config("@validation_key_path", @key, env) @chef_server_url = get_chef_server_url(env) set_config("@chef_server_url", @chef_server_url, env) @validation_client_name = get_validation_client_name(env) set_config("@validation_client_name", @validation_client_name, env) write_knife_config(env) end if berkshelf_enabled?(env) @key = get_key_path(env) set_berkshelf_client_key(@key) end end def call(env) @app.call(env) end end end end end
22.853659
79
0.597652
61493b69249bd457f235b27e79e8f6a10d718ab2
15,451
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # # Copyright (c) 2016, Electric Power Research Institute (EPRI) # All rights reserved. # # OpenADR ("this software") is licensed under BSD 3-Clause license. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the name of EPRI nor the names of its contributors may # be used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY # OF SUCH DAMAGE. # # This EPRI software incorporates work covered by the following copyright and permission # notices. You may not use these works except in compliance with their respective # licenses, which are provided below. # # These works are provided by the copyright holders and contributors "as is" and any express or # implied warranties, including, but not limited to, the implied warranties of merchantability # and fitness for a particular purpose are disclaimed. # ######################################################################################### # MIT Licensed Libraries ######################################################################################### # # * actionmailer 3.2.12 (http://www.rubyonrails.org) - Email composition, delivery, and receiving framework (part of Rails). # * actionpack 3.2.12 (http://www.rubyonrails.org) - Web-flow and rendering framework putting the VC in MVC (part of Rails). # * activemodel 3.2.12 (http://www.rubyonrails.org) - A toolkit for building modeling frameworks (part of Rails). # * activerecord 3.2.12 (http://www.rubyonrails.org) - Object-relational mapper framework (part of Rails). # * activeresource 3.2.12 (http://www.rubyonrails.org) - REST modeling framework (part of Rails). # * activesupport 3.2.12 (http://www.rubyonrails.org) - A toolkit of support libraries and Ruby core extensions extracted from the Rails framework. # * arel 3.0.2 (http://github.com/rails/arel) - Arel is a SQL AST manager for Ruby # * bootstrap-sass 3.1.1.0 (https://github.com/twbs/bootstrap-sass) - Twitter's Bootstrap, converted to Sass and ready to drop into Rails or Compass # * builder 3.0.4 (http://onestepback.org) - Builders for MarkUp. # * bundler 1.12.5 (http://bundler.io) - The best way to manage your application's dependencies # * capybara 2.4.4 (http://github.com/jnicklas/capybara) - Capybara aims to simplify the process of integration testing Rack applications, such as Rails, Sinatra or Merb # * coffee-rails 3.2.2 () - Coffee Script adapter for the Rails asset pipeline. # * coffee-script-source 1.6.3 (http://jashkenas.github.com/coffee-script/) - The CoffeeScript Compiler # * docile 1.1.5 (https://ms-ati.github.io/docile/) - Docile keeps your Ruby DSLs tame and well-behaved # * edn 1.0.0 () - 'edn implements a reader for Extensible Data Notation by Rich Hickey.' # * erubis 2.7.0 (http://www.kuwata-lab.com/erubis/) - a fast and extensible eRuby implementation which supports multi-language # * execjs 1.4.0 (https://github.com/sstephenson/execjs) - Run JavaScript code from Ruby # * factory_girl 4.5.0 (https://github.com/thoughtbot/factory_girl) - factory_girl provides a framework and DSL for defining and using model instance factories. # * factory_girl_rails 4.5.0 (http://github.com/thoughtbot/factory_girl_rails) - factory_girl_rails provides integration between factory_girl and rails 3 # * gem-licenses 0.1.2 (http://github.com/dblock/gem-licenses) - List all gem licenses. # * hike 1.2.3 (http://github.com/sstephenson/hike) - Find files in a set of paths # * i18n 0.6.5 (http://github.com/svenfuchs/i18n) - New wave Internationalization support for Ruby # * jdbc-postgresql 9.2.1000 (https://github.com/rosenfeld/jdbc-postgresql) - PostgresSQL jdbc driver for JRuby # * journey 1.0.4 (http://github.com/rails/journey) - Journey is a router # * jquery-rails 3.0.4 (http://rubygems.org/gems/jquery-rails) - Use jQuery with Rails 3 # * json-schema 2.6.2 (http://github.com/ruby-json-schema/json-schema/tree/master) - Ruby JSON Schema Validator # * mail 2.4.4 (http://github.com/mikel/mail) - Mail provides a nice Ruby DSL for making, sending and reading emails. # * metaclass 0.0.4 (http://github.com/floehopper/metaclass) - Adds a metaclass method to all Ruby objects # * mime-types 1.23 (http://mime-types.rubyforge.org/) - This library allows for the identification of a file's likely MIME content type # * mocha 1.1.0 (http://gofreerange.com/mocha/docs) - Mocking and stubbing library # * multi_json 1.7.9 (http://github.com/intridea/multi_json) - A common interface to multiple JSON libraries. # * nokogiri 1.6.5 (http://nokogiri.org) - Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser # * polyglot 0.3.3 (http://github.com/cjheath/polyglot) - Augment 'require' to load non-Ruby file types # * rack-test 0.6.2 (http://github.com/brynary/rack-test) - Simple testing API built on Rack # * railties 3.2.12 (http://www.rubyonrails.org) - Tools for creating, working with, and running Rails applications. # * rake 10.1.0 (http://rake.rubyforge.org) - Ruby based make-like utility. # * rspec-core 2.14.3 (http://github.com/rspec/rspec-core) - rspec-core-2.14.3 # * rspec-expectations 2.14.0 (http://github.com/rspec/rspec-expectations) - rspec-expectations-2.14.0 # * rspec-mocks 2.14.1 (http://github.com/rspec/rspec-mocks) - rspec-mocks-2.14.1 # * rspec-rails 2.14.0 (http://github.com/rspec/rspec-rails) - rspec-rails-2.14.0 # * sass 3.2.9 (http://sass-lang.com/) - A powerful but elegant CSS compiler that makes CSS fun again. # * sass-rails 3.2.6 () - Sass adapter for the Rails asset pipeline. # * simplecov 0.9.0 (http://github.com/colszowka/simplecov) - Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites # * spork 1.0.0rc3 (http://github.com/sporkrb/spork) - spork # * therubyrhino 2.0.2 (http://github.com/cowboyd/therubyrhino) - Embed the Rhino JavaScript interpreter into JRuby # * thor 0.18.1 (http://whatisthor.com/) - A scripting framework that replaces rake, sake and rubigen # * tilt 1.4.1 (http://github.com/rtomayko/tilt/) - Generic interface to multiple Ruby template engines # * treetop 1.4.14 (https://github.com/cjheath/treetop) - A Ruby-based text parsing and interpretation DSL # * uglifier 2.1.2 (http://github.com/lautis/uglifier) - Ruby wrapper for UglifyJS JavaScript compressor # * xpath 2.0.0 (http://github.com/jnicklas/xpath) - Generate XPath expressions from Ruby # * blankslate 2.1.2.4 (http://github.com/masover/blankslate) - BlankSlate extracted from Builder. # * bourbon 3.1.8 (https://github.com/thoughtbot/bourbon) - Bourbon Sass Mixins using SCSS syntax. # * coffee-script 2.2.0 (http://github.com/josh/ruby-coffee-script) - Ruby CoffeeScript Compiler # * diff-lcs 1.2.4 (http://diff-lcs.rubyforge.org/) - Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm # * jquery-ui-rails 4.0.3 (https://github.com/joliss/jquery-ui-rails) - jQuery UI packaged for the Rails asset pipeline # * parslet 1.4.0 (http://kschiess.github.com/parslet) - Parser construction library with great error reporting in Ruby. # * rack 1.4.5 (http://rack.github.com/) - a modular Ruby webserver interface # * rack-cache 1.2 (http://tomayko.com/src/rack-cache/) - HTTP Caching for Rack # * rack-ssl 1.3.3 (https://github.com/josh/rack-ssl) - Force SSL/TLS in your app. # * rails 3.2.12 (http://www.rubyonrails.org) - Full-stack web application framework. # * simplecov-html 0.8.0 (https://github.com/colszowka/simplecov-html) - Default HTML formatter for SimpleCov code coverage tool for ruby 1.9+ # * tzinfo 0.3.37 (http://tzinfo.rubyforge.org/) - Daylight-savings aware timezone library # * warbler 1.4.0.beta1 (http://caldersphere.rubyforge.org/warbler) - Warbler chirpily constructs .war files of your Rails applications. # ######################################################################################### # BSD Licensed Libraries ######################################################################################### # # * activerecord-jdbc-adapter 1.2.9.1 (https://github.com/jruby/activerecord-jdbc-adapter) - Copyright (c) 2006-2012 Nick Sieger <[email protected]>, Copyright (c) 2006-2008 Ola Bini <[email protected]> # * jdbc-postgres 9.2.1004 (https://github.com/jruby/activerecord-jdbc-adapter) - Copyright (c) 1997-2011, PostgreSQL Global Development Group # * d3js 3.5.16 (https://d3js.org/) Copyright (c) 2015 Mike Bostock # ######################################################################################### # Ruby Licensed Libraries ######################################################################################### # # * json 1.8.0 (http://json-jruby.rubyforge.org/) - JSON implementation for JRuby # * rubyzip 0.9.9 (http://github.com/aussiegeek/rubyzip) - rubyzip is a ruby module for reading and writing zip files # * httpclient 2.3.4.1 (http://github.com/nahi/httpclient) - gives something like the functionality of libwww-perl (LWP) in Ruby # * test-unit 2.5.5 (http://test-unit.rubyforge.org/) - test-unit - Improved version of Test::Unit bundled in Ruby 1.8.x. # ######################################################################################### # Public domain - creative commons Licensed Libraries ######################################################################################### # # * torquebox 3.1.2 (http://torquebox.org/) - TorqueBox Gem # * torquebox-cache 3.1.2 (http://torquebox.org/) - TorqueBox Cache Gem # * torquebox-configure 3.1.2 (http://torquebox.org/) - TorqueBox Configure Gem # * torquebox-core 3.1.2 (http://torquebox.org/) - TorqueBox Core Gem # * torquebox-messaging 3.1.2 (http://torquebox.org/) - TorqueBox Messaging Client # * torquebox-naming 3.1.2 (http://torquebox.org/) - TorqueBox Naming Client # * torquebox-rake-support 3.1.2 (http://torquebox.org/) - TorqueBox Rake Support # * torquebox-security 3.1.2 (http://torquebox.org/) - TorqueBox Security Gem # * torquebox-server 3.1.2 (http://torquebox.org/) - TorqueBox Server Gem # * torquebox-stomp 3.1.2 (http://torquebox.org/) - TorqueBox STOMP Support # * torquebox-transactions 3.1.2 (http://torquebox.org/) - TorqueBox Transactions Gem # * torquebox-web 3.1.2 (http://torquebox.org/) - TorqueBox Web Gem # ######################################################################################### # Apache Licensed Libraries ######################################################################################### # # * addressable 2.3.8 (https://github.com/sporkmonger/addressable) - URI Implementation # * bcrypt-ruby 3.0.1 (http://bcrypt-ruby.rubyforge.org) - OpenBSD's bcrypt() password hashing algorithm. # * database_cleaner 1.4.0 (http://github.com/bmabey/database_cleaner) - Strategies for cleaning databases. Can be used to ensure a clean state for testing. # * annotate 2.5.0 (http://github.com/ctran/annotate_models) - Annotates Rails Models, routes, fixtures, and others based on the database schema. # * nvd3 1.8.4 (http://nvd3.org/) Copeyright (c) 2014 Novus Partners - chart library based on d3js # * smack 3.3.1 (https://www.igniterealtime.org/projects/smack/) - XMPP library # ######################################################################################### # LGPL ######################################################################################### # # * jruby-1.7.4 # * jruby-jars 1.7.4 (http://github.com/jruby/jruby/tree/master/gem/jruby-jars) - The core JRuby code and the JRuby stdlib as jar # ** JRuby is tri-licensed GPL, LGPL, and EPL. # ######################################################################################### # MPL Licensed Libraries ######################################################################################### # # * therubyrhino_jar 1.7.4 (http://github.com/cowboyd/therubyrhino) - Rhino's jars packed for therubyrhino # ######################################################################################### # Artistic 2.0 # * mime-types 1.23 (http://mime-types.rubyforge.org/) - This library allows for the identification of a file's likely MIME content type # ######################################################################################### # ######################################################################################### # GPL-2 ######################################################################################### # * mime-types 1.23 (http://mime-types.rubyforge.org/) - This library allows for the identification of a file's likely MIME content type # ######################################################################################### # No License Given ######################################################################################### # # * spork-testunit 0.0.8 (http://github.com/timcharper/spork-testunit) - spork-testunit # * sprockets 2.2.2 (http://getsprockets.org/) - Rack-based asset packaging system # #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ require 'app/lib/oadr_logger' require 'app/models/schedule' require 'app/models/event' class AdvanceObjects ######################################################## def initialize(options) @sleep = options['sleep'] end ######################################################## def start OadrLogger.instance.log_info('starting UpdateSchedules service') Thread.new do until @done begin # OadrLogger.instance.log_info('updating schedules and events') Schedule.create_events Event.update_statuses rescue Exception => ex OadrLogger.instance.log_caught_exception(ex) end begin # force the service to run on the minute now = DateTime.now sleep_time = 60 - now.sec sleep_time = (sleep_time < @sleep ? sleep_time : @sleep) # OadrLogger.instance.log_info("sleeping for #{sleep_time}") sleep sleep_time rescue Exception => ex OadrLogger.instance.log_caught_exception(ex) end end end end ######################################################## def stop @done = true end end
63.32377
206
0.628244
8755871b0c492f92625f823bf5b44170524c24ba
872
module Librato module Services class Numbers def self.format_for_threshold(threshold, number, tolerance=2) threshold_decimals = number_decimal_places(threshold) number_decimals = number_decimal_places(number) if !threshold_decimals || !number_decimals return number end if (number_decimals - tolerance) <= threshold_decimals return number end # here we have more decimals in the number than the threshold # number: 3.14159 # threshold: 3.14 factor = (10**(threshold_decimals+tolerance)).to_f (number * factor).truncate / factor end def self.number_decimal_places(number) segments = number.to_s.split('.') if segments.length != 2 return 0 end segments[1].length end end end end
24.914286
69
0.62156
28c65be44eefa5b4dc103d2b1b80d2733e278419
275
class Admin::AccountRequestsController < AdminController def index @open_account_requests = AccountRequest.where(confirmed_at: nil).order('created_at DESC') @closed_account_requests = AccountRequest.where.not(confirmed_at: nil).order('confirmed_at DESC') end end
39.285714
101
0.796364
28e99d31b3c5af5ee201a793da64bb1b62f35f12
672
require 'spec_helper' module ShouldaRouting module Namespaces describe Method do subject { Class.new.extend described_class } describe "#namespace" do it "calls Namespaces::Base test! method with correct params" do namespace_instance = Namespaces::Base.new namespace_instance.stub(:test!).and_return("tested!") Namespaces::Base.should_receive(:new). with(:admin, option: 1). exactly(1).times. and_return(namespace_instance) subject.namespace(:admin, option: 1).should eq "tested!" end end end end end
28
71
0.590774
386d06d4e055901842bc8d6af1a5556a7954fce3
1,018
# # Be sure to run `pod lib lint PGFoundation.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'PGFoundation' s.version = '0.0.1' s.summary = 'A short description of PGFoundation.' s.description = <<-DESC TODO: Add long description of the pod here. DESC s.homepage = 'https://github.com/fyhNB/PGFoundation' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'fyhNB' => '[email protected]' } s.source = { :git => 'https://github.com/fyhNB/PGFoundation.git', :tag => s.version.to_s } s.ios.deployment_target = '13.0' s.source_files = 'PGFoundation/Classes/**/*' # s.resource_bundles = { # 'PGFoundation' => ['PGFoundation/Assets/*.png'] # } s.dependency 'RxSwift' end
30.848485
102
0.604126
bffc8ea950e8b9f0bcb694dd572fec091f4be236
3,003
# frozen_string_literal: true require "concurrent-ruby" require "ferrum/browser/subscriber" require "ferrum/browser/web_socket" module Ferrum class Browser class Client INTERRUPTIONS = %w[Fetch.requestPaused Fetch.authRequired].freeze def initialize(browser, ws_url, id_starts_with: 0) @browser = browser @command_id = id_starts_with @pendings = Concurrent::Hash.new @ws = WebSocket.new(ws_url, @browser.ws_max_receive_size, @browser.logger) @subscriber, @interruptor = Subscriber.build(2) @thread = Thread.new do Thread.current.abort_on_exception = true if Thread.current.respond_to?(:report_on_exception=) Thread.current.report_on_exception = true end while message = @ws.messages.pop if INTERRUPTIONS.include?(message["method"]) @interruptor.async.call(message) elsif message.key?("method") @subscriber.async.call(message) else @pendings[message["id"]]&.set(message) end end end end def command(method, params = {}) pending = Concurrent::IVar.new message = build_message(method, params) @pendings[message[:id]] = pending @ws.send_message(message) data = pending.value!(@browser.timeout) @pendings.delete(message[:id]) raise DeadBrowserError if data.nil? && @ws.messages.closed? raise TimeoutError unless data error, response = data.values_at("error", "result") raise_browser_error(error) if error response end def on(event, &block) case event when *INTERRUPTIONS @interruptor.on(event, &block) else @subscriber.on(event, &block) end end def subscribed?(event) [@interruptor, @subscriber].any? { |s| s.subscribed?(event) } end def close @ws.close # Give a thread some time to handle a tail of messages @pendings.clear @thread.kill unless @thread.join(1) end private def build_message(method, params) { method: method, params: params }.merge(id: next_command_id) end def next_command_id @command_id += 1 end def raise_browser_error(error) case error["message"] # Node has disappeared while we were trying to get it when "No node with given id found", "Could not find node with given id" raise NodeNotFoundError.new(error) # Context is lost, page is reloading when "Cannot find context with specified id" raise NoExecutionContextError.new(error) when "No target with given id found" raise NoSuchPageError when /Could not compute content quads/ raise CoordinatesNotFoundError else raise BrowserError.new(error) end end end end end
29.441176
82
0.609391
bbc1e116e6e18c077021ca2aefe4bcf99b83b7ea
172
require File.expand_path('../../../../../spec_helper', __FILE__) describe "Gem::StubSpecification::StubLine#name" do it "needs to be reviewed for spec completeness" end
28.666667
64
0.72093
bf9600f0151e2fe27e35d15fbf81a6cf29828e47
14,013
# encoding: utf-8 require "logstash/outputs/base" require "logstash/namespace" require "logstash/plugin_mixins/aws_config" # This output lets you aggregate and send metric data to AWS CloudWatch # # ==== Summary: # This plugin is intended to be used on a logstash indexer agent (but that # is not the only way, see below.) In the intended scenario, one cloudwatch # output plugin is configured, on the logstash indexer node, with just AWS API # credentials, and possibly a region and/or a namespace. The output looks # for fields present in events, and when it finds them, it uses them to # calculate aggregate statistics. If the `metricname` option is set in this # output, then any events which pass through it will be aggregated & sent to # CloudWatch, but that is not recommended. The intended use is to NOT set the # metricname option here, and instead to add a `CW_metricname` field (and other # fields) to only the events you want sent to CloudWatch. # # When events pass through this output they are queued for background # aggregation and sending, which happens every minute by default. The # queue has a maximum size, and when it is full aggregated statistics will be # sent to CloudWatch ahead of schedule. Whenever this happens a warning # message is written to logstash's log. If you see this you should increase # the `queue_size` configuration option to avoid the extra API calls. The queue # is emptied every time we send data to CloudWatch. # # Note: when logstash is stopped the queue is destroyed before it can be processed. # This is a known limitation of logstash and will hopefully be addressed in a # future version. # # ==== Details: # There are two ways to configure this plugin, and they can be used in # combination: event fields & per-output defaults # # Event Field configuration... # You add fields to your events in inputs & filters and this output reads # those fields to aggregate events. The names of the fields read are # configurable via the `field_*` options. # # Per-output defaults... # You set universal defaults in this output plugin's configuration, and # if an event does not have a field for that option then the default is # used. # # Notice, the event fields take precedence over the per-output defaults. # # At a minimum events must have a "metric name" to be sent to CloudWatch. # This can be achieved either by providing a default here OR by adding a # `CW_metricname` field. By default, if no other configuration is provided # besides a metric name, then events will be counted (Unit: Count, Value: 1) # by their metric name (either a default or from their `CW_metricname` field) # # Other fields which can be added to events to modify the behavior of this # plugin are, `CW_namespace`, `CW_unit`, `CW_value`, and # `CW_dimensions`. All of these field names are configurable in # this output. You can also set per-output defaults for any of them. # See below for details. # # Read more about http://aws.amazon.com/cloudwatch/[AWS CloudWatch], # and the specific of API endpoint this output uses, # http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_PutMetricData.html[PutMetricData] class LogStash::Outputs::CloudWatch < LogStash::Outputs::Base include LogStash::PluginMixins::AwsConfig::V2 config_name "cloudwatch" # Constants # aggregate_key members DIMENSIONS = "dimensions" TIMESTAMP = "timestamp" METRIC = "metric" COUNT = "count" UNIT = "unit" SUM = "sum" MIN = "min" MAX = "max" # Units COUNT_UNIT = "Count" NONE = "None" # How often to send data to CloudWatch # This does not affect the event timestamps, events will always have their # actual timestamp (to-the-minute) sent to CloudWatch. # # We only call the API if there is data to send. # # See the Rufus Scheduler docs for an https://github.com/jmettraux/rufus-scheduler#the-time-strings-understood-by-rufus-scheduler[explanation of allowed values] config :timeframe, :validate => :string, :default => "1m" # How many events to queue before forcing a call to the CloudWatch API ahead of `timeframe` schedule # Set this to the number of events-per-timeframe you will be sending to CloudWatch to avoid extra API calls config :queue_size, :validate => :number, :default => 10000 # How many data points can be given in one call to the CloudWatch API config :batch_size, :validate => :number, :default => 20 # The default namespace to use for events which do not have a `CW_namespace` field config :namespace, :validate => :string, :default => "Logstash" # The name of the field used to set a different namespace per event # Note: Only one namespace can be sent to CloudWatch per API call # so setting different namespaces will increase the number of API calls # and those cost money. config :field_namespace, :validate => :string, :default => "CW_namespace" # The default metric name to use for events which do not have a `CW_metricname` field. # Beware: If this is provided then all events which pass through this output will be aggregated and # sent to CloudWatch, so use this carefully. Furthermore, when providing this option, you # will probably want to also restrict events from passing through this output using event # type, tag, and field matching config :metricname, :validate => :string # The name of the field used to set the metric name on an event # The author of this plugin recommends adding this field to events in inputs & # filters rather than using the per-output default setting so that one output # plugin on your logstash indexer can serve all events (which of course had # fields set on your logstash shippers.) config :field_metricname, :validate => :string, :default => "CW_metricname" VALID_UNITS = ["Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", COUNT_UNIT, "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", NONE] # The default unit to use for events which do not have a `CW_unit` field # If you set this option you should probably set the "value" option along with it config :unit, :validate => VALID_UNITS, :default => COUNT_UNIT # The name of the field used to set the unit on an event metric config :field_unit, :validate => :string, :default => "CW_unit" # The default value to use for events which do not have a `CW_value` field # If provided, this must be a string which can be converted to a float, for example... # "1", "2.34", ".5", and "0.67" # If you set this option you should probably set the `unit` option along with it config :value, :validate => :string, :default => "1" # The name of the field used to set the value (float) on an event metric config :field_value, :validate => :string, :default => "CW_value" # The default dimensions [ name, value, ... ] to use for events which do not have a `CW_dimensions` field config :dimensions, :validate => :hash # The name of the field used to set the dimensions on an event metric # The field named here, if present in an event, must have an array of # one or more key & value pairs, for example... # `add_field => [ "CW_dimensions", "Environment", "CW_dimensions", "prod" ]` # or, equivalently... # `add_field => [ "CW_dimensions", "Environment" ]` # `add_field => [ "CW_dimensions", "prod" ]` config :field_dimensions, :validate => :string, :default => "CW_dimensions" public def register require "thread" require "rufus/scheduler" require "aws-sdk" @cw = Aws::CloudWatch::Client.new(aws_options_hash) @event_queue = SizedQueue.new(@queue_size) @scheduler = Rufus::Scheduler.new @job = @scheduler.every @timeframe do @logger.debug("Scheduler Activated") publish(aggregate({})) end end # def register public def receive(event) if event == LogStash::SHUTDOWN job.trigger() job.unschedule() @logger.info("CloudWatch aggregator thread shutdown.") return end return unless (event.get(@field_metricname) || @metricname) if (@event_queue.length >= @event_queue.max) @job.trigger @logger.warn("Posted to AWS CloudWatch ahead of schedule. If you see this often, consider increasing the cloudwatch queue_size option.") end @logger.debug("Queueing event", :event => event) @event_queue << event end # def receive private def publish(aggregates) aggregates.each do |namespace, data| @logger.debug("Namespace, data: ", :namespace => namespace, :data => data) metric_data = [] data.each do |aggregate_key, stats| new_data = { :metric_name => aggregate_key[METRIC], :timestamp => aggregate_key[TIMESTAMP], :unit => aggregate_key[UNIT], :statistic_values => { :sample_count => stats[COUNT], :sum => stats[SUM], :minimum => stats[MIN], :maximum => stats[MAX], } } dims = aggregate_key[DIMENSIONS] if (dims.is_a?(Array) && dims.length > 0 && (dims.length % 2) == 0) new_data[:dimensions] = Array.new i = 0 while (i < dims.length) new_data[:dimensions] << {:name => dims[i], :value => dims[i+1]} i += 2 end end metric_data << new_data end # data.each metric_data.each_slice(@batch_size) do |batch| begin @cw.put_metric_data( :namespace => namespace, :metric_data => batch ) @logger.debug("Sent data to AWS CloudWatch OK", :namespace => namespace, :metric_data => batch) rescue Exception => e @logger.warn("Failed to send to AWS CloudWatch", :exception => e, :namespace => namespace, :metric_data => batch) break end end end # aggregates.each return aggregates end# def publish private def aggregate(aggregates) @logger.debug("QUEUE SIZE ", :queuesize => @event_queue.size) while !@event_queue.empty? do begin count(aggregates, @event_queue.pop(true)) rescue Exception => e @logger.warn("Exception! Breaking count loop", :exception => e) break end end return aggregates end # def aggregate private def count(aggregates, event) # If the event doesn't declare a namespace, use the default fnamespace = field(event, @field_namespace) namespace = (fnamespace ? fnamespace : event.sprintf(@namespace)) funit = field(event, @field_unit) unit = (funit ? funit : event.sprintf(@unit)) fvalue = field(event, @field_value) value = (fvalue ? fvalue : event.sprintf(@value)) # We may get to this point with valid Units but missing value. Send zeros. val = (!value) ? 0.0 : value.to_f # Event provides exactly one (but not both) of value or unit if ( (fvalue == nil) ^ (funit == nil) ) @logger.warn("Likely config error: event has one of #{@field_value} or #{@field_unit} fields but not both.", :event => event) end # If Unit is still not set or is invalid warn about misconfiguration & use NONE if (!VALID_UNITS.include?(unit)) unit = NONE @logger.warn("Likely config error: invalid or missing Units (#{unit.to_s}), using '#{NONE}' instead", :event => event) end if (!aggregates[namespace]) aggregates[namespace] = {} end dims = event.get(@field_dimensions) if (dims) # event provides dimensions # validate the structure if (!dims.is_a?(Array) || dims.length == 0 || (dims.length % 2) != 0) @logger.warn("Likely config error: CloudWatch dimensions field (#{dims.to_s}) found which is not a positive- & even-length array. Ignoring it.", :event => event) dims = nil end # Best case, we get here and exit the conditional because dims... # - is an array # - with positive length # - and an even number of elements elsif (@dimensions.is_a?(Hash)) # event did not provide dimensions, but the output has been configured with a default dims = @dimensions.flatten.map{|d| event.sprintf(d)} # into the kind of array described just above else dims = nil end fmetric = field(event, @field_metricname) aggregate_key = { METRIC => (fmetric ? fmetric : event.sprintf(@metricname)), DIMENSIONS => dims, UNIT => unit, TIMESTAMP => event.sprintf("%{+YYYY-MM-dd'T'HH:mm:00Z}") } if (!aggregates[namespace][aggregate_key]) aggregates[namespace][aggregate_key] = {} end if (!aggregates[namespace][aggregate_key][MAX] || val > aggregates[namespace][aggregate_key][MAX]) aggregates[namespace][aggregate_key][MAX] = val end if (!aggregates[namespace][aggregate_key][MIN] || val < aggregates[namespace][aggregate_key][MIN]) aggregates[namespace][aggregate_key][MIN] = val end if (!aggregates[namespace][aggregate_key][COUNT]) aggregates[namespace][aggregate_key][COUNT] = 1 else aggregates[namespace][aggregate_key][COUNT] += 1 end if (!aggregates[namespace][aggregate_key][SUM]) aggregates[namespace][aggregate_key][SUM] = val else aggregates[namespace][aggregate_key][SUM] += val end end # def count private def field(event, fieldname) if !event.get(fieldname) return nil else if event.get(fieldname).is_a?(Array) return event.get(fieldname).first else return event.get(fieldname) end end end # def field end # class LogStash::Outputs::CloudWatch
40.267241
170
0.675087
289dfb39c23ee22ed733b3a9bff73628680b0583
895
class Taktuk < Formula desc "Deploy commands to (a potentially large set of) remote nodes" homepage "http://taktuk.gforge.inria.fr/" url "https://gforge.inria.fr/frs/download.php/30903/taktuk-3.7.5.tar.gz" sha256 "62d1b72616a1b260eb87cecde2e21c8cbb844939f2dcafad33507fcb16ef1cb1" bottle do cellar :any rebuild 1 sha256 "236b1b7277a6ff6e33bab7818cb779f32f1415e3e51e4edda6f243499328d1e5" => :sierra sha256 "b5f260c944e09210f94a3b215112ed2975bf9c4a93ad1fdd30a627700e48a364" => :el_capitan sha256 "4f703e2c8fb0f1b5c4c8b19b6a42e3a14023b40d6c511a10e0d460b8810d629e" => :yosemite sha256 "b0ca7976fb797a3d74c4e97d26214f6b7fdd6cf6764cd9fc3d0f2b3931479bd5" => :mavericks end def install system "./configure", "--prefix=#{prefix}" system "make" ENV.deparallelize system "make", "install" end test do system "#{bin}/taktuk", "quit" end end
33.148148
92
0.760894
1d496db2b78a3f0fe83bceb64188f9e1584553ad
1,183
class Ktoblzcheck < Formula desc "Library for German banks" homepage "http://ktoblzcheck.sourceforge.net/" url "https://downloads.sourceforge.net/project/ktoblzcheck/ktoblzcheck-1.48.tar.gz" sha256 "0f4e66d3a880355b1afc88870d224755e078dfaf192242d9c6acb8853f5bcf58" bottle do sha256 "d176f6ea34fbda13e6ce060bb39d091919593840bef7db54eb4fa7996fcbdef1" => :sierra sha256 "2bb0e477b065ae93362a88b4e4174ec11012f922daaac023821e11b990f9d3d3" => :el_capitan sha256 "fdae7050c9000d7793a336a9baa3f3903922d385fe9cf8d0c61ca5c08f595520" => :yosemite sha256 "7a9fda64f86b9762bb98e48299a0d35884f6d1163f8ed8647db9764ad9b76a9c" => :mavericks sha256 "176bf59fd3b5cedac348101b150d2e13e33c08798d838a6ad3af50091ab6531a" => :mountain_lion end def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make" ENV.j1 system "make", "install" end test do assert_match /Ok/, shell_output("#{bin}/ktoblzcheck --outformat=oneline 10000000 123456789", 0) assert_match /unknown/, shell_output("#{bin}/ktoblzcheck --outformat=oneline 12345678 100000000", 3) end end
42.25
104
0.764159
61b7f47adccd0750bd4761f0cf27f0b26790666f
1,102
require_relative "../../lib_lock/ac-library-rb/convolution" require_relative "../../lib_lock/ac-library-rb/crt" require_relative "../../lib_lock/ac-library-rb/dsu" require_relative "../../lib_lock/ac-library-rb/fenwick_tree" require_relative "../../lib_lock/ac-library-rb/floor_sum" require_relative "../../lib_lock/ac-library-rb/inv_mod" require_relative "../../lib_lock/ac-library-rb/lazy_segtree" require_relative "../../lib_lock/ac-library-rb/lcp_array" require_relative "../../lib_lock/ac-library-rb/max_flow" require_relative "../../lib_lock/ac-library-rb/min_cost_flow" require_relative "../../lib_lock/ac-library-rb/modint" require_relative "../../lib_lock/ac-library-rb/pow_mod" require_relative "../../lib_lock/ac-library-rb/priority_queue" require_relative "../../lib_lock/ac-library-rb/scc" require_relative "../../lib_lock/ac-library-rb/segtree" require_relative "../../lib_lock/ac-library-rb/suffix_array" require_relative "../../lib_lock/ac-library-rb/two_sat" require_relative "../../lib_lock/ac-library-rb/z_algorithm" # Usage: # require 'ac-library-rb/all' # include AcLibraryRb
47.913043
62
0.751361
ed5e76ee5f5413e231088ab425084c631f89c408
662
module Hearthstone module Log class GameTurn attr_accessor :number, :player, :timestamp attr_reader :events def initialize(number: nil, player: nil, timestamp: nil) @events = [] @number = number @player = player @timestamp = timestamp end def add_event(event, data, line=nil) if line @events.push([event, data, line]) else @events.push([event, data]) end end def to_hash { number: number, player: player, timestamp: timestamp, events: events } end end end end
20.6875
62
0.522659
03ad50fbb75021589e077a21884a0550c5ee4787
1,617
require 'acceptance_spec_helper' feature "Global server alias" do background { config_exists <<-CONFIG } default_destination 'foo:bar' project :foo do environment :bar do server do host "1.2.3.4" port 5678 user "pivo" location "/var/apps/vodka" end end end project :baz do environment :qux do server :bart do host "2.3.4.5" default_command :console command :console do execute "rails c" end command :killall do execute "killall humans" desc "Kill ALL humans" end end end end CONFIG scenario "Unique server alias" do run "taketo --view" stdout.should == <<-CONFIG_OUTLINE.chomp Project: foo Environment: bar Server: default Host: 1.2.3.4 Port: 5678 User: pivo Default location: /var/apps/vodka Default command: bash Environment: RAILS_ENV=bar Project: baz Environment: qux Server: bart Host: 2.3.4.5 Default command: rails c Environment: RAILS_ENV=qux Commands: console killall - Kill ALL humans CONFIG_OUTLINE exit_status.should be_success end scenario "View particular server config" do run "taketo foo:bar:default --view" stdout.should == <<-CONFIG_OUTLINE.chomp Server: default Host: 1.2.3.4 Port: 5678 User: pivo Default location: /var/apps/vodka Default command: bash Environment: RAILS_ENV=bar CONFIG_OUTLINE exit_status.should be_success end end
21
45
0.606061
ac4d04b80eee515d53ec77a7033b744818cec9de
1,625
class Libarchive < Formula desc "Multi-format archive and compression library" homepage "https://www.libarchive.org" url "https://www.libarchive.org/downloads/libarchive-3.3.2.tar.gz" sha256 "ed2dbd6954792b2c054ccf8ec4b330a54b85904a80cef477a1c74643ddafa0ce" bottle do cellar :any sha256 "ee8c56199da11b8e6ac30e577792288d729233dda36100dbd16192af656bff5d" => :high_sierra sha256 "3afbbb3c4c12dcac7f55d7a038249e4553c4b13bb5c6a5251db1099277446490" => :sierra sha256 "0805b457512f14129a12148c7ad4fc5880c7594515781bc2a11e3a5431c220ec" => :el_capitan sha256 "8ef52679c4f98f7aa7ce0ecdb854d3fea70b46192011e447fabdde8aec5cd940" => :yosemite end keg_only :provided_by_macos depends_on "xz" => :recommended depends_on "lz4" => :optional depends_on "lzop" => :optional def install system "./configure", "--prefix=#{prefix}", "--without-lzo2", # Use lzop binary instead of lzo2 due to GPL "--without-nettle", # xar hashing option but GPLv3 "--without-xml2", # xar hashing option but tricky dependencies "--without-openssl", # mtree hashing now possible without OpenSSL "--with-expat" # best xar hashing option system "make", "install" # Just as apple does it. ln_s bin/"bsdtar", bin/"tar" ln_s bin/"bsdcpio", bin/"cpio" ln_s man1/"bsdtar.1", man1/"tar.1" ln_s man1/"bsdcpio.1", man1/"cpio.1" end test do (testpath/"test").write("test") system bin/"bsdtar", "-czvf", "test.tar.gz", "test" assert_match /test/, shell_output("#{bin}/bsdtar -xOzf test.tar.gz") end end
36.111111
93
0.694154
91751aea05ea33baa17fc26221fd34e9505a7379
579
# Load the gem require 'groupdocs_conversion_cloud' require 'common_utilities/Utils.rb' class Working_With_Files def self.Conversion_Ruby_Copy_File() # Getting instance of the API $api = Common_Utilities.Get_FileApi_Instance() $request = GroupDocsConversionCloud::CopyFileRequest.new("conversions/one-page.docx", "conversions/one-page-copied.docx", $myStorage, $myStorage) $response = $api.copy_file($request) puts("Expected response type is Void: 'conversions/one-page.docx' file copied as 'conversions/one-page-copied.docx'.") end end
36.1875
150
0.746114
61e072aeae3362e140f9f32f8e2afa6f52b54a43
709
module RgGen module VerilogUtility class InterfacePort def initialize(attributes) @attributes = attributes end def to_s "#{interface_type} #{port_identifier}" end def identifier Identifier.new(@attributes[:name], nil, nil, nil) end private def interface_type return @attributes[:type] unless @attributes[:modport] "#{@attributes[:type]}.#{@attributes[:modport]}" end def port_identifier "#{@attributes[:name]}#{dimensions}" end def dimensions return unless @attributes[:dimensions] @attributes[:dimensions].map { |d| "[#{d}]" }.join end end end end
20.852941
62
0.589563
1c407ae4e58681358c6f6304099dcd4e8aa31f61
3,080
class Opro::Oauth::AuthController < OproController before_action :opro_authenticate_user! before_action :ask_user!, :only => [:create] def new @redirect_uri = params[:redirect_uri] @client_app = Opro::Oauth::ClientApp.find_by_app_id(params[:client_id]) @scopes = scope_from_params(params) end # :ask_user! is called before creating a new authorization, this allows us to redirect def create # find or create an auth_grant for a given user application = Opro::Oauth::ClientApp.find_by_client_id(params[:client_id]) auth_grant = Opro::Oauth::AuthGrant.find_or_create_by_user_app(current_user, application) # add permission changes if there are any auth_grant.update_permissions(params[:permissions]) redirect_to auth_grant.redirect_uri_for(params[:redirect_uri], params[:state]) end private # When a user is sent to authorize an application they must first accept the authorization # if they've already authed the app, they skip this section def ask_user! if user_granted_access_before?(current_user, params) # Re-Authorize the application, do not ask the user params.delete(:permissions) ## Delete permissions supplied by client app, this was a security hole return true elsif user_authorizes_the_request?(request) # The user just authorized the application from the form return true else # if the request did not come from a form within the application, render the user form @redirect_uri ||= params[:redirect_uri] @client_app ||= Opro::Oauth::ClientApp.find_by_app_id(params[:client_id]) params.delete("action").delete("controller") redirect_to oauth_new_path(params) end end def user_granted_access_before?(user, params) @client_app ||= Opro::Oauth::ClientApp.find_by_app_id(params[:client_id]) return false if user.blank? || @client_app.blank? Opro::Oauth::AuthGrant.where(:application_id => @client_app.id, :user_id => user.id).present? end # Verifying that a post was made from our own site, indicating a user confirmed via form def user_authorizes_the_request?(request) request.post? && referrer_is_self?(request) end # Ensures that the referrer is the current host, to prevent spoofing def referrer_is_self?(request) return false if request.referrer.blank? referrer_host = URI.parse(request.referrer).host self_host = URI.parse(request.url).host referrer_host == self_host end # take params[:scope] = [:write, :read, :etc] or # take params[:scope] = "write, read, etc" # compare against available scopes ::Opro.request_permissions # return the intersecting set. or the default scope def scope_from_params(params) return default_scope if params[:scope].blank? scope = params[:scope].is_a?(Array) ? params[:scope] : params[:scope].split(',') scope = scope.map(&:downcase).map(&:strip) return scope & default_scope end def default_scope ::Opro.request_permissions.map(&:to_s).map(&:downcase) end end
38.987342
104
0.718506
e89d07b35f462103c144a527b46641f4ccb70389
1,424
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "admin/users/edit" do before do login_and_assign(:admin => true) assign(:user, @user = FactoryGirl.create(:user)) end it "cancel replaces [Edit User] form with user partial" do params[:cancel] = "true" render rendered.should include("jQuery('#user_#{@user.id}').replaceWith") end it "edit hides previously open [Edit User] and replaces it with user partial" do assign(:previous, previous = FactoryGirl.create(:user)) render rendered.should include("user_#{previous.id}") end it "edit removes previously open [Edit User] if it's no longer available" do assign(:previous, previous = 41) render rendered.should include(%Q/crm.flick('user_#{previous}', 'remove');/) end it "edit turns off highlight, hides [Create User] form, and replaces current user with [Edit User] form" do render rendered.should include(%Q/crm.highlight_off('user_#{@user.id}');/) rendered.should include(%Q/crm.hide_form('create_user')/) rendered.should include("user_#{@user.id}") end end
31.644444
109
0.660815
edd7f5972435a833354cdd46c5d4294226105869
818
# frozen_string_literal: true # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! module Google module Cloud module Bigtable module Admin module V2 VERSION = "0.8.1" end end end end end
26.387097
74
0.717604
b98cc290038077288772d32e0dfdb85c93225898
814
Pod::Spec.new do |s| s.name = 'TTReachabilitySwift' s.version = '5.1.0' s.module_name = 'Reachability' s.homepage = 'https://github.com/iWenterHuang/Reachability.swift' s.authors = { 'iWenter' => '[email protected]' } s.summary = 'Replacement for Apple\'s Reachability re-written in Swift with callbacks.' s.license = { :type => 'MIT' } # Source Info s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.10" s.tvos.deployment_target = "9.0" s.source = { :git => 'https://github.com/iWenterHuang/Reachability.swift', :tag => 'v'+s.version.to_s } s.source_files = 'Sources/Reachability.swift' s.framework = 'SystemConfiguration' s.ios.framework = 'CoreTelephony' s.requires_arc = true s.swift_version = '4.2' end
30.148148
94
0.632678
f71a4d37c602f6ffd5e530949c460970c3f5e7f5
40
json.partial! "roles/role", role: @role
20
39
0.7
2687fcbc3d2fd894781576074a5deed5620bede9
4,880
module Ironfan class Dsl class Component < Ironfan::Dsl include Gorillib::Builder include Gorillib::Concern include Ironfan::Plugin::Base; register_with Ironfan::Dsl::Compute field :cluster_name, Symbol field :facet_name, Symbol field :realm_name, Symbol field :name, Symbol def initialize(attrs, &blk) attrs.merge!(facet_name: (attrs[:owner].name unless attrs[:owner].nil? or not attrs[:owner].is_a?(Facet)), cluster_name: (attrs[:owner].cluster_name unless attrs[:owner].nil?), realm_name: (attrs[:owner].realm_name unless attrs[:owner].nil?)) super attrs, &blk end def self.plugin_hook owner, attrs, plugin_name, full_name, &blk (this = new(attrs.merge(owner: owner, name: full_name), &blk))._project(owner) this end def announce_to node node.set['components']["#{cluster_name}-#{name}"]['name'] = name end def self.to_node super.tap do |node| node.set['cluster_name'] = cluster_name end end def self.from_node(node = NilCheckDelegate.new(nil)) cluster_name = node['cluster_name'].to_s realm_name = node['realm_name'].to_s super(node).tap{ |x| x.receive!(cluster_name: cluster_name, realm_name: realm_name) } end def self.announce_name plugin_name end def announce_name self.class.announce_name end def _project(compute) compute.component name, self project(compute) end def realm_announcements (@@realm_announcements ||= {}) end def realm_subscriptions component_name (@@realm_subscriptions ||= {})[component_name] ||= [] end def announce(component_name) Chef::Log.debug("announced #{announce_name} for #{cluster_name}") realm_announcements[[realm_name, component_name]] = [cluster_name, facet_name] realm_subscriptions(component_name).each{|blk| blk.call(cluster_name, facet_name)} end def discover(component_name, &blk) if already_announced = realm_announcements[[realm_name, component_name]] yield *already_announced else Chef::Log.debug("#{cluster_name}: no one announced #{announce_name}. subscribing") realm_subscriptions(component_name) << blk end end end module Discovery include Gorillib::Builder extend Gorillib::Concern magic :server_cluster, Symbol magic :bidirectional, :boolean, default: false magic :create_security_groups, :boolean, default: true (@_dependencies ||= []) << Gorillib::Builder module ClassMethods def default_to_bidirectional default=true magic :bidirectional, :boolean, default: default end def default_create_security_groups default=true magic :create_security_groups, :boolean, default: default end end def set_discovery(compute, keys) if server_cluster wire_to(compute, keys) else # I'm defanging automatic discovery for now. raise StandardError.new("must explicitly specify a server_cluster for discovery") # discover(announce_name) do |cluster_name, facet_name| # wire_to(compute, [cluster_name, facet_name].join('-'), keys) # end end end def wire_to(compute, keys) discovery = {discovers: keys.reverse.inject(compute.realm_name){|hsh,key| {key => hsh}}} (compute.facet_role || compute.cluster_role).override_attributes(discovery) client_group_v = compute.full_cluster_name server_group_v = "#{realm_name}-#{server_cluster}" group_edge(compute, client_group_v, :authorized_by_group, server_group_v) Chef::Log.debug("#{client_group_v} authorized by #{server_group_v}") if bidirectional group_edge(compute, client_group_v, :authorize_group, server_group_v) Chef::Log.debug("#{client_group_v} authorizes #{server_group_v}") end Chef::Log.debug("discovered #{announce_name} for #{cluster_name}: #{discovery}") end protected def group_edge(cloud, group_1, method, group_2) cloud.security_group(group_1).send(method, group_2) Chef::Log.debug("component.rb: allowing access from security group #{group_1} to #{group_2}") end end module Announcement include Gorillib::Builder def _project(compute) announce announce_name super compute end end def to_manifest to_wire.reject{|k,_| _skip_fields.include? k} end def _skip_fields() skip_fields << :_type; end def skip_fields() [] end end end
32.317881
133
0.633811
bb36cbf757891b36d87b03070322bc597d96757e
583
module Arbre module HTML class Document < Tag def build(*args) super build_head build_body end def document self end def tag_name 'html' end def doctype '<!DOCTYPE html>'.html_safe end def to_s doctype + super end protected def build_head @head = head do meta :"http-equiv" => "Content-type", content: "text/html; charset=utf-8" end end def build_body @body = body end end end end
13.55814
83
0.495712
ffe29794c607a9d0495c2424e71a8b6de5745608
136
require File.join(File.dirname(__FILE__), 'matchers', 'validation') require File.join(File.dirname(__FILE__), 'matchers', 'association')
68
68
0.772059
03b8ef45832f7c24cb632a54ce2a98a63bb9a0f9
528
class ImportSourceDataTaskPresenter < JobTaskPresenter def to_hash super.merge({ :source_id => model.payload.source_id, :destination_id => model.payload.destination_id, :row_limit => model.payload.row_limit, :truncate => model.payload.truncate, :source_name => model.payload.source.name, :destination_name => model.payload.destination_name || model.payload.destination.name }) end end
44
105
0.583333
4a52e6f76cefa2d3cc394aa7fe5706b9dc807d5e
373
require "bundler/setup" require "simple_dsl_parser" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end
24.866667
66
0.758713
2879b84c0b24e4da0a7374b926e5ed6124a4b3f1
170
module BoolENV BOOL_TRUE = ["yes", "true", "1"] def self.[](env_variable) ENV[env_variable].present? && BOOL_TRUE.include?(ENV[env_variable].downcase) end end
21.25
80
0.682353
acf62a830456621d6a21d7da5c735cce3af6e2d3
965
require 'geocoder' require 'xmlsimple' #filenames = ["TR Oulu 2017 Day 0 Prologi", # "TR Oulu 2017 Day 1", # "TR Oulu 2017 Day 2", # "TR Oulu 2017 Day 3", # "TR Oulu 2017 Day 4"] filenames = ["TR Oulu 2017 Day 4"] filenames.each do |filename| puts "starting queryinf of #{filename}" hash = XmlSimple.xml_in("#{filename}.gpx") some = [] hash["trk"][0]["trkseg"][0]["trkpt"].each do |x| street = Geocoder.address("#{x["lat"]}, #{x["lon"]}") some.push street if (street.to_s != '' && !street.include?("Google")) end puts "Queryinf finnished for #{filename} with #{some.size} queries" File.open("#{filename}.txt", 'w') do |file| some.each_with_index do |x, index| begin x.slice!(x.scan(/(\s\d*),/)[0][0]) rescue puts end if index == 0 file.puts x else file.puts x if x.split[0] != some[index-1].split[0] end end end puts "#{filename} written" end
24.125
73
0.574093
28310c81c17394e39f0538c94fffcfc34f6b4f11
1,312
# # Be sure to run `pod lib lint BKMVVMKit.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'BKMVVMKit' s.version = '0.3.2' s.summary = 'A short description of BKMVVMKit.' s.description = 'BKMVVMKit' s.homepage = 'https://github.com/isingle/BKMMVMKit' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'isingle' => '[email protected]' } s.platform = :ios, "8.0" s.source = { :git => 'https://github.com/isingle/LBKMMVMKit', :tag => s.name.to_s + "-" + s.version.to_s } s.preserve_paths = "#{s.name}/Classes/**/*", "#{s.name}/Assets/**/*", "#{s.name}/Framework/**/*", "#{s.name}/Archive/**/*", "#{s.name}/Dependencies/**/*", "#{s.name}/**/*.pch" #s.prefix_header_file = '' #//common pod s.source_files = "#{s.name}/Classes/**/*.{h,m,mm,c,cpp,cc}" s.public_header_files = "#{s.name}/Classes/**/*.h" #// # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' end
39.757576
177
0.58689
4a190992560548dced01ee8a1fa9cc7dfdb203ca
4,119
require 'lims-core/persistence/search/all' module Lims::Core shared_examples_for "comparison filter for plate" do let(:filter_model) { "plate" } let(:description) { "lookup plates with 8 rows" } let(:filter) { Persistence::ComparisonFilter.new(:criteria => criteria, :model => filter_model)} let(:search) { Persistence::Search.new(:model => model, :filter => filter, :description => description) } context "get resources by batch uuid criteria" do let(:criteria) { {:comparison => { "number_of_rows" => { "=" => 8} }} } it "finds plates" do store.with_session do |session| results = search.call(session) all = results.slice(0, 1000).to_a all.size.should == 4 all.each do |plate| plate.number_of_rows.should == 8 end all.should include(session['22222222-1111-0000-0000-000000000000']) all.first.should be_a(model) end end end context "create plates with 2 and 8 rows and find the ones with exactly 2 rows" do let(:number_of_rows) { 2 } let(:plate_8_rows) { store.with_session do |session| session << Lims::LaboratoryApp::Laboratory::Plate.new(:number_of_rows => 8, :number_of_columns => number_of_columns) end } let(:criteria) { {:comparison => { "number_of_rows" => { "=" => 2} }} } it "finds plates" do store.with_session do |session| results = search.call(session) all = results.slice(0, 1000).to_a all.each do |plate| plate.number_of_rows.should == 2 end all.size.should == 4 all.first.should be_a(model) end end end context "create plates with 2 and 8 rows and" do let!(:number_of_rows) { 2 } let!(:plate_8_rows) { store.with_session do |session| session << Lims::LaboratoryApp::Laboratory::Plate.new(:number_of_rows => 8, :number_of_columns => number_of_columns) end } context "find the ones which has greater than 2 rows" do let(:criteria) { {:comparison => { "number_of_rows" => { ">" => 2} }} } it "finds plates" do store.with_session do |session| results = search.call(session) all = results.slice(0, 1000).to_a all.each do |plate| plate.number_of_rows.should == 8 end all.size.should == 1 all.first.should be_a(model) end end end context "find the ones which has less than 8 rows" do let(:criteria) { {:comparison => { "number_of_rows" => { "<" => 8} }} } it "finds plates" do store.with_session do |session| results = search.call(session) all = results.slice(0, 1000).to_a all.each do |plate| plate.number_of_rows.should == 2 end all.size.should == 4 all.first.should be_a(model) end end end context "find the ones which has less or equals than 8 rows" do let(:criteria) { {:comparison => { "number_of_rows" => { "<=" => 8} }} } it "finds plates" do store.with_session do |session| results = search.call(session) all = results.slice(0, 1000).to_a all.each do |plate| [2,8].should include(plate.number_of_rows) end all.size.should == 5 all.first.should be_a(model) end end end context "find the ones which has greater or equals than 2 rows" do let(:criteria) { {:comparison => { "number_of_rows" => { ">=" => 2} }} } it "finds plates" do store.with_session do |session| results = search.call(session) all = results.slice(0, 1000).to_a all.each do |plate| [2,8].should include(plate.number_of_rows) end all.size.should == 5 all.first.should be_a(model) end end end end end end
34.325
126
0.556203
bfb1b05ae277da416193fb4890b4439bbec4ccb5
26
require './demo' run Demo
8.666667
16
0.692308
62dfdf6ba61681cadfe6f58e640b99e59391ca4a
2,386
require 'rake' require 'rake/tasklib' require 'rack/test' module GrapeSwagger module Rake class OapiTasks < ::Rake::TaskLib include Rack::Test::Methods attr_reader :oapi attr_reader :api_class def initialize(api_class) super() @api_class = api_class define_tasks end private def define_tasks namespace :oapi do fetch validate end end # tasks # # get swagger/OpenAPI documentation def fetch desc 'generates OpenApi documentation … params (usage: key=value): store – save as JSON file, default: false (optional) resource - if given only for that it would be generated (optional)' task fetch: :environment do make_request save_to_file? ? File.write(file, @oapi) : $stdout.print(@oapi) end end # validates swagger/OpenAPI documentation def validate desc 'validates the generated OpenApi file … params (usage: key=value): resource - if given only for that it would be generated (optional)' task validate: :environment do ENV['store'] = 'true' ::Rake::Task['oapi:fetch'].invoke exit if error? output = system "swagger validate #{file}" $stdout.puts 'install swagger-cli with `npm install swagger-cli -g`' if output.nil? FileUtils.rm(file) end end # helper methods # def make_request get url_for last_response @oapi = JSON.pretty_generate( JSON.parse( last_response.body, symolize_names: true ) ) + "\n" end def url_for oapi_route = api_class.routes[-2] path = oapi_route.path.sub(/\(\.\w+\)$/, '').sub(/\(\.:\w+\)$/, '') path.sub!(':version', oapi_route.version.to_s) [path, ENV['resource']].join('/').chomp('/') end def save_to_file? ENV['store'].present? && !error? end def error? JSON.parse(@oapi).keys.first == 'error' end def file name = ENV['store'] == 'true' || ENV['store'].blank? ? 'swagger_doc.json' : ENV['store'] File.join(Dir.getwd, name) end def app api_class.new end end end end
23.86
96
0.550712
28036ce57d6e2fe95eb2985fac8cbaf95dc9dec0
1,336
module FastVersioning # a timeline for a tracked property class Timeline # @param name [String] tracked property name # @param fast_versions [ActiveRecord::Collection] FastVersion collection # def initialize(fast_versions:, name:) self.fast_versions = fast_versions self.name = name end # @return [Hash] hash of duration => date ranges # # @example # # FastVersioning::Timeline.new(fast_versions: model.fast_versions, name: 'status').to_h # # { # Thu, 01 Apr 2021 14:08:48 EDT -04:00..Mon, 05 Apr 2021 21:53:48 EDT -04:00 => 'active', # Mon, 05 Apr 2021 21:53:48 EDT -04:00..Mon, 05 Apr 2021 22:02:44 EDT -04:00 => 'inactive' # } # def to_h durations_array.map do |duration| [duration.date_range, duration.value] end.to_h end private attr_accessor :fast_versions, :name def filtered_fast_versions fast_versions.where(name: name).order('created_at') end def durations_array @value_durations ||= (filtered_fast_versions.to_a + [nil]).each_cons(2).map do |item, prev_item| Timelines::Duration.new( value: item.value, start_date: item.created_at, end_date: prev_item&.created_at ) end end end end
27.833333
104
0.617515
d5c9e9550d7c6d35fc75457a06d9bc2a2601943f
494
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. LEP::Application.config.secret_token = 'd298e382bf5b19e2a7c1bb13e5917a596fea7132a508083406fd6ef6654b20fc5494fed22d98d04faa794ba024be09fa067baba4e5127fc358178d8c8c78fed1'
61.75
169
0.831984
1c4034cd764bdb8b4f676c5dadbd92012d1139bb
5,198
#!/opt/puppetlabs/puppet/bin/ruby require 'json' require 'puppet' require 'openssl' def create_authorization_v1beta1_namespaced_local_subject_access_review(*args) header_params = {} params=args[0][1..-1].split(',') arg_hash={} params.each { |param| mapValues= param.split(':',2) if mapValues[1].include?(';') mapValues[1].gsub! ';',',' end arg_hash[mapValues[0][1..-2]]=mapValues[1][1..-2] } # Remove task name from arguments - should contain all necessary parameters for URI arg_hash.delete('_task') operation_verb = 'Post' query_params, body_params, path_params = format_params(arg_hash) uri_string = "#{arg_hash['kube_api']}/apis/authorization.k8s.io/v1beta1/namespaces/%{namespace}/localsubjectaccessreviews" % path_params if query_params uri_string = uri_string + '?' + to_query(query_params) end header_params['Content-Type'] = 'application/json' # first of #{parent_consumes} if arg_hash['token'] header_params['Authentication'] = 'Bearer ' + arg_hash['token'] end uri = URI(uri_string) verify_mode= OpenSSL::SSL::VERIFY_NONE if arg_hash['ca_file'] verify_mode=OpenSSL::SSL::VERIFY_PEER end Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', verify_mode: verify_mode, ca_file: arg_hash['ca_file']) do |http| if operation_verb == 'Get' req = Net::HTTP::Get.new(uri) elsif operation_verb == 'Put' req = Net::HTTP::Put.new(uri) elsif operation_verb == 'Delete' req = Net::HTTP::Delete.new(uri) elsif operation_verb == 'Post' req = Net::HTTP::Post.new(uri) end header_params.each { |x, v| req[x] = v } unless header_params.empty? unless body_params.empty? if body_params.key?('file_content') req.body = body_params['file_content'] else req.body = body_params.to_json end end Puppet.debug("URI is (#{operation_verb}) #{uri} headers are #{header_params}") response = http.request req # Net::HTTPResponse object Puppet.debug("response code is #{response.code} and body is #{response.body}") success = response.is_a? Net::HTTPSuccess Puppet.debug("Called (#{operation_verb}) endpoint at #{uri}, success was #{success}") response end end def to_query(hash) if hash return_value = hash.map { |x, v| "#{x}=#{v}" }.reduce { |x, v| "#{x}&#{v}" } if !return_value.nil? return return_value end end return '' end def op_param(name, inquery, paramalias, namesnake) { :name => name, :location => inquery, :paramalias => paramalias, :namesnake => namesnake } end def format_params(key_values) query_params = {} body_params = {} path_params = {} key_values.each { | key, value | if value.include?("=>") Puppet.debug("Running hash from string on #{value}") value.gsub!("=>",":") value.gsub!("'","\"") key_values[key] = JSON.parse(value) Puppet.debug("Obtained hash #{key_values[key].inspect}") end } if key_values.key?('body') if File.file?(key_values['body']) if key_values['body'].include?('json') body_params['file_content'] = File.read(key_values['body']) else body_params['file_content'] =JSON.pretty_generate(YAML.load_file(key_values['body'])) end end end op_params = [ op_param('apiversion', 'body', 'api_version', 'apiversion'), op_param('body', 'body', 'body', 'body'), op_param('dryRun', 'query', 'dry_run', 'dry_run'), op_param('fieldManager', 'query', 'field_manager', 'field_manager'), op_param('kind', 'body', 'kind', 'kind'), op_param('metadata', 'body', 'metadata', 'metadata'), op_param('namespace', 'path', 'namespace', 'namespace'), op_param('pretty', 'query', 'pretty', 'pretty'), op_param('spec', 'body', 'spec', 'spec'), op_param('status', 'body', 'status', 'status'), ] op_params.each do |i| location = i[:location] name = i[:name] paramalias = i[:paramalias] name_snake = i[:namesnake] if location == 'query' query_params[name] = key_values[name_snake] unless key_values[name_snake].nil? query_params[name] = ENV["azure__#{name_snake}"] unless ENV["<no value>_#{name_snake}"].nil? elsif location == 'body' body_params[name] = key_values[name_snake] unless key_values[name_snake].nil? body_params[name] = ENV["azure_#{name_snake}"] unless ENV["<no value>_#{name_snake}"].nil? else path_params[name_snake.to_sym] = key_values[name_snake] unless key_values[name_snake].nil? path_params[name_snake.to_sym] = ENV["azure__#{name_snake}"] unless ENV["<no value>_#{name_snake}"].nil? end end return query_params,body_params,path_params end def task # Get operation parameters from an input JSON params = STDIN.read result = create_authorization_v1beta1_namespaced_local_subject_access_review(params) if result.is_a? Net::HTTPSuccess puts result.body else raise result.body end rescue StandardError => e result = {} result[:_error] = { msg: e.message, kind: 'puppetlabs-kubernetes/error', details: { class: e.class.to_s }, } puts result exit 1 end task
30.940476
138
0.655444
ffca309b6459b50cf3b2e5bced25744acff3a2db
278
require 'flic/protocol/commands' require 'flic/protocol/commands/command' require 'flic/protocol/primitives/bluetooth_address' module Flic module Protocol module Commands class CreateScanWizard < Command uint32le :scan_wizard_id end end end end
19.857143
52
0.744604
b9fc2cb05036c8a206c118994939e4988640d3e3
9,122
## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / require 'spec_helper.rb' describe 'SyncListItem' do it "can fetch" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items(1).fetch() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1', ))).to eq(true) end it "receives fetch responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "created_by": "created_by", "data": {}, "date_expires": "2015-07-30T21:00:00Z", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "index": 100, "list_sid": "ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "revision": "revision", "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/100" } ] )) actual = @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items(1).fetch() expect(actual).to_not eq(nil) end it "can delete" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items(1).delete() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'delete', url: 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1', ))).to eq(true) end it "receives delete responses" do @holodeck.mock(Twilio::Response.new( 204, nil, )) actual = @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items(1).delete() expect(actual).to eq(true) end it "can create" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items.create(data: {}) }.to raise_exception(Twilio::REST::TwilioError) values = {'Data' => Twilio.serialize_object({}), } expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items', data: values, ))).to eq(true) end it "receives create responses" do @holodeck.mock(Twilio::Response.new( 201, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "created_by": "created_by", "data": {}, "date_expires": "2015-07-30T21:00:00Z", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "index": 100, "list_sid": "ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "revision": "revision", "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/100" } ] )) actual = @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items.create(data: {}) expect(actual).to_not eq(nil) end it "can read" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items.list() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'get', url: 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items', ))).to eq(true) end it "receives read_empty responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "items": [], "meta": { "first_page_url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items?PageSize=50&Page=0", "key": "items", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items?PageSize=50&Page=0" } } ] )) actual = @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items.list() expect(actual).to_not eq(nil) end it "receives read_full responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "items": [ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "created_by": "created_by", "data": {}, "date_expires": "2015-07-30T21:00:00Z", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "index": 100, "list_sid": "ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "revision": "revision", "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/100" } ], "meta": { "first_page_url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items?PageSize=50&Page=0", "key": "items", "next_page_url": null, "page": 0, "page_size": 50, "previous_page_url": null, "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items?PageSize=50&Page=0" } } ] )) actual = @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items.list() expect(actual).to_not eq(nil) end it "can update" do @holodeck.mock(Twilio::Response.new(500, '')) expect { @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items(1).update() }.to raise_exception(Twilio::REST::TwilioError) values = {} expect( @holodeck.has_request?(Holodeck::Request.new( method: 'post', url: 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1', ))).to eq(true) end it "receives update responses" do @holodeck.mock(Twilio::Response.new( 200, %q[ { "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "created_by": "created_by", "data": {}, "date_expires": "2015-07-30T21:00:00Z", "date_created": "2015-07-30T20:00:00Z", "date_updated": "2015-07-30T20:00:00Z", "index": 100, "list_sid": "ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "revision": "revision", "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "url": "https://sync.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/100" } ] )) actual = @client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_lists('ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \ .sync_list_items(1).update() expect(actual).to_not eq(nil) end end
35.772549
171
0.602061
1d68a76469aac7221554641db763284088ed8ef9
727
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild require 'kaitai/struct/struct' unless Gem::Version.new(Kaitai::Struct::VERSION) >= Gem::Version.new('0.9') raise "Incompatible Kaitai Struct Ruby API: 0.9 or later is required, but you have #{Kaitai::Struct::VERSION}" end class HeroesOfMightAndMagicBmp < Kaitai::Struct::Struct def initialize(_io, _parent = nil, _root = self) super(_io, _parent, _root) _read end def _read @magic = @_io.read_u2le @width = @_io.read_u2le @height = @_io.read_u2le @data = @_io.read_bytes((width * height)) self end attr_reader :magic attr_reader :width attr_reader :height attr_reader :data end
26.925926
112
0.708391
ed591b01bc0e6d312f236ac057621077fed7d8c7
17,018
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "helper" require "gapic/grpc/service_stub" require "google/pubsub/v1/schema_pb" require "google/pubsub/v1/schema_services_pb" require "google/cloud/pubsub/v1/schema_service" class ::Google::Cloud::PubSub::V1::SchemaService::ClientTest < Minitest::Test class ClientStub attr_accessor :call_rpc_count, :requests def initialize response, operation, &block @response = response @operation = operation @block = block @call_rpc_count = 0 @requests = [] end def call_rpc *args, **kwargs @call_rpc_count += 1 @requests << @block&.call(*args, **kwargs) yield @response, @operation if block_given? @response end end def test_create_schema # Create GRPC objects. grpc_response = ::Google::Cloud::PubSub::V1::Schema.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. parent = "hello world" schema = {} schema_id = "hello world" create_schema_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :create_schema, name assert_kind_of ::Google::Cloud::PubSub::V1::CreateSchemaRequest, request assert_equal "hello world", request["parent"] assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::PubSub::V1::Schema), request["schema"] assert_equal "hello world", request["schema_id"] refute_nil options end Gapic::ServiceStub.stub :new, create_schema_client_stub do # Create client client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end # Use hash object client.create_schema({ parent: parent, schema: schema, schema_id: schema_id }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.create_schema parent: parent, schema: schema, schema_id: schema_id do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.create_schema ::Google::Cloud::PubSub::V1::CreateSchemaRequest.new(parent: parent, schema: schema, schema_id: schema_id) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.create_schema({ parent: parent, schema: schema, schema_id: schema_id }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.create_schema(::Google::Cloud::PubSub::V1::CreateSchemaRequest.new(parent: parent, schema: schema, schema_id: schema_id), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, create_schema_client_stub.call_rpc_count end end def test_get_schema # Create GRPC objects. grpc_response = ::Google::Cloud::PubSub::V1::Schema.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" view = :SCHEMA_VIEW_UNSPECIFIED get_schema_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :get_schema, name assert_kind_of ::Google::Cloud::PubSub::V1::GetSchemaRequest, request assert_equal "hello world", request["name"] assert_equal :SCHEMA_VIEW_UNSPECIFIED, request["view"] refute_nil options end Gapic::ServiceStub.stub :new, get_schema_client_stub do # Create client client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end # Use hash object client.get_schema({ name: name, view: view }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.get_schema name: name, view: view do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.get_schema ::Google::Cloud::PubSub::V1::GetSchemaRequest.new(name: name, view: view) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.get_schema({ name: name, view: view }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.get_schema(::Google::Cloud::PubSub::V1::GetSchemaRequest.new(name: name, view: view), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, get_schema_client_stub.call_rpc_count end end def test_list_schemas # Create GRPC objects. grpc_response = ::Google::Cloud::PubSub::V1::ListSchemasResponse.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. parent = "hello world" view = :SCHEMA_VIEW_UNSPECIFIED page_size = 42 page_token = "hello world" list_schemas_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :list_schemas, name assert_kind_of ::Google::Cloud::PubSub::V1::ListSchemasRequest, request assert_equal "hello world", request["parent"] assert_equal :SCHEMA_VIEW_UNSPECIFIED, request["view"] assert_equal 42, request["page_size"] assert_equal "hello world", request["page_token"] refute_nil options end Gapic::ServiceStub.stub :new, list_schemas_client_stub do # Create client client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end # Use hash object client.list_schemas({ parent: parent, view: view, page_size: page_size, page_token: page_token }) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use named arguments client.list_schemas parent: parent, view: view, page_size: page_size, page_token: page_token do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use protobuf object client.list_schemas ::Google::Cloud::PubSub::V1::ListSchemasRequest.new(parent: parent, view: view, page_size: page_size, page_token: page_token) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use hash object with options client.list_schemas({ parent: parent, view: view, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use protobuf object with options client.list_schemas(::Google::Cloud::PubSub::V1::ListSchemasRequest.new(parent: parent, view: view, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, list_schemas_client_stub.call_rpc_count end end def test_delete_schema # Create GRPC objects. grpc_response = ::Google::Protobuf::Empty.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" delete_schema_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :delete_schema, name assert_kind_of ::Google::Cloud::PubSub::V1::DeleteSchemaRequest, request assert_equal "hello world", request["name"] refute_nil options end Gapic::ServiceStub.stub :new, delete_schema_client_stub do # Create client client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end # Use hash object client.delete_schema({ name: name }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.delete_schema name: name do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.delete_schema ::Google::Cloud::PubSub::V1::DeleteSchemaRequest.new(name: name) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.delete_schema({ name: name }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.delete_schema(::Google::Cloud::PubSub::V1::DeleteSchemaRequest.new(name: name), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, delete_schema_client_stub.call_rpc_count end end def test_validate_schema # Create GRPC objects. grpc_response = ::Google::Cloud::PubSub::V1::ValidateSchemaResponse.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. parent = "hello world" schema = {} validate_schema_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :validate_schema, name assert_kind_of ::Google::Cloud::PubSub::V1::ValidateSchemaRequest, request assert_equal "hello world", request["parent"] assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::PubSub::V1::Schema), request["schema"] refute_nil options end Gapic::ServiceStub.stub :new, validate_schema_client_stub do # Create client client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end # Use hash object client.validate_schema({ parent: parent, schema: schema }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.validate_schema parent: parent, schema: schema do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.validate_schema ::Google::Cloud::PubSub::V1::ValidateSchemaRequest.new(parent: parent, schema: schema) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.validate_schema({ parent: parent, schema: schema }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.validate_schema(::Google::Cloud::PubSub::V1::ValidateSchemaRequest.new(parent: parent, schema: schema), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, validate_schema_client_stub.call_rpc_count end end def test_validate_message # Create GRPC objects. grpc_response = ::Google::Cloud::PubSub::V1::ValidateMessageResponse.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. parent = "hello world" name = "hello world" message = "hello world" encoding = :ENCODING_UNSPECIFIED validate_message_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :validate_message, name assert_kind_of ::Google::Cloud::PubSub::V1::ValidateMessageRequest, request assert_equal "hello world", request["parent"] assert_equal "hello world", request["name"] assert_equal :name, request.schema_spec assert_equal "hello world", request["message"] assert_equal :ENCODING_UNSPECIFIED, request["encoding"] refute_nil options end Gapic::ServiceStub.stub :new, validate_message_client_stub do # Create client client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end # Use hash object client.validate_message({ parent: parent, name: name, message: message, encoding: encoding }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.validate_message parent: parent, name: name, message: message, encoding: encoding do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.validate_message ::Google::Cloud::PubSub::V1::ValidateMessageRequest.new(parent: parent, name: name, message: message, encoding: encoding) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.validate_message({ parent: parent, name: name, message: message, encoding: encoding }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.validate_message(::Google::Cloud::PubSub::V1::ValidateMessageRequest.new(parent: parent, name: name, message: message, encoding: encoding), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, validate_message_client_stub.call_rpc_count end end def test_configure grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure client = block_config = config = nil Gapic::ServiceStub.stub :new, nil do client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config| config.credentials = grpc_channel end end config = client.configure do |c| block_config = c end assert_same block_config, config assert_kind_of ::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration, config end end
38.502262
191
0.709308
5d63d32d05e3df6114447b4b2cb2f05c784c7c16
1,604
module Elasticsearch module Transport module Transport # Handles node discovery ("sniffing"). # class Sniffer RE_URL = /\/([^:]*):([0-9]+)\]/ # Use named groups on Ruby 1.9: /\/(?<host>[^:]*):(?<port>[0-9]+)\]/ attr_reader :transport attr_accessor :timeout # @param transport [Object] A transport instance. # def initialize(transport) @transport = transport @timeout = transport.options[:sniffer_timeout] || 1 end # Retrieves the node list from the Elasticsearch's # [_Nodes Info API_](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/) # and returns a normalized Array of information suitable for passing to transport. # # Shuffles the collection before returning it when the `randomize_hosts` option is set for transport. # # @return [Array<Hash>] # @raise [SnifferTimeoutError] # def hosts Timeout::timeout(timeout, SnifferTimeoutError) do nodes = transport.perform_request('GET', '_nodes').body hosts = nodes['nodes'].map do |id,info| if matches = info["#{transport.protocol}_address"].to_s.match(RE_URL) # TODO: Implement lightweight "indifferent access" here info.merge :host => matches[1], :port => matches[2], :id => id end end.compact hosts.shuffle! if transport.options[:randomize_hosts] hosts end end end end end end
34.12766
109
0.579177
03fd8c591598ea2f2aaba2d14ea1961b767ac5c9
2,577
require 'rails_helper' RSpec.describe Tent::Site, type: :model do before do @site = build :tent_site end subject { @site } it { should respond_to(:path) } it { should respond_to(:title) } it { should respond_to(:description) } it { should respond_to(:logo_url) } it { should respond_to(:note) } it { should respond_to(:created_at) } it { should respond_to(:updated_at) } it { should be_valid } describe '#path' do context 'バリデーションする前に' do it '小文字になっていればOK' do @site.path = 'PATH' @site.valid? expect(@site.path).to eq 'path' end end context '空の場合' do it 'invalid' do @site.path = '' expect(@site).not_to be_valid end end context '50文字を超えた場合' do it 'invalid' do @site.path = 'a' * 51 expect(@site).not_to be_valid @site.path = 'あ' * 51 expect(@site).not_to be_valid end end context '日本語を使用した場合' do it 'OK' do jp_strings = %w( ぱす パス サッカー ないたー 愛 玉ねぎ 表 髙島屋 龠 人々 一二三 @ ) @site.path = 'パス' expect(@site).to be_valid end end context '使用不可の文字を使った場合' do it 'invalid' do invalid_paths = %w- / < > # ? ' " % ! $ & ( ) = ^ ~ \ | { } [ ] @ ` * + : ; , . - valid = false invalid_paths.each do |c| @site.path = c expect(@site).not_to be_valid end end end context '空白文字が前後にある場合' do it '除去' do @site.path = ' spaces ' @site.valid? expect(@site.path).to eq 'spaces' end end context '制御文字を使った場合' do context 'バリデーション前に' do it '除去' do @site.path = "new\nline" @site.valid? expect(@site.path).to eq "new line" @site.path = "contain\ttab" @site.valid? expect(@site.path).to eq "contain tab" @site.path = "\ttab\t" @site.valid? expect(@site.path).to eq "tab" @site.path = "\nnew line\n" @site.valid? expect(@site.path).to eq "new line" end end end context '予約語を指定した場合' do it 'invalid' do @site.path = 'admin' expect(@site).not_to be_valid end end end describe '#title' do context '空の場合' do it 'invalid' do @site.title = '' expect(@site).not_to be_valid end end end end
19.671756
48
0.489329
287c14134d5fec41e73ee13e1f85de2c1e9173b8
323
# frozen_string_literal: true module Toller module Filters ## # Scope handler for filter # class ScopeHandler def call(collection, value, properties) scoped_name = properties[:scope_name] || properties[:field] collection.public_send(scoped_name, value) end end end end
19
67
0.665635
019dca9d0abf1b2e3054b48e09a19a5b620f05fe
1,257
require 'unleash/configuration' require 'unleash/metrics' require 'net/http' require 'json' require 'time' module Unleash class MetricsReporter attr_accessor :last_time def initialize self.last_time = Time.now end def generate_report now = Time.now start = self.last_time stop = now self.last_time = now report = { 'appName': Unleash.configuration.app_name, 'instanceId': Unleash.configuration.instance_id, 'bucket': { 'start': start.iso8601(Unleash::TIME_RESOLUTION), 'stop': stop.iso8601(Unleash::TIME_RESOLUTION), 'toggles': Unleash.toggle_metrics.features } } Unleash.toggle_metrics.reset report end def send Unleash.logger.debug "send() Report" response = Unleash::Util::Http.post(Unleash.configuration.client_metrics_url, self.generate_report.to_json) if ['200', '202'].include? response.code Unleash.logger.debug "Report sent to unleash server sucessfully. Server responded with http code #{response.code}" else Unleash.logger.error "Error when sending report to unleash server. Server responded with http code #{response.code}." end end end end
25.653061
125
0.66428
7ac38d67b8002f3f61020564e93caa0af2396d47
835
# frozen_string_literal: true require 'active_support/core_ext/string' require 'bigdecimal' module Lightspeed class Prices def initialize(attributes) @attributes = attributes end def prices @prices ||= @attributes["ItemPrice"].map { |v| [v["useType"].parameterize.underscore.to_sym, BigDecimal(v["amount"])] }.to_h end def as_json attributes end alias_method :to_h, :as_json def to_json Yajl::Encoder.encode(as_json) end def [](key) prices[key] end def inspect prices.inspect end def respond_to?(method, private_method) prices.keys.include?(method) || super end def method_missing(method, *args, &block) if prices.keys.include?(method) prices[method] else super end end end end
18.152174
130
0.633533
e97c8bd2419637eb7e1401e2d4d56c8d6b89d5b3
1,918
require "idsimple/rack/access_token_helper" require "idsimple/rack/api" module Idsimple module Rack module Helper def configuration Idsimple::Rack.configuration end def logger configuration.logger end def signing_secret configuration.signing_secret end def unauthorized_response(req, res = ::Rack::Response.new) logger.info("Unauthorized") configuration.unauthorized_response.call(req, res) res.finish end def redirect_to_authenticate_or_unauthorized_response(req, res = ::Rack::Response.new) issuer = configuration.issuer app_id = configuration.app_id access_attempt = req.params["idsimple_access_attempt"] if configuration.redirect_to_authenticate && issuer && app_id && !access_attempt logger.info("Redirecting to authenticate") access_url = "#{issuer}/apps/#{app_id}/access?return_to=#{req.fullpath}" res.redirect(access_url) res.finish else unauthorized_response(req, res) end end def get_access_token(req) configuration.get_access_token.call(req) end def set_access_token(req, res, new_access_token, new_decoded_access_token) configuration.set_access_token.call(req, res, new_access_token, new_decoded_access_token) end def remove_access_token(req, res) configuration.remove_access_token.call(req, res) end def decode_access_token(access_token, signing_secret) AccessTokenHelper.decode(access_token, signing_secret, { iss: configuration.issuer, aud: configuration.app_id }) end def api @api ||= Idsimple::Rack::Api.new( configuration.api_base_url, configuration.api_base_path, configuration.api_key ) end end end end
27.797101
97
0.65902
18de9be7e86b569bc58e33829fbb081e64a55b94
1,570
require 'spec_helper' describe BitBucket::Repos::DefaultReviewers do subject { described_class.new } describe '#list' do before do expect(subject).to receive(:request).with( :get, '/2.0/repositories/mock_user/mock_repo/default-reviewers', {}, {} ) end it 'makes a GET request for all default reviewers belonging to the repo' do subject.list('mock_user', 'mock_repo') end end describe '#get' do before do expect(subject).to receive(:request).with( :get, '/2.0/repositories/mock_user/mock_repo/default-reviewers/mock_reviewer', {}, {} ) end it 'makes a GET request for a default reviewer by username' do subject.get('mock_user', 'mock_repo', 'mock_reviewer') end end describe '#add' do before do expect(subject).to receive(:request).with( :put, '/2.0/repositories/mock_user/mock_repo/default-reviewers/mock_reviewer', {}, {} ) end it 'makes a PUT request to add the new reviewer to the default reviewers list' do subject.add('mock_user', 'mock_repo', 'mock_reviewer') end end describe '#remove' do before do expect(subject).to receive(:request).with( :delete, '/2.0/repositories/mock_user/mock_repo/default-reviewers/mock_reviewer', {}, {} ) end it 'makes a DELETE request to remove a reviewer from the list' do subject.remove('mock_user', 'mock_repo', 'mock_reviewer') end end end
24.153846
85
0.615924
e23f98bc833db18e4c73565e3fd362b7f5c75872
6,487
require_relative '../app' require_relative './util' require 'rspec' require 'rack/test' require 'ruby-mpd' RSpec.describe 'MPD web interface' do include Rack::Test::Methods def app App end before(:all) do music_path = '/var/lib/mpd/music' Dir.chdir(music_path) do # create an empty mp3 file [{:file_name => "03. What's Up.mp3", :artist => "4 Non Blondes", :title => "What's Up?", :album => "Bigger, Better, Faster, More !", :genre => "Pop"}, {:file_name => "03. Call Your Girlfriend.mp3", :artist => "Robyn", :title => "Call Your Girlfriend", :album => "Body Talk Pt. 3", :genre => "Dance"}, {:file_name => "04. Wintersong.mp3", :artist => "Sarah McLachlan", :title => "Wintersong", :album => "Wintersong", :genre => "Pop"}, {:file_name => "11. In a Bleak Mid Winter.mp3", :artist => "Sarah McLachlan", :title => "In a Bleak Mid Winter", :album => "Wintersong", :genre => "Pop"} ].each do |file_info| create_audio_file(file_info) expect(File).to exist(File.join(music_path, file_info[:file_name])) end end Dir.chdir('/var/lib/mpd/playlists') do # create a playlist file File.open("holiday.m3u", "w") { |file| file.write(["04. Wintersong.mp3", "11. In a Bleak Mid Winter.mp3"].join("\n")) } end @mpd = MPD.new @mpd.connect @mpd.update # update library with test music end before(:each) do @mpd.clear end after(:all) do @mpd.disconnect end it 'adds a song to the current playlist by title' do expect(@mpd.queue.size).to be(0) get '/add/songs/title/what%27s%20up' expect(last_response).to be_ok expect(@mpd.queue.size).to be(1) expect(JSON.parse(last_response.body)).to include('state' => 'play') expect(JSON.parse(last_response.body)).to include('currentSong') expect(JSON.parse(last_response.body)['currentSong']).to include('title' => 'What\'s Up?') expect(JSON.parse(last_response.body)).to include('currentPlaylist') expect(JSON.parse(last_response.body)['currentPlaylist'].size).to be(1) end it 'returns the currently playing song details' do @mpd.where({title: "What's Up?"}, {add: true}) @mpd.play get '/status' expect(last_response).to be_ok expect(JSON.parse(last_response.body)).to include('state' => 'play') expect(JSON.parse(last_response.body)).to include('currentSong') expect(JSON.parse(last_response.body)['currentSong']).to include('artist' => '4 Non Blondes') expect(JSON.parse(last_response.body)['currentSong']).to include('title' => 'What\'s Up?') expect(JSON.parse(last_response.body)['currentSong']).to include('album' => 'Bigger, Better, Faster, More !') expect(JSON.parse(last_response.body)['currentSong']).to include('genre' => 'Pop') expect(last_response.content_type).to eq('application/json') end it 'advances to the next song' do @mpd.where({title: "What's Up?"}, {add: true}) @mpd.play @mpd.where({title: "Call Your Girlfriend"}, {add: true}) @mpd.repeat=true # wrap to start of playlist next_song_id = @mpd.status[:nextsongid] expect(@mpd.status[:songid]).not_to eq(next_song_id) get '/next' expect(last_response).to be_ok expect(@mpd.status[:songid]).to eq(next_song_id) end it 'returns to the previous song' do @mpd.where({title: "What's Up?"}, {add: true}) @mpd.play @mpd.where({title: "Call Your Girlfriend"}, {add: true}) @mpd.repeat=true # wrap to start of playlist current_song_id = @mpd.status[:songid] # get current song id @mpd.next # advance to next song expect(@mpd.status[:songid]).not_to eq(current_song_id) get '/previous' expect(last_response).to be_ok expect(@mpd.status[:songid]).to eq(current_song_id) end it 'clears the playlist' do @mpd.where({title: "What's Up?"}, {add: true}) expect(@mpd.queue.size).to be(1) get '/clear' expect(last_response).to be_ok expect(@mpd.queue.size).to be(0) end it 'pauses and resumes playback' do @mpd.where({title: "Call Your Girlfriend"}, {add: true}) expect(@mpd.paused?).to be(false) expect(@mpd.stopped?).to be(true) expect(@mpd.playing?).to be(false) # stopped -> playing get '/pause' expect(@mpd.paused?).to be(false) expect(@mpd.stopped?).to be(false) expect(@mpd.playing?).to be(true) # playing -> paused get '/pause' expect(@mpd.paused?).to be(true) expect(@mpd.stopped?).to be(false) expect(@mpd.playing?).to be(false) # paused -> playing get '/pause' expect(@mpd.paused?).to be(false) expect(@mpd.stopped?).to be(false) expect(@mpd.playing?).to be(true) end it 'returns the list of playlists' do get '/playlists' expect(last_response).to be_ok expect(JSON.parse(last_response.body)).to include("holiday") end it 'returns the list of songs in the playlist' do get '/songs/playlist/holiday' expect(last_response).to be_ok expect(JSON.parse(last_response.body)).to include(include("playlist" => "holiday")) expect(JSON.parse(last_response.body)).to include(include("songs")) expect(JSON.parse(last_response.body).find { |playlist| playlist["playlist"].eql? "holiday" }["songs"]).to include(include("title" => "In a Bleak Mid Winter")) expect(JSON.parse(last_response.body).find { |playlist| playlist["playlist"].eql? "holiday" }["songs"]).to include(include("title" => "Wintersong")) expect(@mpd.queue.size).to be(0) # songs should not be added end it 'adds the songs from the playlist to the queue playlist' do expect(@mpd.status[:state]).to eql(:stop) get '/add/songs/playlist/holiday' expect(last_response).to be_ok expect(JSON.parse(last_response.body)).to include("currentPlaylist") expect(JSON.parse(last_response.body)["currentPlaylist"].size).to be(2) expect(@mpd.queue.size).to be(2) expect(@mpd.status[:state]).to eql(:play) end it 'returns not found if the URI is not defined' do get '/notexpected' expect(last_response.status).to be(404) expect(JSON.parse(last_response.body)).to include('message' => 'Not found') expect(last_response.content_type).to eq('application/json') end end
36.038889
165
0.632342
0828719fa6a478af249804878d5a4fe988c8fb66
63
require 'zapier_rest_hooks/engine' module ZapierRestHooks end
12.6
34
0.857143
bf49755248006d976ed7979ecfdea1bad6b0bdd7
1,613
#!/usr/bin/env ruby gem 'minitest', '>= 5.0.0' require 'minitest/autorun' require 'date' require 'time' require_relative 'gigasecond' # Test data version: # 2299e68 Document how to skip the hello world problem class GigasecondTest < Minitest::Test def test_2011_04_25 gs = Gigasecond.from(Time.utc(2011, 4, 25, 0, 0, 0)) assert_equal Time.utc(2043, 1, 1, 1, 46, 40), gs end def test_1977_06_13 gs = Gigasecond.from(Time.utc(1977, 6, 13, 0, 0, 0)) assert_equal Time.utc(2009, 2, 19, 1, 46, 40), gs end def test_1959_07_19 gs = Gigasecond.from(Time.utc(1959, 7, 19, 0, 0, 0)) assert_equal Time.utc(1991, 3, 27, 1, 46, 40), gs end def test_full_time_specified gs = Gigasecond.from(Time.utc(2015, 1, 24, 22, 0, 0)) assert_equal Time.utc(2046, 10, 2, 23, 46, 40), gs end def test_full_time_with_day_roll_over gs = Gigasecond.from(Time.utc(2015, 1, 24, 23, 59, 59)) assert_equal Time.utc(2046, 10, 3, 1, 46, 39), gs end # Test your 1Gs anniversary def test_with_your_birthday gs = Gigasecond.from(Time.utc(1984, 5, 4, 12, 0, 0)) assert_equal Time.utc(2016, 1, 11, 13, 46, 40), gs end # Problems in exercism evolve over time, # as we find better ways to ask questions. # The version number refers to the version of the problem you solved, # not your solution. # # Define a constant named VERSION inside of Gigasecond. # If you're curious, read more about constants on RubyDoc: # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html def test_bookkeeping assert_equal 1, Gigasecond::VERSION end end
29.327273
73
0.685679
1c4db2d3a62a34b2062e886ba06358a29f7fab06
2,690
class RelatorioGeralsController < ApplicationController before_action :set_relatorio_geral, only: [:show, :edit, :update, :destroy] # GET /relatorio_gerals # GET /relatorio_gerals.json def index @relatorio_gerals = RelatorioGeral.all.page(params[:page]).per(15) authorize @relatorio_gerals end # GET /relatorio_gerals/1 # GET /relatorio_gerals/1.json def show end # GET /relatorio_gerals/new def new @relatorio_gerals = RelatorioGeral.all authorize @relatorio_gerals @relatorio_geral = RelatorioGeral.new @relatorio_geral.build_relatorio end # GET /relatorio_gerals/1/edit def edit end # POST /relatorio_gerals # POST /relatorio_gerals.json def create @relatorio_gerals = RelatorioGeral.all authorize @relatorio_gerals @relatorio_geral = RelatorioGeral.new(relatorio_geral_params) respond_to do |format| if @relatorio_geral.save format.html { redirect_to @relatorio_geral, notice: 'Relatório geral criado com sucesso!' } format.json { render :show, status: :created, location: @relatorio_geral } else format.html { render :new } format.json { render json: @relatorio_geral.errors, status: :unprocessable_entity } end end end # PATCH/PUT /relatorio_gerals/1 # PATCH/PUT /relatorio_gerals/1.json def update @relatorio_gerals = RelatorioGeral.all authorize @relatorio_gerals respond_to do |format| if @relatorio_geral.update(relatorio_geral_params) format.html { redirect_to @relatorio_geral, notice: 'Relatório geral atualizado com sucesso!' } format.json { render :show, status: :ok, location: @relatorio_geral } else format.html { render :edit } format.json { render json: @relatorio_geral.errors, status: :unprocessable_entity } end end end # DELETE /relatorio_gerals/1 # DELETE /relatorio_gerals/1.json def destroy @relatorio_gerals = RelatorioGeral.all authorize @relatorio_gerals @relatorio_geral.destroy respond_to do |format| format.html { redirect_to relatorio_gerals_url, notice: 'Relatório geral deletado com sucesso!' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_relatorio_geral @relatorio_geral = RelatorioGeral.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def relatorio_geral_params params.require(:relatorio_geral).permit(:rg_objetivo, :rg_atendimento, :relatorio_attributes => [:relatorio_data, :aluno_id, :funcionario_id]) end end
30.224719
148
0.717472
876ad380b981e8c4b133c468dce91430ef50c44a
608
# This task is not actually used. # Use "ruby setup.rb" instead. # This task is just here to show you the idea of what is going on ext_base = File.join(File.dirname(__FILE__), "ext") task "get_it_done" do sh " pushd #{ext_base}/util/src/; rm *.o make; popd; pushd #{ext_base}/math/src; rm *.o # dont need to make this popd; pushd #{ext_base}/apriori/src/; rm *.o; make; popd; pushd #{ext_base}; rm *.o; rm *.bundle; rm Makefile; ruby extconf.rb; make; popd; ruby -d test/apriori_test.rb; " end
20.965517
65
0.564145
4acc6e64138777e6f8e94a05d983d1597e7caf65
34,128
ActiveRecord::Schema.define(version: 20180906121026) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "availability_zones", id: :bigserial, force: :cascade do |t| t.bigint "ems_id", null: false t.string "name" t.string "ems_ref", null: false t.string "type" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_availability_zone_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_availability_zones_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_availability_zones_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["ems_id"], name: "index_availability_zones_on_ems_id", using: :btree t.index ["type"], name: "index_availability_zones_on_type", using: :btree end create_table "cloud_tenants", id: :bigserial, force: :cascade do |t| t.string "name" t.text "description" t.boolean "enabled" t.string "ems_ref", null: false t.bigint "ems_id", null: false t.datetime "created_at" t.datetime "updated_at" t.string "type" t.bigint "parent_id" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_cloud_tenants_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_cloud_tenants_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_cloud_tenants_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["type"], name: "index_cloud_tenants_on_type", using: :btree end create_table "vms", id: :bigserial, force: :cascade do |t| t.string "vendor" t.string "format" t.string "version" t.string "name" t.text "description" t.string "location" t.string "config_xml" t.string "autostart" t.bigint "host_id" t.bigint "genealogy_parent_id" t.datetime "last_sync_on" t.datetime "created_on", null: false t.datetime "updated_on", null: false t.bigint "storage_id" t.string "guid" t.bigint "ems_id", null: false t.datetime "last_scan_on" t.datetime "last_scan_attempt_on" t.string "uid_ems" t.datetime "retires_on" t.boolean "retired" t.datetime "boot_time" t.string "tools_status" t.string "standby_action" t.string "power_state" t.datetime "state_changed_on" t.string "previous_state" t.string "connection_state" t.datetime "last_perf_capture_on" t.boolean "registered" t.boolean "busy" t.boolean "smart" t.integer "memory_reserve" t.boolean "memory_reserve_expand" t.integer "memory_limit" t.integer "memory_shares" t.string "memory_shares_level" t.integer "cpu_reserve" t.boolean "cpu_reserve_expand" t.integer "cpu_limit" t.integer "cpu_shares" t.string "cpu_shares_level" t.string "cpu_affinity" t.datetime "ems_created_on" t.boolean "template", default: false t.bigint "evm_owner_id" t.string "ems_ref_obj" t.bigint "miq_group_id" t.boolean "linked_clone" t.boolean "fault_tolerance" t.string "type" t.string "ems_ref", null: false t.bigint "ems_cluster_id" t.bigint "retirement_warn" t.datetime "retirement_last_warn" t.integer "vnc_port" t.bigint "flavor_id" t.bigint "availability_zone_id" t.boolean "cloud" t.string "retirement_state" t.bigint "cloud_network_id" t.bigint "cloud_subnet_id" t.bigint "cloud_tenant_id" t.string "raw_power_state" t.boolean "publicly_available" t.bigint "orchestration_stack_id" t.string "retirement_requester" t.bigint "tenant_id" t.bigint "resource_group_id" t.boolean "deprecated" t.bigint "storage_profile_id" t.boolean "cpu_hot_add_enabled" t.boolean "cpu_hot_remove_enabled" t.boolean "memory_hot_add_enabled" t.integer "memory_hot_add_limit" t.integer "memory_hot_add_increment" t.string "hostname" t.bigint "source_region_id" t.bigint "subscription_id" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_vms_on_last_seen_at", using: :btree t.index ["availability_zone_id"], name: "index_vms_on_availability_zone_id", using: :btree t.index ["evm_owner_id"], name: "index_vms_on_evm_owner_id", using: :btree t.index ["flavor_id"], name: "index_vms_on_flavor_id", using: :btree t.index ["guid"], name: "index_vms_on_guid", unique: true, using: :btree t.index ["host_id"], name: "index_vms_on_host_id", using: :btree t.index ["location"], name: "index_vms_on_location", using: :btree t.index ["miq_group_id"], name: "index_vms_on_miq_group_id", using: :btree t.index ["name"], name: "index_vms_on_name", using: :btree t.index ["storage_id"], name: "index_vms_on_storage_id", using: :btree t.index ["type"], name: "index_vms_on_type", using: :btree t.index ["uid_ems"], name: "index_vms_on_vmm_uuid", using: :btree t.index ["source_region_id"], name: "index_vms_on_source_region_id", using: :btree t.index ["subscription_id"], name: "index_vms_on_subscription_id", using: :btree t.index ["archived_at"], name: "index_vms_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_vms_on_ems_id_and_ems_ref", unique: true, using: :btree end create_table "hardwares", id: :bigserial, force: :cascade do |t| t.bigint "vm_or_template_id", null: false t.string "config_version" t.string "virtual_hw_version" t.string "guest_os" t.integer "cpu_sockets", default: 1 t.string "bios" t.string "bios_location" t.string "time_sync" t.text "annotation" t.integer "memory_mb" t.bigint "host_id" t.integer "cpu_speed" t.string "cpu_type" t.bigint "size_on_disk" t.string "manufacturer", default: "" t.string "model", default: "" t.integer "number_of_nics" t.integer "cpu_usage" t.integer "memory_usage" t.integer "cpu_cores_per_socket" t.integer "cpu_total_cores" t.boolean "vmotion_enabled" t.bigint "disk_free_space" t.bigint "disk_capacity" t.string "guest_os_full_name" t.integer "memory_console" t.integer "bitness" t.string "virtualization_type" t.string "root_device_type" t.bigint "computer_system_id" t.bigint "disk_size_minimum" t.bigint "memory_mb_minimum" t.boolean "introspected" t.string "provision_state" t.string "serial_number" t.bigint "switch_id" t.string "firmware_type" t.bigint "canister_id" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_hardwares_on_last_seen_at", using: :btree t.index ["computer_system_id"], name: "index_hardwares_on_computer_system_id", using: :btree t.index ["host_id"], name: "index_hardwares_on_host_id", using: :btree t.index ["vm_or_template_id"], name: "index_hardwares_on_vm_or_template_id", unique: true, using: :btree end add_foreign_key :hardwares, :vms, on_delete: :cascade, column: 'vm_or_template_id' create_table "disks", id: :bigserial, force: :cascade do |t| t.string "device_name", null: false t.string "device_type" t.string "location" t.string "filename" t.bigint "hardware_id", null: false t.string "mode" t.string "controller_type" t.bigint "size" t.bigint "free_space" t.bigint "size_on_disk" t.boolean "present", default: true t.boolean "start_connected", default: true t.boolean "auto_detect" t.datetime "created_on" t.datetime "updated_on" t.string "disk_type" t.bigint "storage_id" t.bigint "backing_id" t.string "backing_type" t.bigint "storage_profile_id" t.boolean "bootable" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_disks_on_last_seen_at", using: :btree t.index ["hardware_id", "device_name"], name: "index_disks_on_hardware_id_and_device_name", unique: true, using: :btree t.index ["device_type"], name: "index_disks_on_device_type", using: :btree t.index ["storage_id"], name: "index_disks_on_storage_id", using: :btree end add_foreign_key :disks, :hardwares, on_delete: :cascade create_table "event_streams", id: :bigserial, force: :cascade do |t| t.string "event_type" t.text "message" t.datetime "timestamp" t.string "host_name" t.bigint "host_id" t.string "vm_name" t.string "vm_location" t.bigint "vm_or_template_id" t.string "dest_host_name" t.bigint "dest_host_id" t.string "dest_vm_name" t.string "dest_vm_location" t.bigint "dest_vm_or_template_id" t.string "source" t.bigint "chain_id" t.bigint "ems_id", null: false t.boolean "is_task" t.text "full_data" t.datetime "created_on" t.string "username" t.bigint "ems_cluster_id" t.string "ems_cluster_name" t.string "ems_cluster_uid" t.bigint "dest_ems_cluster_id" t.string "dest_ems_cluster_name" t.string "dest_ems_cluster_uid" t.bigint "availability_zone_id" t.bigint "container_node_id" t.string "container_node_name" t.bigint "container_group_id" t.string "container_group_name" t.string "container_namespace" t.string "type" t.string "target_type" t.bigint "target_id" t.bigint "container_id" t.string "container_name" t.bigint "container_replicator_id" t.string "container_replicator_name" t.bigint "middleware_server_id" t.string "middleware_server_name" t.bigint "middleware_deployment_id" t.string "middleware_deployment_name" t.bigint "generating_ems_id" t.bigint "physical_server_id" t.string "ems_ref", null: false t.bigint "middleware_domain_id" t.string "middleware_domain_name" t.bigint "user_id" t.bigint "group_id" t.bigint "tenant_id" t.string "vm_ems_ref" t.string "dest_vm_ems_ref" t.bigint "physical_chassis_id" t.bigint "physical_switch_id" t.index ["availability_zone_id", "type"], name: "index_event_streams_on_availability_zone_id_and_type", using: :btree t.index ["chain_id", "ems_id"], name: "index_event_streams_on_chain_id_and_ems_id", using: :btree t.index ["dest_host_id"], name: "index_event_streams_on_dest_host_id", using: :btree t.index ["dest_vm_or_template_id"], name: "index_event_streams_on_dest_vm_or_template_id", using: :btree t.index ["ems_cluster_id"], name: "index_event_streams_on_ems_cluster_id", using: :btree t.index ["ems_id"], name: "index_event_streams_on_ems_id", using: :btree t.index ["event_type"], name: "index_event_streams_on_event_type", using: :btree t.index ["generating_ems_id"], name: "index_event_streams_on_generating_ems_id", using: :btree t.index ["host_id"], name: "index_event_streams_on_host_id", using: :btree t.index ["timestamp"], name: "index_event_streams_on_timestamp", using: :btree t.index ["vm_or_template_id"], name: "index_event_streams_on_vm_or_template_id", using: :btree end create_table "ext_management_systems", id: :bigserial, force: :cascade do |t| t.string "name" t.datetime "created_on" t.datetime "updated_on" t.string "guid", null: false t.bigint "zone_id" t.string "type" t.string "api_version" t.string "uid_ems" t.integer "host_default_vnc_port_start" t.integer "host_default_vnc_port_end" t.string "provider_region" t.text "last_refresh_error" t.datetime "last_refresh_date" t.bigint "provider_id" t.string "realm" t.bigint "tenant_id" t.string "project" t.bigint "parent_ems_id" t.string "subscription" t.text "last_metrics_error" t.datetime "last_metrics_update_date" t.datetime "last_metrics_success_date" t.boolean "tenant_mapping_enabled" t.boolean "enabled" t.text "options" t.index ["guid"], name: "index_ext_management_systems_on_guid", unique: true, using: :btree t.index ["parent_ems_id"], name: "index_ext_management_systems_on_parent_ems_id", using: :btree t.index ["type"], name: "index_ext_management_systems_on_type", using: :btree end create_table "flavors", id: :bigserial, force: :cascade do |t| t.bigint "ems_id", null: false t.string "name", null: false t.string "description" t.integer "cpus" t.integer "cpu_cores" t.bigint "memory" t.string "ems_ref" t.string "type" t.boolean "supports_32_bit" t.boolean "supports_64_bit" t.boolean "enabled" t.boolean "supports_hvm" t.boolean "supports_paravirtual" t.boolean "block_storage_based_only" t.boolean "cloud_subnet_required" t.bigint "ephemeral_disk_size" t.integer "ephemeral_disk_count" t.bigint "root_disk_size" t.bigint "swap_disk_size" t.boolean "publicly_available" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_flavors_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_flavors_on_archived_at", using: :btree t.index ["ems_id", "name"], name: "index_flavors_on_ems_id_and_name", unique: true, using: :btree t.index ["ems_id"], name: "index_flavors_on_ems_id", using: :btree t.index ["type"], name: "index_flavors_on_type", using: :btree end create_table "hosts", id: :bigserial, force: :cascade do |t| t.string "name" t.string "hostname" t.string "ipaddress" t.string "vmm_vendor" t.string "vmm_version" t.string "vmm_product" t.string "vmm_buildnumber" t.datetime "created_on" t.datetime "updated_on" t.string "guid" t.bigint "ems_id", null: false t.string "user_assigned_os" t.string "power_state", default: "" t.integer "smart" t.string "settings" t.datetime "last_perf_capture_on" t.string "uid_ems" t.string "connection_state" t.string "ssh_permit_root_login" t.string "ems_ref_obj" t.boolean "admin_disabled" t.string "service_tag" t.string "asset_tag" t.string "ipmi_address" t.string "mac_address" t.string "type" t.boolean "failover" t.string "ems_ref", null: false t.boolean "hyperthreading" t.bigint "ems_cluster_id" t.integer "next_available_vnc_port" t.string "hypervisor_hostname" t.bigint "availability_zone_id" t.boolean "maintenance" t.string "maintenance_reason" t.bigint "physical_server_id" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_hosts_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_hosts_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_hosts_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["availability_zone_id"], name: "index_hosts_on_availability_zone_id", using: :btree t.index ["ems_id"], name: "index_hosts_on_ems_id", using: :btree t.index ["guid"], name: "index_hosts_on_guid", unique: true, using: :btree t.index ["hostname"], name: "index_hosts_on_hostname", using: :btree t.index ["ipaddress"], name: "index_hosts_on_ipaddress", using: :btree t.index ["type"], name: "index_hosts_on_type", using: :btree end create_table "networks", id: :bigserial, force: :cascade do |t| t.bigint "hardware_id", null: false t.bigint "device_id" t.string "description", null: false t.string "guid" t.boolean "dhcp_enabled" t.string "ipaddress" t.string "subnet_mask" t.datetime "lease_obtained" t.datetime "lease_expires" t.string "default_gateway" t.string "dhcp_server" t.string "dns_server" t.string "hostname" t.string "domain" t.string "ipv6address" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_networks_on_last_seen_at", using: :btree t.index ["hardware_id", "description"], name: "index_networks_on_hardware_id_and_description", unique: true, using: :btree t.index ["device_id"], name: "index_networks_on_device_id", using: :btree end add_foreign_key :networks, :hardwares, on_delete: :cascade create_table "network_ports", id: :bigserial, force: :cascade do |t| t.string "type" t.string "name" t.string "ems_ref", null: false t.bigint "ems_id", null: false t.string "mac_address" t.string "status" t.boolean "admin_state_up" t.string "device_owner" t.string "device_ref" t.bigint "device_id" t.string "device_type" t.bigint "cloud_tenant_id" t.string "binding_host_id" t.string "binding_virtual_interface_type" t.text "extra_attributes" t.string "source" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_network_ports_on_last_seen_at", using: :btree t.index ["cloud_tenant_id"], name: "index_network_ports_on_cloud_tenant_id", using: :btree t.index ["device_id", "device_type"], name: "index_network_ports_on_device_id_and_device_type", using: :btree t.index ["type"], name: "index_network_ports_on_type", using: :btree t.index ["archived_at"], name: "index_network_ports_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_network_ports_on_ems_id_and_ems_ref", unique: true, using: :btree end create_table "orchestration_stack_resources", id: :bigserial, force: :cascade do |t| t.string "name" t.text "description" t.text "logical_resource" t.text "physical_resource" t.string "resource_category" t.string "resource_status" t.text "resource_status_reason" t.datetime "last_updated" t.bigint "stack_id", null: false t.text "ems_ref", null: false t.datetime "start_time" t.datetime "finish_time" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_orchestration_stack_resources_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_stacks_res_on_archived_at", using: :btree t.index ["stack_id", "ems_ref"], name: "index_stacks_res_on_stack_id_and_ems_ref", unique: true, using: :btree t.index ["stack_id"], name: "index_orchestration_stack_resources_on_stack_id", using: :btree end create_table "orchestration_stacks", id: :bigserial, force: :cascade do |t| t.string "name" t.string "type" t.text "description" t.string "status" t.text "ems_ref", null: false t.string "ancestry" t.bigint "ems_id", null: false t.bigint "orchestration_template_id" t.datetime "created_at" t.datetime "updated_at" t.boolean "retired" t.datetime "retires_on" t.bigint "retirement_warn" t.datetime "retirement_last_warn" t.string "retirement_state" t.string "retirement_requester" t.text "status_reason" t.bigint "cloud_tenant_id" t.string "resource_group" t.datetime "start_time" t.datetime "finish_time" t.bigint "configuration_script_base_id" t.integer "verbosity" t.text "hosts", array: true t.datetime "archived_at" t.bigint "parent_id" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_orchestration_stacks_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_stacks_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_stacks_on_ems_id_and_ems_ref", unique: true, using: :btree t.index "ancestry varchar_pattern_ops", name: "index_orchestration_stacks_on_ancestry_vpo", using: :btree t.index ["ancestry"], name: "index_orchestration_stacks_on_ancestry", using: :btree t.index ["orchestration_template_id"], name: "index_orchestration_stacks_on_orchestration_template_id", using: :btree t.index ["type"], name: "index_orchestration_stacks_on_type", using: :btree end create_table "physical_servers", id: :bigserial, force: :cascade do |t| t.bigint "ems_id", null: false t.string "name" t.string "type" t.string "uid_ems" t.string "ems_ref", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "health_state" t.string "power_state" t.string "hostname" t.string "product_name" t.string "manufacturer" t.string "machine_type" t.string "model" t.string "serial_number" t.string "field_replaceable_unit" t.string "raw_power_state" t.string "vendor" t.string "location_led_state" t.bigint "physical_rack_id" t.string "ems_compliance_name" t.string "ems_compliance_status" t.bigint "physical_chassis_id" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_physical_servers_on_last_seen_at", using: :btree t.datetime "archived_at" t.index ["archived_at"], name: "index_physical_servers_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_physical_servers_on_ems_id_and_ems_ref", unique: true, using: :btree end create_table "container_groups", id: :bigserial, force: :cascade do |t| t.string "ems_ref", null: false t.string "name" t.datetime "ems_created_on" t.string "resource_version_string" t.string "restart_policy" t.string "dns_policy" t.bigint "ems_id", null: false t.bigint "container_node_id" t.datetime "last_perf_capture_on" t.bigint "container_replicator_id" t.string "ipaddress" t.string "type" t.bigint "container_project_id" t.string "phase" t.string "message" t.string "reason" t.bigint "container_build_pod_id" t.datetime "created_on" t.datetime "archived_at" t.bigint "old_ems_id" t.bigint "old_container_project_id" t.datetime "updated_on" t.datetime "resource_timestamp" t.jsonb "resource_timestamps", default: {} t.datetime "resource_timestamps_max" t.integer "resource_counter" t.jsonb "resource_counters", default: {} t.integer "resource_counters_max" t.string "resource_version" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_container_groups_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_container_groups_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_container_groups_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["ems_id"], name: "index_container_groups_on_ems_id", using: :btree t.index ["type"], name: "index_container_groups_on_type", using: :btree end create_table "tags", id: :bigserial, force: :cascade do |t| t.bigint "ems_id", null: false t.string "name", null: false t.string "namespace", default: "", null: false t.text "description" t.datetime "created_at", null: false t.string "value", default: "", null: false t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_tags_on_last_seen_at", using: :btree t.index ["ems_id", "namespace", "name", "value"], name: "index_tags_on_ems_id_and_namespace_and_name_and_value", unique: true end create_table "container_group_tags", id: :serial, force: :cascade do |t| t.bigint "tag_id", null: false t.bigint "container_group_id", null: false t.index ["container_group_id", "tag_id"], name: "uniq_index_on_container_group_id_tag_id", unique: true t.index ["tag_id"], name: "index_container_group_tags_on_tag_id" end add_foreign_key "container_group_tags", "container_groups", on_delete: :cascade add_foreign_key "container_group_tags", "tags", on_delete: :cascade create_table "containers", id: :bigserial, force: :cascade do |t| t.string "ems_ref", null: false t.integer "restart_count" t.string "state" t.string "name" t.string "backing_ref" t.datetime "last_perf_capture_on" t.string "type" t.bigint "container_image_id" t.string "reason" t.datetime "started_at" t.datetime "finished_at" t.integer "exit_code" t.integer "signal" t.string "message" t.string "last_state" t.string "last_reason" t.datetime "last_started_at" t.datetime "last_finished_at" t.integer "last_exit_code" t.integer "last_signal" t.string "last_message" t.datetime "archived_at" t.bigint "ems_id", null: false t.bigint "old_ems_id" t.float "request_cpu_cores" t.bigint "request_memory_bytes" t.float "limit_cpu_cores" t.bigint "limit_memory_bytes" t.string "image" t.string "image_pull_policy" t.string "memory" t.float "cpu_cores" t.bigint "container_group_id" t.boolean "privileged" t.bigint "run_as_user" t.boolean "run_as_non_root" t.string "capabilities_add" t.string "capabilities_drop" t.text "command" t.datetime "resource_timestamp" t.jsonb "resource_timestamps", default: {} t.datetime "resource_timestamps_max" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_containers_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_containers_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_containers_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["type"], name: "index_containers_on_type", using: :btree end create_table "nested_containers", id: :bigserial, force: :cascade do |t| t.string "ems_ref" t.integer "restart_count" t.string "state" t.string "name", null: false t.string "backing_ref" t.datetime "last_perf_capture_on" t.string "type" t.bigint "container_image_id" t.string "reason" t.datetime "started_at" t.datetime "finished_at" t.integer "exit_code" t.integer "signal" t.string "message" t.string "last_state" t.string "last_reason" t.datetime "last_started_at" t.datetime "last_finished_at" t.integer "last_exit_code" t.integer "last_signal" t.string "last_message" t.datetime "archived_at" t.bigint "old_ems_id" t.float "request_cpu_cores" t.bigint "request_memory_bytes" t.float "limit_cpu_cores" t.bigint "limit_memory_bytes" t.string "image" t.string "image_pull_policy" t.string "memory" t.float "cpu_cores" t.bigint "container_group_id", :null => false t.boolean "privileged" t.bigint "run_as_user" t.boolean "run_as_non_root" t.string "capabilities_add" t.string "capabilities_drop" t.text "command" t.datetime "resource_timestamp" t.jsonb "resource_timestamps", default: {} t.datetime "resource_timestamps_max" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_nested_containers_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_nested_containers_on_archived_at", using: :btree t.index ["container_group_id", "name"], name: "index_nested_containers_uniq", unique: true, using: :btree t.index ["type"], name: "index_nested_containers_on_type", using: :btree end create_table "container_image_registries", id: :bigserial, force: :cascade do |t| t.string "name" t.string "host", null: false t.string "port", null: false t.bigint "ems_id", null: false t.index ["ems_id", "host", "port"], name: "index_container_image_registries_on_ems_id_and_host_and_port", unique: true, using: :btree end create_table "container_images", id: :bigserial, force: :cascade do |t| t.string "tag" t.string "name" t.string "image_ref", null: false t.bigint "container_image_registry_id" t.bigint "ems_id", null: false t.datetime "last_sync_on" t.datetime "last_scan_attempt_on" t.string "digest" t.datetime "registered_on" t.string "architecture" t.string "author" t.string "command", default: [], array: true t.string "entrypoint", default: [], array: true t.string "docker_version" t.text "exposed_ports" t.text "environment_variables" t.bigint "size" t.datetime "created_on" t.bigint "old_ems_id" t.datetime "archived_at" t.string "type" t.jsonb "timestamps", default: {} t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_container_images_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_container_images_on_archived_at", using: :btree t.index ["ems_id", "image_ref"], name: "index_container_images_unique_multi_column", unique: true, using: :btree t.index ["ems_id"], name: "index_container_images_on_ems_id", using: :btree end create_table "container_projects", id: :bigserial, force: :cascade do |t| t.string "ems_ref", null: false t.string "name" t.datetime "ems_created_on" t.string "resource_version_string" t.string "display_name" t.bigint "ems_id", null: false t.datetime "created_on" t.datetime "archived_at" t.bigint "old_ems_id" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_container_projects_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_container_projects_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_container_projects_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["ems_id"], name: "index_container_projects_on_ems_id", using: :btree end create_table "container_replicators", id: :bigserial, force: :cascade do |t| t.string "ems_ref", null: false t.string "name" t.datetime "ems_created_on" t.bigint "ems_id", null: false t.string "resource_version_string" t.integer "replicas" t.integer "current_replicas" t.bigint "container_project_id" t.datetime "created_on" t.index ["ems_id", "ems_ref"], name: "index_container_replicators_on_ems_id_and_ems_ref", unique: true, using: :btree end create_table "container_nodes", id: :bigserial, force: :cascade do |t| t.string "ems_ref", null: false t.string "name" t.datetime "ems_created_on" t.string "resource_version_string" t.bigint "ems_id", null: false t.string "lives_on_type" t.bigint "lives_on_id" t.datetime "last_perf_capture_on" t.string "identity_infra" t.string "identity_machine" t.string "identity_system" t.string "type" t.string "kubernetes_kubelet_version" t.string "kubernetes_proxy_version" t.string "container_runtime_version" t.integer "max_container_groups" t.datetime "created_on" t.bigint "old_ems_id" t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_container_nodes_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_container_nodes_on_archived_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_container_nodes_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["ems_id"], name: "index_container_nodes_on_ems_id", using: :btree t.index ["type"], name: "index_container_nodes_on_type", using: :btree end create_table "container_build_pods", id: :bigserial, force: :cascade do |t| t.string "ems_ref", null: false t.string "name", null: false t.datetime "ems_created_on" t.string "resource_version_string" t.string "namespace", null: false t.string "message" t.string "phase" t.string "reason" t.string "output_docker_image_reference" t.string "completion_timestamp" t.string "start_timestamp" t.bigint "duration" t.bigint "container_build_id" t.bigint "ems_id", null: false t.datetime "created_on" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_container_build_pods_on_last_seen_at", using: :btree t.index ["ems_id", "ems_ref"], name: "index_container_build_pods_on_ems_id_and_ems_ref", unique: true, using: :btree t.index ["ems_id", "namespace", "name"], name: "index_container_build_pods_on_ems_id_and_name", unique: true, using: :btree t.index ["ems_id"], name: "index_container_build_pods_on_ems_id", using: :btree end create_table "source_regions", force: :cascade do |t| t.bigint "ems_id", null: false t.string "ems_ref", null: false t.string "name" t.string "endpoint" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_source_regions_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_source_regions_on_archived_at" t.index ["ems_id", "ems_ref"], name: "index_source_regions_on_ems_id_and_ems_ref", unique: true t.index ["ems_id"], name: "index_source_regions_on_ems_id" end create_table "subscriptions", force: :cascade do |t| t.bigint "ems_id", null: false t.string "ems_ref", null: false t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.datetime "archived_at" t.datetime "last_seen_at" t.index ["last_seen_at"], name: "index_subscriptions_on_last_seen_at", using: :btree t.index ["archived_at"], name: "index_subscriptions_on_archived_at" t.index ["ems_id", "ems_ref"], name: "index_subscriptions_on_ems_id_and_ems_ref", unique: true t.index ["ems_id"], name: "index_subscriptions_on_ems_id" end end
40.292798
137
0.684335
d50b3a027820b848ddaa234ca40bc6138cddbf13
4,026
#! /usr/bin/env ruby # # check-ebs-burst-limit # # DESCRIPTION: # Check EC2 Volumes for volumes with low burst balance # Optionally check only volumes attached to the current instance # # OUTPUT: # plain-text # # PLATFORMS: # Linux # # DEPENDENCIES: # gem: aws-sdk # gem: sensu-plugin # # USAGE: # ./check-ebs-burst-limit.rb -r ${you_region} # ./check-ebs-burst-limit.rb -r ${you_region} -c 50 # ./check-ebs-burst-limit.rb -r ${you_region} -w 50 -c 10 # ./check-ebs-burst-limit.rb -r ${you_region} -w 50 -c 10 -f "{name:tag-value,values:[infrastructure]}" # # LICENSE: # Barry Martin <[email protected]> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require 'sensu-plugin/check/cli' require 'sensu-plugins-aws' require 'sensu-plugins-aws/filter' require 'aws-sdk' require 'net/http' class CheckEbsBurstLimit < Sensu::Plugin::Check::CLI include CloudwatchCommon include Filter option :aws_region, short: '-r R', long: '--region REGION', description: 'AWS region, will be overridden by the -s option', default: 'us-east-1' option :critical, description: 'Trigger a critical when ebs burst limit is under VALUE', short: '-c VALUE', long: '--critical VALUE', proc: proc(&:to_f), required: true option :warning, description: 'Trigger a warning when ebs burst limit is under VALUE', short: '-w VALUE', long: '--warning VALUE', proc: proc(&:to_f) option :check_self, short: '-s', long: '--check-self', description: 'Only check the instance on which this plugin is being run - this overrides the -r option and uses the region of the current instance', boolean: true, default: false option :filter, short: '-f FILTER', long: '--filter FILTER', description: 'String representation of the filter to apply', default: '{}' def run errors = [] volume_filters = Filter.parse(config[:filter]) # Set the describe-volumes filter depending on whether -s was specified if config[:check_self] == true # Get the region from the availability zone, and override the -r option my_instance_az = Net::HTTP.get(URI.parse('http://169.254.169.254/latest/meta-data/placement/availability-zone')) Aws.config[:region] = my_instance_az.chop my_instance_id = Net::HTTP.get(URI.parse('http://169.254.169.254/latest/meta-data/instance-id')) volume_filters.push( name: 'attachment.instance-id', values: [my_instance_id] ) else # The -s option was not specified, look at all volumes which are attached volume_filters.push( name: 'attachment.status', values: ['attached'] ) end ec2 = Aws::EC2::Client.new volumes = ec2.describe_volumes( filters: volume_filters ) config[:metric_name] = 'BurstBalance' config[:namespace] = 'AWS/EBS' config[:statistics] = 'Average' config[:period] = 120 crit = false should_warn = false volumes[:volumes].each do |volume| config[:dimensions] = [] config[:dimensions] << { name: 'VolumeId', value: volume[:volume_id] } resp = client.get_metric_statistics(metrics_request(config)) unless resp.datapoints.first.nil? if resp.datapoints.first[:average] < config[:critical] errors << "#{volume[:volume_id]} #{resp.datapoints.first[:average]}" crit = true elsif config[:warning] && resp.datapoints.first[:average] < config[:warning] errors << "#{volume[:volume_id]} #{resp.datapoints.first[:average]}" should_warn = true end end end if crit critical "Volume(s) have exceeded critical threshold: #{errors}" elsif should_warn warning "Volume(s) have exceeded warning threshold: #{errors}" else ok 'No volume(s) exceed thresholds' end end end
30.732824
157
0.633631
339151a3fbfb5659dcdfe0e8b402ddd7260e0dfa
6,143
# frozen_string_literal: true require 'spec_helper' require 'fakefs/spec_helpers' require 'json' module LicenseFinder describe Yarn do let(:root) { '/fake-node-project' } it_behaves_like 'a PackageManager' let(:yarn_shell_command_output) do { 'type' => 'table', 'data' => { 'body' => [['yn', '2.0.0', 'MIT', 'https://github.com/sindresorhus/yn.git', 'sindresorhus.com', 'Sindre Sorhus']], 'head' => %w[Name Version License URL VendorUrl VendorName] } }.to_json end describe '.prepare' do subject { Yarn.new(project_path: Pathname(root), logger: double(:logger, active: nil)) } include FakeFS::SpecHelpers before do FileUtils.mkdir_p(Dir.tmpdir) FileUtils.mkdir_p(root) end it 'should call yarn install' do expect(SharedHelpers::Cmd).to receive(:run).with('yarn install --ignore-engines') .and_return([yarn_shell_command_output, '', cmd_success]) subject.prepare end context 'ignored_groups contains devDependencies' do subject { Yarn.new(project_path: Pathname(root), ignored_groups: 'devDependencies') } it 'should include a production flag' do expect(SharedHelpers::Cmd).to receive(:run).with('yarn install --ignore-engines --production') .and_return([yarn_shell_command_output, '', cmd_success]) subject.prepare end end end describe '#current_packages' do subject { Yarn.new(project_path: Pathname(root), logger: double(:logger, active: nil)) } it 'displays packages as returned from "yarn list"' do allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + " --cwd #{Pathname(root)}") do [yarn_shell_command_output, '', cmd_success] end expect(subject.current_packages.length).to eq 1 expect(subject.current_packages.first.name).to eq 'yn' expect(subject.current_packages.first.version).to eq '2.0.0' expect(subject.current_packages.first.license_names_from_spec).to eq ['MIT'] expect(subject.current_packages.first.homepage).to eq 'sindresorhus.com' end it 'displays incompatible packages with license type unknown' do allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + " --cwd #{Pathname(root)}") do ['{"type":"info","data":"[email protected]: The platform \"linux\" is incompatible with this module."} {"type":"info","data":"\"[email protected]\" is an optional dependency and failed compatibility check. Excluding it from installation."}', '', cmd_success] end expect(subject.current_packages.length).to eq 1 expect(subject.current_packages.last.name).to eq 'fsevents' expect(subject.current_packages.last.version).to eq '1.1.1' expect(subject.current_packages.last.license_names_from_spec).to eq ['unknown'] end it 'handles json with non-ascii characters' do allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + " --cwd #{Pathname(root)}") do [{ 'type' => 'table', 'data' => { 'body' => [['stack-trace', '0.0.10', 'MIT', 'git://github.com/felixge/node-stack-trace.git', 'https://github.com/felixgö/node-stack-trace', 'Felix Geisendörfer']], 'head' => %w[Name Version License URL VendorUrl VendorName] } }.to_json, '', cmd_success] end expect(subject.current_packages.length).to eq 1 expect(subject.current_packages.first.name).to eq 'stack-trace' expect(subject.current_packages.first.version).to eq '0.0.10' expect(subject.current_packages.first.license_names_from_spec).to eq ['MIT'] expect(subject.current_packages.first.homepage).to eq 'https://github.com/felixg?/node-stack-trace' end context 'ignored_groups contains devDependencies' do subject { Yarn.new(project_path: Pathname(root), ignored_groups: 'devDependencies') } it 'should include a production flag' do expect(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + ' --production' + " --cwd #{Pathname(root)}") .and_return([yarn_shell_command_output, '', cmd_success]) subject.current_packages end end context 'packages contain workspace-aggregator' do it 'should remove the package' do allow(SharedHelpers::Cmd).to receive(:run).with(Yarn::SHELL_COMMAND + " --cwd #{Pathname(root)}") do [{ 'type' => 'table', 'data' => { 'body' => [['workspace-aggregator-8e9c6710-d159-44a9-b7eb-78831eed0c59', '', 'UNKNOWN', 'Unknown', 'Unknown', 'Unknown'], ['stack-trace', '0.0.10', 'MIT', 'git://github.com/felixge/node-stack-trace.git', 'https://github.com/felixgö/node-stack-trace', 'Felix Geisendörfer']], 'head' => %w[Name Version License URL VendorUrl VendorName] } }.to_json, '', cmd_success] end expect(subject.current_packages.length).to eq 1 expect(subject.current_packages.first.name).to eq 'stack-trace' expect(subject.current_packages.first.version).to eq '0.0.10' expect(subject.current_packages.first.license_names_from_spec).to eq ['MIT'] expect(subject.current_packages.first.homepage).to eq 'https://github.com/felixg?/node-stack-trace' end end end describe '.prepare_command' do subject { Yarn.new(project_path: Pathname(root), logger: double(:logger, active: nil)) } it 'returns the correct prepare method' do expect(subject.prepare_command).to eq('yarn install --ignore-engines') end end describe '.package_management_command' do it 'returns the correct package management command' do expect(subject.package_management_command).to eq('yarn') end end end end
45.169118
179
0.627544
3324bd43c802ee2c1ee2191cb48639ef1956b31d
564
# frozen_string_literal: true module EE module SelectsHelper def ldap_server_select_options options_from_collection_for_select( ::Gitlab::Auth::Ldap::Config.available_servers, 'provider_name', 'label' ) end def admin_email_select_tag(id, opts = {}) css_class = ["ajax-admin-email-select"] css_class << "multiselect" if opts[:multiple] css_class << opts[:class] if opts[:class] value = opts[:selected] || '' hidden_field_tag(id, value, class: css_class.join(' ')) end end end
24.521739
61
0.643617
62adf6a81a7c63312265f94821fab352f430f848
398
require "bundler/setup" require "rails/engine" require "jquery/easing/rails" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end
24.875
66
0.756281
bb0f248e5daac65954866e7958314fa7ae113ac5
1,582
# frozen_string_literal: true require "tempfile" require "webrick" require "webrick/httpproxy" module Ferrum class Proxy def self.start(*args) new(*args).tap(&:start) end attr_reader :host, :port, :user, :password def initialize(host: "127.0.0.1", port: 0, user: nil, password: nil) @host, @port, @user, @password = host, port, user, password at_exit { stop } end def start options = { ProxyURI: nil, ServerType: Thread, Logger: Logger.new(IO::NULL), AccessLog: [], BindAddress: host, Port: port } if user && password @file = Tempfile.new("htpasswd") htpasswd = WEBrick::HTTPAuth::Htpasswd.new(@file.path) htpasswd.set_passwd 'Proxy Realm', user, password htpasswd.flush authenticator = WEBrick::HTTPAuth::ProxyBasicAuth.new(Realm: 'Proxy Realm', UserDB: htpasswd, Logger: Logger.new(IO::NULL)) options.merge!(ProxyAuthProc: authenticator.method(:authenticate).to_proc) end @server = WEBrick::HTTPProxyServer.new(**options) @server.start @port = @server.config[:Port] end def rotate(host:, port:, user: nil, password: nil) credentials = "#{user}:#{password}@" if user && password proxy_uri = "schema://#{credentials}#{host}:#{port}" @server.config[:ProxyURI] = URI.parse(proxy_uri) end def stop @file&.unlink @server.shutdown end end end
28.25
91
0.575221
38619bfb020a8fe29c7347c33e359bd9d5b2f344
523
module OrigenTesters module SmartestBasedTester class Base module Processors # Extracts all runtime variables which are set within the given flow, returning # them in an array class ExtractSetVariables < ATP::Processor def run(nodes) @results = [] process_all(nodes) @results.uniq end def on_set_flag(node) flag = node.value @results << flag end end end end end end
22.73913
87
0.556405
611a125cda38fa7cb49b50b2263a8ee2e3560906
427
require 'spec_helper' describe ResourcesController, 'permissions', type: :controller do it 'renders 403 if user is not space admin' do user = double(:user) log_in user space = double(:space) allow(space).to receive(:admin?).with(user) {false} allow(Space).to receive(:find_by_name!) {space} post :create, params: { space_id: '1', category_id: '2' } expect(response.status).to eq(403) end end
26.6875
65
0.679157
0346d4835bcf657e3ac90691e2303b901036d65e
561
module NilOnInitializationError # https://stackoverflow.com/questions/10692961/inheriting-class-methods-from-modules-mixins-in-ruby def self.included base base.send :include, InstanceMethods base.extend ClassMethods end module InstanceMethods def new_if_valid(args) self.new(args) rescue Biolinkml::InitializationError nil end end module ClassMethods end end module Biolinkml class InitializationError < StandardError #$stderr.puts "a required initialization parameter was not provided" nil end end
20.777778
101
0.752228
d5c35ce356c7fdc9ff15e54220b9a644ec83f433
1,539
class Api::V1::ReadingController < ApplicationController def create thermostat = Thermostat.find_by(household_token: params[:household_token]) params_with_tracking_number = add_tracking_number(params[:household_token], reading_params ) reading = Reading.new(params_with_tracking_number) if reading.valid? Resque.enqueue(ReadingJob, {token: params[:household_token], reading: params_with_tracking_number}) render :json => ReadingSerializer.new(reading).serialized_json else render :json => {:errors => reading.errors.messages } end end def show cache = ActiveSupport::Cache::MemoryStore.new reading = cache.read(params[:household_token]) if reading.blank? reading = Reading.joins(:thermostat).where(thermostats: {household_token: params[:household_token]}, tracking_number: params[:tracking_number]).take() end if reading.present? render json: ReadingSerializer.new(reading).serialized_json else render :json => {:errors => "Reading not found for household_token #{params[:household_token]} and #{params[:transaction_number]}" } end end private def add_tracking_number(token, reading) cache = ActiveSupport::Cache::MemoryStore.new last_number = cache.read(token).try("tracking_number") || 0 reading[:tracking_number] = last_number + 1 cache.write(token, reading) return reading end def reading_params params.require(:reading).permit(:thermostat_id, :temperature, :humidity, :battery_charge) end end
32.0625
156
0.730344
abf8dc977430bb512ee090d4b6bd3fbe4f1366a5
363
class AddUpdatedAtToTodos < ActiveRecord::Migration def self.up add_column :todos, :updated_at, :timestamp execute 'update todos set updated_at = created_at where completed_at IS NULL' execute 'update todos set updated_at = completed_at where NOT (completed_at IS NULL)' end def self.down remove_column :todos, :updated_at end end
33
91
0.741047
6a0fa74cb20f30dc50a7754fc528a93c61154b4d
2,372
# frozen_string_literal: true require 'spec_helper' describe CatarsePagarme::BalanceTransferDelegator do let(:project) { create(:project, state: 'successful') } let(:project_acc) { create(:project_account, project: project) } let(:bank) { create(:bank) } let!(:bank_account) { create(:bank_account, user: project.user)} let(:balance_transfer) { create(:balance_transfer, amount: 10, user: project.user, project: project)} let(:delegator) { balance_transfer.pagarme_delegator } before do allow(CatarsePagarme).to receive(:configuration).and_return(double('fake config', { slip_tax: 2.00, credit_card_tax: 0.01, pagarme_tax: 0.0063, cielo_tax: 0.038, stone_tax: 0.0307, stone_installment_tax: 0.0307, credit_card_cents_fee: 0.39, api_key: '', interest_rate: 0 })) end describe "instance of CatarsePagarme::BalanceTransferDelegator" do it { expect(delegator).to be_a CatarsePagarme::BalanceTransferDelegator} end describe "#value_for_transaction" do subject { delegator.value_for_transaction } it "should convert balance value to pagarme value format" do expect(subject).to eq(1000) end end describe "#transfer_funds" do let(:transfer_mock) { double(create: true, id: "123", foo: false, to_hash: {id: '123'}, to_json: {id: '123'}.to_json) } let(:bank_acc_mock) { double(create: true, id: "1234")} before do allow(PagarMe::BankAccount).to receive(:new).and_return(bank_acc_mock) allow(PagarMe::Transfer).to receive(:new).and_return(transfer_mock) end context "when transfer is not authorized?" do before do allow(balance_transfer).to receive(:authorized?).and_return(false) end it do expect { delegator.transfer_funds }.to raise_error('unable to create transfer, need to be authorized') end end context "when transfer is authorized?" do before do allow(balance_transfer).to receive(:authorized?).and_return(true) allow(balance_transfer).to receive(:transition_to).and_return(true) expect(balance_transfer).to receive(:transition_to).with(:processing, transfer_data: transfer_mock.to_hash) end it do transfer = delegator.transfer_funds expect(transfer.transfer_id).to eq(transfer_mock.id) end end end end
32.944444
123
0.693929
08f18967f678ab3be201d79e06cbbc0e37027bb5
10,829
require 'spec_helper' describe Api::RemoteResource, :type => :model do before :each do @rr = Api::RemoteResource.new("http://example.com/v1/blahs/1") allow(Api).to receive(:service_token).and_return("so-fake") # This is for the basic resource @good_json = {"blah"=>{ "_links"=>{"self"=>{"href"=>"http://example.com/v1/blahs/1", "type"=>"application/json"}, "quux"=>{"href"=>"http://acme.com/v1/quux/1", "type"=>"application/json"}}, "foo" => 123, "bar" => [1,2,3]}} @successful = double success?: true, headers: {"Content-Type"=>"application/json", "ETag"=>"BAAB"}, body: @good_json, status: 200, message: "Success" expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :get, args: nil, :headers=>{}, :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@successful) # This is an updated resource, with a different foo value @updated_json = {"blah"=>{ "_links"=>{"self"=>{"href"=>"http://example.com/v1/blahs/1", "type"=>"application/json"}, "quux"=>{"href"=>"http://acme.com/v1/quux/1", "type"=>"application/json"}}, "foo" => "updated", "bar" => [1,2,3]}} @updated = double success?: true, headers: {"Content-Type"=>"application/json", "ETag"=>"ROFL"}, body: @updated_json, status: 200, message: "Success" # This is for the updated main resource allow(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@updated) # This is for the updated hyperlink @quux = {"quux"=>{ "_links"=>{"self"=>{"href"=>"http://acme.com/v1/quux/1", "type"=>"application/json"} }, "bip" => "lalala", "bop" => true }} @quux_success = double success?: true, headers: {"Content-Type"=>"application/json", "ETag"=>"YMMV"}, body: @quux, status: 200, message: "Success" end describe "#put!" do it "always makes a PUT HTTP request, but only makes an initial GET request if the resource isn't already present" do expect(@rr).to receive(:_retrieve).once.and_call_original expect(@rr).to receive(:_modify).twice @rr.put! @rr.put! end it "allows the body to be set using the :body keyword" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: '{"be":"bop"}', :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@updated) @rr.put!(body: {"be" => "bop"}) end it "defaults :body to {}" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@updated) @rr.put! end it "should convert the body to JSON" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: '{"be":"bop"}', :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@updated) @rr.put!(body: {"be" => "bop"}) end it "updates the resource if a valid resource body of matching type is returned" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@updated) @rr.put! expect(@rr['foo']).to eq "updated" expect(@rr.present?).to eq true end it "updates the etag if a valid resource body of matching type is returned" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@updated) @rr.put! expect(@rr['foo']).to eq "updated" expect(@rr.present?).to eq true expect(@rr.etag).to eq "ROFL" end it "should raise PutError and not update the local resource if the PUT failed" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(double success?: false, status: 404, message: "Not found", :headers=>{}) expect { @rr.put! }.to raise_error Api::RemoteResource::PutFailed, "404 Not found" expect(@rr['foo']).to eq 123 expect(@rr.etag).to eq "BAAB" end it "does quietly not update the local resource if the response body isn't a valid resource" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(double success?: true, status: 200, message: "OK", :headers=>{}, body: {}) @rr.put! expect(@rr['foo']).to eq 123 expect(@rr.etag).to eq "BAAB" end it "does quietly not update the local resource if the resource type is different" do expect(Api).to receive(:request). with("http://example.com/v1/blahs/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(double success?: true, status: 200, message: "OK", :headers=>{}, body: { "moo" => @updated_json['blah']}) @rr.put! expect(@rr['foo']).to eq 123 expect(@rr.etag).to eq "BAAB" end it "should take an optional hyperlink argument" do @rr.put!(:self) end it "should allow the use of symbols or strings as hyperlinks" do expect(@rr.put!("self")).to eq @rr.put!(:self) end it "should raise an exception if the hyperlink can't be found" do expect { @rr.put!("blahonga") }. to raise_error Api::RemoteResource::HyperlinkMissing, "blah has no blahonga hyperlink" end it "should return the new RemoteResource when a hyperlink is specified for PUT" do expect(Api).to receive(:request). with("http://acme.com/v1/quux/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@quux_success) quux = @rr.put!(:quux) expect(quux).to be_a Api::RemoteResource expect(quux).not_to eq @rr expect(quux.present?).to eq true expect(quux.href).to eq "http://acme.com/v1/quux/1" end it "should treat #put!() and #put!(:self) identically" do expect(@rr.put!(:self)).to eq @rr.put! end it "should accept an :args keyword and add it to the path" do expect(Api).to receive(:request). with("http://acme.com/v1/quux/1", :put, :args=>{x: 1, 'y' => 'blah'}, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@quux_success) Api::RemoteResource.new("http://example.com/v1/blahs/1").put!(:quux, args: {x: 1, 'y' => 'blah'}) end end describe "#put" do it "always makes a PUT HTTP request, but only makes an initial GET request if the resource isn't already present" do expect(@rr).to receive(:_retrieve).once.and_call_original expect(@rr).to receive(:_modify).twice @rr.put @rr.put end it "doesn't raise errors if the HTTP PUT operation failed" do allow(@rr).to receive(:_modify).and_raise StandardError expect { @rr.put }.not_to raise_error end it "returns a RemoteResource" do expect(@rr.put).to be_a Api::RemoteResource end it "returns a RemoteResource even if there was an error" do expect(Api).to receive(:request). and_return(double(success?: false, status: 403, message: "Forbidden", headers: {})) rr = Api::RemoteResource.new "http://example.com/v1/blahs/1" expect(rr.put).to be_a Api::RemoteResource end it "should follow hyperlinks, just like #put!" do expect(Api).to receive(:request). with("http://acme.com/v1/quux/1", :put, :args=>nil, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@quux_success) quux = @rr.put!(:quux) expect(quux).to be_a Api::RemoteResource expect(quux).not_to eq @rr expect(quux.present?).to eq true expect(quux.href).to eq "http://acme.com/v1/quux/1" end it "should accept an :args keyword and add it to the path" do expect(Api).to receive(:request). with("http://acme.com/v1/quux/1", :put, :args=>{x: 1, 'y' => 'blah'}, :headers=>{}, body: "{}", :credentials=>nil, :x_api_token=>"so-fake", :retries=>3, :backoff_time=>1, :backoff_rate=>0.9, :backoff_max=>30). and_return(@quux_success) Api::RemoteResource.new("http://example.com/v1/blahs/1").put(:quux, args: {x: 1, 'y' => 'blah'}) end end end
42.633858
120
0.54982
339d17659521ae4c30d6fe4cf019ed2617bb11be
819
module RedpenRuby class FormatMessage attr_reader :error_status, :message_list, :redpen_version private :error_status, :message_list def initialize(raw_message, version) @message_list = raw_message.split(/\n/) @redpen_version = version @error_status = get_error_status remove_unneeded_messages end def valid? return true if error_status false end def messages message_list end def version redpen_version end private def get_error_status message_list.each do |msg| return false if msg.match(/ValidationError/) end true end def remove_unneeded_messages message_list.delete_if { |msg| msg.match(/\A\[[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+\.[0-9]+\].*\Z/) } end end end
19.97561
111
0.634921
f76ffb2bd25dc191e21f0964fd158ae1e1229ca2
80
# frozen_string_literal: true JRuby::Util.load_ext("org.jruby.ext.digest.MD5")
20
48
0.775
b9bc2986d43f03e7eacb4cb7874ce4baab38c687
2,785
# frozen_string_literal: true module Hearth module Middleware describe HostPrefix do let(:app) { double('app', call: output) } let(:host_prefix) { 'foo.' } subject do HostPrefix.new( app, disable_host_prefix: disable_host_prefix, host_prefix: host_prefix ) end describe '#call' do let(:struct) { Struct.new(:foo, keyword_init: true) } let(:input) { struct.new } let(:output) { double('output') } let(:url) { 'https://example.com' } let(:request) { Hearth::HTTP::Request.new(url: url) } let(:response) { double('response') } let(:context) do Context.new( request: request, response: response ) end context 'disable_host_prefix is false' do let(:disable_host_prefix) { false } it 'prefixes the host then calls the next middleware' do expect(request).to receive(:prefix_host) .with(host_prefix).ordered.and_call_original expect(app).to receive(:call).with(input, context).ordered resp = subject.call(input, context) expect(request.url).to eq('https://foo.example.com') expect(resp).to be output end context 'host prefix has labels' do let(:host_prefix) { '{foo}.' } let(:input) { struct.new(foo: 'bar') } it 'populates the label with input' do expect(app).to receive(:call).with(input, context) resp = subject.call(input, context) expect(request.url).to eq('https://bar.example.com') expect(resp).to be output end context 'input does not have the label' do let(:input) { struct.new } it 'raises an ArgumentError' do expect do subject.call(input, context) end.to raise_error(ArgumentError) end end context 'input has an empty label' do let(:input) { struct.new(foo: '') } it 'raises an ArgumentError' do expect do subject.call(input, context) end.to raise_error(ArgumentError) end end end end context 'disable_host_prefix is true' do let(:disable_host_prefix) { true } it 'does not prefix the host and calls the next middleware' do expect(app).to receive(:call).with(input, context) resp = subject.call(input, context) expect(request.url).to eq(url) expect(resp).to be output end end end end end end
29.62766
72
0.533932
f7710fa1cc5e67b56674c481a5c5fa754651f4be
270,295
# frozen_string_literal: true # WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws::AutoScaling module Types # The request failed because an active instance refresh for the # specified Auto Scaling group was not found. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ActiveInstanceRefreshNotFoundFault AWS API Documentation # class ActiveInstanceRefreshNotFoundFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] activities # The scaling activities. Activities are sorted by start time. # Activities still in progress are described first. # @return [Array<Types::Activity>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ActivitiesType AWS API Documentation # class ActivitiesType < Struct.new( :activities, :next_token) SENSITIVE = [] include Aws::Structure end # Describes scaling activity, which is a long-running process that # represents a change to your Auto Scaling group, such as changing its # size or replacing an instance. # # @!attribute [rw] activity_id # The ID of the activity. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] description # A friendly, more verbose description of the activity. # @return [String] # # @!attribute [rw] cause # The reason the activity began. # @return [String] # # @!attribute [rw] start_time # The start time of the activity. # @return [Time] # # @!attribute [rw] end_time # The end time of the activity. # @return [Time] # # @!attribute [rw] status_code # The current status of the activity. # @return [String] # # @!attribute [rw] status_message # A friendly, more verbose description of the activity status. # @return [String] # # @!attribute [rw] progress # A value between 0 and 100 that indicates the progress of the # activity. # @return [Integer] # # @!attribute [rw] details # The details about the activity. # @return [String] # # @!attribute [rw] auto_scaling_group_state # The state of the Auto Scaling group, which is either `InService` or # `Deleted`. # @return [String] # # @!attribute [rw] auto_scaling_group_arn # The Amazon Resource Name (ARN) of the Auto Scaling group. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/Activity AWS API Documentation # class Activity < Struct.new( :activity_id, :auto_scaling_group_name, :description, :cause, :start_time, :end_time, :status_code, :status_message, :progress, :details, :auto_scaling_group_state, :auto_scaling_group_arn) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] activity # A scaling activity. # @return [Types::Activity] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ActivityType AWS API Documentation # class ActivityType < Struct.new( :activity) SENSITIVE = [] include Aws::Structure end # Describes a policy adjustment type. # # @!attribute [rw] adjustment_type # The policy adjustment type. The valid values are `ChangeInCapacity`, # `ExactCapacity`, and `PercentChangeInCapacity`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AdjustmentType AWS API Documentation # class AdjustmentType < Struct.new( :adjustment_type) SENSITIVE = [] include Aws::Structure end # Describes an alarm. # # @!attribute [rw] alarm_name # The name of the alarm. # @return [String] # # @!attribute [rw] alarm_arn # The Amazon Resource Name (ARN) of the alarm. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/Alarm AWS API Documentation # class Alarm < Struct.new( :alarm_name, :alarm_arn) SENSITIVE = [] include Aws::Structure end # You already have an Auto Scaling group or launch configuration with # this name. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AlreadyExistsFault AWS API Documentation # class AlreadyExistsFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass AttachInstancesQuery # data as a hash: # # { # instance_ids: ["XmlStringMaxLen19"], # auto_scaling_group_name: "XmlStringMaxLen255", # required # } # # @!attribute [rw] instance_ids # The IDs of the instances. You can specify up to 20 instances. # @return [Array<String>] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachInstancesQuery AWS API Documentation # class AttachInstancesQuery < Struct.new( :instance_ids, :auto_scaling_group_name) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroupsResultType AWS API Documentation # class AttachLoadBalancerTargetGroupsResultType < Aws::EmptyStructure; end # @note When making an API call, you may pass AttachLoadBalancerTargetGroupsType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # target_group_arns: ["XmlStringMaxLen511"], # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] target_group_arns # The Amazon Resource Names (ARN) of the target groups. You can # specify up to 10 target groups. To get the ARN of a target group, # use the Elastic Load Balancing [DescribeTargetGroups][1] API # operation. # # # # [1]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroupsType AWS API Documentation # class AttachLoadBalancerTargetGroupsType < Struct.new( :auto_scaling_group_name, :target_group_arns) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancersResultType AWS API Documentation # class AttachLoadBalancersResultType < Aws::EmptyStructure; end # @note When making an API call, you may pass AttachLoadBalancersType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # load_balancer_names: ["XmlStringMaxLen255"], # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] load_balancer_names # The names of the load balancers. You can specify up to 10 load # balancers. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancersType AWS API Documentation # class AttachLoadBalancersType < Struct.new( :auto_scaling_group_name, :load_balancer_names) SENSITIVE = [] include Aws::Structure end # Describes an Auto Scaling group. # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] auto_scaling_group_arn # The Amazon Resource Name (ARN) of the Auto Scaling group. # @return [String] # # @!attribute [rw] launch_configuration_name # The name of the associated launch configuration. # @return [String] # # @!attribute [rw] launch_template # The launch template for the group. # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] mixed_instances_policy # The mixed instances policy for the group. # @return [Types::MixedInstancesPolicy] # # @!attribute [rw] min_size # The minimum size of the group. # @return [Integer] # # @!attribute [rw] max_size # The maximum size of the group. # @return [Integer] # # @!attribute [rw] desired_capacity # The desired size of the group. # @return [Integer] # # @!attribute [rw] predicted_capacity # The predicted capacity of the group when it has a predictive scaling # policy. # @return [Integer] # # @!attribute [rw] default_cooldown # The duration of the default cooldown period, in seconds. # @return [Integer] # # @!attribute [rw] availability_zones # One or more Availability Zones for the group. # @return [Array<String>] # # @!attribute [rw] load_balancer_names # One or more load balancers associated with the group. # @return [Array<String>] # # @!attribute [rw] target_group_arns # The Amazon Resource Names (ARN) of the target groups for your load # balancer. # @return [Array<String>] # # @!attribute [rw] health_check_type # The service to use for the health checks. The valid values are `EC2` # and `ELB`. If you configure an Auto Scaling group to use `ELB` # health checks, it considers the instance unhealthy if it fails # either the EC2 status checks or the load balancer health checks. # @return [String] # # @!attribute [rw] health_check_grace_period # The amount of time, in seconds, that Amazon EC2 Auto Scaling waits # before checking the health status of an EC2 instance that has come # into service. # @return [Integer] # # @!attribute [rw] instances # The EC2 instances associated with the group. # @return [Array<Types::Instance>] # # @!attribute [rw] created_time # The date and time the group was created. # @return [Time] # # @!attribute [rw] suspended_processes # The suspended processes associated with the group. # @return [Array<Types::SuspendedProcess>] # # @!attribute [rw] placement_group # The name of the placement group into which to launch your instances, # if any. # @return [String] # # @!attribute [rw] vpc_zone_identifier # One or more subnet IDs, if applicable, separated by commas. # @return [String] # # @!attribute [rw] enabled_metrics # The metrics enabled for the group. # @return [Array<Types::EnabledMetric>] # # @!attribute [rw] status # The current state of the group when the DeleteAutoScalingGroup # operation is in progress. # @return [String] # # @!attribute [rw] tags # The tags for the group. # @return [Array<Types::TagDescription>] # # @!attribute [rw] termination_policies # The termination policies for the group. # @return [Array<String>] # # @!attribute [rw] new_instances_protected_from_scale_in # Indicates whether newly launched instances are protected from # termination by Amazon EC2 Auto Scaling when scaling in. # @return [Boolean] # # @!attribute [rw] service_linked_role_arn # The Amazon Resource Name (ARN) of the service-linked role that the # Auto Scaling group uses to call other Amazon Web Services on your # behalf. # @return [String] # # @!attribute [rw] max_instance_lifetime # The maximum amount of time, in seconds, that an instance can be in # service. # # Valid Range: Minimum value of 0. # @return [Integer] # # @!attribute [rw] capacity_rebalance # Indicates whether Capacity Rebalancing is enabled. # @return [Boolean] # # @!attribute [rw] warm_pool_configuration # The warm pool for the group. # @return [Types::WarmPoolConfiguration] # # @!attribute [rw] warm_pool_size # The current size of the warm pool. # @return [Integer] # # @!attribute [rw] context # Reserved. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AutoScalingGroup AWS API Documentation # class AutoScalingGroup < Struct.new( :auto_scaling_group_name, :auto_scaling_group_arn, :launch_configuration_name, :launch_template, :mixed_instances_policy, :min_size, :max_size, :desired_capacity, :predicted_capacity, :default_cooldown, :availability_zones, :load_balancer_names, :target_group_arns, :health_check_type, :health_check_grace_period, :instances, :created_time, :suspended_processes, :placement_group, :vpc_zone_identifier, :enabled_metrics, :status, :tags, :termination_policies, :new_instances_protected_from_scale_in, :service_linked_role_arn, :max_instance_lifetime, :capacity_rebalance, :warm_pool_configuration, :warm_pool_size, :context) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass AutoScalingGroupNamesType # data as a hash: # # { # auto_scaling_group_names: ["XmlStringMaxLen255"], # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_names # The names of the Auto Scaling groups. By default, you can only # specify up to 50 names. You can optionally increase this limit using # the `MaxRecords` parameter. # # If you omit this parameter, all Auto Scaling groups are described. # @return [Array<String>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AutoScalingGroupNamesType AWS API Documentation # class AutoScalingGroupNamesType < Struct.new( :auto_scaling_group_names, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] auto_scaling_groups # The groups. # @return [Array<Types::AutoScalingGroup>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AutoScalingGroupsType AWS API Documentation # class AutoScalingGroupsType < Struct.new( :auto_scaling_groups, :next_token) SENSITIVE = [] include Aws::Structure end # Describes an EC2 instance associated with an Auto Scaling group. # # @!attribute [rw] instance_id # The ID of the instance. # @return [String] # # @!attribute [rw] instance_type # The instance type of the EC2 instance. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group for the instance. # @return [String] # # @!attribute [rw] availability_zone # The Availability Zone for the instance. # @return [String] # # @!attribute [rw] lifecycle_state # The lifecycle state for the instance. The `Quarantined` state is not # used. For information about lifecycle states, see [Instance # lifecycle][1] in the *Amazon EC2 Auto Scaling User Guide*. # # Valid Values: `Pending` \| `Pending:Wait` \| `Pending:Proceed` \| # `Quarantined` \| `InService` \| `Terminating` \| `Terminating:Wait` # \| `Terminating:Proceed` \| `Terminated` \| `Detaching` \| # `Detached` \| `EnteringStandby` \| `Standby` \| `Warmed:Pending` \| # `Warmed:Pending:Wait` \| `Warmed:Pending:Proceed` \| # `Warmed:Terminating` \| `Warmed:Terminating:Wait` \| # `Warmed:Terminating:Proceed` \| `Warmed:Terminated` \| # `Warmed:Stopped` \| `Warmed:Running` # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html # @return [String] # # @!attribute [rw] health_status # The last reported health status of this instance. "Healthy" means # that the instance is healthy and should remain in service. # "Unhealthy" means that the instance is unhealthy and Amazon EC2 # Auto Scaling should terminate and replace it. # @return [String] # # @!attribute [rw] launch_configuration_name # The launch configuration used to launch the instance. This value is # not available if you attached the instance to the Auto Scaling # group. # @return [String] # # @!attribute [rw] launch_template # The launch template for the instance. # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] protected_from_scale_in # Indicates whether the instance is protected from termination by # Amazon EC2 Auto Scaling when scaling in. # @return [Boolean] # # @!attribute [rw] weighted_capacity # The number of capacity units contributed by the instance based on # its instance type. # # Valid Range: Minimum value of 1. Maximum value of 999. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AutoScalingInstanceDetails AWS API Documentation # class AutoScalingInstanceDetails < Struct.new( :instance_id, :instance_type, :auto_scaling_group_name, :availability_zone, :lifecycle_state, :health_status, :launch_configuration_name, :launch_template, :protected_from_scale_in, :weighted_capacity) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] auto_scaling_instances # The instances. # @return [Array<Types::AutoScalingInstanceDetails>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AutoScalingInstancesType AWS API Documentation # class AutoScalingInstancesType < Struct.new( :auto_scaling_instances, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] failed_scheduled_actions # The names of the scheduled actions that could not be deleted, # including an error message. # @return [Array<Types::FailedScheduledUpdateGroupActionRequest>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchDeleteScheduledActionAnswer AWS API Documentation # class BatchDeleteScheduledActionAnswer < Struct.new( :failed_scheduled_actions) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass BatchDeleteScheduledActionType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # scheduled_action_names: ["XmlStringMaxLen255"], # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scheduled_action_names # The names of the scheduled actions to delete. The maximum number # allowed is 50. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchDeleteScheduledActionType AWS API Documentation # class BatchDeleteScheduledActionType < Struct.new( :auto_scaling_group_name, :scheduled_action_names) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] failed_scheduled_update_group_actions # The names of the scheduled actions that could not be created or # updated, including an error message. # @return [Array<Types::FailedScheduledUpdateGroupActionRequest>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchPutScheduledUpdateGroupActionAnswer AWS API Documentation # class BatchPutScheduledUpdateGroupActionAnswer < Struct.new( :failed_scheduled_update_group_actions) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass BatchPutScheduledUpdateGroupActionType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # scheduled_update_group_actions: [ # required # { # scheduled_action_name: "XmlStringMaxLen255", # required # start_time: Time.now, # end_time: Time.now, # recurrence: "XmlStringMaxLen255", # min_size: 1, # max_size: 1, # desired_capacity: 1, # time_zone: "XmlStringMaxLen255", # }, # ], # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scheduled_update_group_actions # One or more scheduled actions. The maximum number allowed is 50. # @return [Array<Types::ScheduledUpdateGroupActionRequest>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BatchPutScheduledUpdateGroupActionType AWS API Documentation # class BatchPutScheduledUpdateGroupActionType < Struct.new( :auto_scaling_group_name, :scheduled_update_group_actions) SENSITIVE = [] include Aws::Structure end # Describes a block device mapping. # # @note When making an API call, you may pass BlockDeviceMapping # data as a hash: # # { # virtual_name: "XmlStringMaxLen255", # device_name: "XmlStringMaxLen255", # required # ebs: { # snapshot_id: "XmlStringMaxLen255", # volume_size: 1, # volume_type: "BlockDeviceEbsVolumeType", # delete_on_termination: false, # iops: 1, # encrypted: false, # throughput: 1, # }, # no_device: false, # } # # @!attribute [rw] virtual_name # The name of the virtual device (for example, `ephemeral0`). # # You can specify either `VirtualName` or `Ebs`, but not both. # @return [String] # # @!attribute [rw] device_name # The device name exposed to the EC2 instance (for example, `/dev/sdh` # or `xvdh`). For more information, see [Device Naming on Linux # Instances][1] in the *Amazon EC2 User Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html # @return [String] # # @!attribute [rw] ebs # Parameters used to automatically set up EBS volumes when an instance # is launched. # # You can specify either `VirtualName` or `Ebs`, but not both. # @return [Types::Ebs] # # @!attribute [rw] no_device # Setting this value to `true` suppresses the specified device # included in the block device mapping of the AMI. # # If `NoDevice` is `true` for the root device, instances might fail # the EC2 health check. In that case, Amazon EC2 Auto Scaling launches # replacement instances. # # If you specify `NoDevice`, you cannot specify `Ebs`. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/BlockDeviceMapping AWS API Documentation # class BlockDeviceMapping < Struct.new( :virtual_name, :device_name, :ebs, :no_device) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] instance_refresh_id # The instance refresh ID. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefreshAnswer AWS API Documentation # class CancelInstanceRefreshAnswer < Struct.new( :instance_refresh_id) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CancelInstanceRefreshType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CancelInstanceRefreshType AWS API Documentation # class CancelInstanceRefreshType < Struct.new( :auto_scaling_group_name) SENSITIVE = [] include Aws::Structure end # A `GetPredictiveScalingForecast` call returns the capacity forecast # for a predictive scaling policy. This structure includes the data # points for that capacity forecast, along with the timestamps of those # data points. # # @!attribute [rw] timestamps # The time stamps for the data points, in UTC format. # @return [Array<Time>] # # @!attribute [rw] values # The values of the data points. # @return [Array<Float>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CapacityForecast AWS API Documentation # class CapacityForecast < Struct.new( :timestamps, :values) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleActionAnswer AWS API Documentation # class CompleteLifecycleActionAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass CompleteLifecycleActionType # data as a hash: # # { # lifecycle_hook_name: "AsciiStringMaxLen255", # required # auto_scaling_group_name: "ResourceName", # required # lifecycle_action_token: "LifecycleActionToken", # lifecycle_action_result: "LifecycleActionResult", # required # instance_id: "XmlStringMaxLen19", # } # # @!attribute [rw] lifecycle_hook_name # The name of the lifecycle hook. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] lifecycle_action_token # A universally unique identifier (UUID) that identifies a specific # lifecycle action associated with an instance. Amazon EC2 Auto # Scaling sends this token to the notification target you specified # when you created the lifecycle hook. # @return [String] # # @!attribute [rw] lifecycle_action_result # The action for the group to take. This parameter can be either # `CONTINUE` or `ABANDON`. # @return [String] # # @!attribute [rw] instance_id # The ID of the instance. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleActionType AWS API Documentation # class CompleteLifecycleActionType < Struct.new( :lifecycle_hook_name, :auto_scaling_group_name, :lifecycle_action_token, :lifecycle_action_result, :instance_id) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateAutoScalingGroupType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # launch_configuration_name: "XmlStringMaxLen255", # launch_template: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # mixed_instances_policy: { # launch_template: { # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # overrides: [ # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # }, # ], # }, # instances_distribution: { # on_demand_allocation_strategy: "XmlString", # on_demand_base_capacity: 1, # on_demand_percentage_above_base_capacity: 1, # spot_allocation_strategy: "XmlString", # spot_instance_pools: 1, # spot_max_price: "MixedInstanceSpotPrice", # }, # }, # instance_id: "XmlStringMaxLen19", # min_size: 1, # required # max_size: 1, # required # desired_capacity: 1, # default_cooldown: 1, # availability_zones: ["XmlStringMaxLen255"], # load_balancer_names: ["XmlStringMaxLen255"], # target_group_arns: ["XmlStringMaxLen511"], # health_check_type: "XmlStringMaxLen32", # health_check_grace_period: 1, # placement_group: "XmlStringMaxLen255", # vpc_zone_identifier: "XmlStringMaxLen2047", # termination_policies: ["XmlStringMaxLen1600"], # new_instances_protected_from_scale_in: false, # capacity_rebalance: false, # lifecycle_hook_specification_list: [ # { # lifecycle_hook_name: "AsciiStringMaxLen255", # required # lifecycle_transition: "LifecycleTransition", # required # notification_metadata: "XmlStringMaxLen1023", # heartbeat_timeout: 1, # default_result: "LifecycleActionResult", # notification_target_arn: "NotificationTargetResourceName", # role_arn: "XmlStringMaxLen255", # }, # ], # tags: [ # { # resource_id: "XmlString", # resource_type: "XmlString", # key: "TagKey", # required # value: "TagValue", # propagate_at_launch: false, # }, # ], # service_linked_role_arn: "ResourceName", # max_instance_lifetime: 1, # context: "Context", # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. This name must be unique per # Region per account. # @return [String] # # @!attribute [rw] launch_configuration_name # The name of the launch configuration to use to launch instances. # # Conditional: You must specify either a launch template # (`LaunchTemplate` or `MixedInstancesPolicy`) or a launch # configuration (`LaunchConfigurationName` or `InstanceId`). # @return [String] # # @!attribute [rw] launch_template # Parameters used to specify the launch template and version to use to # launch instances. # # Conditional: You must specify either a launch template # (`LaunchTemplate` or `MixedInstancesPolicy`) or a launch # configuration (`LaunchConfigurationName` or `InstanceId`). # # <note markdown="1"> The launch template that is specified must be configured for use # with an Auto Scaling group. For more information, see [Creating a # launch template for an Auto Scaling group][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # </note> # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] mixed_instances_policy # An embedded object that specifies a mixed instances policy. The # required properties must be specified. If optional properties are # unspecified, their default values are used. # # The policy includes properties that not only define the distribution # of On-Demand Instances and Spot Instances, the maximum price to pay # for Spot Instances, and how the Auto Scaling group allocates # instance types to fulfill On-Demand and Spot capacities, but also # the properties that specify the instance configuration # information—the launch template and instance types. The policy can # also include a weight for each instance type and different launch # templates for individual instance types. For more information, see # [Auto Scaling groups with multiple instance types and purchase # options][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html # @return [Types::MixedInstancesPolicy] # # @!attribute [rw] instance_id # The ID of the instance used to base the launch configuration on. If # specified, Amazon EC2 Auto Scaling uses the configuration values # from the specified instance to create a new launch configuration. To # get the instance ID, use the Amazon EC2 [DescribeInstances][1] API # operation. For more information, see [Creating an Auto Scaling group # using an EC2 instance][2] in the *Amazon EC2 Auto Scaling User # Guide*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeInstances.html # [2]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-from-instance.html # @return [String] # # @!attribute [rw] min_size # The minimum size of the group. # @return [Integer] # # @!attribute [rw] max_size # The maximum size of the group. # # <note markdown="1"> With a mixed instances policy that uses instance weighting, Amazon # EC2 Auto Scaling may need to go above `MaxSize` to meet your # capacity requirements. In this event, Amazon EC2 Auto Scaling will # never go above `MaxSize` by more than your largest instance weight # (weights that define how many units each instance contributes to the # desired capacity of the group). # # </note> # @return [Integer] # # @!attribute [rw] desired_capacity # The desired capacity is the initial capacity of the Auto Scaling # group at the time of its creation and the capacity it attempts to # maintain. It can scale beyond this capacity if you configure auto # scaling. This number must be greater than or equal to the minimum # size of the group and less than or equal to the maximum size of the # group. If you do not specify a desired capacity, the default is the # minimum size of the group. # @return [Integer] # # @!attribute [rw] default_cooldown # The amount of time, in seconds, after a scaling activity completes # before another scaling activity can start. The default value is # `300`. This setting applies when using simple scaling policies, but # not when using other scaling policies or scheduled scaling. For more # information, see [Scaling cooldowns for Amazon EC2 Auto Scaling][1] # in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html # @return [Integer] # # @!attribute [rw] availability_zones # A list of Availability Zones where instances in the Auto Scaling # group can be created. This parameter is optional if you specify one # or more subnets for `VPCZoneIdentifier`. # # Conditional: If your account supports EC2-Classic and VPC, this # parameter is required to launch instances into EC2-Classic. # @return [Array<String>] # # @!attribute [rw] load_balancer_names # A list of Classic Load Balancers associated with this Auto Scaling # group. For Application Load Balancers, Network Load Balancers, and # Gateway Load Balancers, specify the `TargetGroupARNs` property # instead. # @return [Array<String>] # # @!attribute [rw] target_group_arns # The Amazon Resource Names (ARN) of the target groups to associate # with the Auto Scaling group. Instances are registered as targets in # a target group, and traffic is routed to the target group. For more # information, see [Elastic Load Balancing and Amazon EC2 Auto # Scaling][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html # @return [Array<String>] # # @!attribute [rw] health_check_type # The service to use for the health checks. The valid values are `EC2` # (default) and `ELB`. If you configure an Auto Scaling group to use # load balancer (ELB) health checks, it considers the instance # unhealthy if it fails either the EC2 status checks or the load # balancer health checks. For more information, see [Health checks for # Auto Scaling instances][1] in the *Amazon EC2 Auto Scaling User # Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html # @return [String] # # @!attribute [rw] health_check_grace_period # The amount of time, in seconds, that Amazon EC2 Auto Scaling waits # before checking the health status of an EC2 instance that has come # into service. During this time, any health check failures for the # instance are ignored. The default value is `0`. For more # information, see [Health check grace period][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # Conditional: Required if you are adding an `ELB` health check. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html#health-check-grace-period # @return [Integer] # # @!attribute [rw] placement_group # The name of an existing placement group into which to launch your # instances, if any. A placement group is a logical grouping of # instances within a single Availability Zone. You cannot specify # multiple Availability Zones and a placement group. For more # information, see [Placement Groups][1] in the *Amazon EC2 User Guide # for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html # @return [String] # # @!attribute [rw] vpc_zone_identifier # A comma-separated list of subnet IDs for a virtual private cloud # (VPC) where instances in the Auto Scaling group can be created. If # you specify `VPCZoneIdentifier` with `AvailabilityZones`, the # subnets that you specify for this parameter must reside in those # Availability Zones. # # Conditional: If your account supports EC2-Classic and VPC, this # parameter is required to launch instances into a VPC. # @return [String] # # @!attribute [rw] termination_policies # A policy or a list of policies that are used to select the instance # to terminate. These policies are executed in the order that you list # them. For more information, see [Controlling which Auto Scaling # instances terminate during scale in][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html # @return [Array<String>] # # @!attribute [rw] new_instances_protected_from_scale_in # Indicates whether newly launched instances are protected from # termination by Amazon EC2 Auto Scaling when scaling in. For more # information about preventing instances from terminating on scale in, # see [Instance scale-in protection][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html#instance-protection # @return [Boolean] # # @!attribute [rw] capacity_rebalance # Indicates whether Capacity Rebalancing is enabled. Otherwise, # Capacity Rebalancing is disabled. When you turn on Capacity # Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot # Instance whenever Amazon EC2 notifies that a Spot Instance is at an # elevated risk of interruption. After launching a new instance, it # then terminates an old instance. For more information, see [Amazon # EC2 Auto Scaling Capacity Rebalancing][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/capacity-rebalance.html # @return [Boolean] # # @!attribute [rw] lifecycle_hook_specification_list # One or more lifecycle hooks for the group, which specify actions to # perform when Amazon EC2 Auto Scaling launches or terminates # instances. # @return [Array<Types::LifecycleHookSpecification>] # # @!attribute [rw] tags # One or more tags. You can tag your Auto Scaling group and propagate # the tags to the Amazon EC2 instances it launches. Tags are not # propagated to Amazon EBS volumes. To add tags to Amazon EBS volumes, # specify the tags in a launch template but use caution. If the launch # template specifies an instance tag with a key that is also specified # for the Auto Scaling group, Amazon EC2 Auto Scaling overrides the # value of that instance tag with the value specified by the Auto # Scaling group. For more information, see [Tagging Auto Scaling # groups and instances][1] in the *Amazon EC2 Auto Scaling User # Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html # @return [Array<Types::Tag>] # # @!attribute [rw] service_linked_role_arn # The Amazon Resource Name (ARN) of the service-linked role that the # Auto Scaling group uses to call other Amazon Web Services on your # behalf. By default, Amazon EC2 Auto Scaling uses a service-linked # role named `AWSServiceRoleForAutoScaling`, which it creates if it # does not exist. For more information, see [Service-linked roles][1] # in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html # @return [String] # # @!attribute [rw] max_instance_lifetime # The maximum amount of time, in seconds, that an instance can be in # service. The default is null. If specified, the value must be either # 0 or a number equal to or greater than 86,400 seconds (1 day). For # more information, see [Replacing Auto Scaling instances based on # maximum instance lifetime][1] in the *Amazon EC2 Auto Scaling User # Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html # @return [Integer] # # @!attribute [rw] context # Reserved. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateAutoScalingGroupType AWS API Documentation # class CreateAutoScalingGroupType < Struct.new( :auto_scaling_group_name, :launch_configuration_name, :launch_template, :mixed_instances_policy, :instance_id, :min_size, :max_size, :desired_capacity, :default_cooldown, :availability_zones, :load_balancer_names, :target_group_arns, :health_check_type, :health_check_grace_period, :placement_group, :vpc_zone_identifier, :termination_policies, :new_instances_protected_from_scale_in, :capacity_rebalance, :lifecycle_hook_specification_list, :tags, :service_linked_role_arn, :max_instance_lifetime, :context) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateLaunchConfigurationType # data as a hash: # # { # launch_configuration_name: "XmlStringMaxLen255", # required # image_id: "XmlStringMaxLen255", # key_name: "XmlStringMaxLen255", # security_groups: ["XmlString"], # classic_link_vpc_id: "XmlStringMaxLen255", # classic_link_vpc_security_groups: ["XmlStringMaxLen255"], # user_data: "XmlStringUserData", # instance_id: "XmlStringMaxLen19", # instance_type: "XmlStringMaxLen255", # kernel_id: "XmlStringMaxLen255", # ramdisk_id: "XmlStringMaxLen255", # block_device_mappings: [ # { # virtual_name: "XmlStringMaxLen255", # device_name: "XmlStringMaxLen255", # required # ebs: { # snapshot_id: "XmlStringMaxLen255", # volume_size: 1, # volume_type: "BlockDeviceEbsVolumeType", # delete_on_termination: false, # iops: 1, # encrypted: false, # throughput: 1, # }, # no_device: false, # }, # ], # instance_monitoring: { # enabled: false, # }, # spot_price: "SpotPrice", # iam_instance_profile: "XmlStringMaxLen1600", # ebs_optimized: false, # associate_public_ip_address: false, # placement_tenancy: "XmlStringMaxLen64", # metadata_options: { # http_tokens: "optional", # accepts optional, required # http_put_response_hop_limit: 1, # http_endpoint: "disabled", # accepts disabled, enabled # }, # } # # @!attribute [rw] launch_configuration_name # The name of the launch configuration. This name must be unique per # Region per account. # @return [String] # # @!attribute [rw] image_id # The ID of the Amazon Machine Image (AMI) that was assigned during # registration. For more information, see [Finding an AMI][1] in the # *Amazon EC2 User Guide for Linux Instances*. # # If you do not specify `InstanceId`, you must specify `ImageId`. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html # @return [String] # # @!attribute [rw] key_name # The name of the key pair. For more information, see [Amazon EC2 Key # Pairs][1] in the *Amazon EC2 User Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html # @return [String] # # @!attribute [rw] security_groups # A list that contains the security groups to assign to the instances # in the Auto Scaling group. # # \[EC2-VPC\] Specify the security group IDs. For more information, # see [Security Groups for Your VPC][1] in the *Amazon Virtual Private # Cloud User Guide*. # # \[EC2-Classic\] Specify either the security group names or the # security group IDs. For more information, see [Amazon EC2 Security # Groups][2] in the *Amazon EC2 User Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html # [2]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html # @return [Array<String>] # # @!attribute [rw] classic_link_vpc_id # The ID of a ClassicLink-enabled VPC to link your EC2-Classic # instances to. For more information, see [ClassicLink][1] in the # *Amazon EC2 User Guide for Linux Instances* and [Linking EC2-Classic # instances to a VPC][2] in the *Amazon EC2 Auto Scaling User Guide*. # # This parameter can only be used if you are launching EC2-Classic # instances. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html # [2]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html#as-ClassicLink # @return [String] # # @!attribute [rw] classic_link_vpc_security_groups # The IDs of one or more security groups for the specified # ClassicLink-enabled VPC. For more information, see [ClassicLink][1] # in the *Amazon EC2 User Guide for Linux Instances* and [Linking # EC2-Classic instances to a VPC][2] in the *Amazon EC2 Auto Scaling # User Guide*. # # If you specify the `ClassicLinkVPCId` parameter, you must specify # this parameter. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html # [2]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html#as-ClassicLink # @return [Array<String>] # # @!attribute [rw] user_data # The user data to make available to the launched EC2 instances. For # more information, see [Instance metadata and user data][1] (Linux) # and [Instance metadata and user data][2] (Windows). If you are using # a command line tool, base64-encoding is performed for you, and you # can load the text from a file. Otherwise, you must provide # base64-encoded text. User data is limited to 16 KB. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html # [2]: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html # @return [String] # # @!attribute [rw] instance_id # The ID of the instance to use to create the launch configuration. # The new launch configuration derives attributes from the instance, # except for the block device mapping. # # To create a launch configuration with a block device mapping or # override any other instance attributes, specify them as part of the # same request. # # For more information, see [Creating a launch configuration using an # EC2 instance][1] in the *Amazon EC2 Auto Scaling User Guide*. # # If you do not specify `InstanceId`, you must specify both `ImageId` # and `InstanceType`. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-lc-with-instanceID.html # @return [String] # # @!attribute [rw] instance_type # Specifies the instance type of the EC2 instance. # # For information about available instance types, see [Available # Instance Types][1] in the *Amazon EC2 User Guide for Linux # Instances*. # # If you do not specify `InstanceId`, you must specify `InstanceType`. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes # @return [String] # # @!attribute [rw] kernel_id # The ID of the kernel associated with the AMI. # @return [String] # # @!attribute [rw] ramdisk_id # The ID of the RAM disk to select. # @return [String] # # @!attribute [rw] block_device_mappings # A block device mapping, which specifies the block devices for the # instance. You can specify virtual devices and EBS volumes. For more # information, see [Block Device Mapping][1] in the *Amazon EC2 User # Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html # @return [Array<Types::BlockDeviceMapping>] # # @!attribute [rw] instance_monitoring # Controls whether instances in this group are launched with detailed # (`true`) or basic (`false`) monitoring. # # The default value is `true` (enabled). # # When detailed monitoring is enabled, Amazon CloudWatch generates # metrics every minute and your account is charged a fee. When you # disable detailed monitoring, CloudWatch generates metrics every 5 # minutes. For more information, see [Configure Monitoring for Auto # Scaling Instances][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html # @return [Types::InstanceMonitoring] # # @!attribute [rw] spot_price # The maximum hourly price to be paid for any Spot Instance launched # to fulfill the request. Spot Instances are launched when the price # you specify exceeds the current Spot price. For more information, # see [Requesting Spot Instances][1] in the *Amazon EC2 Auto Scaling # User Guide*. # # <note markdown="1"> When you change your maximum price by creating a new launch # configuration, running instances will continue to run as long as the # maximum price for those running instances is higher than the current # Spot price. # # </note> # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-launch-spot-instances.html # @return [String] # # @!attribute [rw] iam_instance_profile # The name or the Amazon Resource Name (ARN) of the instance profile # associated with the IAM role for the instance. The instance profile # contains the IAM role. # # For more information, see [IAM role for applications that run on # Amazon EC2 instances][1] in the *Amazon EC2 Auto Scaling User # Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html # @return [String] # # @!attribute [rw] ebs_optimized # Specifies whether the launch configuration is optimized for EBS I/O # (`true`) or not (`false`). The optimization provides dedicated # throughput to Amazon EBS and an optimized configuration stack to # provide optimal I/O performance. This optimization is not available # with all instance types. Additional fees are incurred when you # enable EBS optimization for an instance type that is not # EBS-optimized by default. For more information, see [Amazon # EBS-Optimized Instances][1] in the *Amazon EC2 User Guide for Linux # Instances*. # # The default value is `false`. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html # @return [Boolean] # # @!attribute [rw] associate_public_ip_address # For Auto Scaling groups that are running in a virtual private cloud # (VPC), specifies whether to assign a public IP address to the # group's instances. If you specify `true`, each instance in the Auto # Scaling group receives a unique public IP address. For more # information, see [Launching Auto Scaling instances in a VPC][1] in # the *Amazon EC2 Auto Scaling User Guide*. # # If you specify this parameter, you must specify at least one subnet # for `VPCZoneIdentifier` when you create your group. # # <note markdown="1"> If the instance is launched into a default subnet, the default is to # assign a public IP address, unless you disabled the option to assign # a public IP address on the subnet. If the instance is launched into # a nondefault subnet, the default is not to assign a public IP # address, unless you enabled the option to assign a public IP address # on the subnet. # # </note> # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html # @return [Boolean] # # @!attribute [rw] placement_tenancy # The tenancy of the instance. An instance with `dedicated` tenancy # runs on isolated, single-tenant hardware and can only be launched # into a VPC. # # To launch dedicated instances into a shared tenancy VPC (a VPC with # the instance placement tenancy attribute set to `default`), you must # set the value of this parameter to `dedicated`. # # If you specify `PlacementTenancy`, you must specify at least one # subnet for `VPCZoneIdentifier` when you create your group. # # For more information, see [Configuring instance tenancy with Amazon # EC2 Auto Scaling][1] in the *Amazon EC2 Auto Scaling User Guide*. # # Valid Values: `default` \| `dedicated` # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-dedicated-instances.html # @return [String] # # @!attribute [rw] metadata_options # The metadata options for the instances. For more information, see # [Configuring the Instance Metadata Options][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds # @return [Types::InstanceMetadataOptions] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateLaunchConfigurationType AWS API Documentation # class CreateLaunchConfigurationType < Struct.new( :launch_configuration_name, :image_id, :key_name, :security_groups, :classic_link_vpc_id, :classic_link_vpc_security_groups, :user_data, :instance_id, :instance_type, :kernel_id, :ramdisk_id, :block_device_mappings, :instance_monitoring, :spot_price, :iam_instance_profile, :ebs_optimized, :associate_public_ip_address, :placement_tenancy, :metadata_options) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateOrUpdateTagsType # data as a hash: # # { # tags: [ # required # { # resource_id: "XmlString", # resource_type: "XmlString", # key: "TagKey", # required # value: "TagValue", # propagate_at_launch: false, # }, # ], # } # # @!attribute [rw] tags # One or more tags. # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateOrUpdateTagsType AWS API Documentation # class CreateOrUpdateTagsType < Struct.new( :tags) SENSITIVE = [] include Aws::Structure end # Represents a CloudWatch metric of your choosing for a target tracking # scaling policy to use with Amazon EC2 Auto Scaling. # # To create your customized metric specification: # # * Add values for each required parameter from CloudWatch. You can use # an existing metric, or a new metric that you create. To use your own # metric, you must first publish the metric to CloudWatch. For more # information, see [Publish Custom Metrics][1] in the *Amazon # CloudWatch User Guide*. # # * Choose a metric that changes proportionally with capacity. The value # of the metric should increase or decrease in inverse proportion to # the number of capacity units. That is, the value of the metric # should decrease when capacity increases. # # For more information about CloudWatch, see [Amazon CloudWatch # Concepts][2]. # # # # [1]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html # [2]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html # # @note When making an API call, you may pass CustomizedMetricSpecification # data as a hash: # # { # metric_name: "MetricName", # required # namespace: "MetricNamespace", # required # dimensions: [ # { # name: "MetricDimensionName", # required # value: "MetricDimensionValue", # required # }, # ], # statistic: "Average", # required, accepts Average, Minimum, Maximum, SampleCount, Sum # unit: "MetricUnit", # } # # @!attribute [rw] metric_name # The name of the metric. # @return [String] # # @!attribute [rw] namespace # The namespace of the metric. # @return [String] # # @!attribute [rw] dimensions # The dimensions of the metric. # # Conditional: If you published your metric with dimensions, you must # specify the same dimensions in your scaling policy. # @return [Array<Types::MetricDimension>] # # @!attribute [rw] statistic # The statistic of the metric. # @return [String] # # @!attribute [rw] unit # The unit of the metric. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CustomizedMetricSpecification AWS API Documentation # class CustomizedMetricSpecification < Struct.new( :metric_name, :namespace, :dimensions, :statistic, :unit) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteAutoScalingGroupType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # force_delete: false, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] force_delete # Specifies that the group is to be deleted along with all instances # associated with the group, without waiting for all instances to be # terminated. This parameter also deletes any outstanding lifecycle # actions associated with the group. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteAutoScalingGroupType AWS API Documentation # class DeleteAutoScalingGroupType < Struct.new( :auto_scaling_group_name, :force_delete) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLifecycleHookAnswer AWS API Documentation # class DeleteLifecycleHookAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteLifecycleHookType # data as a hash: # # { # lifecycle_hook_name: "AsciiStringMaxLen255", # required # auto_scaling_group_name: "XmlStringMaxLen255", # required # } # # @!attribute [rw] lifecycle_hook_name # The name of the lifecycle hook. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLifecycleHookType AWS API Documentation # class DeleteLifecycleHookType < Struct.new( :lifecycle_hook_name, :auto_scaling_group_name) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteNotificationConfigurationType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # topic_arn: "XmlStringMaxLen255", # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] topic_arn # The Amazon Resource Name (ARN) of the Amazon Simple Notification # Service (Amazon SNS) topic. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteNotificationConfigurationType AWS API Documentation # class DeleteNotificationConfigurationType < Struct.new( :auto_scaling_group_name, :topic_arn) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeletePolicyType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # policy_name: "ResourceName", # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] policy_name # The name or Amazon Resource Name (ARN) of the policy. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeletePolicyType AWS API Documentation # class DeletePolicyType < Struct.new( :auto_scaling_group_name, :policy_name) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteScheduledActionType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # scheduled_action_name: "XmlStringMaxLen255", # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scheduled_action_name # The name of the action to delete. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteScheduledActionType AWS API Documentation # class DeleteScheduledActionType < Struct.new( :auto_scaling_group_name, :scheduled_action_name) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteTagsType # data as a hash: # # { # tags: [ # required # { # resource_id: "XmlString", # resource_type: "XmlString", # key: "TagKey", # required # value: "TagValue", # propagate_at_launch: false, # }, # ], # } # # @!attribute [rw] tags # One or more tags. # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteTagsType AWS API Documentation # class DeleteTagsType < Struct.new( :tags) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteWarmPoolAnswer AWS API Documentation # class DeleteWarmPoolAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteWarmPoolType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # force_delete: false, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] force_delete # Specifies that the warm pool is to be deleted along with all of its # associated instances, without waiting for all instances to be # terminated. This parameter also deletes any outstanding lifecycle # actions associated with the warm pool instances. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteWarmPoolType AWS API Documentation # class DeleteWarmPoolType < Struct.new( :auto_scaling_group_name, :force_delete) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] max_number_of_auto_scaling_groups # The maximum number of groups allowed for your account. The default # is 200 groups per Region. # @return [Integer] # # @!attribute [rw] max_number_of_launch_configurations # The maximum number of launch configurations allowed for your # account. The default is 200 launch configurations per Region. # @return [Integer] # # @!attribute [rw] number_of_auto_scaling_groups # The current number of groups for your account. # @return [Integer] # # @!attribute [rw] number_of_launch_configurations # The current number of launch configurations for your account. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAccountLimitsAnswer AWS API Documentation # class DescribeAccountLimitsAnswer < Struct.new( :max_number_of_auto_scaling_groups, :max_number_of_launch_configurations, :number_of_auto_scaling_groups, :number_of_launch_configurations) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] adjustment_types # The policy adjustment types. # @return [Array<Types::AdjustmentType>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAdjustmentTypesAnswer AWS API Documentation # class DescribeAdjustmentTypesAnswer < Struct.new( :adjustment_types) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeAutoScalingInstancesType # data as a hash: # # { # instance_ids: ["XmlStringMaxLen19"], # max_records: 1, # next_token: "XmlString", # } # # @!attribute [rw] instance_ids # The IDs of the instances. If you omit this parameter, all Auto # Scaling instances are described. If you specify an ID that does not # exist, it is ignored with no error. # # Array Members: Maximum number of 50 items. # @return [Array<String>] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `50`. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingInstancesType AWS API Documentation # class DescribeAutoScalingInstancesType < Struct.new( :instance_ids, :max_records, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] auto_scaling_notification_types # The notification types. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingNotificationTypesAnswer AWS API Documentation # class DescribeAutoScalingNotificationTypesAnswer < Struct.new( :auto_scaling_notification_types) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] instance_refreshes # The instance refreshes for the specified group. # @return [Array<Types::InstanceRefresh>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeInstanceRefreshesAnswer AWS API Documentation # class DescribeInstanceRefreshesAnswer < Struct.new( :instance_refreshes, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeInstanceRefreshesType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # instance_refresh_ids: ["XmlStringMaxLen255"], # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] instance_refresh_ids # One or more instance refresh IDs. # @return [Array<String>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeInstanceRefreshesType AWS API Documentation # class DescribeInstanceRefreshesType < Struct.new( :auto_scaling_group_name, :instance_refresh_ids, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] lifecycle_hook_types # The lifecycle hook types. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHookTypesAnswer AWS API Documentation # class DescribeLifecycleHookTypesAnswer < Struct.new( :lifecycle_hook_types) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] lifecycle_hooks # The lifecycle hooks for the specified group. # @return [Array<Types::LifecycleHook>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHooksAnswer AWS API Documentation # class DescribeLifecycleHooksAnswer < Struct.new( :lifecycle_hooks) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeLifecycleHooksType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # lifecycle_hook_names: ["AsciiStringMaxLen255"], # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] lifecycle_hook_names # The names of one or more lifecycle hooks. If you omit this # parameter, all lifecycle hooks are described. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHooksType AWS API Documentation # class DescribeLifecycleHooksType < Struct.new( :auto_scaling_group_name, :lifecycle_hook_names) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeLoadBalancerTargetGroupsRequest # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `100` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancerTargetGroupsRequest AWS API Documentation # class DescribeLoadBalancerTargetGroupsRequest < Struct.new( :auto_scaling_group_name, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] load_balancer_target_groups # Information about the target groups. # @return [Array<Types::LoadBalancerTargetGroupState>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancerTargetGroupsResponse AWS API Documentation # class DescribeLoadBalancerTargetGroupsResponse < Struct.new( :load_balancer_target_groups, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeLoadBalancersRequest # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `100` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancersRequest AWS API Documentation # class DescribeLoadBalancersRequest < Struct.new( :auto_scaling_group_name, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] load_balancers # The load balancers. # @return [Array<Types::LoadBalancerState>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancersResponse AWS API Documentation # class DescribeLoadBalancersResponse < Struct.new( :load_balancers, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] metrics # One or more metrics. # @return [Array<Types::MetricCollectionType>] # # @!attribute [rw] granularities # The granularities for the metrics. # @return [Array<Types::MetricGranularityType>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeMetricCollectionTypesAnswer AWS API Documentation # class DescribeMetricCollectionTypesAnswer < Struct.new( :metrics, :granularities) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] notification_configurations # The notification configurations. # @return [Array<Types::NotificationConfiguration>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeNotificationConfigurationsAnswer AWS API Documentation # class DescribeNotificationConfigurationsAnswer < Struct.new( :notification_configurations, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeNotificationConfigurationsType # data as a hash: # # { # auto_scaling_group_names: ["XmlStringMaxLen255"], # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_names # The name of the Auto Scaling group. # @return [Array<String>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeNotificationConfigurationsType AWS API Documentation # class DescribeNotificationConfigurationsType < Struct.new( :auto_scaling_group_names, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribePoliciesType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # policy_names: ["ResourceName"], # policy_types: ["XmlStringMaxLen64"], # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] policy_names # The names of one or more policies. If you omit this parameter, all # policies are described. If a group name is provided, the results are # limited to that group. If you specify an unknown policy name, it is # ignored with no error. # # Array Members: Maximum number of 50 items. # @return [Array<String>] # # @!attribute [rw] policy_types # One or more policy types. The valid values are `SimpleScaling`, # `StepScaling`, `TargetTrackingScaling`, and `PredictiveScaling`. # @return [Array<String>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to be returned with each call. The # default value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribePoliciesType AWS API Documentation # class DescribePoliciesType < Struct.new( :auto_scaling_group_name, :policy_names, :policy_types, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeScalingActivitiesType # data as a hash: # # { # activity_ids: ["XmlString"], # auto_scaling_group_name: "XmlStringMaxLen255", # include_deleted_groups: false, # max_records: 1, # next_token: "XmlString", # } # # @!attribute [rw] activity_ids # The activity IDs of the desired scaling activities. If you omit this # parameter, all activities for the past six weeks are described. If # unknown activities are requested, they are ignored with no error. If # you specify an Auto Scaling group, the results are limited to that # group. # # Array Members: Maximum number of 50 IDs. # @return [Array<String>] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] include_deleted_groups # Indicates whether to include scaling activity from deleted Auto # Scaling groups. # @return [Boolean] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `100` and the maximum value is `100`. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScalingActivitiesType AWS API Documentation # class DescribeScalingActivitiesType < Struct.new( :activity_ids, :auto_scaling_group_name, :include_deleted_groups, :max_records, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeScheduledActionsType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # scheduled_action_names: ["XmlStringMaxLen255"], # start_time: Time.now, # end_time: Time.now, # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scheduled_action_names # The names of one or more scheduled actions. If you omit this # parameter, all scheduled actions are described. If you specify an # unknown scheduled action, it is ignored with no error. # # Array Members: Maximum number of 50 actions. # @return [Array<String>] # # @!attribute [rw] start_time # The earliest scheduled start time to return. If scheduled action # names are provided, this parameter is ignored. # @return [Time] # # @!attribute [rw] end_time # The latest scheduled start time to return. If scheduled action names # are provided, this parameter is ignored. # @return [Time] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScheduledActionsType AWS API Documentation # class DescribeScheduledActionsType < Struct.new( :auto_scaling_group_name, :scheduled_action_names, :start_time, :end_time, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeTagsType # data as a hash: # # { # filters: [ # { # name: "XmlString", # values: ["XmlString"], # }, # ], # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] filters # One or more filters to scope the tags to return. The maximum number # of filters per filter type (for example, `auto-scaling-group`) is # 1000. # @return [Array<Types::Filter>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTagsType AWS API Documentation # class DescribeTagsType < Struct.new( :filters, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] termination_policy_types # The termination policies supported by Amazon EC2 Auto Scaling: # `OldestInstance`, `OldestLaunchConfiguration`, `NewestInstance`, # `ClosestToNextInstanceHour`, `Default`, `OldestLaunchTemplate`, and # `AllocationStrategy`. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTerminationPolicyTypesAnswer AWS API Documentation # class DescribeTerminationPolicyTypesAnswer < Struct.new( :termination_policy_types) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] warm_pool_configuration # The warm pool configuration details. # @return [Types::WarmPoolConfiguration] # # @!attribute [rw] instances # The instances that are currently in the warm pool. # @return [Array<Types::Instance>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeWarmPoolAnswer AWS API Documentation # class DescribeWarmPoolAnswer < Struct.new( :warm_pool_configuration, :instances, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DescribeWarmPoolType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # max_records: 1, # next_token: "XmlString", # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] max_records # The maximum number of instances to return with this call. The # maximum value is `50`. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of instances to return. (You received # this token from a previous call.) # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeWarmPoolType AWS API Documentation # class DescribeWarmPoolType < Struct.new( :auto_scaling_group_name, :max_records, :next_token) SENSITIVE = [] include Aws::Structure end # Describes the desired configuration for an instance refresh. # # If you specify a desired configuration, you must specify either a # `LaunchTemplate` or a `MixedInstancesPolicy`. # # @note When making an API call, you may pass DesiredConfiguration # data as a hash: # # { # launch_template: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # mixed_instances_policy: { # launch_template: { # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # overrides: [ # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # }, # ], # }, # instances_distribution: { # on_demand_allocation_strategy: "XmlString", # on_demand_base_capacity: 1, # on_demand_percentage_above_base_capacity: 1, # spot_allocation_strategy: "XmlString", # spot_instance_pools: 1, # spot_max_price: "MixedInstanceSpotPrice", # }, # }, # } # # @!attribute [rw] launch_template # Describes the launch template and the version of the launch template # that Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. # For more information about launch templates, see [Launch # templates][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] mixed_instances_policy # Describes a mixed instances policy. A mixed instances policy # contains the instance types Amazon EC2 Auto Scaling can launch, and # other information Amazon EC2 Auto Scaling can use to launch # instances to help you optimize your costs. For more information, see # [Auto Scaling groups with multiple instance types and purchase # options][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html # @return [Types::MixedInstancesPolicy] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DesiredConfiguration AWS API Documentation # class DesiredConfiguration < Struct.new( :launch_template, :mixed_instances_policy) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] activities # The activities related to detaching the instances from the Auto # Scaling group. # @return [Array<Types::Activity>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachInstancesAnswer AWS API Documentation # class DetachInstancesAnswer < Struct.new( :activities) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DetachInstancesQuery # data as a hash: # # { # instance_ids: ["XmlStringMaxLen19"], # auto_scaling_group_name: "XmlStringMaxLen255", # required # should_decrement_desired_capacity: false, # required # } # # @!attribute [rw] instance_ids # The IDs of the instances. You can specify up to 20 instances. # @return [Array<String>] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] should_decrement_desired_capacity # Indicates whether the Auto Scaling group decrements the desired # capacity value by the number of instances detached. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachInstancesQuery AWS API Documentation # class DetachInstancesQuery < Struct.new( :instance_ids, :auto_scaling_group_name, :should_decrement_desired_capacity) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancerTargetGroupsResultType AWS API Documentation # class DetachLoadBalancerTargetGroupsResultType < Aws::EmptyStructure; end # @note When making an API call, you may pass DetachLoadBalancerTargetGroupsType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # target_group_arns: ["XmlStringMaxLen511"], # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] target_group_arns # The Amazon Resource Names (ARN) of the target groups. You can # specify up to 10 target groups. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancerTargetGroupsType AWS API Documentation # class DetachLoadBalancerTargetGroupsType < Struct.new( :auto_scaling_group_name, :target_group_arns) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancersResultType AWS API Documentation # class DetachLoadBalancersResultType < Aws::EmptyStructure; end # @note When making an API call, you may pass DetachLoadBalancersType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # load_balancer_names: ["XmlStringMaxLen255"], # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] load_balancer_names # The names of the load balancers. You can specify up to 10 load # balancers. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancersType AWS API Documentation # class DetachLoadBalancersType < Struct.new( :auto_scaling_group_name, :load_balancer_names) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DisableMetricsCollectionQuery # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # metrics: ["XmlStringMaxLen255"], # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] metrics # Specifies one or more of the following metrics: # # * `GroupMinSize` # # * `GroupMaxSize` # # * `GroupDesiredCapacity` # # * `GroupInServiceInstances` # # * `GroupPendingInstances` # # * `GroupStandbyInstances` # # * `GroupTerminatingInstances` # # * `GroupTotalInstances` # # * `GroupInServiceCapacity` # # * `GroupPendingCapacity` # # * `GroupStandbyCapacity` # # * `GroupTerminatingCapacity` # # * `GroupTotalCapacity` # # * `WarmPoolDesiredCapacity` # # * `WarmPoolWarmedCapacity` # # * `WarmPoolPendingCapacity` # # * `WarmPoolTerminatingCapacity` # # * `WarmPoolTotalCapacity` # # * `GroupAndWarmPoolDesiredCapacity` # # * `GroupAndWarmPoolTotalCapacity` # # If you omit this parameter, all metrics are disabled. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DisableMetricsCollectionQuery AWS API Documentation # class DisableMetricsCollectionQuery < Struct.new( :auto_scaling_group_name, :metrics) SENSITIVE = [] include Aws::Structure end # Describes information used to set up an Amazon EBS volume specified in # a block device mapping. # # @note When making an API call, you may pass Ebs # data as a hash: # # { # snapshot_id: "XmlStringMaxLen255", # volume_size: 1, # volume_type: "BlockDeviceEbsVolumeType", # delete_on_termination: false, # iops: 1, # encrypted: false, # throughput: 1, # } # # @!attribute [rw] snapshot_id # The snapshot ID of the volume to use. # # You must specify either a `VolumeSize` or a `SnapshotId`. # @return [String] # # @!attribute [rw] volume_size # The volume size, in GiBs. The following are the supported volumes # sizes for each volume type: # # * `gp2` and `gp3`\: 1-16,384 # # * `io1`\: 4-16,384 # # * `st1` and `sc1`\: 125-16,384 # # * `standard`\: 1-1,024 # # You must specify either a `SnapshotId` or a `VolumeSize`. If you # specify both `SnapshotId` and `VolumeSize`, the volume size must be # equal or greater than the size of the snapshot. # @return [Integer] # # @!attribute [rw] volume_type # The volume type. For more information, see [Amazon EBS Volume # Types][1] in the *Amazon EC2 User Guide for Linux Instances*. # # Valid Values: `standard` \| `io1` \| `gp2` \| `st1` \| `sc1` \| # `gp3` # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html # @return [String] # # @!attribute [rw] delete_on_termination # Indicates whether the volume is deleted on instance termination. For # Amazon EC2 Auto Scaling, the default value is `true`. # @return [Boolean] # # @!attribute [rw] iops # The number of input/output (I/O) operations per second (IOPS) to # provision for the volume. For `gp3` and `io1` volumes, this # represents the number of IOPS that are provisioned for the volume. # For `gp2` volumes, this represents the baseline performance of the # volume and the rate at which the volume accumulates I/O credits for # bursting. # # The following are the supported values for each volume type: # # * `gp3`\: 3,000-16,000 IOPS # # * `io1`\: 100-64,000 IOPS # # For `io1` volumes, we guarantee 64,000 IOPS only for [Instances # built on the Nitro System][1]. Other instance families guarantee # performance up to 32,000 IOPS. # # `Iops` is supported when the volume type is `gp3` or `io1` and # required only when the volume type is `io1`. (Not used with # `standard`, `gp2`, `st1`, or `sc1` volumes.) # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances # @return [Integer] # # @!attribute [rw] encrypted # Specifies whether the volume should be encrypted. Encrypted EBS # volumes can only be attached to instances that support Amazon EBS # encryption. For more information, see [Supported Instance Types][1]. # If your AMI uses encrypted volumes, you can also only launch it on # supported instance types. # # <note markdown="1"> If you are creating a volume from a snapshot, you cannot specify an # encryption value. Volumes that are created from encrypted snapshots # are automatically encrypted, and volumes that are created from # unencrypted snapshots are automatically unencrypted. By default, # encrypted snapshots use the Amazon Web Services managed CMK that is # used for EBS encryption, but you can specify a custom CMK when you # create the snapshot. The ability to encrypt a snapshot during # copying also allows you to apply a new CMK to an already-encrypted # snapshot. Volumes restored from the resulting copy are only # accessible using the new CMK. # # Enabling [encryption by default][2] results in all EBS volumes being # encrypted with the Amazon Web Services managed CMK or a customer # managed CMK, whether or not the snapshot was encrypted. # # </note> # # For more information, see [Using Encryption with EBS-Backed AMIs][3] # in the *Amazon EC2 User Guide for Linux Instances* and [Required CMK # key policy for use with encrypted volumes][4] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances # [2]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default # [3]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIEncryption.html # [4]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/key-policy-requirements-EBS-encryption.html # @return [Boolean] # # @!attribute [rw] throughput # The throughput (MiBps) to provision for a `gp3` volume. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/Ebs AWS API Documentation # class Ebs < Struct.new( :snapshot_id, :volume_size, :volume_type, :delete_on_termination, :iops, :encrypted, :throughput) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass EnableMetricsCollectionQuery # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # metrics: ["XmlStringMaxLen255"], # granularity: "XmlStringMaxLen255", # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] metrics # Specifies which group-level metrics to start collecting. You can # specify one or more of the following metrics: # # * `GroupMinSize` # # * `GroupMaxSize` # # * `GroupDesiredCapacity` # # * `GroupInServiceInstances` # # * `GroupPendingInstances` # # * `GroupStandbyInstances` # # * `GroupTerminatingInstances` # # * `GroupTotalInstances` # # The instance weighting feature supports the following additional # metrics: # # * `GroupInServiceCapacity` # # * `GroupPendingCapacity` # # * `GroupStandbyCapacity` # # * `GroupTerminatingCapacity` # # * `GroupTotalCapacity` # # The warm pools feature supports the following additional metrics: # # * `WarmPoolDesiredCapacity` # # * `WarmPoolWarmedCapacity` # # * `WarmPoolPendingCapacity` # # * `WarmPoolTerminatingCapacity` # # * `WarmPoolTotalCapacity` # # * `GroupAndWarmPoolDesiredCapacity` # # * `GroupAndWarmPoolTotalCapacity` # # If you omit this parameter, all metrics are enabled. # @return [Array<String>] # # @!attribute [rw] granularity # The granularity to associate with the metrics to collect. The only # valid value is `1Minute`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnableMetricsCollectionQuery AWS API Documentation # class EnableMetricsCollectionQuery < Struct.new( :auto_scaling_group_name, :metrics, :granularity) SENSITIVE = [] include Aws::Structure end # Describes an enabled metric. # # @!attribute [rw] metric # One of the following metrics: # # * `GroupMinSize` # # * `GroupMaxSize` # # * `GroupDesiredCapacity` # # * `GroupInServiceInstances` # # * `GroupPendingInstances` # # * `GroupStandbyInstances` # # * `GroupTerminatingInstances` # # * `GroupTotalInstances` # # * `GroupInServiceCapacity` # # * `GroupPendingCapacity` # # * `GroupStandbyCapacity` # # * `GroupTerminatingCapacity` # # * `GroupTotalCapacity` # # * `WarmPoolDesiredCapacity` # # * `WarmPoolWarmedCapacity` # # * `WarmPoolPendingCapacity` # # * `WarmPoolTerminatingCapacity` # # * `WarmPoolTotalCapacity` # # * `GroupAndWarmPoolDesiredCapacity` # # * `GroupAndWarmPoolTotalCapacity` # @return [String] # # @!attribute [rw] granularity # The granularity of the metric. The only valid value is `1Minute`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnabledMetric AWS API Documentation # class EnabledMetric < Struct.new( :metric, :granularity) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] activities # The activities related to moving instances into `Standby` mode. # @return [Array<Types::Activity>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnterStandbyAnswer AWS API Documentation # class EnterStandbyAnswer < Struct.new( :activities) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass EnterStandbyQuery # data as a hash: # # { # instance_ids: ["XmlStringMaxLen19"], # auto_scaling_group_name: "XmlStringMaxLen255", # required # should_decrement_desired_capacity: false, # required # } # # @!attribute [rw] instance_ids # The IDs of the instances. You can specify up to 20 instances. # @return [Array<String>] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] should_decrement_desired_capacity # Indicates whether to decrement the desired capacity of the Auto # Scaling group by the number of instances moved to `Standby` mode. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnterStandbyQuery AWS API Documentation # class EnterStandbyQuery < Struct.new( :instance_ids, :auto_scaling_group_name, :should_decrement_desired_capacity) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ExecutePolicyType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # policy_name: "ResourceName", # required # honor_cooldown: false, # metric_value: 1.0, # breach_threshold: 1.0, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] policy_name # The name or ARN of the policy. # @return [String] # # @!attribute [rw] honor_cooldown # Indicates whether Amazon EC2 Auto Scaling waits for the cooldown # period to complete before executing the policy. # # Valid only if the policy type is `SimpleScaling`. For more # information, see [Scaling cooldowns for Amazon EC2 Auto Scaling][1] # in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html # @return [Boolean] # # @!attribute [rw] metric_value # The metric value to compare to `BreachThreshold`. This enables you # to execute a policy of type `StepScaling` and determine which step # adjustment to use. For example, if the breach threshold is 50 and # you want to use a step adjustment with a lower bound of 0 and an # upper bound of 10, you can set the metric value to 59. # # If you specify a metric value that doesn't correspond to a step # adjustment for the policy, the call returns an error. # # Required if the policy type is `StepScaling` and not supported # otherwise. # @return [Float] # # @!attribute [rw] breach_threshold # The breach threshold for the alarm. # # Required if the policy type is `StepScaling` and not supported # otherwise. # @return [Float] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExecutePolicyType AWS API Documentation # class ExecutePolicyType < Struct.new( :auto_scaling_group_name, :policy_name, :honor_cooldown, :metric_value, :breach_threshold) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] activities # The activities related to moving instances out of `Standby` mode. # @return [Array<Types::Activity>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExitStandbyAnswer AWS API Documentation # class ExitStandbyAnswer < Struct.new( :activities) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ExitStandbyQuery # data as a hash: # # { # instance_ids: ["XmlStringMaxLen19"], # auto_scaling_group_name: "XmlStringMaxLen255", # required # } # # @!attribute [rw] instance_ids # The IDs of the instances. You can specify up to 20 instances. # @return [Array<String>] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExitStandbyQuery AWS API Documentation # class ExitStandbyQuery < Struct.new( :instance_ids, :auto_scaling_group_name) SENSITIVE = [] include Aws::Structure end # Describes a scheduled action that could not be created, updated, or # deleted. # # @!attribute [rw] scheduled_action_name # The name of the scheduled action. # @return [String] # # @!attribute [rw] error_code # The error code. # @return [String] # # @!attribute [rw] error_message # The error message accompanying the error code. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/FailedScheduledUpdateGroupActionRequest AWS API Documentation # class FailedScheduledUpdateGroupActionRequest < Struct.new( :scheduled_action_name, :error_code, :error_message) SENSITIVE = [] include Aws::Structure end # Describes a filter that is used to return a more specific list of # results when describing tags. # # For more information, see [Tagging Auto Scaling groups and # instances][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html # # @note When making an API call, you may pass Filter # data as a hash: # # { # name: "XmlString", # values: ["XmlString"], # } # # @!attribute [rw] name # The name of the filter. The valid values are: `auto-scaling-group`, # `key`, `value`, and `propagate-at-launch`. # @return [String] # # @!attribute [rw] values # One or more filter values. Filter values are case-sensitive. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/Filter AWS API Documentation # class Filter < Struct.new( :name, :values) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] load_forecast # The load forecast. # @return [Array<Types::LoadForecast>] # # @!attribute [rw] capacity_forecast # The capacity forecast. # @return [Types::CapacityForecast] # # @!attribute [rw] update_time # The time the forecast was made. # @return [Time] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/GetPredictiveScalingForecastAnswer AWS API Documentation # class GetPredictiveScalingForecastAnswer < Struct.new( :load_forecast, :capacity_forecast, :update_time) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetPredictiveScalingForecastType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # policy_name: "XmlStringMaxLen255", # required # start_time: Time.now, # required # end_time: Time.now, # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] policy_name # The name of the policy. # @return [String] # # @!attribute [rw] start_time # The inclusive start time of the time range for the forecast data to # get. At most, the date and time can be one year before the current # date and time. # @return [Time] # # @!attribute [rw] end_time # The exclusive end time of the time range for the forecast data to # get. The maximum time duration between the start and end time is 30 # days. # # Although this parameter can accept a date and time that is more than # two days in the future, the availability of forecast data has # limits. Amazon EC2 Auto Scaling only issues forecasts for periods of # two days in advance. # @return [Time] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/GetPredictiveScalingForecastType AWS API Documentation # class GetPredictiveScalingForecastType < Struct.new( :auto_scaling_group_name, :policy_name, :start_time, :end_time) SENSITIVE = [] include Aws::Structure end # Describes an EC2 instance. # # @!attribute [rw] instance_id # The ID of the instance. # @return [String] # # @!attribute [rw] instance_type # The instance type of the EC2 instance. # @return [String] # # @!attribute [rw] availability_zone # The Availability Zone in which the instance is running. # @return [String] # # @!attribute [rw] lifecycle_state # A description of the current lifecycle state. The `Quarantined` # state is not used. For information about lifecycle states, see # [Instance lifecycle][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroupLifecycle.html # @return [String] # # @!attribute [rw] health_status # The last reported health status of the instance. "Healthy" means # that the instance is healthy and should remain in service. # "Unhealthy" means that the instance is unhealthy and that Amazon # EC2 Auto Scaling should terminate and replace it. # @return [String] # # @!attribute [rw] launch_configuration_name # The launch configuration associated with the instance. # @return [String] # # @!attribute [rw] launch_template # The launch template for the instance. # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] protected_from_scale_in # Indicates whether the instance is protected from termination by # Amazon EC2 Auto Scaling when scaling in. # @return [Boolean] # # @!attribute [rw] weighted_capacity # The number of capacity units contributed by the instance based on # its instance type. # # Valid Range: Minimum value of 1. Maximum value of 999. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/Instance AWS API Documentation # class Instance < Struct.new( :instance_id, :instance_type, :availability_zone, :lifecycle_state, :health_status, :launch_configuration_name, :launch_template, :protected_from_scale_in, :weighted_capacity) SENSITIVE = [] include Aws::Structure end # The metadata options for the instances. For more information, see # [Configuring the Instance Metadata Options][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds # # @note When making an API call, you may pass InstanceMetadataOptions # data as a hash: # # { # http_tokens: "optional", # accepts optional, required # http_put_response_hop_limit: 1, # http_endpoint: "disabled", # accepts disabled, enabled # } # # @!attribute [rw] http_tokens # The state of token usage for your instance metadata requests. If the # parameter is not specified in the request, the default state is # `optional`. # # If the state is `optional`, you can choose to retrieve instance # metadata with or without a signed token header on your request. If # you retrieve the IAM role credentials without a token, the version # 1.0 role credentials are returned. If you retrieve the IAM role # credentials using a valid signed token, the version 2.0 role # credentials are returned. # # If the state is `required`, you must send a signed token header with # any instance metadata retrieval requests. In this state, retrieving # the IAM role credentials always returns the version 2.0 credentials; # the version 1.0 credentials are not available. # @return [String] # # @!attribute [rw] http_put_response_hop_limit # The desired HTTP PUT response hop limit for instance metadata # requests. The larger the number, the further instance metadata # requests can travel. # # Default: 1 # @return [Integer] # # @!attribute [rw] http_endpoint # This parameter enables or disables the HTTP metadata endpoint on # your instances. If the parameter is not specified, the default state # is `enabled`. # # <note markdown="1"> If you specify a value of `disabled`, you will not be able to access # your instance metadata. # # </note> # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceMetadataOptions AWS API Documentation # class InstanceMetadataOptions < Struct.new( :http_tokens, :http_put_response_hop_limit, :http_endpoint) SENSITIVE = [] include Aws::Structure end # Describes whether detailed monitoring is enabled for the Auto Scaling # instances. # # @note When making an API call, you may pass InstanceMonitoring # data as a hash: # # { # enabled: false, # } # # @!attribute [rw] enabled # If `true`, detailed monitoring is enabled. Otherwise, basic # monitoring is enabled. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceMonitoring AWS API Documentation # class InstanceMonitoring < Struct.new( :enabled) SENSITIVE = [] include Aws::Structure end # Describes an instance refresh for an Auto Scaling group. # # @!attribute [rw] instance_refresh_id # The instance refresh ID. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] status # The current status for the instance refresh operation: # # * `Pending` - The request was created, but the operation has not # started. # # * `InProgress` - The operation is in progress. # # * `Successful` - The operation completed successfully. # # * `Failed` - The operation failed to complete. You can troubleshoot # using the status reason and the scaling activities. # # * `Cancelling` - An ongoing operation is being cancelled. # Cancellation does not roll back any replacements that have already # been completed, but it prevents new replacements from being # started. # # * `Cancelled` - The operation is cancelled. # @return [String] # # @!attribute [rw] status_reason # Provides more details about the current status of the instance # refresh. # @return [String] # # @!attribute [rw] start_time # The date and time at which the instance refresh began. # @return [Time] # # @!attribute [rw] end_time # The date and time at which the instance refresh ended. # @return [Time] # # @!attribute [rw] percentage_complete # The percentage of the instance refresh that is complete. For each # instance replacement, Amazon EC2 Auto Scaling tracks the instance's # health status and warm-up time. When the instance's health status # changes to healthy and the specified warm-up time passes, the # instance is considered updated and is added to the percentage # complete. # @return [Integer] # # @!attribute [rw] instances_to_update # The number of instances remaining to update before the instance # refresh is complete. # @return [Integer] # # @!attribute [rw] progress_details # Additional progress details for an Auto Scaling group that has a # warm pool. # @return [Types::InstanceRefreshProgressDetails] # # @!attribute [rw] preferences # Describes the preferences for an instance refresh. # @return [Types::RefreshPreferences] # # @!attribute [rw] desired_configuration # Describes the specific update you want to deploy. # @return [Types::DesiredConfiguration] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceRefresh AWS API Documentation # class InstanceRefresh < Struct.new( :instance_refresh_id, :auto_scaling_group_name, :status, :status_reason, :start_time, :end_time, :percentage_complete, :instances_to_update, :progress_details, :preferences, :desired_configuration) SENSITIVE = [] include Aws::Structure end # The request failed because an active instance refresh operation # already exists for the specified Auto Scaling group. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceRefreshInProgressFault AWS API Documentation # class InstanceRefreshInProgressFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # Reports the progress of an instance refresh on instances that are in # the Auto Scaling group. # # @!attribute [rw] percentage_complete # The percentage of instances in the Auto Scaling group that have been # replaced. For each instance replacement, Amazon EC2 Auto Scaling # tracks the instance's health status and warm-up time. When the # instance's health status changes to healthy and the specified # warm-up time passes, the instance is considered updated and is added # to the percentage complete. # @return [Integer] # # @!attribute [rw] instances_to_update # The number of instances remaining to update. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceRefreshLivePoolProgress AWS API Documentation # class InstanceRefreshLivePoolProgress < Struct.new( :percentage_complete, :instances_to_update) SENSITIVE = [] include Aws::Structure end # Reports the progress of an instance refresh on an Auto Scaling group # that has a warm pool. This includes separate details for instances in # the warm pool and instances in the Auto Scaling group (the live pool). # # @!attribute [rw] live_pool_progress # Indicates the progress of an instance refresh on instances that are # in the Auto Scaling group. # @return [Types::InstanceRefreshLivePoolProgress] # # @!attribute [rw] warm_pool_progress # Indicates the progress of an instance refresh on instances that are # in the warm pool. # @return [Types::InstanceRefreshWarmPoolProgress] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceRefreshProgressDetails AWS API Documentation # class InstanceRefreshProgressDetails < Struct.new( :live_pool_progress, :warm_pool_progress) SENSITIVE = [] include Aws::Structure end # Reports the progress of an instance refresh on instances that are in # the warm pool. # # @!attribute [rw] percentage_complete # The percentage of instances in the warm pool that have been # replaced. For each instance replacement, Amazon EC2 Auto Scaling # tracks the instance's health status and warm-up time. When the # instance's health status changes to healthy and the specified # warm-up time passes, the instance is considered updated and is added # to the percentage complete. # @return [Integer] # # @!attribute [rw] instances_to_update # The number of instances remaining to update. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceRefreshWarmPoolProgress AWS API Documentation # class InstanceRefreshWarmPoolProgress < Struct.new( :percentage_complete, :instances_to_update) SENSITIVE = [] include Aws::Structure end # Describes an instances distribution for an Auto Scaling group with a # MixedInstancesPolicy. # # The instances distribution specifies the distribution of On-Demand # Instances and Spot Instances, the maximum price to pay for Spot # Instances, and how the Auto Scaling group allocates instance types to # fulfill On-Demand and Spot capacities. # # When you modify `SpotAllocationStrategy`, `SpotInstancePools`, or # `SpotMaxPrice` in the UpdateAutoScalingGroup API call, this update # action does not deploy any changes across the running Amazon EC2 # instances in the group. Your existing Spot Instances continue to run # as long as the maximum price for those instances is higher than the # current Spot price. When scale out occurs, Amazon EC2 Auto Scaling # launches instances based on the new settings. When scale in occurs, # Amazon EC2 Auto Scaling terminates instances according to the group's # termination policies. # # @note When making an API call, you may pass InstancesDistribution # data as a hash: # # { # on_demand_allocation_strategy: "XmlString", # on_demand_base_capacity: 1, # on_demand_percentage_above_base_capacity: 1, # spot_allocation_strategy: "XmlString", # spot_instance_pools: 1, # spot_max_price: "MixedInstanceSpotPrice", # } # # @!attribute [rw] on_demand_allocation_strategy # Indicates how to allocate instance types to fulfill On-Demand # capacity. The only valid value is `prioritized`, which is also the # default value. This strategy uses the order of instance types in the # `LaunchTemplateOverrides` to define the launch priority of each # instance type. The first instance type in the array is prioritized # higher than the last. If all your On-Demand capacity cannot be # fulfilled using your highest priority instance, then the Auto # Scaling groups launches the remaining capacity using the second # priority instance type, and so on. # @return [String] # # @!attribute [rw] on_demand_base_capacity # The minimum amount of the Auto Scaling group's capacity that must # be fulfilled by On-Demand Instances. This base portion is # provisioned first as your group scales. Defaults to 0 if not # specified. If you specify weights for the instance types in the # overrides, set the value of `OnDemandBaseCapacity` in terms of the # number of capacity units, and not the number of instances. # @return [Integer] # # @!attribute [rw] on_demand_percentage_above_base_capacity # Controls the percentages of On-Demand Instances and Spot Instances # for your additional capacity beyond `OnDemandBaseCapacity`. # Expressed as a number (for example, 20 specifies 20% On-Demand # Instances, 80% Spot Instances). Defaults to 100 if not specified. If # set to 100, only On-Demand Instances are provisioned. # @return [Integer] # # @!attribute [rw] spot_allocation_strategy # Indicates how to allocate instances across Spot Instance pools. # # If the allocation strategy is `lowest-price`, the Auto Scaling group # launches instances using the Spot pools with the lowest price, and # evenly allocates your instances across the number of Spot pools that # you specify. Defaults to `lowest-price` if not specified. # # If the allocation strategy is `capacity-optimized` (recommended), # the Auto Scaling group launches instances using Spot pools that are # optimally chosen based on the available Spot capacity. # Alternatively, you can use `capacity-optimized-prioritized` and set # the order of instance types in the list of launch template overrides # from highest to lowest priority (from first to last in the list). # Amazon EC2 Auto Scaling honors the instance type priorities on a # best-effort basis but optimizes for capacity first. # @return [String] # # @!attribute [rw] spot_instance_pools # The number of Spot Instance pools across which to allocate your Spot # Instances. The Spot pools are determined from the different instance # types in the overrides. Valid only when the Spot allocation strategy # is `lowest-price`. Value must be in the range of 1 to 20. Defaults # to 2 if not specified. # @return [Integer] # # @!attribute [rw] spot_max_price # The maximum price per unit hour that you are willing to pay for a # Spot Instance. If you leave the value at its default (empty), Amazon # EC2 Auto Scaling uses the On-Demand price as the maximum Spot price. # To remove a value that you previously set, include the property but # specify an empty string ("") for the value. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstancesDistribution AWS API Documentation # class InstancesDistribution < Struct.new( :on_demand_allocation_strategy, :on_demand_base_capacity, :on_demand_percentage_above_base_capacity, :spot_allocation_strategy, :spot_instance_pools, :spot_max_price) SENSITIVE = [] include Aws::Structure end # The `NextToken` value is not valid. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InvalidNextToken AWS API Documentation # class InvalidNextToken < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # Describes a launch configuration. # # @!attribute [rw] launch_configuration_name # The name of the launch configuration. # @return [String] # # @!attribute [rw] launch_configuration_arn # The Amazon Resource Name (ARN) of the launch configuration. # @return [String] # # @!attribute [rw] image_id # The ID of the Amazon Machine Image (AMI) to use to launch your EC2 # instances. For more information, see [Finding an AMI][1] in the # *Amazon EC2 User Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html # @return [String] # # @!attribute [rw] key_name # The name of the key pair. # # For more information, see [Amazon EC2 Key Pairs][1] in the *Amazon # EC2 User Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html # @return [String] # # @!attribute [rw] security_groups # A list that contains the security groups to assign to the instances # in the Auto Scaling group. For more information, see [Security # Groups for Your VPC][1] in the *Amazon Virtual Private Cloud User # Guide*. # # # # [1]: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html # @return [Array<String>] # # @!attribute [rw] classic_link_vpc_id # The ID of a ClassicLink-enabled VPC to link your EC2-Classic # instances to. For more information, see [ClassicLink][1] in the # *Amazon EC2 User Guide for Linux Instances* and [Linking EC2-Classic # instances to a VPC][2] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html # [2]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html#as-ClassicLink # @return [String] # # @!attribute [rw] classic_link_vpc_security_groups # The IDs of one or more security groups for the VPC specified in # `ClassicLinkVPCId`. # # For more information, see [ClassicLink][1] in the *Amazon EC2 User # Guide for Linux Instances* and [Linking EC2-Classic instances to a # VPC][2] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html # [2]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html#as-ClassicLink # @return [Array<String>] # # @!attribute [rw] user_data # The user data to make available to the launched EC2 instances. For # more information, see [Instance metadata and user data][1] (Linux) # and [Instance metadata and user data][2] (Windows). If you are using # a command line tool, base64-encoding is performed for you, and you # can load the text from a file. Otherwise, you must provide # base64-encoded text. User data is limited to 16 KB. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html # [2]: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html # @return [String] # # @!attribute [rw] instance_type # The instance type for the instances. # # For information about available instance types, see [Available # Instance Types][1] in the *Amazon EC2 User Guide for Linux # Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes # @return [String] # # @!attribute [rw] kernel_id # The ID of the kernel associated with the AMI. # @return [String] # # @!attribute [rw] ramdisk_id # The ID of the RAM disk associated with the AMI. # @return [String] # # @!attribute [rw] block_device_mappings # A block device mapping, which specifies the block devices for the # instance. For more information, see [Block Device Mapping][1] in the # *Amazon EC2 User Guide for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html # @return [Array<Types::BlockDeviceMapping>] # # @!attribute [rw] instance_monitoring # Controls whether instances in this group are launched with detailed # (`true`) or basic (`false`) monitoring. # # For more information, see [Configure Monitoring for Auto Scaling # Instances][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html # @return [Types::InstanceMonitoring] # # @!attribute [rw] spot_price # The maximum hourly price to be paid for any Spot Instance launched # to fulfill the request. Spot Instances are launched when the price # you specify exceeds the current Spot price. For more information, # see [Requesting Spot Instances][1] in the *Amazon EC2 Auto Scaling # User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-launch-spot-instances.html # @return [String] # # @!attribute [rw] iam_instance_profile # The name or the Amazon Resource Name (ARN) of the instance profile # associated with the IAM role for the instance. The instance profile # contains the IAM role. For more information, see [IAM role for # applications that run on Amazon EC2 instances][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html # @return [String] # # @!attribute [rw] created_time # The creation date and time for the launch configuration. # @return [Time] # # @!attribute [rw] ebs_optimized # Specifies whether the launch configuration is optimized for EBS I/O # (`true`) or not (`false`). For more information, see [Amazon # EBS-Optimized Instances][1] in the *Amazon EC2 User Guide for Linux # Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html # @return [Boolean] # # @!attribute [rw] associate_public_ip_address # For Auto Scaling groups that are running in a VPC, specifies whether # to assign a public IP address to the group's instances. For more # information, see [Launching Auto Scaling instances in a VPC][1] in # the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html # @return [Boolean] # # @!attribute [rw] placement_tenancy # The tenancy of the instance, either `default` or `dedicated`. An # instance with `dedicated` tenancy runs on isolated, single-tenant # hardware and can only be launched into a VPC. # # For more information, see [Configuring instance tenancy with Amazon # EC2 Auto Scaling][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-dedicated-instances.html # @return [String] # # @!attribute [rw] metadata_options # The metadata options for the instances. For more information, see # [Configuring the Instance Metadata Options][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds # @return [Types::InstanceMetadataOptions] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfiguration AWS API Documentation # class LaunchConfiguration < Struct.new( :launch_configuration_name, :launch_configuration_arn, :image_id, :key_name, :security_groups, :classic_link_vpc_id, :classic_link_vpc_security_groups, :user_data, :instance_type, :kernel_id, :ramdisk_id, :block_device_mappings, :instance_monitoring, :spot_price, :iam_instance_profile, :created_time, :ebs_optimized, :associate_public_ip_address, :placement_tenancy, :metadata_options) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass LaunchConfigurationNameType # data as a hash: # # { # launch_configuration_name: "XmlStringMaxLen255", # required # } # # @!attribute [rw] launch_configuration_name # The name of the launch configuration. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfigurationNameType AWS API Documentation # class LaunchConfigurationNameType < Struct.new( :launch_configuration_name) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass LaunchConfigurationNamesType # data as a hash: # # { # launch_configuration_names: ["XmlStringMaxLen255"], # next_token: "XmlString", # max_records: 1, # } # # @!attribute [rw] launch_configuration_names # The launch configuration names. If you omit this parameter, all # launch configurations are described. # # Array Members: Maximum number of 50 items. # @return [Array<String>] # # @!attribute [rw] next_token # The token for the next set of items to return. (You received this # token from a previous call.) # @return [String] # # @!attribute [rw] max_records # The maximum number of items to return with this call. The default # value is `50` and the maximum value is `100`. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfigurationNamesType AWS API Documentation # class LaunchConfigurationNamesType < Struct.new( :launch_configuration_names, :next_token, :max_records) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] launch_configurations # The launch configurations. # @return [Array<Types::LaunchConfiguration>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfigurationsType AWS API Documentation # class LaunchConfigurationsType < Struct.new( :launch_configurations, :next_token) SENSITIVE = [] include Aws::Structure end # Describes a launch template and overrides. # # You specify these properties as part of a mixed instances policy. # # When you update the launch template or overrides in the # UpdateAutoScalingGroup API call, existing Amazon EC2 instances # continue to run. When scale out occurs, Amazon EC2 Auto Scaling # launches instances to match the new settings. When scale in occurs, # Amazon EC2 Auto Scaling terminates instances according to the group's # termination policies. # # @note When making an API call, you may pass LaunchTemplate # data as a hash: # # { # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # overrides: [ # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # }, # ], # } # # @!attribute [rw] launch_template_specification # The launch template to use. # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] overrides # Any properties that you specify override the same properties in the # launch template. If not provided, Amazon EC2 Auto Scaling uses the # instance type specified in the launch template when it launches an # instance. # @return [Array<Types::LaunchTemplateOverrides>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchTemplate AWS API Documentation # class LaunchTemplate < Struct.new( :launch_template_specification, :overrides) SENSITIVE = [] include Aws::Structure end # Describes an override for a launch template. The maximum number of # instance types that can be associated with an Auto Scaling group is # 40. The maximum number of distinct launch templates you can define for # an Auto Scaling group is 20. For more information about configuring # overrides, see [Configuring overrides][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-override-options.html # # @note When making an API call, you may pass LaunchTemplateOverrides # data as a hash: # # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # } # # @!attribute [rw] instance_type # The instance type, such as `m3.xlarge`. You must use an instance # type that is supported in your requested Region and Availability # Zones. For more information, see [Instance types][1] in the *Amazon # Elastic Compute Cloud User Guide*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html # @return [String] # # @!attribute [rw] weighted_capacity # The number of capacity units provided by the specified instance type # in terms of virtual CPUs, memory, storage, throughput, or other # relative performance characteristic. When a Spot or On-Demand # Instance is provisioned, the capacity units count toward the desired # capacity. Amazon EC2 Auto Scaling provisions instances until the # desired capacity is totally fulfilled, even if this results in an # overage. For example, if there are 2 units remaining to fulfill # capacity, and Amazon EC2 Auto Scaling can only provision an instance # with a `WeightedCapacity` of 5 units, the instance is provisioned, # and the desired capacity is exceeded by 3 units. For more # information, see [Instance weighting for Amazon EC2 Auto Scaling][1] # in the *Amazon EC2 Auto Scaling User Guide*. Value must be in the # range of 1 to 999. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-weighting.html # @return [String] # # @!attribute [rw] launch_template_specification # Provides the launch template to be used when launching the instance # type. For example, some instance types might require a launch # template with a different AMI. If not provided, Amazon EC2 Auto # Scaling uses the launch template that's defined for your mixed # instances policy. For more information, see [Specifying a different # launch template for an instance type][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-launch-template-overrides.html # @return [Types::LaunchTemplateSpecification] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchTemplateOverrides AWS API Documentation # class LaunchTemplateOverrides < Struct.new( :instance_type, :weighted_capacity, :launch_template_specification) SENSITIVE = [] include Aws::Structure end # Describes the launch template and the version of the launch template # that Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For # more information about launch templates, see [Launch templates][1] in # the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html # # @note When making an API call, you may pass LaunchTemplateSpecification # data as a hash: # # { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # } # # @!attribute [rw] launch_template_id # The ID of the launch template. To get the template ID, use the # Amazon EC2 [DescribeLaunchTemplates][1] API operation. New launch # templates can be created using the Amazon EC2 # [CreateLaunchTemplate][2] API. # # Conditional: You must specify either a `LaunchTemplateId` or a # `LaunchTemplateName`. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplates.html # [2]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html # @return [String] # # @!attribute [rw] launch_template_name # The name of the launch template. To get the template name, use the # Amazon EC2 [DescribeLaunchTemplates][1] API operation. New launch # templates can be created using the Amazon EC2 # [CreateLaunchTemplate][2] API. # # Conditional: You must specify either a `LaunchTemplateId` or a # `LaunchTemplateName`. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplates.html # [2]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplate.html # @return [String] # # @!attribute [rw] version # The version number, `$Latest`, or `$Default`. To get the version # number, use the Amazon EC2 [DescribeLaunchTemplateVersions][1] API # operation. New launch template versions can be created using the # Amazon EC2 [CreateLaunchTemplateVersion][2] API. If the value is # `$Latest`, Amazon EC2 Auto Scaling selects the latest version of the # launch template when launching instances. If the value is # `$Default`, Amazon EC2 Auto Scaling selects the default version of # the launch template when launching instances. The default value is # `$Default`. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeLaunchTemplateVersions.html # [2]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateLaunchTemplateVersion.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchTemplateSpecification AWS API Documentation # class LaunchTemplateSpecification < Struct.new( :launch_template_id, :launch_template_name, :version) SENSITIVE = [] include Aws::Structure end # Describes a lifecycle hook, which tells Amazon EC2 Auto Scaling that # you want to perform an action whenever it launches instances or # terminates instances. # # @!attribute [rw] lifecycle_hook_name # The name of the lifecycle hook. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group for the lifecycle hook. # @return [String] # # @!attribute [rw] lifecycle_transition # The state of the EC2 instance to which to attach the lifecycle hook. # The following are possible values: # # * autoscaling:EC2\_INSTANCE\_LAUNCHING # # * autoscaling:EC2\_INSTANCE\_TERMINATING # @return [String] # # @!attribute [rw] notification_target_arn # The ARN of the target that Amazon EC2 Auto Scaling sends # notifications to when an instance is in the transition state for the # lifecycle hook. The notification target can be either an SQS queue # or an SNS topic. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that allows the Auto Scaling group to # publish to the specified notification target. # @return [String] # # @!attribute [rw] notification_metadata # Additional information that is included any time Amazon EC2 Auto # Scaling sends a message to the notification target. # @return [String] # # @!attribute [rw] heartbeat_timeout # The maximum time, in seconds, that can elapse before the lifecycle # hook times out. If the lifecycle hook times out, Amazon EC2 Auto # Scaling performs the action that you specified in the # `DefaultResult` parameter. # @return [Integer] # # @!attribute [rw] global_timeout # The maximum time, in seconds, that an instance can remain in a # `Pending:Wait` or `Terminating:Wait` state. The maximum is 172800 # seconds (48 hours) or 100 times `HeartbeatTimeout`, whichever is # smaller. # @return [Integer] # # @!attribute [rw] default_result # Defines the action the Auto Scaling group should take when the # lifecycle hook timeout elapses or if an unexpected failure occurs. # The possible values are `CONTINUE` and `ABANDON`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LifecycleHook AWS API Documentation # class LifecycleHook < Struct.new( :lifecycle_hook_name, :auto_scaling_group_name, :lifecycle_transition, :notification_target_arn, :role_arn, :notification_metadata, :heartbeat_timeout, :global_timeout, :default_result) SENSITIVE = [] include Aws::Structure end # Describes information used to specify a lifecycle hook for an Auto # Scaling group. # # A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on # an instance when the instance launches (before it is put into service) # or as the instance terminates (before it is fully terminated). # # This step is a part of the procedure for creating a lifecycle hook for # an Auto Scaling group: # # 1. (Optional) Create a Lambda function and a rule that allows # CloudWatch Events to invoke your Lambda function when Amazon EC2 # Auto Scaling launches or terminates instances. # # 2. (Optional) Create a notification target and an IAM role. The # target can be either an Amazon SQS queue or an Amazon SNS topic. # The role allows Amazon EC2 Auto Scaling to publish lifecycle # notifications to the target. # # 3. **Create the lifecycle hook. Specify whether the hook is used when # the instances launch or terminate.** # # 4. If you need more time, record the lifecycle action heartbeat to # keep the instance in a pending state. # # 5. If you finish before the timeout period ends, complete the # lifecycle action. # # For more information, see [Amazon EC2 Auto Scaling lifecycle hooks][1] # in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html # # @note When making an API call, you may pass LifecycleHookSpecification # data as a hash: # # { # lifecycle_hook_name: "AsciiStringMaxLen255", # required # lifecycle_transition: "LifecycleTransition", # required # notification_metadata: "XmlStringMaxLen1023", # heartbeat_timeout: 1, # default_result: "LifecycleActionResult", # notification_target_arn: "NotificationTargetResourceName", # role_arn: "XmlStringMaxLen255", # } # # @!attribute [rw] lifecycle_hook_name # The name of the lifecycle hook. # @return [String] # # @!attribute [rw] lifecycle_transition # The state of the EC2 instance to which you want to attach the # lifecycle hook. The valid values are: # # * autoscaling:EC2\_INSTANCE\_LAUNCHING # # * autoscaling:EC2\_INSTANCE\_TERMINATING # @return [String] # # @!attribute [rw] notification_metadata # Additional information that you want to include any time Amazon EC2 # Auto Scaling sends a message to the notification target. # @return [String] # # @!attribute [rw] heartbeat_timeout # The maximum time, in seconds, that can elapse before the lifecycle # hook times out. # # If the lifecycle hook times out, Amazon EC2 Auto Scaling performs # the action that you specified in the `DefaultResult` parameter. You # can prevent the lifecycle hook from timing out by calling # RecordLifecycleActionHeartbeat. # @return [Integer] # # @!attribute [rw] default_result # Defines the action the Auto Scaling group should take when the # lifecycle hook timeout elapses or if an unexpected failure occurs. # The valid values are `CONTINUE` and `ABANDON`. The default value is # `ABANDON`. # @return [String] # # @!attribute [rw] notification_target_arn # The ARN of the target that Amazon EC2 Auto Scaling sends # notifications to when an instance is in the transition state for the # lifecycle hook. The notification target can be either an SQS queue # or an SNS topic. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that allows the Auto Scaling group to # publish to the specified notification target, for example, an Amazon # SNS topic or an Amazon SQS queue. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LifecycleHookSpecification AWS API Documentation # class LifecycleHookSpecification < Struct.new( :lifecycle_hook_name, :lifecycle_transition, :notification_metadata, :heartbeat_timeout, :default_result, :notification_target_arn, :role_arn) SENSITIVE = [] include Aws::Structure end # You have already reached a limit for your Amazon EC2 Auto Scaling # resources (for example, Auto Scaling groups, launch configurations, or # lifecycle hooks). For more information, see [DescribeAccountLimits][1] # in the *Amazon EC2 Auto Scaling API Reference*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LimitExceededFault AWS API Documentation # class LimitExceededFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # Describes the state of a Classic Load Balancer. # # @!attribute [rw] load_balancer_name # The name of the load balancer. # @return [String] # # @!attribute [rw] state # One of the following load balancer states: # # * `Adding` - The Auto Scaling instances are being registered with # the load balancer. # # * `Added` - All Auto Scaling instances are registered with the load # balancer. # # * `InService` - At least one Auto Scaling instance passed an `ELB` # health check. # # * `Removing` - The Auto Scaling instances are being deregistered # from the load balancer. If connection draining is enabled, Elastic # Load Balancing waits for in-flight requests to complete before # deregistering the instances. # # * `Removed` - All Auto Scaling instances are deregistered from the # load balancer. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LoadBalancerState AWS API Documentation # class LoadBalancerState < Struct.new( :load_balancer_name, :state) SENSITIVE = [] include Aws::Structure end # Describes the state of a target group. # # @!attribute [rw] load_balancer_target_group_arn # The Amazon Resource Name (ARN) of the target group. # @return [String] # # @!attribute [rw] state # The state of the target group. # # * `Adding` - The Auto Scaling instances are being registered with # the target group. # # * `Added` - All Auto Scaling instances are registered with the # target group. # # * `InService` - At least one Auto Scaling instance passed an `ELB` # health check. # # * `Removing` - The Auto Scaling instances are being deregistered # from the target group. If connection draining is enabled, Elastic # Load Balancing waits for in-flight requests to complete before # deregistering the instances. # # * `Removed` - All Auto Scaling instances are deregistered from the # target group. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LoadBalancerTargetGroupState AWS API Documentation # class LoadBalancerTargetGroupState < Struct.new( :load_balancer_target_group_arn, :state) SENSITIVE = [] include Aws::Structure end # A `GetPredictiveScalingForecast` call returns the load forecast for a # predictive scaling policy. This structure includes the data points for # that load forecast, along with the timestamps of those data points and # the metric specification. # # @!attribute [rw] timestamps # The time stamps for the data points, in UTC format. # @return [Array<Time>] # # @!attribute [rw] values # The values of the data points. # @return [Array<Float>] # # @!attribute [rw] metric_specification # The metric specification for the load forecast. # @return [Types::PredictiveScalingMetricSpecification] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LoadForecast AWS API Documentation # class LoadForecast < Struct.new( :timestamps, :values, :metric_specification) SENSITIVE = [] include Aws::Structure end # Describes a metric. # # @!attribute [rw] metric # One of the following metrics: # # * `GroupMinSize` # # * `GroupMaxSize` # # * `GroupDesiredCapacity` # # * `GroupInServiceInstances` # # * `GroupPendingInstances` # # * `GroupStandbyInstances` # # * `GroupTerminatingInstances` # # * `GroupTotalInstances` # # * `GroupInServiceCapacity` # # * `GroupPendingCapacity` # # * `GroupStandbyCapacity` # # * `GroupTerminatingCapacity` # # * `GroupTotalCapacity` # # * `WarmPoolDesiredCapacity` # # * `WarmPoolWarmedCapacity` # # * `WarmPoolPendingCapacity` # # * `WarmPoolTerminatingCapacity` # # * `WarmPoolTotalCapacity` # # * `GroupAndWarmPoolDesiredCapacity` # # * `GroupAndWarmPoolTotalCapacity` # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/MetricCollectionType AWS API Documentation # class MetricCollectionType < Struct.new( :metric) SENSITIVE = [] include Aws::Structure end # Describes the dimension of a metric. # # @note When making an API call, you may pass MetricDimension # data as a hash: # # { # name: "MetricDimensionName", # required # value: "MetricDimensionValue", # required # } # # @!attribute [rw] name # The name of the dimension. # @return [String] # # @!attribute [rw] value # The value of the dimension. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/MetricDimension AWS API Documentation # class MetricDimension < Struct.new( :name, :value) SENSITIVE = [] include Aws::Structure end # Describes a granularity of a metric. # # @!attribute [rw] granularity # The granularity. The only valid value is `1Minute`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/MetricGranularityType AWS API Documentation # class MetricGranularityType < Struct.new( :granularity) SENSITIVE = [] include Aws::Structure end # Describes a mixed instances policy. A mixed instances policy contains # the instance types Amazon EC2 Auto Scaling can launch, and other # information Amazon EC2 Auto Scaling can use to launch instances to # help you optimize your costs. For more information, see [Auto Scaling # groups with multiple instance types and purchase options][1] in the # *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html # # @note When making an API call, you may pass MixedInstancesPolicy # data as a hash: # # { # launch_template: { # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # overrides: [ # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # }, # ], # }, # instances_distribution: { # on_demand_allocation_strategy: "XmlString", # on_demand_base_capacity: 1, # on_demand_percentage_above_base_capacity: 1, # spot_allocation_strategy: "XmlString", # spot_instance_pools: 1, # spot_max_price: "MixedInstanceSpotPrice", # }, # } # # @!attribute [rw] launch_template # Specifies the launch template to use and the instance types # (overrides) that are used to provision EC2 instances to fulfill # On-Demand and Spot capacities. Required when creating a mixed # instances policy. # @return [Types::LaunchTemplate] # # @!attribute [rw] instances_distribution # Specifies the instances distribution. If not provided, the value for # each property in `InstancesDistribution` uses a default value. # @return [Types::InstancesDistribution] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/MixedInstancesPolicy AWS API Documentation # class MixedInstancesPolicy < Struct.new( :launch_template, :instances_distribution) SENSITIVE = [] include Aws::Structure end # Describes a notification. # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] topic_arn # The Amazon Resource Name (ARN) of the Amazon Simple Notification # Service (Amazon SNS) topic. # @return [String] # # @!attribute [rw] notification_type # One of the following event notification types: # # * `autoscaling:EC2_INSTANCE_LAUNCH` # # * `autoscaling:EC2_INSTANCE_LAUNCH_ERROR` # # * `autoscaling:EC2_INSTANCE_TERMINATE` # # * `autoscaling:EC2_INSTANCE_TERMINATE_ERROR` # # * `autoscaling:TEST_NOTIFICATION` # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/NotificationConfiguration AWS API Documentation # class NotificationConfiguration < Struct.new( :auto_scaling_group_name, :topic_arn, :notification_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] scaling_policies # The scaling policies. # @return [Array<Types::ScalingPolicy>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PoliciesType AWS API Documentation # class PoliciesType < Struct.new( :scaling_policies, :next_token) SENSITIVE = [] include Aws::Structure end # Contains the output of PutScalingPolicy. # # @!attribute [rw] policy_arn # The Amazon Resource Name (ARN) of the policy. # @return [String] # # @!attribute [rw] alarms # The CloudWatch alarms created for the target tracking scaling # policy. # @return [Array<Types::Alarm>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PolicyARNType AWS API Documentation # class PolicyARNType < Struct.new( :policy_arn, :alarms) SENSITIVE = [] include Aws::Structure end # Represents a predefined metric for a target tracking scaling policy to # use with Amazon EC2 Auto Scaling. # # @note When making an API call, you may pass PredefinedMetricSpecification # data as a hash: # # { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # } # # @!attribute [rw] predefined_metric_type # The metric type. The following predefined metrics are available: # # * `ASGAverageCPUUtilization` - Average CPU utilization of the Auto # Scaling group. # # * `ASGAverageNetworkIn` - Average number of bytes received on all # network interfaces by the Auto Scaling group. # # * `ASGAverageNetworkOut` - Average number of bytes sent out on all # network interfaces by the Auto Scaling group. # # * `ALBRequestCountPerTarget` - Number of requests completed per # target in an Application Load Balancer target group. # @return [String] # # @!attribute [rw] resource_label # A label that uniquely identifies a specific Application Load # Balancer target group from which to determine the average request # count served by your Auto Scaling group. You can't specify a # resource label unless the target group is attached to the Auto # Scaling group. # # You create the resource label by appending the final portion of the # load balancer ARN and the final portion of the target group ARN into # a single value, separated by a forward slash (/). The format of the # resource label is: # # `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff`. # # Where: # # * app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt; is the # final portion of the load balancer ARN # # * targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt; is # the final portion of the target group ARN. # # To find the ARN for an Application Load Balancer, use the # [DescribeLoadBalancers][1] API operation. To find the ARN for the # target group, use the [DescribeTargetGroups][2] API operation. # # # # [1]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html # [2]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PredefinedMetricSpecification AWS API Documentation # class PredefinedMetricSpecification < Struct.new( :predefined_metric_type, :resource_label) SENSITIVE = [] include Aws::Structure end # Represents a predictive scaling policy configuration to use with # Amazon EC2 Auto Scaling. # # @note When making an API call, you may pass PredictiveScalingConfiguration # data as a hash: # # { # metric_specifications: [ # required # { # target_value: 1.0, # required # predefined_metric_pair_specification: { # predefined_metric_type: "ASGCPUUtilization", # required, accepts ASGCPUUtilization, ASGNetworkIn, ASGNetworkOut, ALBRequestCount # resource_label: "XmlStringMaxLen1023", # }, # predefined_scaling_metric_specification: { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # }, # predefined_load_metric_specification: { # predefined_metric_type: "ASGTotalCPUUtilization", # required, accepts ASGTotalCPUUtilization, ASGTotalNetworkIn, ASGTotalNetworkOut, ALBTargetGroupRequestCount # resource_label: "XmlStringMaxLen1023", # }, # }, # ], # mode: "ForecastAndScale", # accepts ForecastAndScale, ForecastOnly # scheduling_buffer_time: 1, # max_capacity_breach_behavior: "HonorMaxCapacity", # accepts HonorMaxCapacity, IncreaseMaxCapacity # max_capacity_buffer: 1, # } # # @!attribute [rw] metric_specifications # This structure includes the metrics and target utilization to use # for predictive scaling. # # This is an array, but we currently only support a single metric # specification. That is, you can specify a target value and a single # metric pair, or a target value and one scaling metric and one load # metric. # @return [Array<Types::PredictiveScalingMetricSpecification>] # # @!attribute [rw] mode # The predictive scaling mode. Defaults to `ForecastOnly` if not # specified. # @return [String] # # @!attribute [rw] scheduling_buffer_time # The amount of time, in seconds, by which the instance launch time # can be advanced. For example, the forecast says to add capacity at # 10:00 AM, and you choose to pre-launch instances by 5 minutes. In # that case, the instances will be launched at 9:55 AM. The intention # is to give resources time to be provisioned. It can take a few # minutes to launch an EC2 instance. The actual amount of time # required depends on several factors, such as the size of the # instance and whether there are startup scripts to complete. # # The value must be less than the forecast interval duration of 3600 # seconds (60 minutes). Defaults to 300 seconds if not specified. # @return [Integer] # # @!attribute [rw] max_capacity_breach_behavior # Defines the behavior that should be applied if the forecast capacity # approaches or exceeds the maximum capacity of the Auto Scaling # group. Defaults to `HonorMaxCapacity` if not specified. # # The following are possible values: # # * `HonorMaxCapacity` - Amazon EC2 Auto Scaling cannot scale out # capacity higher than the maximum capacity. The maximum capacity is # enforced as a hard limit. # # * `IncreaseMaxCapacity` - Amazon EC2 Auto Scaling can scale out # capacity higher than the maximum capacity when the forecast # capacity is close to or exceeds the maximum capacity. The upper # limit is determined by the forecasted capacity and the value for # `MaxCapacityBuffer`. # @return [String] # # @!attribute [rw] max_capacity_buffer # The size of the capacity buffer to use when the forecast capacity is # close to or exceeds the maximum capacity. The value is specified as # a percentage relative to the forecast capacity. For example, if the # buffer is 10, this means a 10 percent buffer, such that if the # forecast capacity is 50, and the maximum capacity is 40, then the # effective maximum capacity is 55. # # If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than # the maximum capacity to equal but not exceed forecast capacity. # # Required if the `MaxCapacityBreachBehavior` property is set to # `IncreaseMaxCapacity`, and cannot be used otherwise. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PredictiveScalingConfiguration AWS API Documentation # class PredictiveScalingConfiguration < Struct.new( :metric_specifications, :mode, :scheduling_buffer_time, :max_capacity_breach_behavior, :max_capacity_buffer) SENSITIVE = [] include Aws::Structure end # This structure specifies the metrics and target utilization settings # for a predictive scaling policy. # # You must specify either a metric pair, or a load metric and a scaling # metric individually. Specifying a metric pair instead of individual # metrics provides a simpler way to configure metrics for a scaling # policy. You choose the metric pair, and the policy automatically knows # the correct sum and average statistics to use for the load metric and # the scaling metric. # # Example # # * You create a predictive scaling policy and specify `ALBRequestCount` # as the value for the metric pair and `1000.0` as the target value. # For this type of metric, you must provide the metric dimension for # the corresponding target group, so you also provide a resource label # for the Application Load Balancer target group that is attached to # your Auto Scaling group. # # * The number of requests the target group receives per minute provides # the load metric, and the request count averaged between the members # of the target group provides the scaling metric. In CloudWatch, this # refers to the `RequestCount` and `RequestCountPerTarget` metrics, # respectively. # # * For optimal use of predictive scaling, you adhere to the best # practice of using a dynamic scaling policy to automatically scale # between the minimum capacity and maximum capacity in response to # real-time changes in resource utilization. # # * Amazon EC2 Auto Scaling consumes data points for the load metric # over the last 14 days and creates an hourly load forecast for # predictive scaling. (A minimum of 24 hours of data is required.) # # * After creating the load forecast, Amazon EC2 Auto Scaling determines # when to reduce or increase the capacity of your Auto Scaling group # in each hour of the forecast period so that the average number of # requests received by each instance is as close to 1000 requests per # minute as possible at all times. # # @note When making an API call, you may pass PredictiveScalingMetricSpecification # data as a hash: # # { # target_value: 1.0, # required # predefined_metric_pair_specification: { # predefined_metric_type: "ASGCPUUtilization", # required, accepts ASGCPUUtilization, ASGNetworkIn, ASGNetworkOut, ALBRequestCount # resource_label: "XmlStringMaxLen1023", # }, # predefined_scaling_metric_specification: { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # }, # predefined_load_metric_specification: { # predefined_metric_type: "ASGTotalCPUUtilization", # required, accepts ASGTotalCPUUtilization, ASGTotalNetworkIn, ASGTotalNetworkOut, ALBTargetGroupRequestCount # resource_label: "XmlStringMaxLen1023", # }, # } # # @!attribute [rw] target_value # Specifies the target utilization. # @return [Float] # # @!attribute [rw] predefined_metric_pair_specification # The metric pair specification from which Amazon EC2 Auto Scaling # determines the appropriate scaling metric and load metric to use. # @return [Types::PredictiveScalingPredefinedMetricPair] # # @!attribute [rw] predefined_scaling_metric_specification # The scaling metric specification. # @return [Types::PredictiveScalingPredefinedScalingMetric] # # @!attribute [rw] predefined_load_metric_specification # The load metric specification. # @return [Types::PredictiveScalingPredefinedLoadMetric] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PredictiveScalingMetricSpecification AWS API Documentation # class PredictiveScalingMetricSpecification < Struct.new( :target_value, :predefined_metric_pair_specification, :predefined_scaling_metric_specification, :predefined_load_metric_specification) SENSITIVE = [] include Aws::Structure end # Describes a load metric for a predictive scaling policy. # # When returned in the output of `DescribePolicies`, it indicates that a # predictive scaling policy uses individually specified load and scaling # metrics instead of a metric pair. # # @note When making an API call, you may pass PredictiveScalingPredefinedLoadMetric # data as a hash: # # { # predefined_metric_type: "ASGTotalCPUUtilization", # required, accepts ASGTotalCPUUtilization, ASGTotalNetworkIn, ASGTotalNetworkOut, ALBTargetGroupRequestCount # resource_label: "XmlStringMaxLen1023", # } # # @!attribute [rw] predefined_metric_type # The metric type. # @return [String] # # @!attribute [rw] resource_label # A label that uniquely identifies a specific Application Load # Balancer target group from which to determine the request count # served by your Auto Scaling group. You can't specify a resource # label unless the target group is attached to the Auto Scaling group. # # You create the resource label by appending the final portion of the # load balancer ARN and the final portion of the target group ARN into # a single value, separated by a forward slash (/). The format of the # resource label is: # # `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff`. # # Where: # # * app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt; is the # final portion of the load balancer ARN # # * targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt; is # the final portion of the target group ARN. # # To find the ARN for an Application Load Balancer, use the # [DescribeLoadBalancers][1] API operation. To find the ARN for the # target group, use the [DescribeTargetGroups][2] API operation. # # # # [1]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html # [2]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PredictiveScalingPredefinedLoadMetric AWS API Documentation # class PredictiveScalingPredefinedLoadMetric < Struct.new( :predefined_metric_type, :resource_label) SENSITIVE = [] include Aws::Structure end # Represents a metric pair for a predictive scaling policy. # # @note When making an API call, you may pass PredictiveScalingPredefinedMetricPair # data as a hash: # # { # predefined_metric_type: "ASGCPUUtilization", # required, accepts ASGCPUUtilization, ASGNetworkIn, ASGNetworkOut, ALBRequestCount # resource_label: "XmlStringMaxLen1023", # } # # @!attribute [rw] predefined_metric_type # Indicates which metrics to use. There are two different types of # metrics for each metric type: one is a load metric and one is a # scaling metric. For example, if the metric type is # `ASGCPUUtilization`, the Auto Scaling group's total CPU metric is # used as the load metric, and the average CPU metric is used for the # scaling metric. # @return [String] # # @!attribute [rw] resource_label # A label that uniquely identifies a specific Application Load # Balancer target group from which to determine the total and average # request count served by your Auto Scaling group. You can't specify # a resource label unless the target group is attached to the Auto # Scaling group. # # You create the resource label by appending the final portion of the # load balancer ARN and the final portion of the target group ARN into # a single value, separated by a forward slash (/). The format of the # resource label is: # # `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff`. # # Where: # # * app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt; is the # final portion of the load balancer ARN # # * targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt; is # the final portion of the target group ARN. # # To find the ARN for an Application Load Balancer, use the # [DescribeLoadBalancers][1] API operation. To find the ARN for the # target group, use the [DescribeTargetGroups][2] API operation. # # # # [1]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html # [2]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PredictiveScalingPredefinedMetricPair AWS API Documentation # class PredictiveScalingPredefinedMetricPair < Struct.new( :predefined_metric_type, :resource_label) SENSITIVE = [] include Aws::Structure end # Describes a scaling metric for a predictive scaling policy. # # When returned in the output of `DescribePolicies`, it indicates that a # predictive scaling policy uses individually specified load and scaling # metrics instead of a metric pair. # # @note When making an API call, you may pass PredictiveScalingPredefinedScalingMetric # data as a hash: # # { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # } # # @!attribute [rw] predefined_metric_type # The metric type. # @return [String] # # @!attribute [rw] resource_label # A label that uniquely identifies a specific Application Load # Balancer target group from which to determine the average request # count served by your Auto Scaling group. You can't specify a # resource label unless the target group is attached to the Auto # Scaling group. # # You create the resource label by appending the final portion of the # load balancer ARN and the final portion of the target group ARN into # a single value, separated by a forward slash (/). The format of the # resource label is: # # `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff`. # # Where: # # * app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt; is the # final portion of the load balancer ARN # # * targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt; is # the final portion of the target group ARN. # # To find the ARN for an Application Load Balancer, use the # [DescribeLoadBalancers][1] API operation. To find the ARN for the # target group, use the [DescribeTargetGroups][2] API operation. # # # # [1]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html # [2]: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PredictiveScalingPredefinedScalingMetric AWS API Documentation # class PredictiveScalingPredefinedScalingMetric < Struct.new( :predefined_metric_type, :resource_label) SENSITIVE = [] include Aws::Structure end # Describes a process type. # # For more information, see [Scaling processes][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types # # @!attribute [rw] process_name # One of the following processes: # # * `Launch` # # * `Terminate` # # * `AddToLoadBalancer` # # * `AlarmNotification` # # * `AZRebalance` # # * `HealthCheck` # # * `InstanceRefresh` # # * `ReplaceUnhealthy` # # * `ScheduledActions` # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ProcessType AWS API Documentation # class ProcessType < Struct.new( :process_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] processes # The names of the process types. # @return [Array<Types::ProcessType>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ProcessesType AWS API Documentation # class ProcessesType < Struct.new( :processes) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutLifecycleHookAnswer AWS API Documentation # class PutLifecycleHookAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass PutLifecycleHookType # data as a hash: # # { # lifecycle_hook_name: "AsciiStringMaxLen255", # required # auto_scaling_group_name: "XmlStringMaxLen255", # required # lifecycle_transition: "LifecycleTransition", # role_arn: "XmlStringMaxLen255", # notification_target_arn: "NotificationTargetResourceName", # notification_metadata: "XmlStringMaxLen1023", # heartbeat_timeout: 1, # default_result: "LifecycleActionResult", # } # # @!attribute [rw] lifecycle_hook_name # The name of the lifecycle hook. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] lifecycle_transition # The instance state to which you want to attach the lifecycle hook. # The valid values are: # # * autoscaling:EC2\_INSTANCE\_LAUNCHING # # * autoscaling:EC2\_INSTANCE\_TERMINATING # # Required for new lifecycle hooks, but optional when updating # existing hooks. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that allows the Auto Scaling group to # publish to the specified notification target, for example, an Amazon # SNS topic or an Amazon SQS queue. # # Required for new lifecycle hooks, but optional when updating # existing hooks. # @return [String] # # @!attribute [rw] notification_target_arn # The ARN of the notification target that Amazon EC2 Auto Scaling uses # to notify you when an instance is in the transition state for the # lifecycle hook. This target can be either an SQS queue or an SNS # topic. # # If you specify an empty string, this overrides the current ARN. # # This operation uses the JSON format when sending notifications to an # Amazon SQS queue, and an email key-value pair format when sending # notifications to an Amazon SNS topic. # # When you specify a notification target, Amazon EC2 Auto Scaling # sends it a test message. Test messages contain the following # additional key-value pair: `"Event": # "autoscaling:TEST_NOTIFICATION"`. # @return [String] # # @!attribute [rw] notification_metadata # Additional information that you want to include any time Amazon EC2 # Auto Scaling sends a message to the notification target. # @return [String] # # @!attribute [rw] heartbeat_timeout # The maximum time, in seconds, that can elapse before the lifecycle # hook times out. The range is from `30` to `7200` seconds. The # default value is `3600` seconds (1 hour). # # If the lifecycle hook times out, Amazon EC2 Auto Scaling performs # the action that you specified in the `DefaultResult` parameter. You # can prevent the lifecycle hook from timing out by calling the # RecordLifecycleActionHeartbeat API. # @return [Integer] # # @!attribute [rw] default_result # Defines the action the Auto Scaling group should take when the # lifecycle hook timeout elapses or if an unexpected failure occurs. # This parameter can be either `CONTINUE` or `ABANDON`. The default # value is `ABANDON`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutLifecycleHookType AWS API Documentation # class PutLifecycleHookType < Struct.new( :lifecycle_hook_name, :auto_scaling_group_name, :lifecycle_transition, :role_arn, :notification_target_arn, :notification_metadata, :heartbeat_timeout, :default_result) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass PutNotificationConfigurationType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # topic_arn: "XmlStringMaxLen255", # required # notification_types: ["XmlStringMaxLen255"], # required # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] topic_arn # The Amazon Resource Name (ARN) of the Amazon Simple Notification # Service (Amazon SNS) topic. # @return [String] # # @!attribute [rw] notification_types # The type of event that causes the notification to be sent. To query # the notification types supported by Amazon EC2 Auto Scaling, call # the DescribeAutoScalingNotificationTypes API. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutNotificationConfigurationType AWS API Documentation # class PutNotificationConfigurationType < Struct.new( :auto_scaling_group_name, :topic_arn, :notification_types) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass PutScalingPolicyType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # policy_name: "XmlStringMaxLen255", # required # policy_type: "XmlStringMaxLen64", # adjustment_type: "XmlStringMaxLen255", # min_adjustment_step: 1, # min_adjustment_magnitude: 1, # scaling_adjustment: 1, # cooldown: 1, # metric_aggregation_type: "XmlStringMaxLen32", # step_adjustments: [ # { # metric_interval_lower_bound: 1.0, # metric_interval_upper_bound: 1.0, # scaling_adjustment: 1, # required # }, # ], # estimated_instance_warmup: 1, # target_tracking_configuration: { # predefined_metric_specification: { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # }, # customized_metric_specification: { # metric_name: "MetricName", # required # namespace: "MetricNamespace", # required # dimensions: [ # { # name: "MetricDimensionName", # required # value: "MetricDimensionValue", # required # }, # ], # statistic: "Average", # required, accepts Average, Minimum, Maximum, SampleCount, Sum # unit: "MetricUnit", # }, # target_value: 1.0, # required # disable_scale_in: false, # }, # enabled: false, # predictive_scaling_configuration: { # metric_specifications: [ # required # { # target_value: 1.0, # required # predefined_metric_pair_specification: { # predefined_metric_type: "ASGCPUUtilization", # required, accepts ASGCPUUtilization, ASGNetworkIn, ASGNetworkOut, ALBRequestCount # resource_label: "XmlStringMaxLen1023", # }, # predefined_scaling_metric_specification: { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # }, # predefined_load_metric_specification: { # predefined_metric_type: "ASGTotalCPUUtilization", # required, accepts ASGTotalCPUUtilization, ASGTotalNetworkIn, ASGTotalNetworkOut, ALBTargetGroupRequestCount # resource_label: "XmlStringMaxLen1023", # }, # }, # ], # mode: "ForecastAndScale", # accepts ForecastAndScale, ForecastOnly # scheduling_buffer_time: 1, # max_capacity_breach_behavior: "HonorMaxCapacity", # accepts HonorMaxCapacity, IncreaseMaxCapacity # max_capacity_buffer: 1, # }, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] policy_name # The name of the policy. # @return [String] # # @!attribute [rw] policy_type # One of the following policy types: # # * `TargetTrackingScaling` # # * `StepScaling` # # * `SimpleScaling` (default) # # * `PredictiveScaling` # @return [String] # # @!attribute [rw] adjustment_type # Specifies how the scaling adjustment is interpreted (for example, an # absolute number or a percentage). The valid values are # `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. # # Required if the policy type is `StepScaling` or `SimpleScaling`. For # more information, see [Scaling adjustment types][1] in the *Amazon # EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment # @return [String] # # @!attribute [rw] min_adjustment_step # Available for backward compatibility. Use `MinAdjustmentMagnitude` # instead. # @return [Integer] # # @!attribute [rw] min_adjustment_magnitude # The minimum value to scale by when the adjustment type is # `PercentChangeInCapacity`. For example, suppose that you create a # step scaling policy to scale out an Auto Scaling group by 25 percent # and you specify a `MinAdjustmentMagnitude` of 2. If the group has 4 # instances and the scaling policy is performed, 25 percent of 4 is 1. # However, because you specified a `MinAdjustmentMagnitude` of 2, # Amazon EC2 Auto Scaling scales out the group by 2 instances. # # Valid only if the policy type is `StepScaling` or `SimpleScaling`. # For more information, see [Scaling adjustment types][1] in the # *Amazon EC2 Auto Scaling User Guide*. # # <note markdown="1"> Some Auto Scaling groups use instance weights. In this case, set the # `MinAdjustmentMagnitude` to a value that is at least as large as # your largest instance weight. # # </note> # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment # @return [Integer] # # @!attribute [rw] scaling_adjustment # The amount by which to scale, based on the specified adjustment # type. A positive value adds to the current capacity while a negative # number removes from the current capacity. For exact capacity, you # must specify a positive value. # # Required if the policy type is `SimpleScaling`. (Not used with any # other policy type.) # @return [Integer] # # @!attribute [rw] cooldown # The duration of the policy's cooldown period, in seconds. When a # cooldown period is specified here, it overrides the default cooldown # period defined for the Auto Scaling group. # # Valid only if the policy type is `SimpleScaling`. For more # information, see [Scaling cooldowns for Amazon EC2 Auto Scaling][1] # in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html # @return [Integer] # # @!attribute [rw] metric_aggregation_type # The aggregation type for the CloudWatch metrics. The valid values # are `Minimum`, `Maximum`, and `Average`. If the aggregation type is # null, the value is treated as `Average`. # # Valid only if the policy type is `StepScaling`. # @return [String] # # @!attribute [rw] step_adjustments # A set of adjustments that enable you to scale based on the size of # the alarm breach. # # Required if the policy type is `StepScaling`. (Not used with any # other policy type.) # @return [Array<Types::StepAdjustment>] # # @!attribute [rw] estimated_instance_warmup # The estimated time, in seconds, until a newly launched instance can # contribute to the CloudWatch metrics. If not provided, the default # is to use the value from the default cooldown period for the Auto # Scaling group. # # Valid only if the policy type is `TargetTrackingScaling` or # `StepScaling`. # @return [Integer] # # @!attribute [rw] target_tracking_configuration # A target tracking scaling policy. Provides support for predefined or # customized metrics. # # The following predefined metrics are available: # # * `ASGAverageCPUUtilization` # # * `ASGAverageNetworkIn` # # * `ASGAverageNetworkOut` # # * `ALBRequestCountPerTarget` # # If you specify `ALBRequestCountPerTarget` for the metric, you must # specify the `ResourceLabel` parameter with the # `PredefinedMetricSpecification`. # # For more information, see [TargetTrackingConfiguration][1] in the # *Amazon EC2 Auto Scaling API Reference*. # # Required if the policy type is `TargetTrackingScaling`. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_TargetTrackingConfiguration.html # @return [Types::TargetTrackingConfiguration] # # @!attribute [rw] enabled # Indicates whether the scaling policy is enabled or disabled. The # default is enabled. For more information, see [Disabling a scaling # policy for an Auto Scaling group][1] in the *Amazon EC2 Auto Scaling # User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-enable-disable-scaling-policy.html # @return [Boolean] # # @!attribute [rw] predictive_scaling_configuration # A predictive scaling policy. Provides support for only predefined # metrics. # # Predictive scaling works with CPU utilization, network in/out, and # the Application Load Balancer request count. # # For more information, see [PredictiveScalingConfiguration][1] in the # *Amazon EC2 Auto Scaling API Reference*. # # Required if the policy type is `PredictiveScaling`. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_PredictiveScalingConfiguration.html # @return [Types::PredictiveScalingConfiguration] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScalingPolicyType AWS API Documentation # class PutScalingPolicyType < Struct.new( :auto_scaling_group_name, :policy_name, :policy_type, :adjustment_type, :min_adjustment_step, :min_adjustment_magnitude, :scaling_adjustment, :cooldown, :metric_aggregation_type, :step_adjustments, :estimated_instance_warmup, :target_tracking_configuration, :enabled, :predictive_scaling_configuration) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass PutScheduledUpdateGroupActionType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # scheduled_action_name: "XmlStringMaxLen255", # required # time: Time.now, # start_time: Time.now, # end_time: Time.now, # recurrence: "XmlStringMaxLen255", # min_size: 1, # max_size: 1, # desired_capacity: 1, # time_zone: "XmlStringMaxLen255", # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scheduled_action_name # The name of this scaling action. # @return [String] # # @!attribute [rw] time # This parameter is no longer used. # @return [Time] # # @!attribute [rw] start_time # The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ # format in UTC/GMT only and in quotes (for example, # `"2019-06-01T00:00:00Z"`). # # If you specify `Recurrence` and `StartTime`, Amazon EC2 Auto Scaling # performs the action at this time, and then performs the action based # on the specified recurrence. # # If you try to schedule your action in the past, Amazon EC2 Auto # Scaling returns an error message. # @return [Time] # # @!attribute [rw] end_time # The date and time for the recurring schedule to end, in UTC. # @return [Time] # # @!attribute [rw] recurrence # The recurring schedule for this action. This format consists of five # fields separated by white spaces: \[Minute\] \[Hour\] # \[Day\_of\_Month\] \[Month\_of\_Year\] \[Day\_of\_Week\]. The value # must be in quotes (for example, `"30 0 1 1,6,12 *"`). For more # information about this format, see [Crontab][1]. # # When `StartTime` and `EndTime` are specified with `Recurrence`, they # form the boundaries of when the recurring action starts and stops. # # Cron expressions use Universal Coordinated Time (UTC) by default. # # # # [1]: http://crontab.org # @return [String] # # @!attribute [rw] min_size # The minimum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] max_size # The maximum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] desired_capacity # The desired capacity is the initial capacity of the Auto Scaling # group after the scheduled action runs and the capacity it attempts # to maintain. It can scale beyond this capacity if you add more # scaling conditions. # @return [Integer] # # @!attribute [rw] time_zone # Specifies the time zone for a cron expression. If a time zone is not # provided, UTC is used by default. # # Valid values are the canonical names of the IANA time zones, derived # from the IANA Time Zone Database (such as `Etc/GMT+9` or # `Pacific/Tahiti`). For more information, see # [https://en.wikipedia.org/wiki/List\_of\_tz\_database\_time\_zones][1]. # # # # [1]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScheduledUpdateGroupActionType AWS API Documentation # class PutScheduledUpdateGroupActionType < Struct.new( :auto_scaling_group_name, :scheduled_action_name, :time, :start_time, :end_time, :recurrence, :min_size, :max_size, :desired_capacity, :time_zone) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutWarmPoolAnswer AWS API Documentation # class PutWarmPoolAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass PutWarmPoolType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # max_group_prepared_capacity: 1, # min_size: 1, # pool_state: "Stopped", # accepts Stopped, Running # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] max_group_prepared_capacity # Specifies the maximum number of instances that are allowed to be in # the warm pool or in any state except `Terminated` for the Auto # Scaling group. This is an optional property. Specify it only if you # do not want the warm pool size to be determined by the difference # between the group's maximum capacity and its desired capacity. # # If a value for `MaxGroupPreparedCapacity` is not specified, Amazon # EC2 Auto Scaling launches and maintains the difference between the # group's maximum capacity and its desired capacity. If you specify a # value for `MaxGroupPreparedCapacity`, Amazon EC2 Auto Scaling uses # the difference between the `MaxGroupPreparedCapacity` and the # desired capacity instead. # # The size of the warm pool is dynamic. Only when # `MaxGroupPreparedCapacity` and `MinSize` are set to the same value # does the warm pool have an absolute size. # # If the desired capacity of the Auto Scaling group is higher than the # `MaxGroupPreparedCapacity`, the capacity of the warm pool is 0, # unless you specify a value for `MinSize`. To remove a value that you # previously set, include the property but specify -1 for the value. # @return [Integer] # # @!attribute [rw] min_size # Specifies the minimum number of instances to maintain in the warm # pool. This helps you to ensure that there is always a certain number # of warmed instances available to handle traffic spikes. Defaults to # 0 if not specified. # @return [Integer] # # @!attribute [rw] pool_state # Sets the instance state to transition to after the lifecycle actions # are complete. Default is `Stopped`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutWarmPoolType AWS API Documentation # class PutWarmPoolType < Struct.new( :auto_scaling_group_name, :max_group_prepared_capacity, :min_size, :pool_state) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RecordLifecycleActionHeartbeatAnswer AWS API Documentation # class RecordLifecycleActionHeartbeatAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass RecordLifecycleActionHeartbeatType # data as a hash: # # { # lifecycle_hook_name: "AsciiStringMaxLen255", # required # auto_scaling_group_name: "ResourceName", # required # lifecycle_action_token: "LifecycleActionToken", # instance_id: "XmlStringMaxLen19", # } # # @!attribute [rw] lifecycle_hook_name # The name of the lifecycle hook. # @return [String] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] lifecycle_action_token # A token that uniquely identifies a specific lifecycle action # associated with an instance. Amazon EC2 Auto Scaling sends this # token to the notification target that you specified when you created # the lifecycle hook. # @return [String] # # @!attribute [rw] instance_id # The ID of the instance. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RecordLifecycleActionHeartbeatType AWS API Documentation # class RecordLifecycleActionHeartbeatType < Struct.new( :lifecycle_hook_name, :auto_scaling_group_name, :lifecycle_action_token, :instance_id) SENSITIVE = [] include Aws::Structure end # Describes the preferences for an instance refresh. # # @note When making an API call, you may pass RefreshPreferences # data as a hash: # # { # min_healthy_percentage: 1, # instance_warmup: 1, # checkpoint_percentages: [1], # checkpoint_delay: 1, # skip_matching: false, # } # # @!attribute [rw] min_healthy_percentage # The amount of capacity in the Auto Scaling group that must remain # healthy during an instance refresh to allow the operation to # continue. The value is expressed as a percentage of the desired # capacity of the Auto Scaling group (rounded up to the nearest # integer). The default is `90`. # # Setting the minimum healthy percentage to 100 percent limits the # rate of replacement to one instance at a time. In contrast, setting # it to 0 percent has the effect of replacing all instances at the # same time. # @return [Integer] # # @!attribute [rw] instance_warmup # The number of seconds until a newly launched instance is configured # and ready to use. During this time, Amazon EC2 Auto Scaling does not # immediately move on to the next replacement. The default is to use # the value for the health check grace period defined for the group. # @return [Integer] # # @!attribute [rw] checkpoint_percentages # Threshold values for each checkpoint in ascending order. Each number # must be unique. To replace all instances in the Auto Scaling group, # the last number in the array must be `100`. # # For usage examples, see [Adding checkpoints to an instance # refresh][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-adding-checkpoints-instance-refresh.html # @return [Array<Integer>] # # @!attribute [rw] checkpoint_delay # The amount of time, in seconds, to wait after a checkpoint before # continuing. This property is optional, but if you specify a value # for it, you must also specify a value for `CheckpointPercentages`. # If you specify a value for `CheckpointPercentages` and not for # `CheckpointDelay`, the `CheckpointDelay` defaults to `3600` (1 # hour). # @return [Integer] # # @!attribute [rw] skip_matching # A boolean value that indicates whether skip matching is enabled. If # true, then Amazon EC2 Auto Scaling skips replacing instances that # match the desired configuration. If no desired configuration is # specified, then it skips replacing instances that have the same # configuration that is already set on the group. The default is # `false`. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RefreshPreferences AWS API Documentation # class RefreshPreferences < Struct.new( :min_healthy_percentage, :instance_warmup, :checkpoint_percentages, :checkpoint_delay, :skip_matching) SENSITIVE = [] include Aws::Structure end # You already have a pending update to an Amazon EC2 Auto Scaling # resource (for example, an Auto Scaling group, instance, or load # balancer). # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ResourceContentionFault AWS API Documentation # class ResourceContentionFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # The operation can't be performed because the resource is in use. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ResourceInUseFault AWS API Documentation # class ResourceInUseFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # The operation can't be performed because there are scaling activities # in progress. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScalingActivityInProgressFault AWS API Documentation # class ScalingActivityInProgressFault < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # Describes a scaling policy. # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] policy_name # The name of the scaling policy. # @return [String] # # @!attribute [rw] policy_arn # The Amazon Resource Name (ARN) of the policy. # @return [String] # # @!attribute [rw] policy_type # One of the following policy types: # # * `TargetTrackingScaling` # # * `StepScaling` # # * `SimpleScaling` (default) # # * `PredictiveScaling` # # For more information, see [Target tracking scaling policies][1] and # [Step and simple scaling policies][2] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html # [2]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html # @return [String] # # @!attribute [rw] adjustment_type # Specifies how the scaling adjustment is interpreted (for example, an # absolute number or a percentage). The valid values are # `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. # @return [String] # # @!attribute [rw] min_adjustment_step # Available for backward compatibility. Use `MinAdjustmentMagnitude` # instead. # @return [Integer] # # @!attribute [rw] min_adjustment_magnitude # The minimum value to scale by when the adjustment type is # `PercentChangeInCapacity`. # @return [Integer] # # @!attribute [rw] scaling_adjustment # The amount by which to scale, based on the specified adjustment # type. A positive value adds to the current capacity while a negative # number removes from the current capacity. # @return [Integer] # # @!attribute [rw] cooldown # The duration of the policy's cooldown period, in seconds. # @return [Integer] # # @!attribute [rw] step_adjustments # A set of adjustments that enable you to scale based on the size of # the alarm breach. # @return [Array<Types::StepAdjustment>] # # @!attribute [rw] metric_aggregation_type # The aggregation type for the CloudWatch metrics. The valid values # are `Minimum`, `Maximum`, and `Average`. # @return [String] # # @!attribute [rw] estimated_instance_warmup # The estimated time, in seconds, until a newly launched instance can # contribute to the CloudWatch metrics. # @return [Integer] # # @!attribute [rw] alarms # The CloudWatch alarms related to the policy. # @return [Array<Types::Alarm>] # # @!attribute [rw] target_tracking_configuration # A target tracking scaling policy. # @return [Types::TargetTrackingConfiguration] # # @!attribute [rw] enabled # Indicates whether the policy is enabled (`true`) or disabled # (`false`). # @return [Boolean] # # @!attribute [rw] predictive_scaling_configuration # A predictive scaling policy. # @return [Types::PredictiveScalingConfiguration] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScalingPolicy AWS API Documentation # class ScalingPolicy < Struct.new( :auto_scaling_group_name, :policy_name, :policy_arn, :policy_type, :adjustment_type, :min_adjustment_step, :min_adjustment_magnitude, :scaling_adjustment, :cooldown, :step_adjustments, :metric_aggregation_type, :estimated_instance_warmup, :alarms, :target_tracking_configuration, :enabled, :predictive_scaling_configuration) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ScalingProcessQuery # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # scaling_processes: ["XmlStringMaxLen255"], # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scaling_processes # One or more of the following processes: # # * `Launch` # # * `Terminate` # # * `AddToLoadBalancer` # # * `AlarmNotification` # # * `AZRebalance` # # * `HealthCheck` # # * `InstanceRefresh` # # * `ReplaceUnhealthy` # # * `ScheduledActions` # # If you omit this parameter, all processes are specified. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScalingProcessQuery AWS API Documentation # class ScalingProcessQuery < Struct.new( :auto_scaling_group_name, :scaling_processes) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] scheduled_update_group_actions # The scheduled actions. # @return [Array<Types::ScheduledUpdateGroupAction>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScheduledActionsType AWS API Documentation # class ScheduledActionsType < Struct.new( :scheduled_update_group_actions, :next_token) SENSITIVE = [] include Aws::Structure end # Describes a scheduled scaling action. # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] scheduled_action_name # The name of the scheduled action. # @return [String] # # @!attribute [rw] scheduled_action_arn # The Amazon Resource Name (ARN) of the scheduled action. # @return [String] # # @!attribute [rw] time # This parameter is no longer used. # @return [Time] # # @!attribute [rw] start_time # The date and time in UTC for this action to start. For example, # `"2019-06-01T00:00:00Z"`. # @return [Time] # # @!attribute [rw] end_time # The date and time in UTC for the recurring schedule to end. For # example, `"2019-06-01T00:00:00Z"`. # @return [Time] # # @!attribute [rw] recurrence # The recurring schedule for the action, in Unix cron syntax format. # # When `StartTime` and `EndTime` are specified with `Recurrence`, they # form the boundaries of when the recurring action starts and stops. # @return [String] # # @!attribute [rw] min_size # The minimum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] max_size # The maximum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] desired_capacity # The desired capacity is the initial capacity of the Auto Scaling # group after the scheduled action runs and the capacity it attempts # to maintain. # @return [Integer] # # @!attribute [rw] time_zone # The time zone for the cron expression. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScheduledUpdateGroupAction AWS API Documentation # class ScheduledUpdateGroupAction < Struct.new( :auto_scaling_group_name, :scheduled_action_name, :scheduled_action_arn, :time, :start_time, :end_time, :recurrence, :min_size, :max_size, :desired_capacity, :time_zone) SENSITIVE = [] include Aws::Structure end # Describes information used for one or more scheduled scaling action # updates in a BatchPutScheduledUpdateGroupAction operation. # # @note When making an API call, you may pass ScheduledUpdateGroupActionRequest # data as a hash: # # { # scheduled_action_name: "XmlStringMaxLen255", # required # start_time: Time.now, # end_time: Time.now, # recurrence: "XmlStringMaxLen255", # min_size: 1, # max_size: 1, # desired_capacity: 1, # time_zone: "XmlStringMaxLen255", # } # # @!attribute [rw] scheduled_action_name # The name of the scaling action. # @return [String] # # @!attribute [rw] start_time # The date and time for the action to start, in YYYY-MM-DDThh:mm:ssZ # format in UTC/GMT only and in quotes (for example, # `"2019-06-01T00:00:00Z"`). # # If you specify `Recurrence` and `StartTime`, Amazon EC2 Auto Scaling # performs the action at this time, and then performs the action based # on the specified recurrence. # # If you try to schedule the action in the past, Amazon EC2 Auto # Scaling returns an error message. # @return [Time] # # @!attribute [rw] end_time # The date and time for the recurring schedule to end, in UTC. # @return [Time] # # @!attribute [rw] recurrence # The recurring schedule for the action, in Unix cron syntax format. # This format consists of five fields separated by white spaces: # \[Minute\] \[Hour\] \[Day\_of\_Month\] \[Month\_of\_Year\] # \[Day\_of\_Week\]. The value must be in quotes (for example, `"30 0 # 1 1,6,12 *"`). For more information about this format, see # [Crontab][1]. # # When `StartTime` and `EndTime` are specified with `Recurrence`, they # form the boundaries of when the recurring action starts and stops. # # Cron expressions use Universal Coordinated Time (UTC) by default. # # # # [1]: http://crontab.org # @return [String] # # @!attribute [rw] min_size # The minimum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] max_size # The maximum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] desired_capacity # The desired capacity is the initial capacity of the Auto Scaling # group after the scheduled action runs and the capacity it attempts # to maintain. # @return [Integer] # # @!attribute [rw] time_zone # Specifies the time zone for a cron expression. If a time zone is not # provided, UTC is used by default. # # Valid values are the canonical names of the IANA time zones, derived # from the IANA Time Zone Database (such as `Etc/GMT+9` or # `Pacific/Tahiti`). For more information, see # [https://en.wikipedia.org/wiki/List\_of\_tz\_database\_time\_zones][1]. # # # # [1]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScheduledUpdateGroupActionRequest AWS API Documentation # class ScheduledUpdateGroupActionRequest < Struct.new( :scheduled_action_name, :start_time, :end_time, :recurrence, :min_size, :max_size, :desired_capacity, :time_zone) SENSITIVE = [] include Aws::Structure end # The service-linked role is not yet ready for use. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ServiceLinkedRoleFailure AWS API Documentation # class ServiceLinkedRoleFailure < Struct.new( :message) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass SetDesiredCapacityType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # desired_capacity: 1, # required # honor_cooldown: false, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] desired_capacity # The desired capacity is the initial capacity of the Auto Scaling # group after this operation completes and the capacity it attempts to # maintain. # @return [Integer] # # @!attribute [rw] honor_cooldown # Indicates whether Amazon EC2 Auto Scaling waits for the cooldown # period to complete before initiating a scaling activity to set your # Auto Scaling group to its new capacity. By default, Amazon EC2 Auto # Scaling does not honor the cooldown period during manual scaling # activities. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetDesiredCapacityType AWS API Documentation # class SetDesiredCapacityType < Struct.new( :auto_scaling_group_name, :desired_capacity, :honor_cooldown) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass SetInstanceHealthQuery # data as a hash: # # { # instance_id: "XmlStringMaxLen19", # required # health_status: "XmlStringMaxLen32", # required # should_respect_grace_period: false, # } # # @!attribute [rw] instance_id # The ID of the instance. # @return [String] # # @!attribute [rw] health_status # The health status of the instance. Set to `Healthy` to have the # instance remain in service. Set to `Unhealthy` to have the instance # be out of service. Amazon EC2 Auto Scaling terminates and replaces # the unhealthy instance. # @return [String] # # @!attribute [rw] should_respect_grace_period # If the Auto Scaling group of the specified instance has a # `HealthCheckGracePeriod` specified for the group, by default, this # call respects the grace period. Set this to `False`, to have the # call not respect the grace period associated with the group. # # For more information about the health check grace period, see # [CreateAutoScalingGroup][1] in the *Amazon EC2 Auto Scaling API # Reference*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CreateAutoScalingGroup.html # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceHealthQuery AWS API Documentation # class SetInstanceHealthQuery < Struct.new( :instance_id, :health_status, :should_respect_grace_period) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceProtectionAnswer AWS API Documentation # class SetInstanceProtectionAnswer < Aws::EmptyStructure; end # @note When making an API call, you may pass SetInstanceProtectionQuery # data as a hash: # # { # instance_ids: ["XmlStringMaxLen19"], # required # auto_scaling_group_name: "XmlStringMaxLen255", # required # protected_from_scale_in: false, # required # } # # @!attribute [rw] instance_ids # One or more instance IDs. You can specify up to 50 instances. # @return [Array<String>] # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] protected_from_scale_in # Indicates whether the instance is protected from termination by # Amazon EC2 Auto Scaling when scaling in. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceProtectionQuery AWS API Documentation # class SetInstanceProtectionQuery < Struct.new( :instance_ids, :auto_scaling_group_name, :protected_from_scale_in) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] instance_refresh_id # A unique ID for tracking the progress of the request. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/StartInstanceRefreshAnswer AWS API Documentation # class StartInstanceRefreshAnswer < Struct.new( :instance_refresh_id) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass StartInstanceRefreshType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # strategy: "Rolling", # accepts Rolling # desired_configuration: { # launch_template: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # mixed_instances_policy: { # launch_template: { # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # overrides: [ # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # }, # ], # }, # instances_distribution: { # on_demand_allocation_strategy: "XmlString", # on_demand_base_capacity: 1, # on_demand_percentage_above_base_capacity: 1, # spot_allocation_strategy: "XmlString", # spot_instance_pools: 1, # spot_max_price: "MixedInstanceSpotPrice", # }, # }, # }, # preferences: { # min_healthy_percentage: 1, # instance_warmup: 1, # checkpoint_percentages: [1], # checkpoint_delay: 1, # skip_matching: false, # }, # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] strategy # The strategy to use for the instance refresh. The only valid value # is `Rolling`. # # A rolling update helps you update your instances gradually. A # rolling update can fail due to failed health checks or if instances # are on standby or are protected from scale in. If the rolling update # process fails, any instances that are replaced are not rolled back # to their previous configuration. # @return [String] # # @!attribute [rw] desired_configuration # The desired configuration. For example, the desired configuration # can specify a new launch template or a new version of the current # launch template. # # Once the instance refresh succeeds, Amazon EC2 Auto Scaling updates # the settings of the Auto Scaling group to reflect the new desired # configuration. # # <note markdown="1"> When you specify a new launch template or a new version of the # current launch template for your desired configuration, consider # enabling the `SkipMatching` property in preferences. If it's # enabled, Amazon EC2 Auto Scaling skips replacing instances that # already use the specified launch template and version. This can help # you reduce the number of replacements that are required to apply # updates. # # </note> # @return [Types::DesiredConfiguration] # # @!attribute [rw] preferences # Set of preferences associated with the instance refresh request. If # not provided, the default values are used. # @return [Types::RefreshPreferences] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/StartInstanceRefreshType AWS API Documentation # class StartInstanceRefreshType < Struct.new( :auto_scaling_group_name, :strategy, :desired_configuration, :preferences) SENSITIVE = [] include Aws::Structure end # Describes information used to create a step adjustment for a step # scaling policy. # # For the following examples, suppose that you have an alarm with a # breach threshold of 50: # # * To trigger the adjustment when the metric is greater than or equal # to 50 and less than 60, specify a lower bound of 0 and an upper # bound of 10. # # * To trigger the adjustment when the metric is greater than 40 and # less than or equal to 50, specify a lower bound of -10 and an upper # bound of 0. # # There are a few rules for the step adjustments for your step policy: # # * The ranges of your step adjustments can't overlap or have a gap. # # * At most, one step adjustment can have a null lower bound. If one # step adjustment has a negative lower bound, then there must be a # step adjustment with a null lower bound. # # * At most, one step adjustment can have a null upper bound. If one # step adjustment has a positive upper bound, then there must be a # step adjustment with a null upper bound. # # * The upper and lower bound can't be null in the same step # adjustment. # # For more information, see [Step adjustments][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-steps # # @note When making an API call, you may pass StepAdjustment # data as a hash: # # { # metric_interval_lower_bound: 1.0, # metric_interval_upper_bound: 1.0, # scaling_adjustment: 1, # required # } # # @!attribute [rw] metric_interval_lower_bound # The lower bound for the difference between the alarm threshold and # the CloudWatch metric. If the metric value is above the breach # threshold, the lower bound is inclusive (the metric must be greater # than or equal to the threshold plus the lower bound). Otherwise, it # is exclusive (the metric must be greater than the threshold plus the # lower bound). A null value indicates negative infinity. # @return [Float] # # @!attribute [rw] metric_interval_upper_bound # The upper bound for the difference between the alarm threshold and # the CloudWatch metric. If the metric value is above the breach # threshold, the upper bound is exclusive (the metric must be less # than the threshold plus the upper bound). Otherwise, it is inclusive # (the metric must be less than or equal to the threshold plus the # upper bound). A null value indicates positive infinity. # # The upper bound must be greater than the lower bound. # @return [Float] # # @!attribute [rw] scaling_adjustment # The amount by which to scale, based on the specified adjustment # type. A positive value adds to the current capacity while a negative # number removes from the current capacity. # @return [Integer] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/StepAdjustment AWS API Documentation # class StepAdjustment < Struct.new( :metric_interval_lower_bound, :metric_interval_upper_bound, :scaling_adjustment) SENSITIVE = [] include Aws::Structure end # Describes an auto scaling process that has been suspended. # # For more information, see [Scaling processes][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types # # @!attribute [rw] process_name # The name of the suspended process. # @return [String] # # @!attribute [rw] suspension_reason # The reason that the process was suspended. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SuspendedProcess AWS API Documentation # class SuspendedProcess < Struct.new( :process_name, :suspension_reason) SENSITIVE = [] include Aws::Structure end # Describes a tag for an Auto Scaling group. # # @note When making an API call, you may pass Tag # data as a hash: # # { # resource_id: "XmlString", # resource_type: "XmlString", # key: "TagKey", # required # value: "TagValue", # propagate_at_launch: false, # } # # @!attribute [rw] resource_id # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] resource_type # The type of resource. The only supported value is # `auto-scaling-group`. # @return [String] # # @!attribute [rw] key # The tag key. # @return [String] # # @!attribute [rw] value # The tag value. # @return [String] # # @!attribute [rw] propagate_at_launch # Determines whether the tag is added to new instances as they are # launched in the group. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/Tag AWS API Documentation # class Tag < Struct.new( :resource_id, :resource_type, :key, :value, :propagate_at_launch) SENSITIVE = [] include Aws::Structure end # Describes a tag for an Auto Scaling group. # # @!attribute [rw] resource_id # The name of the group. # @return [String] # # @!attribute [rw] resource_type # The type of resource. The only supported value is # `auto-scaling-group`. # @return [String] # # @!attribute [rw] key # The tag key. # @return [String] # # @!attribute [rw] value # The tag value. # @return [String] # # @!attribute [rw] propagate_at_launch # Determines whether the tag is added to new instances as they are # launched in the group. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TagDescription AWS API Documentation # class TagDescription < Struct.new( :resource_id, :resource_type, :key, :value, :propagate_at_launch) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] tags # One or more tags. # @return [Array<Types::TagDescription>] # # @!attribute [rw] next_token # A string that indicates that the response contains more items than # can be returned in a single response. To receive additional items, # specify this string for the `NextToken` value when requesting the # next set of items. This value is null when there are no more items # to return. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TagsType AWS API Documentation # class TagsType < Struct.new( :tags, :next_token) SENSITIVE = [] include Aws::Structure end # Represents a target tracking scaling policy configuration to use with # Amazon EC2 Auto Scaling. # # @note When making an API call, you may pass TargetTrackingConfiguration # data as a hash: # # { # predefined_metric_specification: { # predefined_metric_type: "ASGAverageCPUUtilization", # required, accepts ASGAverageCPUUtilization, ASGAverageNetworkIn, ASGAverageNetworkOut, ALBRequestCountPerTarget # resource_label: "XmlStringMaxLen1023", # }, # customized_metric_specification: { # metric_name: "MetricName", # required # namespace: "MetricNamespace", # required # dimensions: [ # { # name: "MetricDimensionName", # required # value: "MetricDimensionValue", # required # }, # ], # statistic: "Average", # required, accepts Average, Minimum, Maximum, SampleCount, Sum # unit: "MetricUnit", # }, # target_value: 1.0, # required # disable_scale_in: false, # } # # @!attribute [rw] predefined_metric_specification # A predefined metric. You must specify either a predefined metric or # a customized metric. # @return [Types::PredefinedMetricSpecification] # # @!attribute [rw] customized_metric_specification # A customized metric. You must specify either a predefined metric or # a customized metric. # @return [Types::CustomizedMetricSpecification] # # @!attribute [rw] target_value # The target value for the metric. # @return [Float] # # @!attribute [rw] disable_scale_in # Indicates whether scaling in by the target tracking scaling policy # is disabled. If scaling in is disabled, the target tracking scaling # policy doesn't remove instances from the Auto Scaling group. # Otherwise, the target tracking scaling policy can remove instances # from the Auto Scaling group. The default is `false`. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TargetTrackingConfiguration AWS API Documentation # class TargetTrackingConfiguration < Struct.new( :predefined_metric_specification, :customized_metric_specification, :target_value, :disable_scale_in) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass TerminateInstanceInAutoScalingGroupType # data as a hash: # # { # instance_id: "XmlStringMaxLen19", # required # should_decrement_desired_capacity: false, # required # } # # @!attribute [rw] instance_id # The ID of the instance. # @return [String] # # @!attribute [rw] should_decrement_desired_capacity # Indicates whether terminating the instance also decrements the size # of the Auto Scaling group. # @return [Boolean] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TerminateInstanceInAutoScalingGroupType AWS API Documentation # class TerminateInstanceInAutoScalingGroupType < Struct.new( :instance_id, :should_decrement_desired_capacity) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateAutoScalingGroupType # data as a hash: # # { # auto_scaling_group_name: "XmlStringMaxLen255", # required # launch_configuration_name: "XmlStringMaxLen255", # launch_template: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # mixed_instances_policy: { # launch_template: { # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # overrides: [ # { # instance_type: "XmlStringMaxLen255", # weighted_capacity: "XmlStringMaxLen32", # launch_template_specification: { # launch_template_id: "XmlStringMaxLen255", # launch_template_name: "LaunchTemplateName", # version: "XmlStringMaxLen255", # }, # }, # ], # }, # instances_distribution: { # on_demand_allocation_strategy: "XmlString", # on_demand_base_capacity: 1, # on_demand_percentage_above_base_capacity: 1, # spot_allocation_strategy: "XmlString", # spot_instance_pools: 1, # spot_max_price: "MixedInstanceSpotPrice", # }, # }, # min_size: 1, # max_size: 1, # desired_capacity: 1, # default_cooldown: 1, # availability_zones: ["XmlStringMaxLen255"], # health_check_type: "XmlStringMaxLen32", # health_check_grace_period: 1, # placement_group: "XmlStringMaxLen255", # vpc_zone_identifier: "XmlStringMaxLen2047", # termination_policies: ["XmlStringMaxLen1600"], # new_instances_protected_from_scale_in: false, # service_linked_role_arn: "ResourceName", # max_instance_lifetime: 1, # capacity_rebalance: false, # context: "Context", # } # # @!attribute [rw] auto_scaling_group_name # The name of the Auto Scaling group. # @return [String] # # @!attribute [rw] launch_configuration_name # The name of the launch configuration. If you specify # `LaunchConfigurationName` in your update request, you can't specify # `LaunchTemplate` or `MixedInstancesPolicy`. # @return [String] # # @!attribute [rw] launch_template # The launch template and version to use to specify the updates. If # you specify `LaunchTemplate` in your update request, you can't # specify `LaunchConfigurationName` or `MixedInstancesPolicy`. # @return [Types::LaunchTemplateSpecification] # # @!attribute [rw] mixed_instances_policy # An embedded object that specifies a mixed instances policy. When you # make changes to an existing policy, all optional properties are left # unchanged if not specified. For more information, see [Auto Scaling # groups with multiple instance types and purchase options][1] in the # *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html # @return [Types::MixedInstancesPolicy] # # @!attribute [rw] min_size # The minimum size of the Auto Scaling group. # @return [Integer] # # @!attribute [rw] max_size # The maximum size of the Auto Scaling group. # # <note markdown="1"> With a mixed instances policy that uses instance weighting, Amazon # EC2 Auto Scaling may need to go above `MaxSize` to meet your # capacity requirements. In this event, Amazon EC2 Auto Scaling will # never go above `MaxSize` by more than your largest instance weight # (weights that define how many units each instance contributes to the # desired capacity of the group). # # </note> # @return [Integer] # # @!attribute [rw] desired_capacity # The desired capacity is the initial capacity of the Auto Scaling # group after this operation completes and the capacity it attempts to # maintain. This number must be greater than or equal to the minimum # size of the group and less than or equal to the maximum size of the # group. # @return [Integer] # # @!attribute [rw] default_cooldown # The amount of time, in seconds, after a scaling activity completes # before another scaling activity can start. The default value is # `300`. This setting applies when using simple scaling policies, but # not when using other scaling policies or scheduled scaling. For more # information, see [Scaling cooldowns for Amazon EC2 Auto Scaling][1] # in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html # @return [Integer] # # @!attribute [rw] availability_zones # One or more Availability Zones for the group. # @return [Array<String>] # # @!attribute [rw] health_check_type # The service to use for the health checks. The valid values are `EC2` # and `ELB`. If you configure an Auto Scaling group to use `ELB` # health checks, it considers the instance unhealthy if it fails # either the EC2 status checks or the load balancer health checks. # @return [String] # # @!attribute [rw] health_check_grace_period # The amount of time, in seconds, that Amazon EC2 Auto Scaling waits # before checking the health status of an EC2 instance that has come # into service. The default value is `0`. For more information, see # [Health check grace period][1] in the *Amazon EC2 Auto Scaling User # Guide*. # # Conditional: Required if you are adding an `ELB` health check. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html#health-check-grace-period # @return [Integer] # # @!attribute [rw] placement_group # The name of an existing placement group into which to launch your # instances, if any. A placement group is a logical grouping of # instances within a single Availability Zone. You cannot specify # multiple Availability Zones and a placement group. For more # information, see [Placement Groups][1] in the *Amazon EC2 User Guide # for Linux Instances*. # # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html # @return [String] # # @!attribute [rw] vpc_zone_identifier # A comma-separated list of subnet IDs for a virtual private cloud # (VPC). If you specify `VPCZoneIdentifier` with `AvailabilityZones`, # the subnets that you specify for this parameter must reside in those # Availability Zones. # @return [String] # # @!attribute [rw] termination_policies # A policy or a list of policies that are used to select the instances # to terminate. The policies are executed in the order that you list # them. For more information, see [Controlling which Auto Scaling # instances terminate during scale in][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html # @return [Array<String>] # # @!attribute [rw] new_instances_protected_from_scale_in # Indicates whether newly launched instances are protected from # termination by Amazon EC2 Auto Scaling when scaling in. For more # information about preventing instances from terminating on scale in, # see [Instance scale-in protection][1] in the *Amazon EC2 Auto # Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html#instance-protection # @return [Boolean] # # @!attribute [rw] service_linked_role_arn # The Amazon Resource Name (ARN) of the service-linked role that the # Auto Scaling group uses to call other Amazon Web Services on your # behalf. For more information, see [Service-linked roles][1] in the # *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html # @return [String] # # @!attribute [rw] max_instance_lifetime # The maximum amount of time, in seconds, that an instance can be in # service. The default is null. If specified, the value must be either # 0 or a number equal to or greater than 86,400 seconds (1 day). To # clear a previously set value, specify a new value of 0. For more # information, see [Replacing Auto Scaling instances based on maximum # instance lifetime][1] in the *Amazon EC2 Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html # @return [Integer] # # @!attribute [rw] capacity_rebalance # Enables or disables Capacity Rebalancing. For more information, see # [Amazon EC2 Auto Scaling Capacity Rebalancing][1] in the *Amazon EC2 # Auto Scaling User Guide*. # # # # [1]: https://docs.aws.amazon.com/autoscaling/ec2/userguide/capacity-rebalance.html # @return [Boolean] # # @!attribute [rw] context # Reserved. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/UpdateAutoScalingGroupType AWS API Documentation # class UpdateAutoScalingGroupType < Struct.new( :auto_scaling_group_name, :launch_configuration_name, :launch_template, :mixed_instances_policy, :min_size, :max_size, :desired_capacity, :default_cooldown, :availability_zones, :health_check_type, :health_check_grace_period, :placement_group, :vpc_zone_identifier, :termination_policies, :new_instances_protected_from_scale_in, :service_linked_role_arn, :max_instance_lifetime, :capacity_rebalance, :context) SENSITIVE = [] include Aws::Structure end # Describes a warm pool configuration. # # @!attribute [rw] max_group_prepared_capacity # The maximum number of instances that are allowed to be in the warm # pool or in any state except `Terminated` for the Auto Scaling group. # @return [Integer] # # @!attribute [rw] min_size # The minimum number of instances to maintain in the warm pool. # @return [Integer] # # @!attribute [rw] pool_state # The instance state to transition to after the lifecycle actions are # complete. # @return [String] # # @!attribute [rw] status # The status of a warm pool that is marked for deletion. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/WarmPoolConfiguration AWS API Documentation # class WarmPoolConfiguration < Struct.new( :max_group_prepared_capacity, :min_size, :pool_state, :status) SENSITIVE = [] include Aws::Structure end end end
37.34388
187
0.638946
1806bc54675ba09c307a634a61505ed41c519cf4
150
class Mtask < ActiveRecord::Base unloadable belongs_to :author, :class_name => 'User' belongs_to :assigned_to, :class_name => 'Principal' end
18.75
53
0.726667