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
e8b78e170cab32ab1fab0d942d63d3fd9945af7b
905
require 'restforce' require 'dotenv' Dotenv.load # Takes in a connected Restforce client Salesforce = Struct.new(:client) do def destroy(id) account = client.find('Account', id) puts "Deleting #{account.Name}" client.destroy('Account', id) end end # Create Restforce client def create_client() client = Restforce.new(username: ENV['SALESFORCE_USERNAME'], password: ENV['SALESFORCE_PASSWORD'], security_token: ENV['SALESFORCE_SECURITY_TOKEN'], client_id: ENV['SALESFORCE_CLIENT_ID'], client_secret: ENV['SALESFORCE_CLIENT_SECRET'], api_version: ENV['SALESFORCE_API_VERSION']) response = client.authenticate! info = client.get(response.id).body puts "#{info.user_id ? '' : 'NOT '}Connected!" Salesforce.new(client) end # Main client = create_client()
28.28125
74
0.637569
1d1fc7fe8a650be7be59cf79a7dfc480ccb2bd04
2,751
module Member class Initializer # login node Cms::Node.plugin "member/login" # registration node Cms::Node.plugin "member/registration" # mypage nodes Cms::Node.plugin "member/mypage" Cms::Node.plugin "member/my_profile" Cms::Node.plugin "member/my_blog" Cms::Node.plugin "member/my_photo" # public nodes Cms::Node.plugin "member/blog" Cms::Node.plugin "member/blog_page_location" Cms::Node.plugin "member/photo" Cms::Node.plugin "member/photo_search" Cms::Node.plugin "member/photo_category" Cms::Node.plugin "member/photo_location" Cms::Node.plugin "member/photo_spot" # anpi Cms::Node.plugin "member/my_anpi_post" Cms::Node.plugin "member/my_group" Cms::Part.plugin "member/login" Cms::Part.plugin "member/blog_page" Cms::Part.plugin "member/photo" Cms::Part.plugin "member/photo_search" Cms::Part.plugin "member/photo_slide" Cms::Part.plugin "member/invited_group" Cms::Role.permission :read_other_member_blogs Cms::Role.permission :read_private_member_blogs Cms::Role.permission :edit_other_member_blogs Cms::Role.permission :edit_private_member_blogs Cms::Role.permission :delete_other_member_blogs Cms::Role.permission :delete_private_member_blogs Cms::Role.permission :release_other_member_blogs Cms::Role.permission :release_private_member_blogs Cms::Role.permission :approve_other_member_blogs Cms::Role.permission :approve_private_member_blogs Cms::Role.permission :reroute_other_member_blogs Cms::Role.permission :reroute_private_member_blogs Cms::Role.permission :revoke_other_member_blogs Cms::Role.permission :revoke_private_member_blogs Cms::Role.permission :read_other_member_photos Cms::Role.permission :read_private_member_photos Cms::Role.permission :edit_other_member_photos Cms::Role.permission :edit_private_member_photos Cms::Role.permission :delete_other_member_photos Cms::Role.permission :delete_private_member_photos Cms::Role.permission :release_other_member_photos Cms::Role.permission :release_private_member_photos Cms::Role.permission :approve_other_member_photos Cms::Role.permission :approve_private_member_photos Cms::Role.permission :reroute_other_member_photos Cms::Role.permission :reroute_private_member_photos Cms::Role.permission :revoke_other_member_photos Cms::Role.permission :revoke_private_member_photos SS::File.model "member/photo", Member::PhotoFile, permit: %i(role) SS::File.model "member/blog_page", Member::File, permit: %i(role) SS::File.model "member/temp_file", Member::File SS::File.model "member/node/blog_page", SS::File, permit: %i(role) end end
38.746479
70
0.754635
ffad6e3806535802fac6666fd0e3bccf92cd7e24
408
require File.expand_path('../lib/active_file/version', __FILE__) Gem::Specification.new do |gem| gem.name = "active_file" gem.version = ActiveFile::VERSION gem.description = "Just a file system database" gem.summary = "Just a file system database" gem.author = "Lucas Souza" gem.files = Dir["{lib/**/*.rb,lib/tasks/*.rake,README.md,Rakefile,active_file.gemspec}"] end
34
96
0.671569
910a4124ebe64d7abdf196065359fa497ffcfc68
158
class CreateEntities < ActiveRecord::Migration[6.1] def change create_table :entities do |t| t.string :name t.timestamps end end end
15.8
51
0.664557
7a189cd36acfe22d781f51810407a24bfe9e06ab
11,754
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class with default "from" parameter. config.mailer_sender = "[email protected]" config.secret_key = '8c6059a264b4a8fb117c5c2322e621a077aa304637d32282eec6ee4ef5f228a3eafade1b514dc044749e8c73a82de66f9e34130cc78e3c5f78dff5d6e3e66c22' # Configure the class responsible to send e-mails. # config.mailer = "Devise::Mailer" # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. # config.authentication_keys = [ :email ] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [ :email ] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [ :email ] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Basic Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:token]` will # enable it only for token authentication. # config.http_authenticatable = false # If http headers should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. "Application" by default. # config.http_authentication_realm = "Application" # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # :http_auth and :token_auth by adding those symbols to the array below. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing :skip => :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 10. If # using other encryptors, it sets how many times you want the password re-encrypted. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. config.stretches = Rails.env.test? ? 1 : 10 # Setup a pepper to generate the encrypted password. # config.pepper = "b0696289fbc8ea37b0d3277ec314c4ed53a0d4060b1cb13eff19b34c01444528c7cb1c4882bfefac59d2a7c7a79544ab00ae49bf853220707e30f73ea92f0333" # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming his account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming his account, # access will be blocked just in the third day. Default is 0.days, meaning # the user cannot access the website without confirming his account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed new email is stored in # unconfirmed email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account # config.confirmation_keys = [ :email ] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # :secure => true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. Default is 8..128. config.password_length = 4..128 # Email regex used to validate email formats. It simply asserts that # an one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. # config.email_regexp = /\A[^@]+@[^@]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # If true, expires auth token on session timeout. # config.expire_auth_token_on_timeout = false # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [ :email ] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [ :email ] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 6.hours # ==> Configuration for :encryptable # Allow you to use another encryption algorithm besides bcrypt (default). You can use # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) # and :restful_authentication_sha1 (then you should set stretches to 10, and copy # REST_AUTH_SITE_KEY to pepper) # config.encryptor = :sha512 # ==> Configuration for :token_authenticatable # Defines name of the authentication token params key # config.token_authentication_key = :auth_token # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ["*/*", :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(:scope => :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: "/my_engine" # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using omniauth, Devise cannot automatically set Omniauth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = "/my_engine/users/auth" end
48.570248
152
0.748511
e8144ac44891109dddb91c5265651d3f364a1f6a
720
module FHIR # fhir/sort_direction.rb class SortDirection < PrimitiveCode include Mongoid::Document def as_json(*args) result = super result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end def self.transform_json(json_hash, extension_hash, target = SortDirection.new) result = target unless extension_hash.nil? result['fhirId'] = extension_hash['id'] unless extension_hash['id'].nil? result['extension'] = extension_hash['extension'].map { |ext| Extension.transform_json(ext) } end result['value'] = json_hash result end end end
25.714286
101
0.626389
f7c8b5ef614107d8842b94fc2c47ff11e97297b4
438
class UsersController < ApplicationController def index @users = User.all render json: @users, include:[:recipes] end def show @user = User.find params[:id] render json: @user, include:[:recipes] end def create @user = User.create( name: params[:name], age: params[:age] ) redirect_to "http://localhost:3001/user_select.html" end end
24.333333
60
0.568493
913b7c8cfc4c4411a06a1b4490cf77694336ef30
27,896
require "abstract_unit" module CallbacksTest class Record include ActiveSupport::Callbacks define_callbacks :save def self.before_save(*filters, &blk) set_callback(:save, :before, *filters, &blk) end def self.after_save(*filters, &blk) set_callback(:save, :after, *filters, &blk) end class << self def callback_symbol(callback_method) method_name = :"#{callback_method}_method" define_method(method_name) do history << [callback_method, :symbol] end method_name end def callback_string(callback_method) "history << [#{callback_method.to_sym.inspect}, :string]" end def callback_proc(callback_method) Proc.new { |model| model.history << [callback_method, :proc] } end def callback_object(callback_method) klass = Class.new klass.send(:define_method, callback_method) do |model| model.history << [:"#{callback_method}_save", :object] end klass.new end end def history @history ||= [] end end class CallbackClass def self.before(model) model.history << [:before_save, :class] end def self.after(model) model.history << [:after_save, :class] end end class Person < Record [:before_save, :after_save].each do |callback_method| callback_method_sym = callback_method.to_sym send(callback_method, callback_symbol(callback_method_sym)) ActiveSupport::Deprecation.silence { send(callback_method, callback_string(callback_method_sym)) } send(callback_method, callback_proc(callback_method_sym)) send(callback_method, callback_object(callback_method_sym.to_s.gsub(/_save/, ""))) send(callback_method, CallbackClass) send(callback_method) { |model| model.history << [callback_method_sym, :block] } end def save run_callbacks :save end end class PersonSkipper < Person skip_callback :save, :before, :before_save_method, if: :yes skip_callback :save, :after, :after_save_method, unless: :yes skip_callback :save, :after, :after_save_method, if: :no skip_callback :save, :before, :before_save_method, unless: :no skip_callback :save, :before, CallbackClass , if: :yes def yes; true; end def no; false; end end class PersonForProgrammaticSkipping < Person end class ParentController include ActiveSupport::Callbacks define_callbacks :dispatch set_callback :dispatch, :before, :log, unless: proc {|c| c.action_name == :index || c.action_name == :show } set_callback :dispatch, :after, :log2 attr_reader :action_name, :logger def initialize(action_name) @action_name, @logger = action_name, [] end def log @logger << action_name end def log2 @logger << action_name end def dispatch run_callbacks :dispatch do @logger << "Done" end self end end class Child < ParentController skip_callback :dispatch, :before, :log, if: proc {|c| c.action_name == :update} skip_callback :dispatch, :after, :log2 end class OneTimeCompile < Record @@starts_true, @@starts_false = true, false def initialize super end before_save Proc.new {|r| r.history << [:before_save, :starts_true, :if] }, if: :starts_true before_save Proc.new {|r| r.history << [:before_save, :starts_false, :if] }, if: :starts_false before_save Proc.new {|r| r.history << [:before_save, :starts_true, :unless] }, unless: :starts_true before_save Proc.new {|r| r.history << [:before_save, :starts_false, :unless] }, unless: :starts_false def starts_true if @@starts_true @@starts_true = false return true end @@starts_true end def starts_false unless @@starts_false @@starts_false = true return false end @@starts_false end def save run_callbacks :save end end class OneTimeCompileTest < ActiveSupport::TestCase def test_optimized_first_compile around = OneTimeCompile.new around.save assert_equal [ [:before_save, :starts_true, :if], [:before_save, :starts_true, :unless] ], around.history end end class AfterSaveConditionalPerson < Record after_save Proc.new { |r| r.history << [:after_save, :string1] } after_save Proc.new { |r| r.history << [:after_save, :string2] } def save run_callbacks :save end end class AfterSaveConditionalPersonCallbackTest < ActiveSupport::TestCase def test_after_save_runs_in_the_reverse_order person = AfterSaveConditionalPerson.new person.save assert_equal [ [:after_save, :string2], [:after_save, :string1] ], person.history end end class ConditionalPerson < Record # proc before_save Proc.new { |r| r.history << [:before_save, :proc] }, if: Proc.new { |r| true } before_save Proc.new { |r| r.history << "b00m" }, if: Proc.new { |r| false } before_save Proc.new { |r| r.history << [:before_save, :proc] }, unless: Proc.new { |r| false } before_save Proc.new { |r| r.history << "b00m" }, unless: Proc.new { |r| true } # symbol before_save Proc.new { |r| r.history << [:before_save, :symbol] }, if: :yes before_save Proc.new { |r| r.history << "b00m" }, if: :no before_save Proc.new { |r| r.history << [:before_save, :symbol] }, unless: :no before_save Proc.new { |r| r.history << "b00m" }, unless: :yes # string before_save Proc.new { |r| r.history << [:before_save, :string] }, if: "yes" before_save Proc.new { |r| r.history << "b00m" }, if: "no" before_save Proc.new { |r| r.history << [:before_save, :string] }, unless: "no" before_save Proc.new { |r| r.history << "b00m" }, unless: "yes" # Combined if and unless before_save Proc.new { |r| r.history << [:before_save, :combined_symbol] }, if: :yes, unless: :no before_save Proc.new { |r| r.history << "b00m" }, if: :yes, unless: :yes def yes; true; end def other_yes; true; end def no; false; end def other_no; false; end def save run_callbacks :save end end class CleanPerson < ConditionalPerson reset_callbacks :save end class MySuper include ActiveSupport::Callbacks define_callbacks :save end class AroundPerson < MySuper attr_reader :history set_callback :save, :before, :nope, if: :no set_callback :save, :before, :nope, unless: :yes set_callback :save, :after, :tweedle ActiveSupport::Deprecation.silence { set_callback :save, :before, "tweedle_dee" } set_callback :save, :before, proc {|m| m.history << "yup" } set_callback :save, :before, :nope, if: proc { false } set_callback :save, :before, :nope, unless: proc { true } set_callback :save, :before, :yup, if: proc { true } set_callback :save, :before, :yup, unless: proc { false } set_callback :save, :around, :tweedle_dum set_callback :save, :around, :w0tyes, if: :yes set_callback :save, :around, :w0tno, if: :no set_callback :save, :around, :tweedle_deedle def no; false; end def yes; true; end def nope @history << "boom" end def yup @history << "yup" end def w0tyes @history << "w0tyes before" yield @history << "w0tyes after" end def w0tno @history << "boom" yield end def tweedle_dee @history << "tweedle dee" end def tweedle_dum @history << "tweedle dum pre" yield @history << "tweedle dum post" end def tweedle @history << "tweedle" end def tweedle_deedle @history << "tweedle deedle pre" yield @history << "tweedle deedle post" end def initialize @history = [] end def save run_callbacks :save do @history << "running" end end end class AroundPersonResult < MySuper attr_reader :result set_callback :save, :after, :tweedle_1 set_callback :save, :around, :tweedle_dum set_callback :save, :after, :tweedle_2 def tweedle_dum @result = yield end def tweedle_1 :tweedle_1 end def tweedle_2 :tweedle_2 end def save run_callbacks :save do :running end end end class HyphenatedCallbacks include ActiveSupport::Callbacks define_callbacks :save attr_reader :stuff set_callback :save, :before, :action, if: :yes def yes() true end def action @stuff = "ACTION" end def save run_callbacks :save do @stuff end end end module ExtendModule def self.extended(base) base.class_eval do set_callback :save, :before, :record3 end end def record3 @recorder << 3 end end module IncludeModule def self.included(base) base.class_eval do set_callback :save, :before, :record2 end end def record2 @recorder << 2 end end class ExtendCallbacks include ActiveSupport::Callbacks define_callbacks :save set_callback :save, :before, :record1 include IncludeModule def save run_callbacks :save end attr_reader :recorder def initialize @recorder = [] end private def record1 @recorder << 1 end end class AroundCallbacksTest < ActiveSupport::TestCase def test_save_around around = AroundPerson.new around.save assert_equal [ "tweedle dee", "yup", "yup", "tweedle dum pre", "w0tyes before", "tweedle deedle pre", "running", "tweedle deedle post", "w0tyes after", "tweedle dum post", "tweedle" ], around.history end end class AroundCallbackResultTest < ActiveSupport::TestCase def test_save_around around = AroundPersonResult.new around.save assert_equal :running, around.result end end class SkipCallbacksTest < ActiveSupport::TestCase def test_skip_person person = PersonSkipper.new assert_equal [], person.history person.save assert_equal [ [:before_save, :string], [:before_save, :proc], [:before_save, :object], [:before_save, :block], [:after_save, :block], [:after_save, :class], [:after_save, :object], [:after_save, :proc], [:after_save, :string], [:after_save, :symbol] ], person.history end def test_skip_person_programmatically PersonForProgrammaticSkipping._save_callbacks.each do |save_callback| if "before" == save_callback.kind.to_s PersonForProgrammaticSkipping.skip_callback("save", save_callback.kind, save_callback.filter) end end person = PersonForProgrammaticSkipping.new assert_equal [], person.history person.save assert_equal [ [:after_save, :block], [:after_save, :class], [:after_save, :object], [:after_save, :proc], [:after_save, :string], [:after_save, :symbol] ], person.history end end class CallbacksTest < ActiveSupport::TestCase def test_save_person person = Person.new assert_equal [], person.history person.save assert_equal [ [:before_save, :symbol], [:before_save, :string], [:before_save, :proc], [:before_save, :object], [:before_save, :class], [:before_save, :block], [:after_save, :block], [:after_save, :class], [:after_save, :object], [:after_save, :proc], [:after_save, :string], [:after_save, :symbol] ], person.history end end class ConditionalCallbackTest < ActiveSupport::TestCase def test_save_conditional_person person = ConditionalPerson.new person.save assert_equal [ [:before_save, :proc], [:before_save, :proc], [:before_save, :symbol], [:before_save, :symbol], [:before_save, :string], [:before_save, :string], [:before_save, :combined_symbol], ], person.history end end class ResetCallbackTest < ActiveSupport::TestCase def test_save_conditional_person person = CleanPerson.new person.save assert_equal [], person.history end end class AbstractCallbackTerminator include ActiveSupport::Callbacks def self.set_save_callbacks set_callback :save, :before, :first set_callback :save, :before, :second set_callback :save, :around, :around_it set_callback :save, :before, :third set_callback :save, :after, :first set_callback :save, :around, :around_it set_callback :save, :after, :third end attr_reader :history, :saved, :halted def initialize @history = [] end def around_it @history << "around1" yield @history << "around2" end def first @history << "first" end def second @history << "second" :halt end def third @history << "third" end def save run_callbacks :save do @saved = true end end def halted_callback_hook(filter) @halted = filter end end class CallbackTerminator < AbstractCallbackTerminator define_callbacks :save, terminator: ->(_, result_lambda) { result_lambda.call == :halt } set_save_callbacks end class CallbackTerminatorSkippingAfterCallbacks < AbstractCallbackTerminator define_callbacks :save, terminator: ->(_, result_lambda) { result_lambda.call == :halt }, skip_after_callbacks_if_terminated: true set_save_callbacks end class CallbackDefaultTerminator < AbstractCallbackTerminator define_callbacks :save def second @history << "second" throw(:abort) end set_save_callbacks end class CallbackFalseTerminator < AbstractCallbackTerminator define_callbacks :save def second @history << "second" false end set_save_callbacks end class CallbackObject def before(caller) caller.record << "before" end def before_save(caller) caller.record << "before save" end def around(caller) caller.record << "around before" yield caller.record << "around after" end end class UsingObjectBefore include ActiveSupport::Callbacks define_callbacks :save set_callback :save, :before, CallbackObject.new attr_accessor :record def initialize @record = [] end def save run_callbacks :save do @record << "yielded" end end end class UsingObjectAround include ActiveSupport::Callbacks define_callbacks :save set_callback :save, :around, CallbackObject.new attr_accessor :record def initialize @record = [] end def save run_callbacks :save do @record << "yielded" end end end class CustomScopeObject include ActiveSupport::Callbacks define_callbacks :save, scope: [:kind, :name] set_callback :save, :before, CallbackObject.new attr_accessor :record def initialize @record = [] end def save run_callbacks :save do @record << "yielded" "CallbackResult" end end end class OneTwoThreeSave include ActiveSupport::Callbacks define_callbacks :save attr_accessor :record def initialize @record = [] end def save run_callbacks :save do @record << "yielded" end end def first @record << "one" end def second @record << "two" end def third @record << "three" end end class DuplicatingCallbacks < OneTwoThreeSave set_callback :save, :before, :first, :second set_callback :save, :before, :first, :third end class DuplicatingCallbacksInSameCall < OneTwoThreeSave set_callback :save, :before, :first, :second, :first, :third end class UsingObjectTest < ActiveSupport::TestCase def test_before_object u = UsingObjectBefore.new u.save assert_equal ["before", "yielded"], u.record end def test_around_object u = UsingObjectAround.new u.save assert_equal ["around before", "yielded", "around after"], u.record end def test_customized_object u = CustomScopeObject.new u.save assert_equal ["before save", "yielded"], u.record end def test_block_result_is_returned u = CustomScopeObject.new assert_equal "CallbackResult", u.save end end class CallbackTerminatorTest < ActiveSupport::TestCase def test_termination_skips_following_before_and_around_callbacks terminator = CallbackTerminator.new terminator.save assert_equal ["first", "second", "third", "first"], terminator.history end def test_termination_invokes_hook terminator = CallbackTerminator.new terminator.save assert_equal :second, terminator.halted end def test_block_never_called_if_terminated obj = CallbackTerminator.new obj.save assert !obj.saved end end class CallbackTerminatorSkippingAfterCallbacksTest < ActiveSupport::TestCase def test_termination_skips_after_callbacks terminator = CallbackTerminatorSkippingAfterCallbacks.new terminator.save assert_equal ["first", "second"], terminator.history end end class CallbackDefaultTerminatorTest < ActiveSupport::TestCase def test_default_termination terminator = CallbackDefaultTerminator.new terminator.save assert_equal ["first", "second", "third", "first"], terminator.history end def test_default_termination_invokes_hook terminator = CallbackDefaultTerminator.new terminator.save assert_equal :second, terminator.halted end def test_block_never_called_if_abort_is_thrown obj = CallbackDefaultTerminator.new obj.save assert !obj.saved end end class CallbackFalseTerminatorWithoutConfigTest < ActiveSupport::TestCase def test_returning_false_does_not_halt_callback_if_config_variable_is_not_set obj = CallbackFalseTerminator.new obj.save assert_equal nil, obj.halted assert obj.saved end end class CallbackFalseTerminatorWithConfigTrueTest < ActiveSupport::TestCase def setup ActiveSupport::Callbacks.halt_and_display_warning_on_return_false = true end def test_returning_false_does_not_halt_callback_if_config_variable_is_true obj = CallbackFalseTerminator.new obj.save assert_equal nil, obj.halted assert obj.saved end end class CallbackFalseTerminatorWithConfigFalseTest < ActiveSupport::TestCase def setup ActiveSupport::Callbacks.halt_and_display_warning_on_return_false = false end def test_returning_false_does_not_halt_callback_if_config_variable_is_false obj = CallbackFalseTerminator.new obj.save assert_equal nil, obj.halted assert obj.saved end end class HyphenatedKeyTest < ActiveSupport::TestCase def test_save obj = HyphenatedCallbacks.new obj.save assert_equal "ACTION", obj.stuff end end class WriterSkipper < Person attr_accessor :age skip_callback :save, :before, :before_save_method, if: -> { age > 21 } end class WriterCallbacksTest < ActiveSupport::TestCase def test_skip_writer writer = WriterSkipper.new writer.age = 18 assert_equal [], writer.history writer.save assert_equal [ [:before_save, :symbol], [:before_save, :string], [:before_save, :proc], [:before_save, :object], [:before_save, :class], [:before_save, :block], [:after_save, :block], [:after_save, :class], [:after_save, :object], [:after_save, :proc], [:after_save, :string], [:after_save, :symbol] ], writer.history end end class ExtendCallbacksTest < ActiveSupport::TestCase def test_save model = ExtendCallbacks.new.extend ExtendModule model.save assert_equal [1, 2, 3], model.recorder end end class ExcludingDuplicatesCallbackTest < ActiveSupport::TestCase def test_excludes_duplicates_in_separate_calls model = DuplicatingCallbacks.new model.save assert_equal ["two", "one", "three", "yielded"], model.record end def test_excludes_duplicates_in_one_call model = DuplicatingCallbacksInSameCall.new model.save assert_equal ["two", "one", "three", "yielded"], model.record end end class CallbackProcTest < ActiveSupport::TestCase def build_class(callback) Class.new { include ActiveSupport::Callbacks define_callbacks :foo set_callback :foo, :before, callback def run; run_callbacks :foo; end } end def test_proc_arity_0 calls = [] klass = build_class(->() { calls << :foo }) klass.new.run assert_equal [:foo], calls end def test_proc_arity_1 calls = [] klass = build_class(->(o) { calls << o }) instance = klass.new instance.run assert_equal [instance], calls end def test_proc_arity_2 assert_raises(ArgumentError) do klass = build_class(->(x,y) { }) klass.new.run end end def test_proc_negative_called_with_empty_list calls = [] klass = build_class(->(*args) { calls << args }) klass.new.run assert_equal [[]], calls end end class ConditionalTests < ActiveSupport::TestCase def build_class(callback) Class.new { include ActiveSupport::Callbacks define_callbacks :foo set_callback :foo, :before, :foo, if: callback def foo; end def run; run_callbacks :foo; end } end # FIXME: do we really want to support classes as conditionals? There were # no tests for it previous to this. def test_class_conditional_with_scope z = [] callback = Class.new { define_singleton_method(:foo) { |o| z << o } } klass = Class.new { include ActiveSupport::Callbacks define_callbacks :foo, scope: [:name] set_callback :foo, :before, :foo, if: callback def run; run_callbacks :foo; end private def foo; end } object = klass.new object.run assert_equal [object], z end # FIXME: do we really want to support classes as conditionals? There were # no tests for it previous to this. def test_class z = [] klass = build_class Class.new { define_singleton_method(:before) { |o| z << o } } object = klass.new object.run assert_equal [object], z end def test_proc_negative_arity # passes an empty list if *args z = [] object = build_class(->(*args) { z << args }).new object.run assert_equal [], z.flatten end def test_proc_arity0 z = [] object = build_class(->() { z << 0 }).new object.run assert_equal [0], z end def test_proc_arity1 z = [] object = build_class(->(x) { z << x }).new object.run assert_equal [object], z end def test_proc_arity2 assert_raises(ArgumentError) do object = build_class(->(a,b) { }).new object.run end end end class ResetCallbackTest < ActiveSupport::TestCase def build_class(memo) klass = Class.new { include ActiveSupport::Callbacks define_callbacks :foo set_callback :foo, :before, :hello def run; run_callbacks :foo; end } klass.class_eval { define_method(:hello) { memo << :hi } } klass end def test_reset_callbacks events = [] klass = build_class events klass.new.run assert_equal 1, events.length klass.reset_callbacks :foo klass.new.run assert_equal 1, events.length end def test_reset_impacts_subclasses events = [] klass = build_class events subclass = Class.new(klass) { set_callback :foo, :before, :world } subclass.class_eval { define_method(:world) { events << :world } } subclass.new.run assert_equal 2, events.length klass.reset_callbacks :foo subclass.new.run assert_equal 3, events.length end end class CallbackTypeTest < ActiveSupport::TestCase def build_class(callback, n = 10) Class.new { include ActiveSupport::Callbacks define_callbacks :foo n.times { set_callback :foo, :before, callback } def run; run_callbacks :foo; end def self.skip(*things); skip_callback :foo, :before, *things; end } end def test_add_class calls = [] callback = Class.new { define_singleton_method(:before) { |o| calls << o } } build_class(callback).new.run assert_equal 10, calls.length end def test_add_lambda calls = [] build_class(->(o) { calls << o }).new.run assert_equal 10, calls.length end def test_add_symbol calls = [] klass = build_class(:bar) klass.class_eval { define_method(:bar) { calls << klass } } klass.new.run assert_equal 1, calls.length end def test_add_eval calls = [] klass = ActiveSupport::Deprecation.silence { build_class("bar") } klass.class_eval { define_method(:bar) { calls << klass } } klass.new.run assert_equal 1, calls.length end def test_skip_class # removes one at a time calls = [] callback = Class.new { define_singleton_method(:before) { |o| calls << o } } klass = build_class(callback) 9.downto(0) { |i| klass.skip callback klass.new.run assert_equal i, calls.length calls.clear } end def test_skip_lambda # raises error calls = [] callback = ->(o) { calls << o } klass = build_class(callback) assert_raises(ArgumentError) { klass.skip callback } klass.new.run assert_equal 10, calls.length end def test_skip_symbol # removes all calls = [] klass = build_class(:bar) klass.class_eval { define_method(:bar) { calls << klass } } klass.skip :bar klass.new.run assert_equal 0, calls.length end def test_skip_string # raises error calls = [] klass = ActiveSupport::Deprecation.silence { build_class("bar") } klass.class_eval { define_method(:bar) { calls << klass } } assert_raises(ArgumentError) { klass.skip "bar" } klass.new.run assert_equal 1, calls.length end def test_skip_undefined_callback # raises error calls = [] klass = build_class(:bar) klass.class_eval { define_method(:bar) { calls << klass } } assert_raises(ArgumentError) { klass.skip :qux } klass.new.run assert_equal 1, calls.length end def test_skip_without_raise # removes nothing calls = [] klass = build_class(:bar) klass.class_eval { define_method(:bar) { calls << klass } } klass.skip :qux, raise: false klass.new.run assert_equal 1, calls.length end end class DeprecatedWarningTest < ActiveSupport::TestCase def test_deprecate_string_callback klass = Class.new(Record) assert_deprecated do klass.send :before_save, "tweedle_dee" end end end end
24.929401
112
0.632707
91b05698465a68c762cf44d89fb6dc630dafd7e1
21,214
require "bundler" require "bundler/vendored_thor" module Bundler class CLI < Thor include Thor::Actions AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean) def self.start(*) super rescue Exception => e Bundler.ui = UI::Shell.new raise e end def initialize(*args) super custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty? Bundler.settings[:retry] = options[:retry] if options[:retry] current_cmd = args.last[:current_command].name auto_install if AUTO_INSTALL_CMDS.include?(current_cmd) rescue UnknownArgumentError => e raise InvalidOption, e.message ensure self.options ||= {} Bundler.ui = UI::Shell.new(options) Bundler.ui.level = "debug" if options["verbose"] if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty? Bundler.ui.warn( "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \ "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \ "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true) end end check_unknown_options!(:except => [:config, :exec]) stop_on_unknown_option! :exec default_task :install class_option "no-color", :type => :boolean, :desc => "Disable colorization in output" class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM", :desc => "Specify the number of times you wish to attempt network commands" class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V" def help(cli = nil) case cli when "gemfile" then command = "gemfile.5" when nil then command = "bundle" else command = "bundle-#{cli}" end manpages = %w( bundle bundle-config bundle-exec bundle-gem bundle-install bundle-package bundle-update bundle-platform gemfile.5) if manpages.include?(command) root = File.expand_path("../man", __FILE__) if Bundler.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{root}/#{command}" else puts File.read("#{root}/#{command}.txt") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") else super end end def self.handle_no_command_error(command, has_namespace = $thor_runner) return super unless command_path = Bundler.which("bundler-#{command}") Kernel.exec(command_path, *ARGV[1..-1]) end desc "init [OPTIONS]", "Generates a Gemfile into the current working directory" long_desc <<-D Init generates a default Gemfile in the current working directory. When adding a Gemfile to a gem with a gemspec, the --gemspec option will automatically add each dependency listed in the gemspec file to the newly created Gemfile. D method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile" def init require "bundler/cli/init" Init.new(options.dup).run end desc "check [OPTIONS]", "Checks if the dependencies listed in Gemfile are satisfied by currently installed gems" long_desc <<-D Check searches the local machine for each of the gems requested in the Gemfile. If all gems are found, Bundler prints a success message and exits with a status of 0. If not, the first missing gem is listed and Bundler exits status 1. D method_option "dry-run", :type => :boolean, :default => false, :banner => "Lock the Gemfile" method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" map "c" => "check" def check require "bundler/cli/check" Check.new(options).run end desc "install [OPTIONS]", "Install the current environment to the system" long_desc <<-D Install will install all of the gems in the current bundle, making them available for use. In a freshly checked out repository, this command will give you the same gem versions as the last person who updated the Gemfile and ran `bundle update`. Passing [DIR] to install (e.g. vendor) will cause the unpacked gems to be installed into the [DIR] directory rather than into system gems. If the bundle has already been installed, bundler will tell you so and then exit. D method_option "binstubs", :type => :string, :lazy_default => "bin", :banner => "Generate bin stubs for bundled gems to ./bin" method_option "clean", :type => :boolean, :banner => "Run bundle clean automatically after install" method_option "deployment", :type => :boolean, :banner => "Install using defaults tuned for deployment environments" method_option "frozen", :type => :boolean, :banner => "Do not allow the Gemfile.lock to be updated after this install" method_option "full-index", :type => :boolean, :banner => "Fall back to using the single-file index of all gems" method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" method_option "jobs", :aliases => "-j", :type => :numeric, :banner => "Specify the number of jobs to run in parallel" method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "no-cache", :type => :boolean, :banner => "Don't update the existing gem cache." method_option "force", :type => :boolean, :banner => "Force downloading every gem." method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." method_option "shebang", :type => :string, :banner => "Specify a different shebang executable name than the default (usually 'ruby')" method_option "standalone", :type => :array, :lazy_default => [], :banner => "Make a bundle that can work without the Bundler runtime" method_option "system", :type => :boolean, :banner => "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application" method_option "trust-policy", :alias => "P", :type => :string, :banner => "Gem trust policy (like gem install -P). Must be one of " + Bundler.rubygems.security_policy_keys.join("|") method_option "without", :type => :array, :banner => "Exclude gems that are part of the specified named group." method_option "with", :type => :array, :banner => "Include gems that are part of the specified named group." map "i" => "install" def install require "bundler/cli/install" Install.new(options.dup).run end desc "update [OPTIONS]", "update the current environment" long_desc <<-D Update will install the newest versions of the gems listed in the Gemfile. Use update when you have changed the Gemfile, or if you want to get the newest possible versions of the gems in the bundle. D method_option "full-index", :type => :boolean, :banner => "Fall back to using the single-file index of all gems" method_option "group", :aliases => "-g", :type => :array, :banner => "Update a specific group" method_option "jobs", :aliases => "-j", :type => :numeric, :banner => "Specify the number of jobs to run in parallel" method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)" method_option "force", :type => :boolean, :banner => "Force downloading every gem." method_option "ruby", :type => :boolean, :banner => "Update ruby specified in Gemfile.lock" def update(*gems) require "bundler/cli/update" Update.new(options, gems).run end desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem" long_desc <<-D Show lists the names and versions of all gems that are required by your Gemfile. Calling show with [GEM] will list the exact location of that gem on your machine. D method_option "paths", :type => :boolean, :banner => "List the paths of all gems that are required by your Gemfile." method_option "outdated", :type => :boolean, :banner => "Show verbose output including whether gems are outdated." def show(gem_name = nil) require "bundler/cli/show" Show.new(options, gem_name).run end map %w(list) => "show" desc "binstubs GEM [OPTIONS]", "Install the binstubs of the listed gem" long_desc <<-D Generate binstubs for executables in [GEM]. Binstubs are put into bin, or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]] will create binstubs for all given gems. D method_option "force", :type => :boolean, :default => false, :banner => "Overwrite existing binstubs if they exist" method_option "path", :type => :string, :lazy_default => "bin", :banner => "Binstub destination directory (default bin)" def binstubs(*gems) require "bundler/cli/binstubs" Binstubs.new(options, gems).run end desc "outdated GEM [OPTIONS]", "list installed gems with newer versions available" long_desc <<-D Outdated lists the names and versions of gems that have a newer version available in the given source. Calling outdated with [GEM [GEM]] will only check for newer versions of the given gems. Prerelease gems are ignored by default. If your gems are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1. D method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems" method_option "source", :type => :array, :banner => "Check against a specific source" method_option "strict", :type => :boolean, :banner => "Only list newer versions allowed by your Gemfile requirements" def outdated(*gems) require "bundler/cli/outdated" Outdated.new(options, gems).run end desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)." method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one" method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." def cache require "bundler/cli/cache" Cache.new(options).run end desc "package [OPTIONS]", "Locks and then caches all of the gems into vendor/cache" method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)." method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one" method_option "cache-path", :type => :string, :banner => "Specify a different cache path than the default (vendor/cache)." method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package." method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." long_desc <<-D The package command will copy the .gem files for every gem in the bundle into the directory ./vendor/cache. If you then check that directory into your source control repository, others who check out your source will be able to install the bundle without having to download any additional gems. D def package require "bundler/cli/package" Package.new(options).run end map %w(pack) => :package desc "exec [OPTIONS]", "Run the command in context of the bundle" method_option :keep_file_descriptors, :type => :boolean, :default => false long_desc <<-D Exec runs a command, providing it access to the gems in the bundle. While using bundle exec you can require and call the bundled gems as if they were installed into the system wide Rubygems repository. D map "e" => "exec" def exec(*args) require "bundler/cli/exec" Exec.new(options, args).run end desc "config NAME [VALUE]", "retrieve or set a configuration value" long_desc <<-D Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the existing value with the newly provided one. By default, setting a configuration value sets it for all projects on the machine. If a global setting is superceded by local configuration, this command will show the current value, as well as any superceded values and where they were specified. D def config(*args) require "bundler/cli/config" Config.new(options, args, self).run end desc "open GEM", "Opens the source directory of the given bundled gem" def open(name) require "bundler/cli/open" Open.new(options, name).run end desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded" def console(group = nil) require "bundler/cli/console" Console.new(options, group).run end desc "version", "Prints the bundler's version information" def version Bundler.ui.info "Bundler version #{Bundler::VERSION}" end map %w(-v --version) => :version desc "licenses", "Prints the license of all gems in the bundle" def licenses Bundler.load.specs.sort_by {|s| s.license.to_s }.reverse_each do |s| gem_name = s.name license = s.license || s.licenses if license.empty? Bundler.ui.warn "#{gem_name}: Unknown" else Bundler.ui.info "#{gem_name}: #{license}" end end end desc "viz [OPTIONS]", "Generates a visual dependency graph" long_desc <<-D Viz generates a PNG file of the current Gemfile as a dependency graph. Viz requires the ruby-graphviz gem (and its dependencies). The associated gems must also be installed via 'bundle install'. D method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :banner => "The name to use for the generated file. see format option" method_option :format, :type => :string, :default => "png", :aliases => "-F", :banner => "This is output format option. Supported format is png, jpg, svg, dot ..." method_option :requirements, :type => :boolean, :default => false, :aliases => "-r", :banner => "Set to show the version of each required dependency." method_option :version, :type => :boolean, :default => false, :aliases => "-v", :banner => "Set to show each gem version." method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group." def viz require "bundler/cli/viz" Viz.new(options).run end desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem" method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library." method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code" method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config gem.mit true`." method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec", :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`." def gem(name) require "bundler/cli/gem" Gem.new(options, name, self).run end def self.source_root File.expand_path(File.join(File.dirname(__FILE__), "templates")) end desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory" method_option "dry-run", :type => :boolean, :default => false, :banner => "Only print out changes, do not actually clean gems" method_option "force", :type => :boolean, :default => false, :banner => "Forces clean even if --path is not set" def clean require "bundler/cli/clean" Clean.new(options.dup).run end desc "platform [OPTIONS]", "Displays platform compatibility information" method_option "ruby", :type => :boolean, :default => false, :banner => "only display ruby related platform information" def platform require "bundler/cli/platform" Platform.new(options).run end desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile" def inject(name, version, *gems) require "bundler/cli/inject" Inject.new(options, name, version, gems).run end desc "lock", "Creates a lockfile without installing" method_option "update", :type => :array, :lazy_default => [], :banner => "ignore the existing lockfile, update all gems by default, or update list of given gems" method_option "local", :type => :boolean, :default => false, :banner => "do not attempt to fetch remote gemspecs and use the local gem cache only" method_option "print", :type => :boolean, :default => false, :banner => "print the lockfile to STDOUT instead of writing to the file system" method_option "lockfile", :type => :string, :default => nil, :banner => "the path the lockfile should be written to" method_option "full-index", :type => :boolean, :default => false, :banner => "Fall back to using the single-file index of all gems" def lock require "bundler/cli/lock" Lock.new(options).run end desc "env", "Print information about the environment Bundler is running under" def env Env.new.write($stdout) end # Reformat the arguments passed to bundle that include a --help flag # into the corresponding `bundle help #{command}` call def self.reformatted_help_args(args) bundler_commands = all_commands.keys command = args.select {|a| bundler_commands.include? a } if command.empty? abort("Could not find command \"#{args.join(" ")}\".") else command = command.first end ["help", command] end private # Automatically invoke `bundle install` and resume if # Bundler.settings[:auto_install] exists. This is set through config cmd # `bundle config auto_install 1`. # # Note that this method `nil`s out the global Definition object, so it # should be called first, before you instantiate anything like an # `Installer` that'll keep a reference to the old one instead. def auto_install return unless Bundler.settings[:auto_install] begin Bundler.definition.specs rescue GemNotFound Bundler.ui.info "Automatically installing missing gems." Bundler.reset! invoke :install, [] Bundler.reset! end end end end
46.117391
167
0.659659
38d3c828cddd2cbac1999b8c6b362e9942555e1b
1,744
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you 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 # # http://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. require 'test_helper' module Elasticsearch module Test class XPackIndicesGetDataStreamTest < Minitest::Test subject { FakeClient.new } context 'XPack: Get Data Stream' do should 'perform correct request' do subject.expects(:perform_request).with do |method, url, params, body| assert_equal('GET', method) assert_equal('_data_stream', url) assert_equal({}, params) assert_nil(body) end.returns(FakeResponse.new) subject.indices.get_data_stream end end context 'Get Data Stream with name' do should 'perform correct request' do subject.expects(:perform_request).with do |method, url, params, body| assert_equal('GET', method) assert_equal('_data_stream/foo', url) end.returns(FakeResponse.new) subject.indices.get_data_stream(name: 'foo') end end end end end
34.196078
79
0.690367
62442e88488e5dfc9bdb2bf045043f3cd1ad6c62
2,938
module Faraday class Adapter class Typhoeus < Faraday::Adapter self.supports_parallel = true def self.setup_parallel_manager(options = {}) options.empty? ? ::Typhoeus::Hydra.hydra : ::Typhoeus::Hydra.new(options) end dependency 'typhoeus' def call(env) super perform_request env @app.call env end def perform_request(env) read_body env hydra = env[:parallel_manager] || self.class.setup_parallel_manager hydra.queue request(env) hydra.run unless parallel?(env) rescue Errno::ECONNREFUSED raise Error::ConnectionFailed, $! end # TODO: support streaming requests def read_body(env) env[:body] = env[:body].read if env[:body].respond_to? :read end def request(env) req = ::Typhoeus::Request.new env[:url].to_s, :method => env[:method], :body => env[:body], :headers => env[:request_headers], :disable_ssl_peer_verification => (env[:ssl] && !env[:ssl].fetch(:verify, true)) configure_ssl req, env configure_proxy req, env configure_timeout req, env req.on_complete do |resp| if resp.timed_out? if parallel?(env) # TODO: error callback in async mode else raise Faraday::Error::TimeoutError, "request timed out" end end save_response(env, resp.code, resp.body) do |response_headers| response_headers.parse resp.headers end # in async mode, :response is initialized at this point env[:response].finish(env) if parallel?(env) end req end def configure_ssl(req, env) ssl = env[:ssl] req.ssl_version = ssl[:version] if ssl[:version] req.ssl_cert = ssl[:client_cert_file] if ssl[:client_cert_file] req.ssl_key = ssl[:client_key_file] if ssl[:client_key_file] req.ssl_cacert = ssl[:ca_file] if ssl[:ca_file] req.ssl_capath = ssl[:ca_path] if ssl[:ca_path] end def configure_proxy(req, env) proxy = request_options(env)[:proxy] return unless proxy req.proxy = "#{proxy[:uri].host}:#{proxy[:uri].port}" if proxy[:username] && proxy[:password] req.proxy_username = proxy[:username] req.proxy_password = proxy[:password] end end def configure_timeout(req, env) env_req = request_options(env) req.timeout = req.connect_timeout = (env_req[:timeout] * 1000) if env_req[:timeout] req.connect_timeout = (env_req[:open_timeout] * 1000) if env_req[:open_timeout] end def request_options(env) env[:request] end def parallel?(env) !!env[:parallel_manager] end end end end
29.089109
96
0.582029
7a613a757fce34ce9c073c3470f8ba46255d0ef8
971
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../shared/path', __FILE__) describe "File#path" do it_behaves_like :file_path, :path end describe "File.path" do before :each do @name = tmp("file_path") end after :each do rm_r @name end it "returns the string argument without any change" do File.path("abc").should == "abc" File.path("./abc").should == "./abc" File.path("../abc").should == "../abc" File.path("/./a/../bc").should == "/./a/../bc" end it "returns path for File argument" do File.open(@name, "w") do |f| File.path(f).should == @name end end it "returns path for Pathname argument" do require "pathname" File.path(Pathname.new(@name)).should == @name end it "calls #to_path for non-string argument and returns result" do path = mock("path") path.should_receive(:to_path).and_return("abc") File.path(path).should == "abc" end end
23.682927
67
0.631308
d5569a25aefb5ea3cd6ca5655f4e7d3f2546c5c3
1,266
# -*- encoding: utf-8 -*- # stub: mini_backtrace 0.1.3 ruby lib Gem::Specification.new do |s| s.name = "mini_backtrace" s.version = "0.1.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["Ken Collins"] s.date = "2012-01-03" s.description = "MiniBacktrace allows you to take advantage of the Rails.backtrace_cleaner when using MiniTest. This includes everyone using Rails 3 with Ruby 1.9." s.email = ["[email protected]"] s.homepage = "http://github.com/metaskills/mini_backtrace" s.rubygems_version = "2.4.8" s.summary = "Integrates the Rails.backtrace_cleaner with MiniTest." s.installed_by_version = "2.4.8" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<minitest>, ["> 1.2.0"]) s.add_runtime_dependency(%q<rails>, [">= 2.3.3"]) else s.add_dependency(%q<minitest>, ["> 1.2.0"]) s.add_dependency(%q<rails>, [">= 2.3.3"]) end else s.add_dependency(%q<minitest>, ["> 1.2.0"]) s.add_dependency(%q<rails>, [">= 2.3.3"]) end end
36.171429
166
0.669826
911ee5eaa5a375a43981a7e93c619571a2d71cae
3,083
require 'spec_helper' require 'puppet/util/package/version/debian' describe Puppet::Util::Package::Version::Debian do context "when creating new version should fail" do it "if is parsing symbols" do expect { described_class.parse(:absent) }.to raise_error(described_class::ValidationFailure) end end context "when creating new version" do it "is parsing basic version" do v = described_class.parse('1:20191210.1-0ubuntu0.19.04.2') expect(v.epoch).to eql(1) expect(v.upstream_version).to eql('20191210.1') expect(v.debian_revision).to eql('0ubuntu0.19.04.2') end it "is parsing no epoch basic version" do v = described_class.parse('20191210.1-0ubuntu0.19.04.2') expect(v.epoch).to eql(0) expect(v.upstream_version).to eql('20191210.1') expect(v.debian_revision).to eql('0ubuntu0.19.04.2') end it "is parsing no debian revision basic version" do v = described_class.parse('2.42.1+19.04') expect(v.epoch).to eql(0) expect(v.upstream_version).to eql('2.42.1+19.04') expect(v.debian_revision).to eql(nil) end it "is parsing no epoch complex version" do v = described_class.parse('3.32.2+git20190711-2ubuntu1~19.04.1') expect(v.epoch).to eql(0) expect(v.upstream_version).to eql('3.32.2+git20190711') expect(v.debian_revision).to eql('2ubuntu1~19.04.1') end it "is parsing even more complex version" do v = described_class.parse('5:1.0.0+git-20190109.133f4c4-0ubuntu2') expect(v.epoch).to eql(5) expect(v.upstream_version).to eql('1.0.0+git-20190109.133f4c4') expect(v.debian_revision).to eql('0ubuntu2') end end context "when comparing two versions" do it "epoch has precedence" do first = described_class.parse('9:99-99') second = described_class.parse('10:01-01') expect(first < second).to eql(true) end it "handles equals letters-only versions" do lower = described_class.parse('abd-def') higher = described_class.parse('abd-def') expect(lower == higher).to eql(true) end it "shorter version is smaller" do lower = described_class.parse('abd-de') higher = described_class.parse('abd-def') expect(lower < higher).to eql(true) end it "shorter version is smaller even with digits" do lower = described_class.parse('a1b2d-d3e') higher = described_class.parse('a1b2d-d3ef') expect(lower < higher).to eql(true) end it "shorter version is smaller when number is less" do lower = described_class.parse('a1b2d-d9') higher = described_class.parse('a1b2d-d13') expect(lower < higher).to eql(true) end it "handles ~ version" do lower = described_class.parse('a1b2d-d10~') higher = described_class.parse('a1b2d-d10') expect(lower < higher).to eql(true) end it "handles letters versus -" do lower = described_class.parse('a1b2d-d1a') higher = described_class.parse('a1b2d-d1-') expect(lower < higher).to eql(true) end end end
36.702381
98
0.667207
e9697a1997af7aca0da931cec89083e329e73533
414
module Puppet::Scheduler require 'puppet/scheduler/job' require 'puppet/scheduler/splay_job' require 'puppet/scheduler/scheduler' require 'puppet/scheduler/timer' module_function def create_job(interval, splay=false, splay_limit=0, &block) if splay Puppet::Scheduler::SplayJob.new(interval, splay_limit, &block) else Puppet::Scheduler::Job.new(interval, &block) end end end
24.352941
68
0.729469
f75b94c14488a82240989c6b99bb928339e6967b
9,146
describe Docker::Compose::Session do let(:shell) { double('shell', :interactive => false, :"interactive=" => true, :"chdir=" => true) } subject(:session) { described_class.new(shell) } let(:exitstatus) { 0 } let(:status) { double('exit status', to_s: "pid 12345 exit #{exitstatus}", to_i: exitstatus) } let(:output) { '' } let(:command) { double('command', status:status, captured_output:output, captured_error:'') } before do allow(status).to receive(:success?).and_return(exitstatus == 0) allow(shell).to receive(:run).and_return(command) allow(command).to receive(:join).and_return(command) end describe '.new' do it 'allows project_name override' do s1 = described_class.new(shell, project_name: 'test_name') expect(shell).to receive(:run).with('docker-compose', {project_name: 'test_name'}, anything, anything, anything) s1.up end it 'allows file override' do s1 = described_class.new(shell, file: 'foo.yml') expect(shell).to receive(:run).with('docker-compose', {file: 'foo.yml'}, anything, anything, anything) s1.up end end describe '#build' do it 'creates images' do expect(shell).to receive(:run).with('docker-compose', 'build', {}, ['alice', 'bob']).once session.build('alice', 'bob') expect(shell).to receive(:run).with('docker-compose', 'build', {force_rm:true, no_cache:true, pull:true}, []).once session.build(force_rm:true, no_cache:true, pull:true) end end describe '#ps' do # hashes is overridden in nested contexts. let(:hashes) { ['corned_beef'] } # output is used by command (defined in top context). let(:output) { hashes.join("\n") } # Mock some additional calls to run! that the ps method makes in order # to get info about each container before do hashes.each do |h| cmd = double('command', status:status, captured_output:"(#{h}) (xeger/#{h}:latest) (1.0MB (virtual 7.3MB)) (Up 1 second) (#{h}) () ()", captured_error:'') allow(cmd).to receive(:join).and_return(cmd) expect(shell).to receive(:run).with('docker', 'ps', hash_including(f:"id=#{h}",no_trunc:true)).and_return(cmd) allow(shell).to receive(:interactive=) end end it 'reports accurate size' do cont = session.ps() expect(cont).not_to be_empty expect(cont[0].size).to eq(1_048_576) end context 'given no filter' do let(:hashes) { ['corned_beef', 'sweet_potato', 'afghan_black'] } it 'lists containers' do session.ps end end context 'given a filter' do let(:hashes) { ['sweet_potato', 'afghan_black'] } it 'lists containers' do expect(shell).to receive(:run).with("docker-compose", "ps", hash_including(), ["service1", "service2"]) expect(shell).not_to receive(:run).with('docker', 'ps', hash_including(f:"id=corned_beef")) cont = session.ps('service1', 'service2') expect(cont.size).to eq(2) end end end describe '#up' do it 'runs containers' do expect(shell).to receive(:run).with('docker-compose', 'up', {}, []) expect(shell).to receive(:run).with('docker-compose', 'up', hash_including(d:true,timeout:3), []) expect(shell).to receive(:run).with('docker-compose', 'up', hash_including(no_start:true), []) expect(shell).to receive(:run).with('docker-compose', 'up', hash_including(exit_code_from:'foo'), []) expect(shell).to receive(:run).with('docker-compose', 'up', hash_including(abort_on_container_exit:true), []) session.up session.up detached:true, timeout:3 session.up no_start:true session.up exit_code_from:'foo' session.up abort_on_container_exit:true end end describe '#down' do it 'brings down containers' do expect(shell).to receive(:run).with('docker-compose', 'down', {}) expect(shell).to receive(:run).with('docker-compose', 'down', hash_including(v:true)) session.down session.down remove_volumes:true end end describe '#run' do it 'runs containers' do expect(shell).to receive(:run).with('docker-compose', 'run', {}, 'service1', []) expect(shell).to receive(:run).with('docker-compose', 'run', hash_including(d:true,T:true), 'service1', %w(command command_args)) expect(shell).to receive(:run).with('docker-compose', 'run', hash_including(u:'user_id:group_id'), 'service1', []) session.run('service1') session.run('service1', 'command', 'command_args', no_tty: true, detached: true) session.run('service1', user: 'user_id:group_id') end it 'runs containers with env vars' do expect(shell).to receive(:run).with('docker-compose', 'run', {}, { e:'VAR1=val1' }, 'service1', []) session.run('service1', env: ["VAR1=val1"]) expect(shell).to receive(:run).with('docker-compose', 'run', {}, { e:'VAR1=val1' }, { e:'VAR2=val2'}, 'service1', []) session.run('service1', env: ["VAR1=val1", "VAR2=val2"]) end it 'runs containers with mounted volumes' do expect(shell).to receive(:run).with('docker-compose', 'run', {}, { v:'/host1:/container1' }, 'service1', []) session.run('service1', volumes: ['/host1:/container1']) expect(shell).to receive(:run).with('docker-compose', 'run', {}, { v:'/host1:/container1' }, { v:'/host2:/container2' }, 'service1', []) session.run('service1', volumes: ['/host1:/container1', '/host2:/container2']) end it 'runs containers with service ports' do expect(shell).to receive(:run).with('docker-compose', 'run', {service_ports: true}, 'service1', %w(command command_args)) session.run('service1', 'command', 'command_args', service_ports: true) end end describe '#scale' do it 'scales containers' do expect(shell).to receive(:run).with('docker-compose', 'scale', {}, 'service1=2') expect(shell).to receive(:run).with('docker-compose', 'scale', {}, 'service1=3', 'service2=4') expect(shell).to receive(:run).with('docker-compose', 'scale', { timeout: 3 }, 'service1=1') session.scale(service1: 2) session.scale(service1: 3, service2: 4) session.scale({ service1: 1 }, timeout: 3) end end describe '#rm' do it 'removes containers' do expect(shell).to receive(:run).with('docker-compose', 'rm', {}, []) expect(shell).to receive(:run).with('docker-compose', 'rm', {}, ['joebob']) expect(shell).to receive(:run).with('docker-compose', 'rm', hash_including(f:true,v:true), []) session.rm session.rm 'joebob' session.rm force:true,volumes:true end end describe '#port' do context 'given color output' do let(:output) { "\033[37m0.0.0.0:32769\n" } it 'maps ports' do expect(session.port('svc1', 8080)).to eq('0.0.0.0:32769') end end context 'given a running service' do let(:output) { "0.0.0.0:32769\n" } it 'maps ports' do expect(session.port('svc1', 8080)).to eq('0.0.0.0:32769') end end context 'given a stopped service' do let(:output) { "\n" } it 'returns nil' do expect(session.port('svc1', 8080)).to eq(nil) end end end describe '#run!' do it 'omits "--file" when possible' do fancypants = described_class.new(shell, file:'docker-compose.yml') expect(shell).to receive(:run).with('docker-compose', 'foo') fancypants.instance_eval { run!('foo') } end it 'handles project_name overrides' do fancypants = described_class.new(shell, project_name:'test_name') expect(shell).to receive(:run).with('docker-compose', {project_name: 'test_name'}, 'foo') fancypants.instance_eval { run!('foo') } end it 'handles file overrides' do fancypants = described_class.new(shell, file:'docker-decompose.yml') expect(shell).to receive(:run).with('docker-compose', {file: 'docker-decompose.yml'}, 'foo') fancypants.instance_eval { run!('foo') } end it 'handles multiple files' do fancypants = described_class.new(shell, file:['orange.yml', 'apple.yml']) expect(shell).to receive(:run).with('docker-compose', {file: 'orange.yml'}, {file: 'apple.yml'}, 'foo') fancypants.instance_eval { run!('foo') } end it 'handles weird input' do fancypants = described_class.new(shell, file:42) expect(shell).to receive(:run).with('docker-compose', {file: '42'}, 'foo') fancypants.instance_eval { run!('foo') } fancypants = described_class.new(shell, file:Pathname.new('/tmp/moo.yml')) expect(shell).to receive(:run).with('docker-compose', {file: '/tmp/moo.yml'}, 'foo') fancypants.instance_eval { run!('foo') } end it 'stores the last executed runner command' do fancypants = described_class.new(shell) expect(fancypants.last_command).to be_nil fancypants.instance_eval { run!('foo') } expect(fancypants.last_command).to eq(command) end end end
39.593074
142
0.623879
282f97a4a994a028fa31c0f79a3f02eb83c621e8
40,522
# Copyright 2015 Google Inc. # # 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 # # http://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. require 'date' require 'google/apis/core/base_service' require 'google/apis/core/json_representation' require 'google/apis/core/hashable' require 'google/apis/errors' module Google module Apis module ComposerV1beta1 # A generic empty message that you can re-use to avoid defining duplicated # empty messages in your APIs. A typical example is to use it as the request # or the response type of an API method. For instance: # service Foo ` # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); # ` # The JSON representation for `Empty` is empty JSON object ````. class Empty include Google::Apis::Core::Hashable def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) end end # An environment for running orchestration tasks. class Environment include Google::Apis::Core::Hashable # Configuration information for an environment. # Corresponds to the JSON property `config` # @return [Google::Apis::ComposerV1beta1::EnvironmentConfig] attr_accessor :config # Output only. # The time at which this environment was created. # Corresponds to the JSON property `createTime` # @return [String] attr_accessor :create_time # Optional. User-defined labels for this environment. # The labels map can contain no more than 64 entries. Entries of the labels # map are UTF8 strings that comply with the following restrictions: # * Keys must conform to regexp: \p`Ll`\p`Lo``0,62` # * Values must conform to regexp: [\p`Ll`\p`Lo`\p`N`_-]`0,63` # * Both keys and values are additionally constrained to be <= 128 bytes in # size. # Corresponds to the JSON property `labels` # @return [Hash<String,String>] attr_accessor :labels # The resource name of the environment, in the form: # "projects/`projectId`/locations/`locationId`/environments/`environmentId`" # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The current state of the environment. # Corresponds to the JSON property `state` # @return [String] attr_accessor :state # Output only. # The time at which this environment was last modified. # Corresponds to the JSON property `updateTime` # @return [String] attr_accessor :update_time # Output only. # The UUID (Universally Unique IDentifier) associated with this environment. # This value is generated when the environment is created. # Corresponds to the JSON property `uuid` # @return [String] attr_accessor :uuid def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @config = args[:config] if args.key?(:config) @create_time = args[:create_time] if args.key?(:create_time) @labels = args[:labels] if args.key?(:labels) @name = args[:name] if args.key?(:name) @state = args[:state] if args.key?(:state) @update_time = args[:update_time] if args.key?(:update_time) @uuid = args[:uuid] if args.key?(:uuid) end end # Configuration information for an environment. class EnvironmentConfig include Google::Apis::Core::Hashable # Output only. # The URI of the Apache Airflow Web UI hosted within this environment (see # [Airflow web interface](/composer/docs/how-to/accessing/airflow-web-interface)) # . # Corresponds to the JSON property `airflowUri` # @return [String] attr_accessor :airflow_uri # Output only. # The Cloud Storage prefix of the DAGs for this environment. Although Cloud # Storage objects reside in a flat namespace, a hierarchical file tree # can be simulated using "/"-delimited object name prefixes. DAG objects for # this environment reside in a simulated directory with the given prefix. # Corresponds to the JSON property `dagGcsPrefix` # @return [String] attr_accessor :dag_gcs_prefix # Output only. # The Kubernetes Engine cluster used to run this environment. # Corresponds to the JSON property `gkeCluster` # @return [String] attr_accessor :gke_cluster # The configuration information for the Kubernetes Engine nodes running # the Apache Airflow software. # Corresponds to the JSON property `nodeConfig` # @return [Google::Apis::ComposerV1beta1::NodeConfig] attr_accessor :node_config # The number of nodes in the Kubernetes Engine cluster that will be # used to run this environment. # Corresponds to the JSON property `nodeCount` # @return [Fixnum] attr_accessor :node_count # The configuration information for configuring a Private IP Cloud Composer # environment. # Corresponds to the JSON property `privateEnvironmentConfig` # @return [Google::Apis::ComposerV1beta1::PrivateEnvironmentConfig] attr_accessor :private_environment_config # Specifies the selection and configuration of software inside the environment. # Corresponds to the JSON property `softwareConfig` # @return [Google::Apis::ComposerV1beta1::SoftwareConfig] attr_accessor :software_config def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @airflow_uri = args[:airflow_uri] if args.key?(:airflow_uri) @dag_gcs_prefix = args[:dag_gcs_prefix] if args.key?(:dag_gcs_prefix) @gke_cluster = args[:gke_cluster] if args.key?(:gke_cluster) @node_config = args[:node_config] if args.key?(:node_config) @node_count = args[:node_count] if args.key?(:node_count) @private_environment_config = args[:private_environment_config] if args.key?(:private_environment_config) @software_config = args[:software_config] if args.key?(:software_config) end end # Configuration for controlling how IPs are allocated in the # GKE cluster. class IpAllocationPolicy include Google::Apis::Core::Hashable # Optional. The IP address range used to allocate IP addresses to pods in # the cluster. # This field is applicable only when `use_ip_aliases` is true. # Set to blank to have GKE choose a range with the default size. # Set to /netmask (e.g. `/14`) to have GKE choose a range with a specific # netmask. # Set to a # [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) # notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. # `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range # to use. # Specify `cluster_secondary_range_name` or `cluster_ipv4_cidr_block` # but not both. # Corresponds to the JSON property `clusterIpv4CidrBlock` # @return [String] attr_accessor :cluster_ipv4_cidr_block # Optional. The name of the cluster's secondary range used to allocate # IP addresses to pods. Specify either `cluster_secondary_range_name` # or `cluster_ipv4_cidr_block` but not both. # This field is applicable only when `use_ip_aliases` is true. # Corresponds to the JSON property `clusterSecondaryRangeName` # @return [String] attr_accessor :cluster_secondary_range_name # Optional. The IP address range of the services IP addresses in this # cluster. # This field is applicable only when `use_ip_aliases` is true. # Set to blank to have GKE choose a range with the default size. # Set to /netmask (e.g. `/14`) to have GKE choose a range with a specific # netmask. # Set to a # [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) # notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. # `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range # to use. # Specify `services_secondary_range_name` or `services_ipv4_cidr_block` # but not both. # Corresponds to the JSON property `servicesIpv4CidrBlock` # @return [String] attr_accessor :services_ipv4_cidr_block # Optional. The name of the services' secondary range used to allocate # IP addresses to the cluster. Specify either `services_secondary_range_name` # or `services_ipv4_cidr_block` but not both. # This field is applicable only when `use_ip_aliases` is true. # Corresponds to the JSON property `servicesSecondaryRangeName` # @return [String] attr_accessor :services_secondary_range_name # Optional. Whether or not to enable Alias IPs in the GKE cluster. # If `true`, a VPC-native cluster is created. # Corresponds to the JSON property `useIpAliases` # @return [Boolean] attr_accessor :use_ip_aliases alias_method :use_ip_aliases?, :use_ip_aliases def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @cluster_ipv4_cidr_block = args[:cluster_ipv4_cidr_block] if args.key?(:cluster_ipv4_cidr_block) @cluster_secondary_range_name = args[:cluster_secondary_range_name] if args.key?(:cluster_secondary_range_name) @services_ipv4_cidr_block = args[:services_ipv4_cidr_block] if args.key?(:services_ipv4_cidr_block) @services_secondary_range_name = args[:services_secondary_range_name] if args.key?(:services_secondary_range_name) @use_ip_aliases = args[:use_ip_aliases] if args.key?(:use_ip_aliases) end end # Image Version information class ImageVersion include Google::Apis::Core::Hashable # The string identifier of the ImageVersion, in the form: # "composer-x.y.z-airflow-a.b(.c)" # Corresponds to the JSON property `imageVersionId` # @return [String] attr_accessor :image_version_id # Whether this is the default ImageVersion used by Composer during # environment creation if no input ImageVersion is specified. # Corresponds to the JSON property `isDefault` # @return [Boolean] attr_accessor :is_default alias_method :is_default?, :is_default # supported python versions # Corresponds to the JSON property `supportedPythonVersions` # @return [Array<String>] attr_accessor :supported_python_versions def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @image_version_id = args[:image_version_id] if args.key?(:image_version_id) @is_default = args[:is_default] if args.key?(:is_default) @supported_python_versions = args[:supported_python_versions] if args.key?(:supported_python_versions) end end # The environments in a project and location. class ListEnvironmentsResponse include Google::Apis::Core::Hashable # The list of environments returned by a ListEnvironmentsRequest. # Corresponds to the JSON property `environments` # @return [Array<Google::Apis::ComposerV1beta1::Environment>] attr_accessor :environments # The page token used to query for the next page if one exists. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @environments = args[:environments] if args.key?(:environments) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) end end # The ImageVersions in a project and location. class ListImageVersionsResponse include Google::Apis::Core::Hashable # The list of supported ImageVersions in a location. # Corresponds to the JSON property `imageVersions` # @return [Array<Google::Apis::ComposerV1beta1::ImageVersion>] attr_accessor :image_versions # The page token used to query for the next page if one exists. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @image_versions = args[:image_versions] if args.key?(:image_versions) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) end end # The response message for Operations.ListOperations. class ListOperationsResponse include Google::Apis::Core::Hashable # The standard List next-page token. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token # A list of operations that matches the specified filter in the request. # Corresponds to the JSON property `operations` # @return [Array<Google::Apis::ComposerV1beta1::Operation>] attr_accessor :operations def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) @operations = args[:operations] if args.key?(:operations) end end # The configuration information for the Kubernetes Engine nodes running # the Apache Airflow software. class NodeConfig include Google::Apis::Core::Hashable # Optional. The disk size in GB used for node VMs. Minimum size is 20GB. # If unspecified, defaults to 100GB. Cannot be updated. # Corresponds to the JSON property `diskSizeGb` # @return [Fixnum] attr_accessor :disk_size_gb # Configuration for controlling how IPs are allocated in the # GKE cluster. # Corresponds to the JSON property `ipAllocationPolicy` # @return [Google::Apis::ComposerV1beta1::IpAllocationPolicy] attr_accessor :ip_allocation_policy # Optional. The Compute Engine [zone](/compute/docs/regions-zones) in which # to deploy the VMs used to run the Apache Airflow software, specified as a # [relative resource name](/apis/design/resource_names#relative_resource_name). # For example: "projects/`projectId`/zones/`zoneId`". # This `location` must belong to the enclosing environment's project and # location. If both this field and `nodeConfig.machineType` are specified, # `nodeConfig.machineType` must belong to this `location`; if both are # unspecified, the service will pick a zone in the Compute Engine region # corresponding to the Cloud Composer location, and propagate that choice to # both fields. If only one field (`location` or `nodeConfig.machineType`) is # specified, the location information from the specified field will be # propagated to the unspecified field. # Corresponds to the JSON property `location` # @return [String] attr_accessor :location # Optional. The Compute Engine # [machine type](/compute/docs/machine-types) used for cluster instances, # specified as a # [relative resource name](/apis/design/resource_names#relative_resource_name). # For example: # "projects/`projectId`/zones/`zoneId`/machineTypes/`machineTypeId`". # The `machineType` must belong to the enclosing environment's project and # location. If both this field and `nodeConfig.location` are specified, # this `machineType` must belong to the `nodeConfig.location`; if both are # unspecified, the service will pick a zone in the Compute Engine region # corresponding to the Cloud Composer location, and propagate that choice to # both fields. If exactly one of this field and `nodeConfig.location` is # specified, the location information from the specified field will be # propagated to the unspecified field. # If this field is unspecified, the `machineTypeId` defaults # to "n1-standard-1". # Corresponds to the JSON property `machineType` # @return [String] attr_accessor :machine_type # Optional. The Compute Engine network to be used for machine # communications, specified as a # [relative resource name](/apis/design/resource_names#relative_resource_name). # For example: "projects/`projectId`/global/networks/`networkId`". # If unspecified, the default network in the environment's project is used. # If a [Custom Subnet Network](/vpc/docs/vpc#vpc_networks_and_subnets) # is provided, `nodeConfig.subnetwork` must also be provided. For # [Shared VPC](/vpc/docs/shared-vpc) subnetwork requirements, see # `nodeConfig.subnetwork`. # Corresponds to the JSON property `network` # @return [String] attr_accessor :network # Optional. The set of Google API scopes to be made available on all # node VMs. If `oauth_scopes` is empty, defaults to # ["https://www.googleapis.com/auth/cloud-platform"]. Cannot be updated. # Corresponds to the JSON property `oauthScopes` # @return [Array<String>] attr_accessor :oauth_scopes # Optional. The Google Cloud Platform Service Account to be used by the node # VMs. If a service account is not specified, the "default" Compute Engine # service account is used. Cannot be updated. # Corresponds to the JSON property `serviceAccount` # @return [String] attr_accessor :service_account # Optional. The Compute Engine subnetwork to be used for machine # communications, specified as a # [relative resource name](/apis/design/resource_names#relative_resource_name). # For example: # "projects/`projectId`/regions/`regionId`/subnetworks/`subnetworkId`" # If a subnetwork is provided, `nodeConfig.network` must also be provided, # and the subnetwork must belong to the enclosing environment's project and # location. # Corresponds to the JSON property `subnetwork` # @return [String] attr_accessor :subnetwork # Optional. The list of instance tags applied to all node VMs. Tags are used # to identify valid sources or targets for network firewalls. Each tag within # the list must comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). # Cannot be updated. # Corresponds to the JSON property `tags` # @return [Array<String>] attr_accessor :tags def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @disk_size_gb = args[:disk_size_gb] if args.key?(:disk_size_gb) @ip_allocation_policy = args[:ip_allocation_policy] if args.key?(:ip_allocation_policy) @location = args[:location] if args.key?(:location) @machine_type = args[:machine_type] if args.key?(:machine_type) @network = args[:network] if args.key?(:network) @oauth_scopes = args[:oauth_scopes] if args.key?(:oauth_scopes) @service_account = args[:service_account] if args.key?(:service_account) @subnetwork = args[:subnetwork] if args.key?(:subnetwork) @tags = args[:tags] if args.key?(:tags) end end # This resource represents a long-running operation that is the result of a # network API call. class Operation include Google::Apis::Core::Hashable # If the value is `false`, it means the operation is still in progress. # If `true`, the operation is completed, and either `error` or `response` is # available. # Corresponds to the JSON property `done` # @return [Boolean] attr_accessor :done alias_method :done?, :done # The `Status` type defines a logical error model that is suitable for # different programming environments, including REST APIs and RPC APIs. It is # used by [gRPC](https://github.com/grpc). The error model is designed to be: # - Simple to use and understand for most users # - Flexible enough to meet unexpected needs # # Overview # The `Status` message contains three pieces of data: error code, error # message, and error details. The error code should be an enum value of # google.rpc.Code, but it may accept additional error codes if needed. The # error message should be a developer-facing English message that helps # developers *understand* and *resolve* the error. If a localized user-facing # error message is needed, put the localized message in the error details or # localize it in the client. The optional error details may contain arbitrary # information about the error. There is a predefined set of error detail types # in the package `google.rpc` that can be used for common error conditions. # # Language mapping # The `Status` message is the logical representation of the error model, but it # is not necessarily the actual wire format. When the `Status` message is # exposed in different client libraries and different wire protocols, it can be # mapped differently. For example, it will likely be mapped to some exceptions # in Java, but more likely mapped to some error codes in C. # # Other uses # The error model and the `Status` message can be used in a variety of # environments, either with or without APIs, to provide a # consistent developer experience across different environments. # Example uses of this error model include: # - Partial errors. If a service needs to return partial errors to the client, # it may embed the `Status` in the normal response to indicate the partial # errors. # - Workflow errors. A typical workflow has multiple steps. Each step may # have a `Status` message for error reporting. # - Batch operations. If a client uses batch request and batch response, the # `Status` message should be used directly inside batch response, one for # each error sub-response. # - Asynchronous operations. If an API call embeds asynchronous operation # results in its response, the status of those operations should be # represented directly using the `Status` message. # - Logging. If some API errors are stored in logs, the message `Status` could # be used directly after any stripping needed for security/privacy reasons. # Corresponds to the JSON property `error` # @return [Google::Apis::ComposerV1beta1::Status] attr_accessor :error # Service-specific metadata associated with the operation. It typically # contains progress information and common metadata such as create time. # Some services might not provide such metadata. Any method that returns a # long-running operation should document the metadata type, if any. # Corresponds to the JSON property `metadata` # @return [Hash<String,Object>] attr_accessor :metadata # The server-assigned name, which is only unique within the same service that # originally returns it. If you use the default HTTP mapping, the # `name` should have the format of `operations/some/unique/name`. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The normal response of the operation in case of success. If the original # method returns no data on success, such as `Delete`, the response is # `google.protobuf.Empty`. If the original method is standard # `Get`/`Create`/`Update`, the response should be the resource. For other # methods, the response should have the type `XxxResponse`, where `Xxx` # is the original method name. For example, if the original method name # is `TakeSnapshot()`, the inferred response type is # `TakeSnapshotResponse`. # Corresponds to the JSON property `response` # @return [Hash<String,Object>] attr_accessor :response def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @done = args[:done] if args.key?(:done) @error = args[:error] if args.key?(:error) @metadata = args[:metadata] if args.key?(:metadata) @name = args[:name] if args.key?(:name) @response = args[:response] if args.key?(:response) end end # Metadata describing an operation. class OperationMetadata include Google::Apis::Core::Hashable # Output only. # The time the operation was submitted to the server. # Corresponds to the JSON property `createTime` # @return [String] attr_accessor :create_time # Output only. # The time when the operation terminated, regardless of its success. # This field is unset if the operation is still ongoing. # Corresponds to the JSON property `endTime` # @return [String] attr_accessor :end_time # Output only. # The type of operation being performed. # Corresponds to the JSON property `operationType` # @return [String] attr_accessor :operation_type # Output only. # The resource being operated on, as a [relative resource name]( # /apis/design/resource_names#relative_resource_name). # Corresponds to the JSON property `resource` # @return [String] attr_accessor :resource # Output only. # The UUID of the resource being operated on. # Corresponds to the JSON property `resourceUuid` # @return [String] attr_accessor :resource_uuid # Output only. # The current operation state. # Corresponds to the JSON property `state` # @return [String] attr_accessor :state def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @create_time = args[:create_time] if args.key?(:create_time) @end_time = args[:end_time] if args.key?(:end_time) @operation_type = args[:operation_type] if args.key?(:operation_type) @resource = args[:resource] if args.key?(:resource) @resource_uuid = args[:resource_uuid] if args.key?(:resource_uuid) @state = args[:state] if args.key?(:state) end end # Configuration options for the private GKE cluster in a Cloud Composer # environment. class PrivateClusterConfig include Google::Apis::Core::Hashable # Optional. If `true`, access to the public endpoint of the GKE cluster is # denied. # Corresponds to the JSON property `enablePrivateEndpoint` # @return [Boolean] attr_accessor :enable_private_endpoint alias_method :enable_private_endpoint?, :enable_private_endpoint # The IP range in CIDR notation to use for the hosted master network. This # range is used for assigning internal IP addresses to the cluster # master or set of masters and to the internal load balancer virtual IP. # This range must not overlap with any other ranges in use # within the cluster's network. If left blank, the default value of # '172.16.0.0/28' is used. # Corresponds to the JSON property `masterIpv4CidrBlock` # @return [String] attr_accessor :master_ipv4_cidr_block def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @enable_private_endpoint = args[:enable_private_endpoint] if args.key?(:enable_private_endpoint) @master_ipv4_cidr_block = args[:master_ipv4_cidr_block] if args.key?(:master_ipv4_cidr_block) end end # The configuration information for configuring a Private IP Cloud Composer # environment. class PrivateEnvironmentConfig include Google::Apis::Core::Hashable # Optional. If `true`, a Private IP Cloud Composer environment is created. # If this field is true, `use_ip_aliases` must be true. # Corresponds to the JSON property `enablePrivateEnvironment` # @return [Boolean] attr_accessor :enable_private_environment alias_method :enable_private_environment?, :enable_private_environment # Configuration options for the private GKE cluster in a Cloud Composer # environment. # Corresponds to the JSON property `privateClusterConfig` # @return [Google::Apis::ComposerV1beta1::PrivateClusterConfig] attr_accessor :private_cluster_config def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @enable_private_environment = args[:enable_private_environment] if args.key?(:enable_private_environment) @private_cluster_config = args[:private_cluster_config] if args.key?(:private_cluster_config) end end # Specifies the selection and configuration of software inside the environment. class SoftwareConfig include Google::Apis::Core::Hashable # Optional. Apache Airflow configuration properties to override. # Property keys contain the section and property names, separated by a hyphen, # for example "core-dags_are_paused_at_creation". Section names must not # contain hyphens ("-"), opening square brackets ("["), or closing square # brackets ("]"). The property name must not be empty and must not contain # an equals sign ("=") or semicolon (";"). Section and property names must # not contain a period ("."). Apache Airflow configuration property names # must be written in [snake_case](https://en.wikipedia.org/wiki/Snake_case). # Property values can contain any character, and can be written in any # lower/upper case format. # Certain Apache Airflow configuration property values are # [blacklisted](/composer/docs/how-to/managing/setting-airflow-configurations# # airflow_configuration_blacklists), # and cannot be overridden. # Corresponds to the JSON property `airflowConfigOverrides` # @return [Hash<String,String>] attr_accessor :airflow_config_overrides # Optional. Additional environment variables to provide to the Apache Airflow # scheduler, worker, and webserver processes. # Environment variable names must match the regular expression # `a-zA-Z_*`. They cannot specify Apache Airflow # software configuration overrides (they cannot match the regular expression # `AIRFLOW__[A-Z0-9_]+__[A-Z0-9_]+`), and they cannot match any of the # following reserved names: # * `AIRFLOW_HOME` # * `C_FORCE_ROOT` # * `CONTAINER_NAME` # * `DAGS_FOLDER` # * `GCP_PROJECT` # * `GCS_BUCKET` # * `GKE_CLUSTER_NAME` # * `SQL_DATABASE` # * `SQL_INSTANCE` # * `SQL_PASSWORD` # * `SQL_PROJECT` # * `SQL_REGION` # * `SQL_USER` # Corresponds to the JSON property `envVariables` # @return [Hash<String,String>] attr_accessor :env_variables # The version of the software running in the environment. # This encapsulates both the version of Cloud Composer functionality and the # version of Apache Airflow. It must match the regular expression # `composer-([0-9]+\.[0-9]+\.[0-9]+|latest)-airflow-[0-9]+\.[0-9]+(\.[0-9]+.*)?`. # When used as input, the server also checks if the provided version is # supported and denies the request for an unsupported version. # The Cloud Composer portion of the version is a # [semantic version](https://semver.org) or `latest`. When the patch version # is omitted, the current Cloud Composer patch version is selected. # When `latest` is provided instead of an explicit version number, # the server replaces `latest` with the current Cloud Composer version # and stores that version number in the same field. # The portion of the image version that follows <em>airflow-</em> is an # official Apache Airflow repository # [release name](https://github.com/apache/incubator-airflow/releases). # See also [Version List](/composer/docs/concepts/versioning/composer-versions). # Corresponds to the JSON property `imageVersion` # @return [String] attr_accessor :image_version # Optional. Custom Python Package Index (PyPI) packages to be installed in # the environment. # Keys refer to the lowercase package name such as "numpy" # and values are the lowercase extras and version specifier such as # "==1.12.0", "[devel,gcp_api]", or "[devel]>=1.8.2, <1.9.2". To specify a # package without pinning it to a version specifier, use the empty string as # the value. # Corresponds to the JSON property `pypiPackages` # @return [Hash<String,String>] attr_accessor :pypi_packages # Optional. The major version of Python used to run the Apache Airflow # scheduler, worker, and webserver processes. # Can be set to '2' or '3'. If not specified, the default is '2'. Cannot be # updated. # Corresponds to the JSON property `pythonVersion` # @return [String] attr_accessor :python_version def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @airflow_config_overrides = args[:airflow_config_overrides] if args.key?(:airflow_config_overrides) @env_variables = args[:env_variables] if args.key?(:env_variables) @image_version = args[:image_version] if args.key?(:image_version) @pypi_packages = args[:pypi_packages] if args.key?(:pypi_packages) @python_version = args[:python_version] if args.key?(:python_version) end end # The `Status` type defines a logical error model that is suitable for # different programming environments, including REST APIs and RPC APIs. It is # used by [gRPC](https://github.com/grpc). The error model is designed to be: # - Simple to use and understand for most users # - Flexible enough to meet unexpected needs # # Overview # The `Status` message contains three pieces of data: error code, error # message, and error details. The error code should be an enum value of # google.rpc.Code, but it may accept additional error codes if needed. The # error message should be a developer-facing English message that helps # developers *understand* and *resolve* the error. If a localized user-facing # error message is needed, put the localized message in the error details or # localize it in the client. The optional error details may contain arbitrary # information about the error. There is a predefined set of error detail types # in the package `google.rpc` that can be used for common error conditions. # # Language mapping # The `Status` message is the logical representation of the error model, but it # is not necessarily the actual wire format. When the `Status` message is # exposed in different client libraries and different wire protocols, it can be # mapped differently. For example, it will likely be mapped to some exceptions # in Java, but more likely mapped to some error codes in C. # # Other uses # The error model and the `Status` message can be used in a variety of # environments, either with or without APIs, to provide a # consistent developer experience across different environments. # Example uses of this error model include: # - Partial errors. If a service needs to return partial errors to the client, # it may embed the `Status` in the normal response to indicate the partial # errors. # - Workflow errors. A typical workflow has multiple steps. Each step may # have a `Status` message for error reporting. # - Batch operations. If a client uses batch request and batch response, the # `Status` message should be used directly inside batch response, one for # each error sub-response. # - Asynchronous operations. If an API call embeds asynchronous operation # results in its response, the status of those operations should be # represented directly using the `Status` message. # - Logging. If some API errors are stored in logs, the message `Status` could # be used directly after any stripping needed for security/privacy reasons. class Status include Google::Apis::Core::Hashable # The status code, which should be an enum value of google.rpc.Code. # Corresponds to the JSON property `code` # @return [Fixnum] attr_accessor :code # A list of messages that carry the error details. There is a common set of # message types for APIs to use. # Corresponds to the JSON property `details` # @return [Array<Hash<String,Object>>] attr_accessor :details # A developer-facing error message, which should be in English. Any # user-facing error message should be localized and sent in the # google.rpc.Status.details field, or localized by the client. # Corresponds to the JSON property `message` # @return [String] attr_accessor :message def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @code = args[:code] if args.key?(:code) @details = args[:details] if args.key?(:details) @message = args[:message] if args.key?(:message) end end end end end
46.684332
124
0.64824
8775cf1ab71e2bd333535b7206574b11183edb46
416
require 'rails_helper' RSpec.describe User, type: :model do # Association test # ensure User model has a 1:m relationship with the Todo model it { should have_one(:step) } # Validation tests # ensure name, email and password_digest are present before save it { should validate_presence_of(:name) } it { should validate_presence_of(:email) } it { should validate_presence_of(:password_digest) } end
32
66
0.745192
f8fc1058f1eb778a028a8d33dae0f9794f4ec5c7
2,720
module Travis::API::V3 class Renderer::Repository < ModelRenderer representation(:minimal, :id, :name, :slug) representation(:standard, :id, :name, :slug, :description, :github_id, :github_language, :active, :private, :owner, :default_branch, :starred, :managed_by_installation, :active_on_org) representation(:experimental, :id, :name, :slug, :description, :github_id, :github_language, :active, :private, :owner, :default_branch, :starred, :current_build, :last_started_build, :next_build_number) hidden_representations(:experimental) def active !!model.active end def default_branch return model.default_branch if include_default_branch? { :@type => 'branch'.freeze, :@href => Renderer.href(:branch, name: model.default_branch_name, repository_id: id, script_name: script_name), :@representation => 'minimal'.freeze, :name => model.default_branch_name } end def current_build build = model.current_build build if access_control.visible? build end def last_started_build build = model.last_started_build build if access_control.visible? build end def starred return false unless user = access_control.user user.starred_repository_ids.include? id end def include_default_branch? return true if include? 'repository.default_branch'.freeze return true if include.any? { |i| i.start_with? 'branch'.freeze } return true if included.any? { |i| i.is_a? Models::Branch and i.repository_id == id and i.name == i.default_branch_name } end def owner return nil if model.owner_type.nil? return model.owner if include_owner? owner_href = Renderer.href(owner_type.to_sym, id: model.owner_id, script_name: script_name) if included_owner? and owner_href { :@href => owner_href } else result = { :@type => owner_type, :id => model.owner_id, :login => model.owner_name } result[:@href] = owner_href if owner_href result end end def include_owner? return false if model.owner_type.nil? return false if included_owner? return true if include? 'repository.owner'.freeze return true if include.any? { |i| i.start_with? owner_type or i.start_with? 'owner'.freeze } end def included_owner? included.any? { |i| i.is_a? Model and i.class.polymorphic_name == model.owner_type and i.id == model.owner_id } end def owner_type @owner_type ||= model.owner_type.downcase if model.owner_type end def managed_by_installation model.managed_by_installation? end end end
34.871795
207
0.672794
4a6f58454cfe359054da0474a370cc7277db23dd
3,478
describe Travis::Yml, 'accept deploy', slow: true do subject { described_class.schema } xit { puts JSON.pretty_generate(subject[:definitions][:engineyard]) } describe 'engineyard' do describe 'username' do it { should validate deploy: { provider: :engineyard, username: 'str' } } it { should_not validate deploy: { provider: :engineyard, username: 1 } } it { should_not validate deploy: { provider: :engineyard, username: true } } it { should_not validate deploy: { provider: :engineyard, username: ['str'] } } it { should_not validate deploy: { provider: :engineyard, username: {:foo=>'foo'} } } it { should_not validate deploy: { provider: :engineyard, username: [{:foo=>'foo'}] } } end describe 'password' do it { should validate deploy: { provider: :engineyard, password: 'str' } } it { should_not validate deploy: { provider: :engineyard, password: 1 } } it { should_not validate deploy: { provider: :engineyard, password: true } } it { should_not validate deploy: { provider: :engineyard, password: ['str'] } } it { should_not validate deploy: { provider: :engineyard, password: {:foo=>'foo'} } } it { should_not validate deploy: { provider: :engineyard, password: [{:foo=>'foo'}] } } end describe 'api_key' do it { should validate deploy: { provider: :engineyard, api_key: 'str' } } it { should_not validate deploy: { provider: :engineyard, api_key: 1 } } it { should_not validate deploy: { provider: :engineyard, api_key: true } } it { should_not validate deploy: { provider: :engineyard, api_key: ['str'] } } it { should_not validate deploy: { provider: :engineyard, api_key: {:foo=>'foo'} } } it { should_not validate deploy: { provider: :engineyard, api_key: [{:foo=>'foo'}] } } end describe 'app' do it { should validate deploy: { provider: :engineyard, app: 'str' } } it { should_not validate deploy: { provider: :engineyard, app: 1 } } it { should_not validate deploy: { provider: :engineyard, app: true } } it { should_not validate deploy: { provider: :engineyard, app: ['str'] } } it { should_not validate deploy: { provider: :engineyard, app: {:foo=>'foo'} } } it { should_not validate deploy: { provider: :engineyard, app: [{:foo=>'foo'}] } } end describe 'environment' do it { should validate deploy: { provider: :engineyard, environment: 'str' } } it { should_not validate deploy: { provider: :engineyard, environment: 1 } } it { should_not validate deploy: { provider: :engineyard, environment: true } } it { should_not validate deploy: { provider: :engineyard, environment: ['str'] } } it { should_not validate deploy: { provider: :engineyard, environment: {:foo=>'foo'} } } it { should_not validate deploy: { provider: :engineyard, environment: [{:foo=>'foo'}] } } end describe 'migrate' do it { should validate deploy: { provider: :engineyard, migrate: 'str' } } it { should_not validate deploy: { provider: :engineyard, migrate: 1 } } it { should_not validate deploy: { provider: :engineyard, migrate: true } } it { should_not validate deploy: { provider: :engineyard, migrate: ['str'] } } it { should_not validate deploy: { provider: :engineyard, migrate: {:foo=>'foo'} } } it { should_not validate deploy: { provider: :engineyard, migrate: [{:foo=>'foo'}] } } end end end
56.096774
96
0.641461
39a0e30de21f0c45b2d62de5a0eb8f0353c8f4e2
1,108
def get_randomness(args) args.state.upper_height ||= rand(310) args.state.lower_height ||= 720 - args.state.upper_height end def jump(args) args.state.player_accel = 10 end def gravity(args) args.state.player_accel = args.state.player_accel - args.state.gravity_coeff end def move_player(args) args.state.player_y += args.state.player_accel end def generate_pipes(args) args.outputs.solids << [1000, 0, 100, args.state.upper_height] args.outputs.solids << [1000, 620 - args.state.lower_height, 100, 720] end def tick(args) args.outputs.labels << [100, 100, args.state.player_accel] args.state.player_x ||= 100 args.state.player_y ||= 360 args.state.player_accel ||= 0 args.state.gravity_coeff ||= 0.5 args.state.player = [ args.state.player_x, # X args.state.player_y, # Y 64, # WIDTH 64, # HEIGHT 'sprites/circle-violet.png' ] get_randomness(args) generate_pipes(args) jump(args) if args.inputs.keyboard.key_down.a gravity(args) move_player(args) args.outputs.background_color = [50, 130, 190] args.outputs.sprites << args.state.player end
25.181818
78
0.716606
1aa54703324e6d8e4132577f5774ec0cb48f5274
1,856
module RequestLogAnalyzer::Spec::Matchers class HasLineDefinition def initialize(line_type) @line_type = line_type.to_sym @captures = [] end def capturing(*captures) @captures += captures return self end def matches?(file_format) file_format = file_format.create if file_format.kind_of?(Class) if ld = file_format.line_definitions[@line_type] @captures.all? { |c| ld.captures.map { |cd| cd[:name] }.include?(c) } else false end end end class ParseLine def initialize(line) @line = line @captures = {} @line_type = nil end def failure_message @failure_message end def as(line_type) @line_type = line_type return self end def and_capture(captures) @captures = captures return self end def fail(message) @failure_message = message return false end def matches?(file_format) if @line_hash = file_format.parse_line(@line) if @line_type.nil? || @line_hash[:line_definition].name == @line_type @request = file_format.request(@line_hash) @captures.each do |key, value| return fail("Expected line #{@line.inspect}\n to capture #{key.inspect} as #{value.inspect} but was #{@request[key].inspect}.") if @request[key] != value end return true else return fail("The line should match the #{@line_type.inspect} line definition, but matched #{@line_hash[:line_definition].name.inspect} instead.") end else return fail("The line did not match any line definition.") end end end def have_line_definition(line_type) return HasLineDefinition.new(line_type) end def parse_line(line) ParseLine.new(line) end end
24.103896
168
0.62069
3937ba4e35dde955990a07187e5e1a2f776f64fb
348
module Steps module Abduction class ChildrenHavePassportController < Steps::AbductionStepController def edit @form_object = ChildrenHavePassportForm.build( c100_application: current_c100_application ) end def update update_and_advance(ChildrenHavePassportForm) end end end end
21.75
73
0.695402
2687deb831c989d3ce6b1afc6627b365f703b38c
18,193
$LOAD_PATH.unshift '/srv/whimsy/lib' require 'weakref' require 'whimsy/asf/config' module ASF module MLIST # utility methods for handling mailing list attributes: # - subscriptions # - moderation # whilst the source files are not particularly difficult to parse, it makes # sense to centralise access so any necessary changes can be localised # Note that email matching is case blind, but the original case is returned # list and domain names are always returned as lower-case # Potentially also the methods could check if access was allowed. # This is currently done by the callers # Note that the data files don't provide information on whether a list is # public or private. @@file_times = {} # Key=type, value = modtime @@file_parsed = {} # Key=type, value = cache hash # Return an array of board subscribers followed by the file update time def self.board_subscribers(archivers=true) return list_filter('sub', 'apache.org', 'board', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) end # Return an array of members@ subscribers followed by the file update time def self.members_subscribers(archivers=true) return list_filter('sub', 'apache.org', 'members', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) end # Return an array of members-notify@ subscribers followed by the file update time def self.members_notify_subscribers(archivers=true) return list_filter('sub', 'apache.org', 'members-notify', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) end # Return an array of private@pmc subscribers followed by the file update time # By default does not return the standard archivers # pmc can either be a pmc name, in which case it uses private@<pmc>.apache.org # or it can be an ASF list name, e.g. [email protected] def self.private_subscribers(pmc, archivers=false) return [] unless Dir.exist? LIST_BASE parts = pmc.split('@', 3) # want to detect trailing '@' if parts.length == 1 return list_filter('sub', "#{pmc}.apache.org", 'private', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) elsif parts.length == 2 && parts[1] == 'apache.org' return list_filter('sub', parts[1], parts[0], archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) else raise "Unexpected parameter: #{pmc}" end end def self.security_subscribers(pmc, archivers=false) return [] unless Dir.exist? LIST_BASE return list_filter('sub', "#{pmc}.apache.org", 'security', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) end # return a hash of subscriptions for the list of emails provided # the following keys are added to the response hash: # :subtime - the timestamp when the data was last updated # :subscriptions - an array of pairs: [list name, subscriber email] # N.B. not the same format as the moderates() method def self.subscriptions(emails, response = {}) return response unless File.exist? LIST_SUBS response[:subscriptions] = [] response[:subtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) emailslc = emails.map {|email| ASF::Mail.to_canonical(email.downcase)} list_parse('sub') do |dom, list, subs| subs.each do |sub| if emailslc.include? ASF::Mail.to_canonical(sub.downcase) response[:subscriptions] << ["#{list}@#{dom}", sub] end end end response end # return a hash of digest subscriptions for the list of emails provided # the following keys are added to the response hash: # :digtime - the timestamp when the data was last updated # :digests - an array of pairs: [list name, subscriber email] # N.B. not the same format as the moderates() method def self.digests(emails, response = {}) return response unless File.exist? LIST_DIGS response[:digests] = [] response[:digtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_DIGS)) emailslc = emails.map {|email| ASF::Mail.to_canonical(email.downcase)} list_parse('dig') do |dom, list, subs| subs.each do |sub| if emailslc.include? ASF::Mail.to_canonical(sub.downcase) response[:digests] << ["#{list}@#{dom}", sub] end end end response end # return the mailing lists which are moderated by any of the list of emails # the following keys are added to the response hash: # :modtime - the timestamp when the data was last updated # :moderates - a hash. key: list name; entry: array of emails that match a moderator for the list # N.B. not the same format as the subscriptions() method def self.moderates(user_emails, response = {}) return response unless File.exist? LIST_MODS response[:moderates] = {} response[:modtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_MODS)) umails = user_emails.map {|m| ASF::Mail.to_canonical(m.downcase)} # outside loop list_parse('mod') do |dom, list, emails| matching = emails.select {|m| umails.include? ASF::Mail.to_canonical(m.downcase)} response[:moderates]["#{list}@#{dom}"] = matching unless matching.empty? end response end # helper function for matching against mod and subs entries # does the target mail_domain match the current list? def self.matches_list?(mail_domain, dom, list) # normal tlp style (now also podlings): #/home/apmail/lists/commons.apache.org/dev/mod #Apache lists (e.g. some non-PMCs) #/home/apmail/lists/apache.org/list/mod return "#{mail_domain}.apache.org" == dom || (dom == 'apache.org' && (list == mail_domain || list.start_with?("#{mail_domain}-")) ) || "#{list}@#{dom}" == mail_domain # e.g. [email protected] end # for a mail domain, extract related lists and their moderators # also returns the time when the data was last checked # If podling==true, then also check for old-style podling names # returns: [{[email protected]=>[email1, email2]}, mod-time] def self.list_moderators(mail_domain, podling=false) return nil, nil unless File.exist? LIST_MODS moderators = {} list_parse('mod') do |dom, list, subs| # drop infra test lists next if list =~ /^infra-[a-z]$/ next if dom == 'incubator.apache.org' && list =~ /^infra-dev2?$/ # does the list match our target? next unless matches_list?(mail_domain, dom, list) moderators["#{list}@#{dom}"] = subs.sort end return moderators.to_h, (File.mtime(LIST_TIME) rescue File.mtime(LIST_MODS)) end # for a mail domain, extract related lists and their subscribers (default only the count) # also returns the time when the data was last checked # N.B. by default includes archivers as subscribers # For top-level apache.org lists, the mail_domain is either: # - the full list name (e.g. press), or: # - the list prefix (e.g. legal) # If podling==true, then also check for old-style podling names # If list_subs==true, return subscriber emails else sub count # If skip_archivers==true, exclude archivers # Matches: # {mail_domain}.apache.org/* # apache.org/{mail_domain}(-.*)? (e.g. press, legal) # incubator.apache.org/{mail_domain}-.* (if podling==true) # Returns: {list}@{dom} def self.list_subscribers(mail_domain, podling=false, list_subs=false, skip_archivers=false) return nil, nil unless File.exist? LIST_SUBS subscribers = {} list_parse('sub') do |dom, list, subs| # drop infra test lists next if list =~ /^infra-[a-z]$/ next if dom == 'incubator.apache.org' && list =~ /^infra-dev2?$/ # normal tlp style: #/home/apmail/lists/commons.apache.org/dev/mod # does the list match our target? next unless matches_list?(mail_domain, dom, list) if skip_archivers subscribers["#{list}@#{dom}"] = list_subs ? subs.reject {|sub| is_archiver?(sub)}.sort : subs.reject {|sub| is_archiver?(sub)}.size else subscribers["#{list}@#{dom}"] = list_subs ? subs.sort : subs.size end end return subscribers.to_h, (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)) end # for a mail domain, extract related lists and their subscribers (default only the count) # also returns the time when the data was last checked # N.B. excludes known archivers # For top-level apache.org lists, the mail_domain is either: # - the full list name (e.g. press), or: # - the list prefix (e.g. legal) # If podling==true, then also check for old-style podling names # If list_subs==true, return subscriber emails else sub count # Matches: # {mail_domain}.apache.org/* # apache.org/{mail_domain}(-.*)? (e.g. press, legal) # incubator.apache.org/{mail_domain}-.* (if podling==true) # Returns: {list}@{dom} def self.list_subs(mail_domain, podling=false, list_subs=false) self.list_subscribers(mail_domain, podling, list_subs, true) end # returns the list time (defaulting to list-subs time if the marker is not present) def self.list_time File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS) end def self.list_archivers list_parse('sub') do |dom, list, subs| yield [dom, list, subs.select {|s| is_archiver? s}.map {|m| [m, archiver_type(m, dom, list)].flatten}] end end # return the [domain, list, types=public|private|...] for all entries in the subscriber listings # the subscribers are not included def self.list_types(show_all=false) list_archivers do |dom, list, subs| types = {} subs.each do |sub| type = sub[2] types[type] = 1 unless %w(alias direct).include? type end type = types.keys.sort.join(',') yield [dom, list, type] if show_all || type == 'public' end end # return a hash of lists for a project, together with privacy setting # tlp - the prefix for the full domain # This is a replacement for ASF::Mail.lists def self.domain_lists(project, show_all) lists = {} list_types(show_all) do |dom, list, type| if matches_list?(project, dom, list) lists["#{list}@#{dom}"] = type end end lists end # return the [domain, list] for all entries in the subscriber listings # the subscribers are not included def self.each_list list_parse('sub') do |dom, list, _subs| yield [dom, list] end end private # return the archiver type as array: [:MBOX|:PONY|:MINO|:MAIL_ARCH|:MARKMAIL|:WHIMSY, 'public'|'private'|'alias'|'direct'] # minotaur archiver names do not include any public/private indication def self.archiver_type(email, dom, list) case email when ARCH_MBOX_PUB then return [:MBOX, 'public'] when ARCH_MBOX_PRV then return [:MBOX, 'private'] when ARCH_MBOX_RST then return [:MBOX, 'restricted'] when ARCH_PONY_PUB then return [:PONY, 'public'] when ARCH_PONY_PRV then return [:PONY, 'private'] when ARCH_EXT_MAIL_ARCHIVE then return [:MAIL_ARCH, 'public'] # normal archiver routed via .qmail-[tlp-]list-archive when "#{list}-archive@#{dom}" then return [:MINO, 'alias'] # Direct mail to minotaur when "apmail-#{dom.split('.').first}-#{list}[email protected]" then return [:MINO, 'direct'] # Unexpected archiver email [email protected] for [email protected] # INFRA-21658 when "#{list.chomp('.deprecated')}-archive@#{dom}" then return [:MINO, 'alias'] else return [:MARKMAIL, 'public'] if is_markmail_archiver?(email) # Whimsy currently only 'archives' private lists return [:WHIMSY, 'private'] if is_whimsy_archiver?(email) end raise "Unexpected archiver email #{email} for #{list}@#{dom}" # Should not happen? end # Is the email a minotaur archiver? def self.is_mino_archiver?(e) e =~ /.-archive@([^.]+\.)?(apache\.org|apachecon\.com)$/ end # Is the email a Whimsy archiver? def self.is_whimsy_archiver?(e) e =~ /@whimsy(-vm\d+)?\.apache\.org$/ end # Is the email a markmail archiver? def self.is_markmail_archiver?(e) e =~ ARCH_EXT_MARKMAIL_RE end def self.is_archiver?(e) ARCHIVERS.include?(e) or is_mino_archiver?(e) or is_whimsy_archiver?(e) or is_markmail_archiver?(e) end def self.is_private_archiver?(e) [ARCH_MBOX_PRV, ARCH_PONY_PRV].include? (e) or e =~ /^security-archive@.*\.apache\.org$/ or e =~ /^apmail-\[email protected]/ # direct subscription end def self.downcase(array) array.map(&:downcase) end def self.isRecent(file) return File.exist?(file) && (Time.now - File.mtime(file)) < 60 * 60 * 5 end # Filter the appropriate list, matching on domain and list # Params: # - type: 'mod' or 'sub' or 'dig' # - matchdom: must match the domain (e.g. 'httpd.apache.org') # - matchlist: must match the list (e.g. 'dev') # - archivers: whether to include standard ASF archivers (default true) # The email addresses are returned as an array. May be empty. # If there is no match, then nil is returned def self.list_filter(type, matchdom, matchlist, archivers=true) list_parse(type) do |dom, list, emails| if matchdom == dom && matchlist == list if archivers return emails else return emails.reject {|e| is_archiver?(e)} end end end return nil end # Parses the list-mods/list-subs files # Param: type = 'mod' or 'sub' or 'dig' # Yields: # - domain (e.g. [xxx.].apache.org) # - list (e.g. dev) # - emails as an array def self.list_parse(type) if type == 'mod' path = LIST_MODS suffix = '/mod' elsif type == 'sub' path = LIST_SUBS suffix = '' elsif type == 'dig' path = LIST_DIGS suffix = '' else raise ArgumentError.new('type: expecting dig, mod or sub') end ctime = @@file_times[type] || 0 mtime = File.mtime(path).to_i if mtime <= ctime cached = @@file_parsed[type] if cached begin cached.each do |d, l, m| yield d, l, m # these are already frozen end return rescue WeakRef::RefError @@file_times[type] = 0 end end else @@file_parsed[type] = nil end cache = [] # see if this preserves mod cache # split file into paragraphs File.read(path).split(/\n\n/).each do |stanza| # domain may start in column 1 or following a '/' # match [/home/apmail/lists/][accumulo.]apache.org/dev[/mod] # list names can include '-': empire-db # or [/home/apmail/lists/]apachecon.com/announce[/mod] match = stanza.match(%r{(?:^|/)([-\w]*\.?apache\.org|apachecon\.com)/(.*?)#{suffix}(?:\n|\Z)}) if match dom = match[1].downcase.freeze # just in case list = match[2].downcase.freeze # just in case # Keep original case of email addresses mails = stanza.split(/\n/).select {|x| x =~ /@/}.freeze cache << [dom, list, mails] yield dom, list, mails else # don't allow mismatches as that means the RE is wrong line = stanza[0..(stanza.index("\n") || -1)] raise ArgumentError.new("Unexpected section header #{line}") end end @@file_parsed[type] = WeakRef.new(cache) @@file_times[type] = mtime nil # don't return file contents end # Standard ASF archivers ARCH_MBOX_PUB = "[email protected]" ARCH_MBOX_PRV = "[email protected]" ARCH_MBOX_RST = "[email protected]" ARCH_PONY_PUB = "[email protected]" ARCH_PONY_PRV = "[email protected]" # Standard external archivers (necessarily public) ARCH_EXT_MAIL_ARCHIVE = "[email protected]" ARCH_EXT_MARKMAIL_RE = %r{^\w+\.\w+\.\w+@.\.markmail\.org$} # [email protected] ARCHIVERS = [ARCH_PONY_PRV, ARCH_PONY_PUB, ARCH_MBOX_PUB, ARCH_MBOX_PRV, ARCH_MBOX_RST, ARCH_EXT_MAIL_ARCHIVE] # Private archivers ARCHIVERS_PRV = [ARCH_PONY_PRV, ARCH_MBOX_PRV] # TODO alias archivers: either add list or use RE to filter them LIST_BASE = ASF::Config[:subscriptions] # allow overrides for testing etc # Note: the files are named after the sub-list (mod, digest etc) with an 's' appended # The main subscriber list uses 'subs' as the name suffix LIST_MODS = File.join(LIST_BASE, 'list-mods') LIST_SUBS = File.join(LIST_BASE, 'list-subs') LIST_DIGS = File.join(LIST_BASE, 'list-digests') # If this file exists, it is the time when the data was last extracted # The mods and subs files are only updated if they have changed LIST_TIME = File.join(LIST_BASE, 'list-start') end end if __FILE__ == $0 $LOAD_PATH.unshift '/srv/whimsy/lib' require 'whimsy/asf' domain = ARGV.shift || 'whimsical' mlist = ASF::Committee.find(domain).mail_list p mlist p ASF::MLIST.domain_lists(mlist, false) p ASF::MLIST.domain_lists(mlist, true) p ASF::MLIST.list_subscribers(domain) p ASF::MLIST.list_subscribers(domain, false, false, true) p ASF::MLIST.list_subs(domain) p ASF::MLIST.list_subscribers(domain, false, true) p ASF::MLIST.list_subscribers(domain, false, true, true) p ASF::MLIST.list_subs(domain, false, true) p ASF::MLIST.list_moderators(domain, true) p ASF::MLIST.private_subscribers(domain) p ASF::MLIST.moderates(['[email protected]']) p ASF::MLIST.digests(['[email protected]']) end
39.124731
141
0.643544
bff4f6aa00450900654fdd83d083f3411b9c7ccf
76
# typed: true a&.x, = 0 # error: &. inside multiple assignment destination
19
60
0.684211
6237345bf2549c06a498fb8b680eeb4d2f154f8d
268
require "spec_helper" describe Mogli::Client do let :client do Mogli::Client.new end it "fetches a user by id" do client.should_receive(:get_and_map).with(12451752,Mogli::User).and_return("user") client.user(12451752).should == "user" end end
22.333333
85
0.697761
1c1f921914e3486f8fd9968dd334b057bc58d7eb
849
module SpreeeedBackend require 'devise' require 'bootstrap-will_paginate' require 'simple_form' require 'cocoon' require 'spreeeed_backend/active_record_extend' require 'spreeeed_backend/acts_as_option_tree' class << self mattr_accessor :name_space, :devise_auth_resource self.name_space = 'backend' self.devise_auth_resource = 'user' end def self.setup(&block) yield self end class Engine < ::Rails::Engine config.time_zone = 'Taipei' config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"] config.i18n.available_locales ||= [:'zh-TW'] config.i18n.default_locale = :'zh-TW' initializer "SpreeeedBackend.assets.precompile" do |app| app.config.assets.precompile += %w(index.css style.css index.js) end isolate_namespace SpreeeedBackend end end
24.970588
74
0.706714
61e3b59fd7ee610abab3c2b67dff72c93ab7a80d
5,197
require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' require 'rubygems/source_info_cache' class Gem::Commands::DependencyCommand < Gem::Command include Gem::LocalRemoteOptions include Gem::VersionOption def initialize super 'dependency', 'Show the dependencies of an installed gem', :version => Gem::Requirement.default, :domain => :local add_version_option add_platform_option add_prerelease_option add_option('-R', '--[no-]reverse-dependencies', 'Include reverse dependencies in the output') do |value, options| options[:reverse_dependencies] = value end add_option('-p', '--pipe', "Pipe Format (name --version ver)") do |value, options| options[:pipe_format] = value end add_local_remote_options end def arguments # :nodoc: "GEMNAME name of gem to show dependencies for" end def defaults_str # :nodoc: "--local --version '#{Gem::Requirement.default}' --no-reverse-dependencies" end def usage # :nodoc: "#{program_name} GEMNAME" end def execute options[:args] << '' if options[:args].empty? specs = {} source_indexes = Hash.new do |h, source_uri| h[source_uri] = Gem::SourceIndex.new end pattern = if options[:args].length == 1 and options[:args].first =~ /\A\/(.*)\/(i)?\z/m then flags = $2 ? Regexp::IGNORECASE : nil Regexp.new $1, flags else /\A#{Regexp.union(*options[:args])}/ end dependency = Gem::Dependency.new pattern, options[:version] dependency.prerelease = options[:prerelease] if options[:reverse_dependencies] and remote? and not local? then alert_error 'Only reverse dependencies for local gems are supported.' terminate_interaction 1 end if local? then Gem.source_index.search(dependency).each do |spec| source_indexes[:local].add_spec spec end end if remote? and not options[:reverse_dependencies] then fetcher = Gem::SpecFetcher.fetcher begin specs_and_sources = fetcher.find_matching(dependency, false, true, dependency.prerelease?) specs_and_sources.each do |spec_tuple, source_uri| spec = fetcher.fetch_spec spec_tuple, URI.parse(source_uri) source_indexes[source_uri].add_spec spec end rescue Gem::RemoteFetcher::FetchError => e raise unless fetcher.warn_legacy e do require 'rubygems/source_info_cache' specs = Gem::SourceInfoCache.search_with_source dependency, false specs.each do |spec, source_uri| source_indexes[source_uri].add_spec spec end end end end if source_indexes.empty? then patterns = options[:args].join ',' say "No gems found matching #{patterns} (#{options[:version]})" if Gem.configuration.verbose terminate_interaction 1 end specs = {} source_indexes.values.each do |source_index| source_index.gems.each do |name, spec| specs[spec.full_name] = [source_index, spec] end end reverse = Hash.new { |h, k| h[k] = [] } if options[:reverse_dependencies] then specs.values.each do |_, spec| reverse[spec.full_name] = find_reverse_dependencies spec end end if options[:pipe_format] then specs.values.sort_by { |_, spec| spec }.each do |_, spec| unless spec.dependencies.empty? spec.dependencies.sort_by { |dep| dep.name }.each do |dep| say "#{dep.name} --version '#{dep.requirement}'" end end end else response = '' specs.values.sort_by { |_, spec| spec }.each do |_, spec| response << print_dependencies(spec) unless reverse[spec.full_name].empty? then response << " Used by\n" reverse[spec.full_name].each do |sp, dep| response << " #{sp} (#{dep})\n" end end response << "\n" end say response end end def print_dependencies(spec, level = 0) response = '' response << ' ' * level + "Gem #{spec.full_name}\n" unless spec.dependencies.empty? then spec.dependencies.sort_by { |dep| dep.name }.each do |dep| response << ' ' * level + " #{dep}\n" end end response end # Retuns list of [specification, dep] that are satisfied by spec. def find_reverse_dependencies(spec) result = [] Gem.source_index.each do |name, sp| sp.dependencies.each do |dep| dep = Gem::Dependency.new(*dep) unless Gem::Dependency === dep if spec.name == dep.name and dep.requirement.satisfied_by?(spec.version) then result << [sp.full_name, dep] end end end result end def find_gems(name, source_index) specs = {} spec_list = source_index.search name, options[:version] spec_list.each do |spec| specs[spec.full_name] = [source_index, spec] end specs end end
26.78866
79
0.612661
79a45532ed6ce28c7e1e750bc23761aec5fd0e7e
652
# Copyright 2018 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 # # http://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. require 'spec_helper' describe user('tomcat') do it { should exist } end
32.6
74
0.754601
ed3f567d8a35f8d545a4749509aa1f7168e9a97e
370
#!/usr/bin/env ruby18 # Copyright: # (c) 2006 syncPEOPLE, LLC. # Visit us at http://syncpeople.com/ # Author: Duane Johnson ([email protected]) # Description: # Makes an intelligent decision on which file to go to based on the current line or current context. require 'rails_bundle_tools' require 'rails/command_go_to_file' CommandGoToFile.alternate(ARGV)
28.461538
102
0.756757
1a66a627bb3bf24d6664348ab381310b460c6013
1,159
=begin #Accounting API #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 2.3.2 Contact: [email protected] Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'time' require 'date' module XeroRuby::Accounting class QuoteStatusCodes DRAFT = "DRAFT".freeze SENT = "SENT".freeze DECLINED = "DECLINED".freeze ACCEPTED = "ACCEPTED".freeze INVOICED = "INVOICED".freeze DELETED = "DELETED".freeze # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value def self.build_from_hash(value) new.build_from_hash(value) end # Builds the enum from string # @param [String] The enum value in the form of the string # @return [String] The enum value def build_from_hash(value) constantValues = QuoteStatusCodes.constants.select { |c| QuoteStatusCodes::const_get(c) == value } raise "Invalid ENUM value #{value} for class #QuoteStatusCodes" if constantValues.empty? value end end end
27.595238
107
0.710958
bbce9bd98f434465f49c978b111b2227c4c2a67b
587
# frozen_string_literal: true RSpec.describe ViewComponent::Storybook::Controls::ColorConfig do subject { described_class.new(default_value, param: param, name: name) } let(:type) { :color } it_behaves_like "a simple controls config" context "with :preset_color array" do subject { described_class.new(default_value, param: param, name: name, preset_colors: preset_colors) } let(:preset_colors) { %w[red green blue] } it_behaves_like "a simple controls config" do let(:csf_arg_type_control_overrides) { { presetColors: preset_colors } } end end end
29.35
106
0.734242
28c95edc40e5f8b9084720842f642234db649395
6,230
=begin #SCORM Cloud Rest API #REST API used for SCORM Cloud integrations. OpenAPI spec version: 2.0 Generated by: https://github.com/swagger-api/swagger-codegen.git =end require 'date' module RusticiSoftwareCloudV2 # https://github.com/adlnet/xAPI-Spec/blob/1.0.2/xAPI.md#4162-contextactivities-property class XapiContextActivity attr_accessor :parent attr_accessor :grouping attr_accessor :category attr_accessor :other # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'parent' => :'parent', :'grouping' => :'grouping', :'category' => :'category', :'other' => :'other' } end # Attribute type mapping. def self.swagger_types { :'parent' => :'Array<XapiActivity>', :'grouping' => :'Array<XapiActivity>', :'category' => :'Array<XapiActivity>', :'other' => :'Array<XapiActivity>' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'parent') if (value = attributes[:'parent']).is_a?(Array) self.parent = value end end if attributes.has_key?(:'grouping') if (value = attributes[:'grouping']).is_a?(Array) self.grouping = value end end if attributes.has_key?(:'category') if (value = attributes[:'category']).is_a?(Array) self.category = value end end if attributes.has_key?(:'other') if (value = attributes[:'other']).is_a?(Array) self.other = value end end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properies with the reasons def list_invalid_properties invalid_properties = Array.new return invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? return true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && parent == o.parent && grouping == o.grouping && category == o.category && other == o.other end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [parent, grouping, category, other].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = RusticiSoftwareCloudV2.const_get(type).new temp_model.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end
27.93722
107
0.605778
ab7fffa82bdf33672f2873e399b95c53644cc2bf
1,621
# # Be sure to run `pod lib lint TestPod2.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 http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'TestPod2' s.version = '0.1.0' s.summary = 'A subclass on UILabel that provides a blink..' # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? # * Try to keep it short, snappy and to the point. # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! s.description = 'This CocoaPod provides the ability to use a UILabel that may be started and stopped blinking.' s.homepage = 'https://github.com/yasodha-msf/TestPod2' # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'yasodha' => '[email protected]' } s.source = { :git => 'https://github.com/<GITHUB_USERNAME>/TestPod2.git', :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>' s.ios.deployment_target = '8.0' s.source_files = 'TestPod2/Classes/**/*' # s.resource_bundles = { # 'TestPod2' => ['TestPod2/Assets/*.png'] # } # s.public_header_files = 'Pod/Classes/**/*.h' # s.frameworks = 'UIKit', 'MapKit' # s.dependency 'AFNetworking', '~> 2.3' end
38.595238
118
0.649599
1cb0e377b51c96003034925defd1950dda8cd851
7,189
# -*- frozen_string_literal: true -*- require "spec_helper" describe RSplit do it "has a version number" do expect(RSplit::VERSION).not_to be_nil end describe String do describe "#rsplit" do it "throws a TypeError if the separator is Regexp" do expect { "str".rsplit(/\w/) }.to raise_error(TypeError) end it "splits on multibyte characters" do expect("ありがりがとう".rsplit("が")).to eq(["あり", "り", "とう"]) end it "throws a TypeError if limit can't be converted to an integer" do expect { "1.2.3.4".rsplit(".", "three") }.to raise_error(TypeError) expect { "1.2.3.4".rsplit(".", nil) }.to raise_error(TypeError) end it "returns an array of substrings based on splitting on the given string" do expect("mellow yellow".rsplit("ello")).to eq(["m", "w y", "w"]) end it "suppresses trailing empty fields when limit isn't given or 0" do expect("1,2,,3,4,,".rsplit(",")).to eq(["1", "2", "", "3", "4", "", ""]) expect("1,2,,3,4,,".rsplit(",", 0)).to eq(["1", "2", "", "3", "4", "", ""]) expect(" a b c\nd ".rsplit(" ")).to eq(["a", "b", "c\nd", ""]) expect("hai".rsplit("hai")).to be_empty expect(",".rsplit(",")).to be_empty expect(",".rsplit(",", 0)).to be_empty end it "returns an array with one entry if limit is 1: the original string" do expect("hai".rsplit("hai", 1)).to eq(["hai"]) expect("x.y.z".rsplit(".", 1)).to eq(["x.y.z"]) expect("hello world ".rsplit(" ", 1)).to eq(["hello world "]) expect(" hello world".rsplit(" ", 1)).to eq([" hello world"]) expect("hi!".rsplit("", 1)).to eq(["hi!"]) end it "returns at most limit fields when limit > 1" do expect("hai".rsplit("hai", 2)).to eq(["", ""]) expect("1,2,,3,4,,".rsplit(",", 2)).to eq(["1,2,,3,4,", ""]) expect("1,2,,3,4,,".rsplit(",", 3)).to eq(["1,2,,3,4", "", ""]) expect("1,2,,3,4,,".rsplit(",", 4)).to eq(["1,2,,3", "4", "", ""]) expect("1,2,,3,4,,".rsplit(",", 5)).to eq(["1,2,", "3", "4", "", ""]) expect("1,2,,3,4,,".rsplit(",", 6)).to eq(["1,2", "", "3", "4", "", ""]) expect(",,1,2,,3,4".rsplit(",", 2)).to eq([",,1,2,,3", "4"]) expect(",,1,2,,3,4".rsplit(",", 3)).to eq([",,1,2,", "3", "4"]) expect(",,1,2,,3,4".rsplit(",", 4)).to eq([",,1,2", "", "3", "4"]) expect(",,1,2,,3,4".rsplit(",", 5)).to eq([",,1", "2", "", "3", "4"]) expect(",,1,2,,3,4".rsplit(",", 6)).to eq([",", "1", "2", "", "3", "4"]) expect("x".rsplit("x", 2)).to eq(["", ""]) expect("xx".rsplit("x", 2)).to eq(["x", ""]) expect("xx".rsplit("x", 3)).to eq(["", "", ""]) expect("xxx".rsplit("x", 2)).to eq(["xx", ""]) expect("xxx".rsplit("x", 3)).to eq(["x", "", ""]) expect("xxx".rsplit("x", 4)).to eq(["", "", "", ""]) end it "doesn't suppress or limit fields when limit is negative" do expect("1,2,,3,4,,".rsplit(",", -1)).to eq(["1", "2", "", "3", "4", "", ""]) expect("1,2,,3,4,,".rsplit(",", -5)).to eq(["1", "2", "", "3", "4", "", ""]) expect(" a b c\nd ".rsplit(" ", -1)).to eq(["", "a", "b", "c\nd", ""]) expect(",".rsplit(",", -1)).to eq(["", ""]) end it "defaults to $; when string isn't given or nil" do begin old_fs = $; [",", ":", "", "XY", nil].each do |fs| $; = fs ["x,y,z,,,", "1:2:", "aXYbXYcXY", ""].each do |str| expected = str.rsplit(fs || " ") expect(str.rsplit(nil)).to eq(expected) expect(str.rsplit).to eq(expected) expect(str.rsplit(nil, -1)).to eq(str.rsplit(fs || " ", -1)) expect(str.rsplit(nil, 0)).to eq(str.rsplit(fs || " ", 0)) expect(str.rsplit(nil, 2)).to eq(str.rsplit(fs || " ", 2)) end end ensure $; = old_fs end end it "ignores leading and continuous whitespace when string is a single space" do expect(" now's the time ".rsplit(" ")).to eq(["now's", "the", "time"]) expect(" now's the time ".rsplit(" ", -1)).to eq(["", "now's", "the", "time"]) expect(" now's the time ".rsplit(" ", 3)).to eq([" now's", "the", "time"]) expect("\t\n a\t\tb \n\r\r\nc\v\vd\v ".rsplit(" ")).to eq(["a", "b", "c", "d"]) expect("a\x00a b".rsplit(" ")).to eq(["a\x00a", "b"]) end it "splits between characters when its argument is an empty string" do expect("hi!".rsplit("")).to eq(["h", "i", "!"]) expect("hi!".rsplit("", -1)).to eq(["", "h", "i", "!"]) expect("hi!".rsplit("", 2)).to eq(["hi", "!"]) end it "doesn't set $~" do $~ = nil "x.y.z".rsplit(".") expect($~).to be_nil end it "returns the original string if no matches are found" do expect("foo".rsplit("bar")).to eq(["foo"]) expect("foo".rsplit("bar", -1)).to eq(["foo"]) expect("foo".rsplit("bar", 0)).to eq(["foo"]) expect("foo".rsplit("bar", 1)).to eq(["foo"]) expect("foo".rsplit("bar", 2)).to eq(["foo"]) expect("foo".rsplit("bar", 3)).to eq(["foo"]) end it "returns subclass instances based on self" do ["", "x.y.z.", " x y "].each do |str| ["", ".", " "].each do |pat| [-1, 0, 1, 2].each do |limit| MyString.new(str).rsplit(pat, limit).each do |x| expect(x).to be_an_instance_of(MyString) end str.rsplit(MyString.new(pat), limit).each do |x| expect(x).to be_an_instance_of(String) end end end end end it "retains the encoding of the source string" do ary = "а б в".rsplit encodings = ary.map { |s| s.encoding } expect(encodings).to eq([Encoding::UTF_8, Encoding::UTF_8, Encoding::UTF_8]) end it "splits a string on each character for a multibyte encoding and empty split" do expect("That's why efficiency could not be helped".rsplit("").size).to eq(39) expect("俺の想いよルイズへ届け!!ハルケギニアのルイズへ届け!".rsplit("").size).to eq(27) end context "avoid interpreter's bug" do it "throws an ArgumentError if the pattern is not a valid string" do str = "проверка" broken_str = +"проверка" broken_str.force_encoding("binary") broken_str.chop! broken_str.force_encoding("utf-8") broken_str.freeze expect { str.rsplit(broken_str) }.to raise_error(ArgumentError) end end context "Ruby 2.6+" do if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create("2.6") it "yields each split substrings if a block is given" do a = [] returned_object = "foo/bar/baz/foo/bar/baz".rsplit("/", 3) { |s| a << s.capitalize } expect(returned_object).to eq("foo/bar/baz/foo/bar/baz") expect(a).to eq(["Foo/bar/baz/foo", "Bar", "Baz"]) end end end end end end
39.718232
96
0.484351
acd42b777bfe229843513709fd5a6dfcc63f20da
8,342
require 'digest' RSpec.describe Percy::Cli::SnapshotRunner do subject(:runner) { Percy::Cli::SnapshotRunner.new } let(:root_dir) { File.expand_path('../testdata/', __FILE__) } # Used for testing that paths are collapsed before use.r let(:root_dir_relative) { root_dir + '/../testdata' } describe '#initialize' do it 'passes client info down to the lower level Percy client' do expect(runner.client.client_info).to eq("percy-cli/#{Percy::Cli::VERSION}") end end describe '#run' do xit 'snapshots a root directory of static files' do # TODO(fotinakis): tests for the full flow. end end describe '#rescue_connection_failures' do it 'returns block result on success' do result = runner._rescue_connection_failures { true } expect(result).to be true expect(runner._failed?).to be false end it 'makes block safe from quota exceeded errors' do result = runner._rescue_connection_failures do raise Percy::Client::PaymentRequiredError.new(409, 'POST', '', '') end expect(result).to be_nil expect(runner._failed?).to be true end it 'makes block safe from server errors' do result = runner._rescue_connection_failures do raise Percy::Client::ServerError.new(502, 'POST', '', '') end expect(result).to be_nil expect(runner._failed?).to be true end it 'makes block safe from ConnectionFailed' do result = runner._rescue_connection_failures { raise Percy::Client::ConnectionFailed } expect(result).to be_nil expect(runner._failed?).to be true end it 'makes block safe from UnauthorizedError' do result = runner._rescue_connection_failures do raise Percy::Client::UnauthorizedError.new(401, 'GET', '', '') end expect(result).to be_nil expect(runner._failed?).to be true end it 'makes block safe from TimeoutError' do result = runner._rescue_connection_failures { raise Percy::Client::TimeoutError } expect(result).to be_nil expect(runner._failed?).to be true end it 'requires a block' do expect { runner._rescue_connection_failures }.to raise_error(ArgumentError) end end describe '#_find_root_paths' do it 'returns only the HTML files in the directory' do paths = runner._find_root_paths root_dir expected_results = [ File.join(root_dir, 'index.html'), File.join(root_dir, 'ignore.html'), File.join(root_dir, 'skip.html'), File.join(root_dir, 'subdir/test.html'), # Make sure file symlinks are followed. File.join(root_dir, 'subdir/test_symlink.html'), ] # Symlinked folders don't work out-of-the-box upon git clone on windows unless Gem.win_platform? expected_results += [ # Make sure directory symlinks are followed. File.join(root_dir, 'subdir_symlink/test.html'), File.join(root_dir, 'subdir_symlink/test_symlink.html'), ] end expect(paths).to match_array(expected_results) end it 'returns only the files matching the snapshots_regex' do opts = {snapshots_regex: 'xml'} paths = runner._find_root_paths(root_dir, opts) expected_results = [ File.join(root_dir, 'index.xml'), File.join(root_dir, 'subdir/test.xml'), ] # Symlinked folders don't work out-of-the-box upon git clone on windows unless Gem.win_platform? expected_results += [ # Make sure directory symlinks are followed. File.join(root_dir, 'subdir_symlink/test.xml'), ] end expect(paths).to match_array(expected_results) end it 'skips files passed into the ignore_regex option' do opts = {ignore_regex: 'skip|ignore'} paths = runner._find_root_paths(root_dir, opts) expected_results = [ File.join(root_dir, 'index.html'), File.join(root_dir, 'subdir/test.html'), # Make sure file symlinks are followed. File.join(root_dir, 'subdir/test_symlink.html'), ] # Symlinked folders don't work out-of-the-box upon git clone on windows unless Gem.win_platform? expected_results += [ # Make sure directory symlinks are followed. File.join(root_dir, 'subdir_symlink/test.html'), File.join(root_dir, 'subdir_symlink/test_symlink.html'), ] end expect(paths).to match_array(expected_results) end end describe '#_find_resource_paths' do it 'returns only the related static files in the directory' do paths = runner._find_resource_paths root_dir expected_results = [ File.join(root_dir, 'css/base.css'), File.join(root_dir, 'css/test with spaces.css'), File.join(root_dir, 'images/jellybeans.png'), File.join(root_dir, 'images/large-file-skipped.png'), # Make sure file symlinks are followed. File.join(root_dir, 'images/jellybeans-symlink.png'), ] # Symlinked folders don't work out-of-the-box upon git clone on windows unless Gem.win_platform? expected_results += [ # Make sure directory symlinks are followed. File.join(root_dir, 'images_symlink/jellybeans.png'), File.join(root_dir, 'images_symlink/large-file-skipped.png'), File.join(root_dir, 'images_symlink/jellybeans-symlink.png'), ] end expect(paths).to match_array(expected_results) end end describe '#_list_resources' do it 'returns resource objects' do paths = [File.join(root_dir, 'css/base.css')] options = {baseurl: '/', strip_prefix: root_dir} resources = runner._list_resources paths, options expect(resources.length).to eq(1) expect(resources.first.sha).to eq(Digest::SHA256.hexdigest(File.read(paths.first))) expect(resources.first.is_root).to be_nil expect(resources.first.content).to be_nil expect(resources.first.path).to eq(paths.first) end it 'correctly strips the prefix from resource_url' do paths = [File.join(root_dir, 'index.html')] options = {baseurl: '/', strip_prefix: root_dir_relative, is_root: true} resources = runner._list_resources paths, options expect(resources.length).to eq(1) expect(resources.first.resource_url).to eq('/index.html') end it 'returns resource objects with is_root set if given' do paths = [File.join(root_dir, 'index.html')] options = {baseurl: '/', strip_prefix: root_dir, is_root: true} resources = runner._list_resources paths, options expect(resources.length).to eq(1) expect(resources.first.resource_url).to eq('/index.html') expect(resources.first.sha).to eq(Digest::SHA256.hexdigest(File.read(paths.first))) expect(resources.first.is_root).to be_truthy expect(resources.first.content).to be_nil expect(resources.first.path).to eq(paths.first) end it 'encodes the resource_url' do paths = [File.join(root_dir, 'css/test with spaces.css')] options = {baseurl: '/', strip_prefix: root_dir} resources = runner._list_resources paths, options expect(resources.length).to eq(1) expect(resources.first.resource_url).to eq('/css/test%20with%20spaces.css') expect(resources.first.sha).to eq(Digest::SHA256.hexdigest(File.read(paths.first))) expect(resources.first.is_root).to be_nil expect(resources.first.content).to be_nil expect(resources.first.path).to eq(paths.first) end it 'prepends the baseurl if given' do paths = [File.join(root_dir, 'index.html')] options = {strip_prefix: root_dir, is_root: true, baseurl: '/test baseurl/'} resources = runner._list_resources paths, options expect(resources.length).to eq(1) expect(resources.first.resource_url).to eq('/test%20baseurl/index.html') expect(resources.first.sha).to eq(Digest::SHA256.hexdigest(File.read(paths.first))) expect(resources.first.is_root).to be_truthy expect(resources.first.content).to be_nil expect(resources.first.path).to eq(paths.first) end end describe '#upload_snapshot' do xit 'uploads the given resources to the build' do # TODO(fotinakis): tests for this. end end end
34.614108
91
0.669384
2697876446cc070c5be76465f2664d1dd47361a6
2,419
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::HttpClient def initialize(info = {}) super( update_info( info, 'Name' => 'Zivif Camera iptest.cgi Blind Remote Command Execution', 'Description' => %q{ This module exploits a remote command execution vulnerability in Zivif webcams. This is known to impact versions prior to and including v2.3.4.2103. Exploit was reported in CVE-2017-17105. }, 'License' => MSF_LICENSE, 'Author' => [ 'Silas Cutler (p1nk)' ], 'References' => [ [ 'URL', 'https://seclists.org/fulldisclosure/2017/Dec/42' ], [ 'CVE', '2017-171069' ] ], 'Platform' => 'unix', 'Targets' => [ [ 'Automatic Target', {}] ], 'Payload' => { 'Space' => 1024, 'BadChars' => "\x00\x27", 'DisableNops' => true, 'Compat' => { 'PayloadType' => 'cmd', 'RequiredCmd' => 'generic' } }, 'DefaultOptions' => { 'PAYLOAD' => 'cmd/unix/generic' }, 'Privileged' => false, 'DisclosureDate' => '2017-09-01', 'DefaultTarget' => 0 ) ) end def check res = send_request_cgi('uri' => normalize_uri('cgi-bin', 'iptest.cgi')) unless res vprint_error('Connection failed') return Exploit::CheckCode::Unknown end unless res.code && res.code == 200 return CheckCode::Safe end CheckCode::Detected end def exploit print_status('Sending request') cmd = datastore['CMD'] res = send_request_cgi( 'uri' => normalize_uri('cgi-bin', 'iptest.cgi'), 'method' => 'GET', 'vars_get' => { 'cmd' => 'iptest.cgi', '-time' => Time.now.to_i, '-url' => '$(' + cmd + ')' } ) unless res fail_with(Failure::Unreachable, 'Connection failed') end if res.code && res.code == 200 print_good('Command sent successfully') else fail_with(Failure::UnexpectedReply, 'Unable to send command to target') end end end
25.734043
88
0.529558
5dff5c91215b361736def028ac588d0143adef67
430
When(/^I get help for "([^"]*)"$/) do |app_name| @app_name = app_name step %(I run `#{app_name} --help`) end # Add more step definitions here Given(/^docker is installed$/) do step %(I run `docker --version`) step %(the output should contain "Docker version") end Given(/^curl is installed$/) do step %(I run `curl`) step %(the output should contain "try 'curl --help' or 'curl --manual' for more information") end
25.294118
95
0.653488
1a878eb23fe91318172046a7cc3df74f58069305
1,192
require 'net/http' require 'open-uri' module Crawler class NetHttp def initialize init_proxy end def request_response(url, limit = 10) begin http = Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass) result = http.get_response(URI.parse(url)) case result when Net::HTTPSuccess then result.body when Net::HTTPRedirection then request_response(result['location'], limit - 1) else result.error! end rescue => e puts e.message return false end end def get_proxy { p_user: @proxy_user, p_pass: @proxy_pass, p_addr: @proxy_host, p_port: @proxy_port } end def get_url_proxy "#{@proxy_host}:#{@proxy_port}" end private def get_proxy_env ENV['http_proxy'] end def init_proxy @proxy = get_proxy_env unless @proxy.nil? uri = URI.parse(@proxy) @proxy_user, @proxy_pass = uri.userinfo.split(/:/) if uri.userinfo @proxy_host = uri.host @proxy_port = uri.port end end end end
20.912281
83
0.564597
21bfc6b31a3914c51f03c13fbde9486734b5953b
286
rule "FC027", "Resource sets internal attribute" do tags %w{correctness} recipe do |ast| find_resources(ast, type: :service).map do |service| service unless (resource_attributes(service).keys & %w{enabled running}).empty? end.compact end end
28.6
57
0.65035
b95e019bb8cf71a5bf470c89c880c7f968c7fe16
576
module DC # The canonical server root, including SSL, if requested. def self.server_root(options={:ssl => true, :agnostic => false }) url_for('server_root', options) end def self.cdn_root(options={:ssl => true, :agnostic => false }) url_for('asset_root', options) end def self.url_for(config, options) root = case when options[:force_ssl] || (options[:ssl] && Thread.current[:ssl]) then 'https://' when options[:agnostic] then '//' else 'http://' end root + DC::CONFIG[config] end end
25.043478
94
0.595486
1d1354c23ec20a3ee730c565158c56e3c03b957e
3,423
require "active_support/notifications" module ActiveSupport # Raised when <tt>ActiveSupport::Deprecation::Behavior#behavior</tt> is set with <tt>:raise</tt>. # You would set <tt>:raise</tt>, as a behavior to raise errors and proactively report exceptions from deprecations. class DeprecationException < StandardError end class Deprecation # Default warning behaviors per Rails.env. DEFAULT_BEHAVIORS = { raise: ->(message, callstack) { e = DeprecationException.new(message) e.set_backtrace(callstack.map(&:to_s)) raise e }, stderr: ->(message, callstack) { $stderr.puts(message) $stderr.puts callstack.join("\n ") if debug }, log: ->(message, callstack) { logger = if defined?(Rails.logger) && Rails.logger Rails.logger else require "active_support/logger" ActiveSupport::Logger.new($stderr) end logger.warn message logger.debug callstack.join("\n ") if debug }, notify: ->(message, callstack) { ActiveSupport::Notifications.instrument("deprecation.rails", message: message, callstack: callstack) }, silence: ->(message, callstack) {}, } # Behavior module allows to determine how to display deprecation messages. # You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+ # constant. Available behaviors are: # # [+raise+] Raise <tt>ActiveSupport::DeprecationException</tt>. # [+stderr+] Log all deprecation warnings to +$stderr+. # [+log+] Log all deprecation warnings to +Rails.logger+. # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. # [+silence+] Do nothing. # # Setting behaviors only affects deprecations that happen after boot time. # For more information you can read the documentation of the +behavior=+ method. module Behavior # Whether to print a backtrace along with the warning. attr_accessor :debug # Returns the current behavior or if one isn't set, defaults to +:stderr+. def behavior @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] end # Sets the behavior to the specified value. Can be a single value, array, # or an object that responds to +call+. # # Available behaviors: # # [+raise+] Raise <tt>ActiveSupport::DeprecationException</tt>. # [+stderr+] Log all deprecation warnings to +$stderr+. # [+log+] Log all deprecation warnings to +Rails.logger+. # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. # [+silence+] Do nothing. # # Setting behaviors only affects deprecations that happen after boot time. # Deprecation warnings raised by gems are not affected by this setting # because they happen before Rails boots up. # # ActiveSupport::Deprecation.behavior = :stderr # ActiveSupport::Deprecation.behavior = [:stderr, :log] # ActiveSupport::Deprecation.behavior = MyCustomHandler # ActiveSupport::Deprecation.behavior = ->(message, callstack) { # # custom stuff # } def behavior=(behavior) @behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || b } end end end end
37.615385
117
0.630733
e970ed2861a2a258c293dd8f193f4f528d56208f
84
move 'southwest' move 'southeast' move 'northwest' move 'southwest' move 'northwest'
16.8
16
0.77381
f815bb44f25867ded60e0c1285ef995004a81a59
9,002
require 'spec_helper' describe 'cassandra-dse::default' do shared_examples_for 'cassandra' do context 'all_platforms' do it 'enables cassandra service' do expect(chef_run).to enable_service('cassandra') expect(chef_run).to start_service('cassandra') end it 'creates the cassandra user' do expect(chef_run).to create_user('cassandra').with( comment: 'Cassandra Server user', gid: 'cassandra', home: nil, system: true, shell: '/bin/bash' ) end it 'creates the cassandra group' do expect(chef_run).to create_group('cassandra') end it 'explicity adds the cassandra user to the cassandra group' do expect(chef_run).to modify_group('explicity add cassandra to cassandra group').with( members: ['cassandra'], group_name: 'cassandra', append: true ) end it 'creates the cassandra home directory' do %w(/usr/share/cassandra /usr/share/cassandra/bin /var/log/cassandra /var/lib/cassandra /usr/share/cassandra/lib).each do |d| expect(chef_run).to create_directory(d).with( owner: 'cassandra', group: 'cassandra' ) end end it 'creates the directory /etc/cassandra' do expect(chef_run).to create_directory('/etc/cassandra').with( owner: 'cassandra', group: 'cassandra', recursive: true, mode: '0755' ) end end end context 'Centos 6.4 - yum - dsc20' do cached(:chef_run) do ChefSpec::SoloRunner.new(platform: 'centos', version: '6.4') do |node| node.set['cassandra']['config']['cluster_name'] = 'test' node.set['cassandra']['version'] = '2.0.11' node.set['cassandra']['package_name'] = 'dsc20' end.converge(described_recipe) end include_examples 'cassandra' it 'installs cassandra dsc20 2.0.11-1' do expect(chef_run).to install_yum_package('dsc20').with(version: '2.0.11-1') end it 'Creates /usr/share/java dir' do expect(chef_run).to create_directory('/usr/share/java') end it 'Creates symlink between /usr/share/cassandra/lib/jna.jar and /usr/share/java/jna.jar' do expect(chef_run).to create_link('/usr/share/cassandra/lib/jna.jar').with(to: '/usr/share/java/jna.jar') end it 'creates and sets permissions of /etc/cassandra/conf' do expect(chef_run).to create_directory('/etc/cassandra/conf').with( owner: 'cassandra', group: 'cassandra', recursive: true, mode: '0755' ) end # only create link if there is a diffrent conf dir it 'Creates symlink between /etc/cassandra/conf and ' do expect(chef_run).to_not create_link('/etc/cassandra/conf') end it 'creates /etc/cassandra/conf/log4j-server.properties' do expect(chef_run).to create_template('/etc/cassandra/conf/log4j-server.properties').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/conf/cassandra.yaml' do expect(chef_run).to create_template('/etc/cassandra/conf/cassandra.yaml').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/cassandra-env.sh' do expect(chef_run).to create_template('/etc/cassandra/conf/cassandra-env.sh').with( owner: 'cassandra', group: 'cassandra' ) end end context 'Centos 6.4 - yum - dsc21' do cached(:chef_run) do ChefSpec::SoloRunner.new(platform: 'centos', version: '6.4') do |node| node.set['cassandra']['config']['cluster_name'] = 'test' node.set['cassandra']['version'] = '2.1.7' node.set['cassandra']['package_name'] = 'dsc21' end.converge(described_recipe) end include_examples 'cassandra' it 'installs cassandra dsc21 2.1.7-1' do expect(chef_run).to install_yum_package('dsc21').with(version: '2.1.7-1') end it 'Creates /usr/share/java dir' do expect(chef_run).to create_directory('/usr/share/java') end it 'Does NOT Create symlink between /usr/share/cassandra/lib/jna.jar and /usr/share/java/jna.jar' do expect(chef_run).to_not create_link('/usr/share/cassandra/lib/jna.jar').with(to: '/usr/share/java/jna.jar') end it 'creates /etc/cassandra/conf/logback.xml' do expect(chef_run).to create_template('/etc/cassandra/conf/logback.xml').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/conf/logback-tools.xml' do expect(chef_run).to create_template('/etc/cassandra/conf/logback-tools.xml').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/conf/cassandra.yaml' do expect(chef_run).to create_template('/etc/cassandra/conf/cassandra.yaml').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/cassandra-env.sh' do expect(chef_run).to create_template('/etc/cassandra/conf/cassandra-env.sh').with( owner: 'cassandra', group: 'cassandra' ) end end context 'Centos 6.4 - yum - dsc22' do cached(:chef_run) do ChefSpec::SoloRunner.new(platform: 'centos', version: '6.4') do |node| node.set['cassandra']['config']['cluster_name'] = 'test' node.set['cassandra']['version'] = '2.2.1' node.set['cassandra']['package_name'] = 'dsc22' end.converge(described_recipe) end include_examples 'cassandra' it 'installs cassandra dsc21 2.2.1-1' do expect(chef_run).to install_yum_package('dsc22').with(version: '2.2.1-1') end end context 'Ubuntu 12.04 - apt - cassandra 2.0.11' do cached(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node| node.set['cassandra']['config']['cluster_name'] = 'test' node.set['cassandra']['version'] = '2.0.11' node.set['cassandra']['package_name'] = 'dsc20' end.converge(described_recipe) end include_examples 'cassandra' it 'installs cassandra 2.0.11' do expect(chef_run).to install_package('dsc20') end it 'installs cassandra' do expect(chef_run).to install_package('python-cql') end it 'Creates /usr/share/java dir' do expect(chef_run).to create_directory('/usr/share/java') end it 'Creates symlink between /usr/share/cassandra/lib/jna.jar and /usr/share/java/jna.jar' do expect(chef_run).to create_link('/usr/share/cassandra/lib/jna.jar').with(to: '/usr/share/java/jna.jar') end it 'uses apt to pin the priority of dsc22 to version xxx' do expect(chef_run).to add_apt_preference('dsc20').with( pin: 'version 2.0.11-1', pin_priority: '700' ) end it 'uses apt to pin the priority of dsc22 to version xxx' do expect(chef_run).to add_apt_preference('cassandra').with( pin: 'version 2.0.11', pin_priority: '700' ) end it 'defines a ruby block sleep resource' do expect(chef_run).to_not run_ruby_block('sleep30s') end it 'defines a ruby block set_fd_limit resource' do expect(chef_run).to_not run_ruby_block('set_fd_limit') end it 'defines a "set_cluster_name" resource to be called on cluster name update' do expect(chef_run).to_not run_execute('set_cluster_name') end it 'creates /etc/cassandra/log4j-server.properties' do expect(chef_run).to create_template('/etc/cassandra/log4j-server.properties').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/cassandra.yaml' do expect(chef_run).to create_template('/etc/cassandra/cassandra.yaml').with( owner: 'cassandra', group: 'cassandra' ) end it 'creates /etc/cassandra/cassandra-env.sh' do expect(chef_run).to create_template('/etc/cassandra/cassandra-env.sh').with( owner: 'cassandra', group: 'cassandra' ) end end context 'Ubuntu 12.04 - apt - dsc22' do cached(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') do |node| node.set['cassandra']['config']['cluster_name'] = 'test' node.set['cassandra']['version'] = '2.2.1' node.set['cassandra']['package_name'] = 'dsc22' end.converge(described_recipe) end include_examples 'cassandra' it 'uses apt to pin the priority of dsc22 to version xxx' do expect(chef_run).to add_apt_preference('dsc22').with( pin: 'version 2.2.1-1', pin_priority: '700' ) end it 'installs cassandra 2.2.1' do expect(chef_run).to install_package('cassandra').with(version: '2.2.1') end it 'installs cassandra dsc22 2.2.1-1' do expect(chef_run).to install_package('dsc22').with(version: '2.2.1-1') end end end
31.921986
132
0.634081
21c3f1120139f101417a0d1d1efc92fc82d5409b
186
# frozen_string_literal: true module FlexInfiniteScroll class Engine < ::Rails::Engine; end end require 'flex_infinite_scroll/activerecord' require 'flex_infinite_scroll/actionview'
20.666667
43
0.822581
e8262fd544c485f9dec757135d66515a75317b66
3,060
#-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2020 the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2017 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See docs/COPYRIGHT.rdoc for more details. #++ module OpenProject ## # Notifications about Events in OpenProject (e.g. created work packages) # # @see OpenProject::Events module Notifications module_function # Subscribe to a specific event with name # Contrary to ActiveSupport::Notifications, we don't support regexps here, but only # single events specified as string. # # @param name [String] The name of the event to subscribe to. # @param clear_subscriptions [Boolean] Clears all previous subscriptions to this # event if true. Use with care! # @return [Int] Subscription ID # @raises ArgumentError if no block is given. def subscribe(name, clear_subscriptions: false, &block) # if no block is given, raise an error raise ArgumentError, 'please provide a block as a callback' unless block_given? if clear_subscriptions subscriptions[name].each do |sub| ActiveSupport::Notifications.unsubscribe sub end end sub = ActiveSupport::Notifications.subscribe(name.to_s) do |_, _, _, _, payload| block.call(payload) end subs = clear_subscriptions ? [] : Array(subscriptions[name]) subscriptions[name] = subs + [sub] subscriptions[name].size - 1 end def unsubscribe(name, id) sub = subscriptions[name].delete_at id if sub ActiveSupport::Notifications.unsubscribe sub true end end # Send a notification # payload should be a Hash and might be marshalled and unmarshalled before being # delivered (although it is not at the moment), so don't count on object equality # for the payload. def send(name, payload) ActiveSupport::Notifications.instrument(name.to_s, payload) end def subscriptions @subscriptions ||= {} end end end
34.382022
91
0.702288
3361ff426eaabe236c4b076176a3b817391a2686
436
module Praxis class MultipartPart attr_accessor :body attr_accessor :headers attr_accessor :filename def initialize(body, headers={}, filename: nil) @body = body @headers = headers @filename = filename end def status @headers['Status'].to_i end def encode! case @body when Hash, Array @body = JSON.pretty_generate(@body) end end end end
16.148148
51
0.600917
ede2596d951c902d7c7e11a1c42f50c12d19e70e
456
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'simplecov' # SimpleCov.minimum_coverage 95 SimpleCov.start # This module is only used to check the environment is currently a testing env module SpecHelper end require 'fastlane' # to import the Action super class require 'fastlane/plugin/lock_keychain' # import the actual plugin Fastlane.load_actions # load other actions (in case your plugin calls other actions or shared values)
28.5
101
0.791667
033b6e69673e75f128255279618fbbe71c631928
1,474
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "vcloud/walker/version" Gem::Specification.new do |s| s.name = 'vcloud-walker' s.version = Vcloud::Walker::VERSION s.authors = ['Government Digital Service'] s.homepage = 'https://github.com/gds-operations/vcloud-walker' s.summary = %q{Command line tool to describe vCloud entities} s.description = %q{Vcloud-walker is a command line tool to describe different vCloud entities. This tool is a thin layer around fog api, which exposes summarized vCloud entities in the form of JSON} s.license = 'MIT' s.files = `git ls-files`.split("\n") s.executables = s.files.grep(%r{^bin/}) {|f| File.basename(f)} s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = ["lib"] s.required_ruby_version = '>= 2.2.2' s.add_runtime_dependency 'fog', '>= 1.40.0' s.add_runtime_dependency 'json', '~> 1.8.0' s.add_runtime_dependency 'nokogiri', '~> 1.6.8.1' s.add_runtime_dependency 'vcloud-core', '~> 2.1.0' s.add_development_dependency 'gem_publisher', '1.2.0' s.add_development_dependency 'json_spec', '~> 1.1.1' s.add_development_dependency 'rake', '>= 12' s.add_development_dependency 'rspec', '>= 3.6' s.add_development_dependency 'rspec-mocks', '>= 3.6' s.add_development_dependency 'rubocop', '~> 0.49.1' s.add_development_dependency 'simplecov', '~> 0.14.1' end
42.114286
102
0.660787
e8453b7899f693013fbfaa32850304053c4afe64
1,404
# Equivalent to a header guard in C/C++ # Used to prevent the spec helper from being loaded more than once unless defined? WEBBY_SPEC_HELPER WEBBY_SPEC_HELPER = true require 'rubygems' require 'spec' require 'fileutils' require 'stringio' begin require 'fake_web' $test_externals = true rescue LoadError $test_externals = false end require File.expand_path( File.join(File.dirname(__FILE__), %w[.. lib webby])) Spec::Runner.configure do |config| config.before :all do @pwd = Dir.pwd Dir.chdir Webby.datapath('site') FileUtils.mkdir_p Webby.datapath('site', ::Webby.site.output_dir) end config.after :all do FileUtils.rm_rf(Webby.datapath('site', ::Webby.cairn)) FileUtils.rm_rf(Dir.glob(Webby.datapath(%w[site output *]))) Dir.chdir @pwd end # == Mock Framework # # RSpec uses it's own mocking framework by default. If you prefer to # use mocha, flexmock or RR, uncomment the appropriate line: # # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rr end module Webby DATAPATH = ::Webby.path(%w[spec data]) def self.datapath( *args ) args.empty? ? DATAPATH : ::File.join(DATAPATH, args.flatten) end end $webby_log_output = StringIO.new logger = Logging::Logger['Webby'] logger.clear_appenders logger.add_appenders(Logging::Appenders::IO.new('stringio', $webby_log_output)) end # unless defined? # EOF
23.4
79
0.717949
ff3bf6d6e9311530cf1c995ce7eb1f7cc3de4ad3
621
cask 'paye-tools' do version '17.2.17125.433' sha256 'e8d2f9d27d873c120cd11343753fc23a917b27d8ddfbf32f65590409019f20b8' url "https://www.gov.uk/government/uploads/uploaded/hmrc/payetools-rti-#{version}-osx.zip" name 'Basic PAYE Tools' homepage 'https://www.gov.uk/basic-paye-tools' installer script: { executable: "payetools-rti-#{version}-osx.app/Contents/MacOS/osx-intel", args: ['--mode', 'unattended'], sudo: true, } uninstall quit: 'uk.gov.hmrc.bptrti', delete: '/Applications/HMRC' end
34.5
94
0.605475
e29ab7aa9382a8c4204fba2318a43ce621aca519
715
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'proceso/version' Gem::Specification.new do |spec| spec.name = "proceso-rails" spec.version = Proceso::VERSION spec.authors = ["Bryan Goines"] spec.email = ["[email protected]"] spec.description = %q{Proceso Middleware for Rails} spec.summary = %q{Proceso Middleware for Rails 4} spec.homepage = "https://github.com/bry4n/proceso" spec.license = "MIT" spec.files = Dir["{lib,ext}/**/*.{rb,c,h}"] spec.test_files = Dir["spec/**/*.rb"] spec.add_dependency "proceso", "~> 0.2", ">= 0.2.0" spec.add_development_dependency "rake" end
31.086957
56
0.634965
61024a7770a79a5e054fae6e28b42e40c52e8aee
663
# frozen_string_literal: true class Comment::AfterUpdateCallback def after_update(comment) return unless comment.commentable.instance_of?(Product) update_last_commented_at(comment) update_commented_at(comment) end private def update_last_commented_at(comment) product = Product.find(comment.commentable.id) if comment.user.mentor product.mentor_last_commented_at = comment.updated_at elsif comment.user == product.user product.self_last_commented_at = comment.updated_at end product.save! end def update_commented_at(comment) comment.commentable.update!(commented_at: comment.updated_at) end end
24.555556
65
0.769231
f837eabc128ea4d491506083cfceea90c6131735
1,156
class Mighttpd2 < Formula desc "HTTP server" homepage "https://www.mew.org/~kazu/proj/mighttpd/en/" url "https://hackage.haskell.org/package/mighttpd2-3.4.6/mighttpd2-3.4.6.tar.gz" sha256 "fe14264ea0e45281591c86030cad2b349480f16540ad1d9e3a29657ddf62e471" license "BSD-3-Clause" revision 1 livecheck do url :stable end bottle do cellar :any_skip_relocation sha256 "f4825cfc94adb7f0d47ca4dcaa3b924726845eef22dafa8a9603c6efe8a3e24d" => :big_sur sha256 "bcea435a9feba47df19b64d9fac972a1df8f580647204b07a73b2ade2e14c479" => :catalina sha256 "68e563757fb405de41a4312c03f7b72da99586430ea8f0aff98fdab48213635f" => :mojave sha256 "7b033c6ce128310465134a09bae1ef3df9cb630db732167a06028c1a5773576e" => :high_sierra sha256 "7652478fdda8d75605a033d776ef5020bb8e5a231ba0ab2991906feab9a80af9" => :x86_64_linux end depends_on "cabal-install" => :build depends_on "ghc" => :build uses_from_macos "zlib" def install system "cabal", "v2-update" system "cabal", "v2-install", "-ftls", *std_cabal_v2_args end test do system "#{bin}/mighty-mkindex" assert (testpath/"index.html").file? end end
31.243243
94
0.763841
e9c40096c28c718def63b88613b094450d16c0f1
599
class Flow::Base attr_reader :list, :account def initialize(account, flow, unknown, list, previous_flow) @account = account @list = list @account_name = account.name @flow = flow @previous_flow = previous_flow @unknown = unknown end def percentage return nil if flow < 0 plus_sum = list.plus_sum return 0 if plus_sum == 0 (flow * 100.0 / list.plus_sum).round end def unknown? !!@unknown end def name unknown? ? "不明金(#{@account_name})" : @account_name end def previous_flow @previous_flow ? @previous_flow.flow : 0 end end
19.966667
61
0.652755
e20389d3cc7332fa7d778304067cbf3ba3fdf625
4,221
require "json" require "open3" def hcl2json(tf) stdout, stderr, exit_status = Open3.capture3("hcl2json", { stdin_data: tf }) unless exit_status.success? warn stderr end JSON.parse(stdout) end def get_lbs(tf) tf.dig("resource", "aws_lb").values end def get_tgs(tf) tf.dig("resource", "aws_lb_target_group").values end describe "alb" do describe "alb helpers" do it "gets lbs correctly" do terraform = { "resource" => { "aws_lb" => { "my_alb_resource" => { "name" => "my-application-load-balancer" }, "my_nlb_resource" => { "name" => "my-network-load-balancer" }, }, }, } lbs = get_lbs(terraform) expect(lbs.length).to be(2) expect(lbs.first.dig("name")).to eq("my-application-load-balancer") expect(lbs.last.dig("name")).to eq("my-network-load-balancer") end it "gets lb tgs correctly" do terraform = { "resource" => { "aws_lb_target_group" => { "my_alb_target_group" => { "port" => "443" }, "my_nlb_target_group" => { "port" => "8443" }, }, }, } tgs = get_tgs(terraform) expect(tgs.length).to be(2) expect(tgs.first.dig("port")).to eq("443") expect(tgs.last.dig("port")).to eq("8443") end end describe "albs" do terraform_files = TERRAFORM_FILES .reject { |f| File.read(f).lines.grep(/resource\s+"aws_lb"/).empty? } terraform_contents = terraform_files .map { |f| File.read(f) } .join("\n\n") terraform = hcl2json(terraform_contents) it "does not contain any aws_alb resources" do expect( TERRAFORM_FILES .map { |f| File.read(f) }.join("\n").lines .grep(/"aws_alb"/), ).to be_empty end it "is have terraform files describing albs" do expect(terraform_files).not_to be_empty end it "is valid terraform" do expect(terraform).not_to be(false) end it "has names less than 32 characters" do lb_names = get_lbs(terraform) .map { |r| r.dig("name") } .map { |val| val.gsub("${var.env}", "prod-lon") } expect(lb_names).not_to be_empty expect(lb_names).to all(match(/^[-a-z]{4,32}$/)) expect(lb_names).not_to include(match("var.env")) end it "has access_logs configured" do access_logs = get_lbs(terraform) .map { |r| r.dig("access_logs") } expect(access_logs).not_to be_empty expect(access_logs).not_to include(nil) end it "does not have deletion protection enabled" do deletion_protection = get_lbs(terraform) .map { |r| r.dig("enable_deletion_protection") } expect(deletion_protection).not_to be_empty expect(deletion_protection).to all(be(nil)) end end describe "alb_tgs" do terraform_files = TERRAFORM_FILES .reject { |f| File.read(f).lines.grep(/resource\s+"aws_lb"/).empty? } terraform_contents = terraform_files .map { |f| File.read(f) } .join("\n\n") terraform = hcl2json(terraform_contents) it "is have terraform files describing albs" do expect(terraform_files).not_to be_empty end it "is valid terraform" do expect(terraform).not_to be(false) end it "has deregistration configured" do deregistration_delay = get_tgs(terraform) .reject { |r| r.dig("name").match?(/broker|alertmanager|prometheus/) } .reject { |r| r.dig("port") == 83 } # This is temporary port .map { |r| r.dig("deregistration_delay") } expect(deregistration_delay).not_to be_empty expect(deregistration_delay).to all(be < 120) end it "has slow_start configured if it is a router" do router_tgs = get_tgs(terraform) .reject { |r| r.dig("name").match?(/broker|alertmanager|prometheus|rlp|doppler/) } .reject { |r| r.dig("port") == 83 } # This is temporary port expect(router_tgs).not_to be_empty slow_start = router_tgs.map { |r| r.dig("slow_start") } expect(slow_start).to all(be > 30) # More than the routing table sync interval expect(slow_start).to all(be < 110) # Less than the drain wait time end end end
27.588235
90
0.613599
38bda84464fca22bcc40d75409e6160695264b8f
193
module Libcouchbase::Ext # (Not documented) # # ## Fields: # :v0 :: # (DURABILITYOPTSv0) class DurabilityOptsStV < FFI::Union layout :v0, DURABILITYOPTSv0.by_value end end
16.083333
41
0.65285
6acc9bcab0c6a7e481694360068e949068bee20d
367
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'rubystats/binomial_distribution' t = 100 f = 7 p = 0.05 bin = Rubystats::BinomialDistribution.new(t,p) f = f - 1 mean = bin.mean puts mean for i in 1..12 pdf = bin.pdf(i) cdf = bin.cdf(i) inv = bin.icdf(cdf) pval = 1 - cdf # puts inv puts "#{i}: #{pdf} : #{cdf}: pval: #{pval}" end
15.956522
57
0.604905
e8b9a7d5dcbf19bdadec836e3b03138e557d0e12
876
Gem::Specification.new do |spec| spec.name = "lita-slack-actions" spec.version = "0.1.0" spec.authors = ["Guillermo Moreno"] spec.email = ["[email protected]"] spec.summary = "Handle Slack's interactive message payloads" spec.license = "MIT" spec.metadata = { "lita_plugin_type" => "handler" } spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "lita", ">= 4.7" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "pry-byebug" spec.add_development_dependency "rake" spec.add_development_dependency "rack-test" spec.add_development_dependency "rspec", ">= 3.0.0" end
38.086957
74
0.65411
799ce82271a1c112a2501688c4abc99e1b88d4fa
1,724
# Represents objects where permissions should be based on ownership. # # Implementations that have a `perms_ident` method, that will be used to generate the location in the permissions hash # If this is not present, the class name downcased and pluralized will be used. # # Implementations that have the `handle_ids` method set to true will use the object's ID during permissions hash retrieval. module Permissions::ScopedEditable # NOTE: Each class needs to implement the owns?(user) and perms_ident methods in order for scopes to work # If the class has no owner, editable should be used instead # Check if a user can edit a field. # If user is nil, will return false. # Field will be stringified. def can_edit?(user, field) return false if user.nil? perms_ident = self.respond_to?(:perms_ident) ? self.perms_ident : self.class.name.underscore.downcase.pluralize.to_sym handle_ids = self.respond_to?(:handle_ids) ? self.handle_ids : false if handle_ids value = user.has_permission?(perms_ident, self.id, :edit, field.to_s, 'all') if !value && self.owns?(user) value = user.has_permission?(perms_ident, self.id, :edit, field.to_s, 'own') end else value = user.has_permission?(perms_ident, :edit, field.to_s, 'all') if !value && self.owns?(user) value = (user.has_permission?(perms_ident, :edit, field.to_s, 'own') || user.has_permission?(perms_ident, :edit, field.to_s, 'issued')) end end value end # Checks if a user has permission to edit any of the fields defined in the `perm_fields` hash. def can_edit_any?(user) (self.class.perm_fields.collect { |f| f.to_s }).any? { |field| can_edit?(user, field) } end end
43.1
143
0.711137
4a3b349c8b37470b97b8f0e7cc2202050cd97c4c
85
json.extract! @account, :id, :description, :top_account_id, :created_at, :updated_at
42.5
84
0.764706
bbb56c76f0cacb0ad79b88dce4b202fb94648e5a
41
# placeholder to make this a rails plugin
41
41
0.804878
ac93d71632867d2d22c68238e66cd60d8ee179a1
175,951
# 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::Proton module Types # @note When making an API call, you may pass AcceptEnvironmentAccountConnectionInput # data as a hash: # # { # id: "EnvironmentAccountConnectionId", # required # } # # @!attribute [rw] id # The ID of the environment account connection. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/AcceptEnvironmentAccountConnectionInput AWS API Documentation # class AcceptEnvironmentAccountConnectionInput < Struct.new( :id) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connection # The environment account connection data that's returned by Proton. # @return [Types::EnvironmentAccountConnection] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/AcceptEnvironmentAccountConnectionOutput AWS API Documentation # class AcceptEnvironmentAccountConnectionOutput < Struct.new( :environment_account_connection) SENSITIVE = [] include Aws::Structure end # There *isn't* sufficient access for performing this action. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/AccessDeniedException AWS API Documentation # class AccessDeniedException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end # The Proton pipeline service role and repository data. # # @!attribute [rw] pipeline_provisioning_repository # The repository that you provide with pull request provisioning. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [Types::RepositoryBranch] # # @!attribute [rw] pipeline_service_role_arn # The Amazon Resource Name (ARN) of the Proton pipeline service role. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/AccountSettings AWS API Documentation # class AccountSettings < Struct.new( :pipeline_provisioning_repository, :pipeline_service_role_arn) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CancelEnvironmentDeploymentInput # data as a hash: # # { # environment_name: "ResourceName", # required # } # # @!attribute [rw] environment_name # The name of the environment with the deployment to cancel. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CancelEnvironmentDeploymentInput AWS API Documentation # class CancelEnvironmentDeploymentInput < Struct.new( :environment_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment # The environment summary data that's returned by Proton. # @return [Types::Environment] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CancelEnvironmentDeploymentOutput AWS API Documentation # class CancelEnvironmentDeploymentOutput < Struct.new( :environment) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CancelServiceInstanceDeploymentInput # data as a hash: # # { # service_instance_name: "ResourceName", # required # service_name: "ResourceName", # required # } # # @!attribute [rw] service_instance_name # The name of the service instance with the deployment to cancel. # @return [String] # # @!attribute [rw] service_name # The name of the service with the service instance deployment to # cancel. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CancelServiceInstanceDeploymentInput AWS API Documentation # class CancelServiceInstanceDeploymentInput < Struct.new( :service_instance_name, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service_instance # The service instance summary data that's returned by Proton. # @return [Types::ServiceInstance] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CancelServiceInstanceDeploymentOutput AWS API Documentation # class CancelServiceInstanceDeploymentOutput < Struct.new( :service_instance) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CancelServicePipelineDeploymentInput # data as a hash: # # { # service_name: "ResourceName", # required # } # # @!attribute [rw] service_name # The name of the service with the service pipeline deployment to # cancel. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CancelServicePipelineDeploymentInput AWS API Documentation # class CancelServicePipelineDeploymentInput < Struct.new( :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] pipeline # The service pipeline detail data that's returned by Proton. # @return [Types::ServicePipeline] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CancelServicePipelineDeploymentOutput AWS API Documentation # class CancelServicePipelineDeploymentOutput < Struct.new( :pipeline) SENSITIVE = [] include Aws::Structure end # Compatible environment template data. # # @!attribute [rw] major_version # The major version of the compatible environment template. # @return [String] # # @!attribute [rw] template_name # The compatible environment template name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CompatibleEnvironmentTemplate AWS API Documentation # class CompatibleEnvironmentTemplate < Struct.new( :major_version, :template_name) SENSITIVE = [] include Aws::Structure end # Compatible environment template data. # # @note When making an API call, you may pass CompatibleEnvironmentTemplateInput # data as a hash: # # { # major_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # The major version of the compatible environment template. # @return [String] # # @!attribute [rw] template_name # The compatible environment template name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CompatibleEnvironmentTemplateInput AWS API Documentation # class CompatibleEnvironmentTemplateInput < Struct.new( :major_version, :template_name) SENSITIVE = [] include Aws::Structure end # The request *couldn't* be made due to a conflicting operation or # resource. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ConflictException AWS API Documentation # class ConflictException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end # @note When making an API call, you may pass CreateEnvironmentAccountConnectionInput # data as a hash: # # { # client_token: "ClientToken", # environment_name: "ResourceName", # required # management_account_id: "AwsAccountId", # required # role_arn: "Arn", # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # } # # @!attribute [rw] client_token # When included, if two identical requests are made with the same # client token, Proton returns the environment account connection that # the first request created. # # **A suitable default value is auto-generated.** You should normally # not need to pass this option. # @return [String] # # @!attribute [rw] environment_name # The name of the Proton environment that's created in the associated # management account. # @return [String] # # @!attribute [rw] management_account_id # The ID of the management account that accepts or rejects the # environment account connection. You create an manage the Proton # environment in this account. If the management account accepts the # environment account connection, Proton can use the associated IAM # role to provision environment infrastructure resources in the # associated environment account. # @return [String] # # @!attribute [rw] role_arn # The Amazon Resource Name (ARN) of the IAM service role that's # created in the environment account. Proton uses this role to # provision infrastructure resources in the associated environment # account. # @return [String] # # @!attribute [rw] tags # Tags for your environment account connection. For more information, # see [Proton resources and tagging][1] in the *Proton Administrator # Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/resources.html # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentAccountConnectionInput AWS API Documentation # class CreateEnvironmentAccountConnectionInput < Struct.new( :client_token, :environment_name, :management_account_id, :role_arn, :tags) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connection # The environment account connection detail data that's returned by # Proton. # @return [Types::EnvironmentAccountConnection] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentAccountConnectionOutput AWS API Documentation # class CreateEnvironmentAccountConnectionOutput < Struct.new( :environment_account_connection) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateEnvironmentInput # data as a hash: # # { # description: "Description", # environment_account_connection_id: "EnvironmentAccountConnectionId", # name: "ResourceName", # required # proton_service_role_arn: "Arn", # provisioning_repository: { # branch: "GitBranchName", # required # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # }, # spec: "SpecContents", # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # template_major_version: "TemplateVersionPart", # required # template_minor_version: "TemplateVersionPart", # template_name: "ResourceName", # required # } # # @!attribute [rw] description # A description of the environment that's being created and deployed. # @return [String] # # @!attribute [rw] environment_account_connection_id # The ID of the environment account connection that you provide if # you're provisioning your environment infrastructure resources to an # environment account. You must include either the # `environmentAccountConnectionId` or `protonServiceRoleArn` parameter # and value and omit the `provisioningRepository` parameter and # values. For more information, see [Environment account # connections][1] in the *Proton Administrator guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-env-account-connections.html # @return [String] # # @!attribute [rw] name # The name of the environment. # @return [String] # # @!attribute [rw] proton_service_role_arn # The Amazon Resource Name (ARN) of the Proton service role that # allows Proton to make calls to other services on your behalf. You # must include either the `environmentAccountConnectionId` or # `protonServiceRoleArn` parameter and value and omit the # `provisioningRepository` parameter when you use standard # provisioning. # @return [String] # # @!attribute [rw] provisioning_repository # The repository that you provide with pull request provisioning. If # you provide this parameter, you must omit the # `environmentAccountConnectionId` and `protonServiceRoleArn` # parameters. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [Types::RepositoryBranchInput] # # @!attribute [rw] spec # A link to a YAML formatted spec file that provides inputs as defined # in the environment template bundle schema file. For more # information, see [Environments][1] in the *Proton Administrator # Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-environments.html # @return [String] # # @!attribute [rw] tags # Create tags for your environment. For more information, see *Proton # resources and tagging* in the [Proton Administrator Guide][1] or # [Proton User Guide][2]. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/resources.html # [2]: https://docs.aws.amazon.com/proton/latest/userguide/resources.html # @return [Array<Types::Tag>] # # @!attribute [rw] template_major_version # The major version of the environment template. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the environment template. # @return [String] # # @!attribute [rw] template_name # The name of the environment template. For more information, see # [Environment Templates][1] in the *Proton Administrator Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-templates.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentInput AWS API Documentation # class CreateEnvironmentInput < Struct.new( :description, :environment_account_connection_id, :name, :proton_service_role_arn, :provisioning_repository, :spec, :tags, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:description, :spec] include Aws::Structure end # @!attribute [rw] environment # The environment detail data that's returned by Proton. # @return [Types::Environment] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentOutput AWS API Documentation # class CreateEnvironmentOutput < Struct.new( :environment) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateEnvironmentTemplateInput # data as a hash: # # { # description: "Description", # display_name: "DisplayName", # encryption_key: "Arn", # name: "ResourceName", # required # provisioning: "CUSTOMER_MANAGED", # accepts CUSTOMER_MANAGED # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # } # # @!attribute [rw] description # A description of the environment template. # @return [String] # # @!attribute [rw] display_name # The environment template name as displayed in the developer # interface. # @return [String] # # @!attribute [rw] encryption_key # A customer provided encryption key that Proton uses to encrypt data. # @return [String] # # @!attribute [rw] name # The name of the environment template. # @return [String] # # @!attribute [rw] provisioning # When included, indicates that the environment template is for # customer provisioned and managed infrastructure. # @return [String] # # @!attribute [rw] tags # Create tags for your environment template. For more information, see # *Proton resources and tagging* in the [Proton Administrator # Guide][1] or [Proton User Guide][2]. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/resources.html # [2]: https://docs.aws.amazon.com/proton/latest/userguide/resources.html # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentTemplateInput AWS API Documentation # class CreateEnvironmentTemplateInput < Struct.new( :description, :display_name, :encryption_key, :name, :provisioning, :tags) SENSITIVE = [:description, :display_name] include Aws::Structure end # @!attribute [rw] environment_template # The environment template detail data that's returned by Proton. # @return [Types::EnvironmentTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentTemplateOutput AWS API Documentation # class CreateEnvironmentTemplateOutput < Struct.new( :environment_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateEnvironmentTemplateVersionInput # data as a hash: # # { # client_token: "ClientToken", # description: "Description", # major_version: "TemplateVersionPart", # source: { # required # s3: { # bucket: "S3Bucket", # required # key: "S3Key", # required # }, # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # template_name: "ResourceName", # required # } # # @!attribute [rw] client_token # When included, if two identical requests are made with the same # client token, Proton returns the environment template version that # the first request created. # # **A suitable default value is auto-generated.** You should normally # not need to pass this option. # @return [String] # # @!attribute [rw] description # A description of the new version of an environment template. # @return [String] # # @!attribute [rw] major_version # To create a new minor version of the environment template, include a # `major Version`. # # To create a new major and minor version of the environment template, # *exclude* `major Version`. # @return [String] # # @!attribute [rw] source # An object that includes the template bundle S3 bucket path and name # for the new version of an template. # @return [Types::TemplateVersionSourceInput] # # @!attribute [rw] tags # Create tags for a new version of an environment template. # @return [Array<Types::Tag>] # # @!attribute [rw] template_name # The name of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentTemplateVersionInput AWS API Documentation # class CreateEnvironmentTemplateVersionInput < Struct.new( :client_token, :description, :major_version, :source, :tags, :template_name) SENSITIVE = [:description] include Aws::Structure end # @!attribute [rw] environment_template_version # The environment template detail data that's returned by Proton. # @return [Types::EnvironmentTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateEnvironmentTemplateVersionOutput AWS API Documentation # class CreateEnvironmentTemplateVersionOutput < Struct.new( :environment_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateRepositoryInput # data as a hash: # # { # connection_arn: "Arn", # required # encryption_key: "Arn", # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # } # # @!attribute [rw] connection_arn # The Amazon Resource Name (ARN) of your Amazon Web Services CodeStar # connection. For more information, see [Setting up for Proton][1] in # the *Proton Administrator Guide*. # # # # [1]: https://docs.aws.amazon.com/setting-up-for-service # @return [String] # # @!attribute [rw] encryption_key # The ARN of your customer Amazon Web Services Key Management Service # (Amazon Web Services KMS) key. # @return [String] # # @!attribute [rw] name # The repository name, for example `myrepos/myrepo`. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateRepositoryInput AWS API Documentation # class CreateRepositoryInput < Struct.new( :connection_arn, :encryption_key, :name, :provider) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] repository # The repository detail data that's returned by Proton. # @return [Types::Repository] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateRepositoryOutput AWS API Documentation # class CreateRepositoryOutput < Struct.new( :repository) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateServiceInput # data as a hash: # # { # branch_name: "GitBranchName", # description: "Description", # name: "ResourceName", # required # repository_connection_arn: "Arn", # repository_id: "RepositoryId", # spec: "SpecContents", # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # template_major_version: "TemplateVersionPart", # required # template_minor_version: "TemplateVersionPart", # template_name: "ResourceName", # required # } # # @!attribute [rw] branch_name # The name of the code repository branch that holds the code that's # deployed in Proton. *Don't* include this parameter if your service # template *doesn't* include a service pipeline. # @return [String] # # @!attribute [rw] description # A description of the Proton service. # @return [String] # # @!attribute [rw] name # The service name. # @return [String] # # @!attribute [rw] repository_connection_arn # The Amazon Resource Name (ARN) of the repository connection. For # more information, see [Set up repository connection][1] in the # *Proton Administrator Guide* and [Setting up with Proton][2] in the # *Proton User Guide*. *Don't* include this parameter if your service # template *doesn't* include a service pipeline. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/setting-up-for-service.html#setting-up-vcontrol # [2]: https://docs.aws.amazon.com/proton/latest/userguide/proton-setup.html#setup-repo-connection # @return [String] # # @!attribute [rw] repository_id # The ID of the code repository. *Don't* include this parameter if # your service template *doesn't* include a service pipeline. # @return [String] # # @!attribute [rw] spec # A link to a spec file that provides inputs as defined in the service # template bundle schema file. The spec file is in YAML format. Don’t # include pipeline inputs in the spec if your service template # *doesn’t* include a service pipeline. For more information, see # [Create a service][1] in the *Proton Administrator Guide* and # [Create a service][2] in the *Proton User Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-create-svc.html.html # [2]: https://docs.aws.amazon.com/proton/latest/userguide/ug-svc-create.html # @return [String] # # @!attribute [rw] tags # Create tags for your service. For more information, see *Proton # resources and tagging* in the [Proton Administrator Guide][1] or # [Proton User Guide][2]. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/resources.html # [2]: https://docs.aws.amazon.com/proton/latest/userguide/resources.html # @return [Array<Types::Tag>] # # @!attribute [rw] template_major_version # The major version of the service template that was used to create # the service. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the service template that was used to create # the service. # @return [String] # # @!attribute [rw] template_name # The name of the service template that's used to create the service. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateServiceInput AWS API Documentation # class CreateServiceInput < Struct.new( :branch_name, :description, :name, :repository_connection_arn, :repository_id, :spec, :tags, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:description, :spec] include Aws::Structure end # @!attribute [rw] service # The service detail data that's returned by Proton. # @return [Types::Service] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateServiceOutput AWS API Documentation # class CreateServiceOutput < Struct.new( :service) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateServiceTemplateInput # data as a hash: # # { # description: "Description", # display_name: "DisplayName", # encryption_key: "Arn", # name: "ResourceName", # required # pipeline_provisioning: "CUSTOMER_MANAGED", # accepts CUSTOMER_MANAGED # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # } # # @!attribute [rw] description # A description of the service template. # @return [String] # # @!attribute [rw] display_name # The name of the service template as displayed in the developer # interface. # @return [String] # # @!attribute [rw] encryption_key # A customer provided encryption key that's used to encrypt data. # @return [String] # # @!attribute [rw] name # The name of the service template. # @return [String] # # @!attribute [rw] pipeline_provisioning # Proton includes a service pipeline for your service by default. When # included, this parameter indicates that an Proton service pipeline # *won't* be included for your service. Once specified, this # parameter *can't* be changed. For more information, see [Service # template bundles][1] in the *Proton Administrator Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-template-bundles.html # @return [String] # # @!attribute [rw] tags # Create tags for your service template. For more information, see # *Proton resources and tagging* in the [Proton Administrator # Guide][1] or [Proton User Guide][2]. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/resources.html # [2]: https://docs.aws.amazon.com/proton/latest/userguide/resources.html # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateServiceTemplateInput AWS API Documentation # class CreateServiceTemplateInput < Struct.new( :description, :display_name, :encryption_key, :name, :pipeline_provisioning, :tags) SENSITIVE = [:description, :display_name] include Aws::Structure end # @!attribute [rw] service_template # The service template detail data that's returned by Proton. # @return [Types::ServiceTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateServiceTemplateOutput AWS API Documentation # class CreateServiceTemplateOutput < Struct.new( :service_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateServiceTemplateVersionInput # data as a hash: # # { # client_token: "ClientToken", # compatible_environment_templates: [ # required # { # major_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # }, # ], # description: "Description", # major_version: "TemplateVersionPart", # source: { # required # s3: { # bucket: "S3Bucket", # required # key: "S3Key", # required # }, # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # template_name: "ResourceName", # required # } # # @!attribute [rw] client_token # When included, if two identical requests are made with the same # client token, Proton returns the service template version that the # first request created. # # **A suitable default value is auto-generated.** You should normally # not need to pass this option. # @return [String] # # @!attribute [rw] compatible_environment_templates # An array of compatible environment template objects for the new # version of a service template. # @return [Array<Types::CompatibleEnvironmentTemplateInput>] # # @!attribute [rw] description # A description of the new version of a service template. # @return [String] # # @!attribute [rw] major_version # To create a new minor version of the service template, include a # `major Version`. # # To create a new major and minor version of the service template, # *exclude* `major Version`. # @return [String] # # @!attribute [rw] source # An object that includes the template bundle S3 bucket path and name # for the new version of a service template. # @return [Types::TemplateVersionSourceInput] # # @!attribute [rw] tags # Create tags for a new version of a service template. # @return [Array<Types::Tag>] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateServiceTemplateVersionInput AWS API Documentation # class CreateServiceTemplateVersionInput < Struct.new( :client_token, :compatible_environment_templates, :description, :major_version, :source, :tags, :template_name) SENSITIVE = [:description] include Aws::Structure end # @!attribute [rw] service_template_version # The service template version summary of detail data that's returned # by Proton. # @return [Types::ServiceTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateServiceTemplateVersionOutput AWS API Documentation # class CreateServiceTemplateVersionOutput < Struct.new( :service_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass CreateTemplateSyncConfigInput # data as a hash: # # { # branch: "GitBranchName", # required # repository_name: "RepositoryName", # required # repository_provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # subdirectory: "Subdirectory", # template_name: "ResourceName", # required # template_type: "ENVIRONMENT", # required, accepts ENVIRONMENT, SERVICE # } # # @!attribute [rw] branch # The branch of the registered repository for your template. # @return [String] # # @!attribute [rw] repository_name # The name of your repository, for example `myrepos/myrepo`. # @return [String] # # @!attribute [rw] repository_provider # The provider type for your repository. # @return [String] # # @!attribute [rw] subdirectory # A repository subdirectory path to your template bundle directory. # When included, Proton limits the template bundle search to this # repository directory. # @return [String] # # @!attribute [rw] template_name # The name of your registered template. # @return [String] # # @!attribute [rw] template_type # The type of the registered template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateTemplateSyncConfigInput AWS API Documentation # class CreateTemplateSyncConfigInput < Struct.new( :branch, :repository_name, :repository_provider, :subdirectory, :template_name, :template_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] template_sync_config # The template sync configuration detail data that's returned by # Proton. # @return [Types::TemplateSyncConfig] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/CreateTemplateSyncConfigOutput AWS API Documentation # class CreateTemplateSyncConfigOutput < Struct.new( :template_sync_config) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteEnvironmentAccountConnectionInput # data as a hash: # # { # id: "EnvironmentAccountConnectionId", # required # } # # @!attribute [rw] id # The ID of the environment account connection to delete. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentAccountConnectionInput AWS API Documentation # class DeleteEnvironmentAccountConnectionInput < Struct.new( :id) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connection # The environment account connection detail data that's returned by # Proton. # @return [Types::EnvironmentAccountConnection] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentAccountConnectionOutput AWS API Documentation # class DeleteEnvironmentAccountConnectionOutput < Struct.new( :environment_account_connection) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteEnvironmentInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the environment to delete. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentInput AWS API Documentation # class DeleteEnvironmentInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment # The environment detail data that's returned by Proton. # @return [Types::Environment] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentOutput AWS API Documentation # class DeleteEnvironmentOutput < Struct.new( :environment) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteEnvironmentTemplateInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the environment template to delete. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentTemplateInput AWS API Documentation # class DeleteEnvironmentTemplateInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_template # The environment template detail data that's returned by Proton. # @return [Types::EnvironmentTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentTemplateOutput AWS API Documentation # class DeleteEnvironmentTemplateOutput < Struct.new( :environment_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteEnvironmentTemplateVersionInput # data as a hash: # # { # major_version: "TemplateVersionPart", # required # minor_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # The environment template major version to delete. # @return [String] # # @!attribute [rw] minor_version # The environment template minor version to delete. # @return [String] # # @!attribute [rw] template_name # The name of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentTemplateVersionInput AWS API Documentation # class DeleteEnvironmentTemplateVersionInput < Struct.new( :major_version, :minor_version, :template_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_template_version # The environment template version detail data that's returned by # Proton. # @return [Types::EnvironmentTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteEnvironmentTemplateVersionOutput AWS API Documentation # class DeleteEnvironmentTemplateVersionOutput < Struct.new( :environment_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteRepositoryInput # data as a hash: # # { # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # } # # @!attribute [rw] name # The name of the repository. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteRepositoryInput AWS API Documentation # class DeleteRepositoryInput < Struct.new( :name, :provider) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] repository # The repository detail data that's returned by Proton. # @return [Types::Repository] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteRepositoryOutput AWS API Documentation # class DeleteRepositoryOutput < Struct.new( :repository) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteServiceInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the service to delete. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteServiceInput AWS API Documentation # class DeleteServiceInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service # The service detail data that's returned by Proton. # @return [Types::Service] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteServiceOutput AWS API Documentation # class DeleteServiceOutput < Struct.new( :service) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteServiceTemplateInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the service template to delete. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteServiceTemplateInput AWS API Documentation # class DeleteServiceTemplateInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service_template # The service template detail data that's returned by Proton. # @return [Types::ServiceTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteServiceTemplateOutput AWS API Documentation # class DeleteServiceTemplateOutput < Struct.new( :service_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteServiceTemplateVersionInput # data as a hash: # # { # major_version: "TemplateVersionPart", # required # minor_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # The service template major version to delete. # @return [String] # # @!attribute [rw] minor_version # The service template minor version to delete. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteServiceTemplateVersionInput AWS API Documentation # class DeleteServiceTemplateVersionInput < Struct.new( :major_version, :minor_version, :template_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service_template_version # The service template version detail data that's returned by Proton. # @return [Types::ServiceTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteServiceTemplateVersionOutput AWS API Documentation # class DeleteServiceTemplateVersionOutput < Struct.new( :service_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass DeleteTemplateSyncConfigInput # data as a hash: # # { # template_name: "ResourceName", # required # template_type: "ENVIRONMENT", # required, accepts ENVIRONMENT, SERVICE # } # # @!attribute [rw] template_name # The template name. # @return [String] # # @!attribute [rw] template_type # The template type. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteTemplateSyncConfigInput AWS API Documentation # class DeleteTemplateSyncConfigInput < Struct.new( :template_name, :template_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] template_sync_config # The template sync configuration detail data that's returned by # Proton. # @return [Types::TemplateSyncConfig] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/DeleteTemplateSyncConfigOutput AWS API Documentation # class DeleteTemplateSyncConfigOutput < Struct.new( :template_sync_config) SENSITIVE = [] include Aws::Structure end # The environment detail data. An Proton environment is a set resources # shared across an Proton service. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the environment. # @return [String] # # @!attribute [rw] created_at # The time when the environment was created. # @return [Time] # # @!attribute [rw] deployment_status # The environment deployment status. # @return [String] # # @!attribute [rw] deployment_status_message # An environment deployment status message. # @return [String] # # @!attribute [rw] description # The description of the environment. # @return [String] # # @!attribute [rw] environment_account_connection_id # The ID of the environment account connection that's used to # provision infrastructure resources in an environment account. # @return [String] # # @!attribute [rw] environment_account_id # The ID of the environment account that the environment # infrastructure resources are provisioned in. # @return [String] # # @!attribute [rw] last_deployment_attempted_at # The time when a deployment of the environment was last attempted. # @return [Time] # # @!attribute [rw] last_deployment_succeeded_at # The time when the environment was last deployed successfully. # @return [Time] # # @!attribute [rw] name # The name of the environment. # @return [String] # # @!attribute [rw] proton_service_role_arn # The Amazon Resource Name (ARN) of the Proton service role that # allows Proton to make calls to other services on your behalf. # @return [String] # # @!attribute [rw] provisioning # When included, indicates that the environment template is for # customer provisioned and managed infrastructure. # @return [String] # # @!attribute [rw] provisioning_repository # The repository that you provide with pull request provisioning. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [Types::RepositoryBranch] # # @!attribute [rw] spec # The environment spec. # @return [String] # # @!attribute [rw] template_major_version # The ID of the major version of the environment template. # @return [String] # # @!attribute [rw] template_minor_version # The ID of the minor version of the environment template. # @return [String] # # @!attribute [rw] template_name # The Amazon Resource Name (ARN) of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/Environment AWS API Documentation # class Environment < Struct.new( :arn, :created_at, :deployment_status, :deployment_status_message, :description, :environment_account_connection_id, :environment_account_id, :last_deployment_attempted_at, :last_deployment_succeeded_at, :name, :proton_service_role_arn, :provisioning, :provisioning_repository, :spec, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:deployment_status_message, :description, :spec] include Aws::Structure end # The environment account connection detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the environment account # connection. # @return [String] # # @!attribute [rw] environment_account_id # The environment account that's connected to the environment account # connection. # @return [String] # # @!attribute [rw] environment_name # The name of the environment that's associated with the environment # account connection. # @return [String] # # @!attribute [rw] id # The ID of the environment account connection. # @return [String] # # @!attribute [rw] last_modified_at # The time when the environment account connection was last modified. # @return [Time] # # @!attribute [rw] management_account_id # The ID of the management account that's connected to the # environment account connection. # @return [String] # # @!attribute [rw] requested_at # The time when the environment account connection request was made. # @return [Time] # # @!attribute [rw] role_arn # The IAM service role that's associated with the environment account # connection. # @return [String] # # @!attribute [rw] status # The status of the environment account connection. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentAccountConnection AWS API Documentation # class EnvironmentAccountConnection < Struct.new( :arn, :environment_account_id, :environment_name, :id, :last_modified_at, :management_account_id, :requested_at, :role_arn, :status) SENSITIVE = [] include Aws::Structure end # A summary of the environment account connection detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the environment account # connection. # @return [String] # # @!attribute [rw] environment_account_id # The ID of the environment account that's connected to the # environment account connection. # @return [String] # # @!attribute [rw] environment_name # The name of the environment that's associated with the environment # account connection. # @return [String] # # @!attribute [rw] id # The ID of the environment account connection. # @return [String] # # @!attribute [rw] last_modified_at # The time when the environment account connection was last modified. # @return [Time] # # @!attribute [rw] management_account_id # The ID of the management account that's connected to the # environment account connection. # @return [String] # # @!attribute [rw] requested_at # The time when the environment account connection request was made. # @return [Time] # # @!attribute [rw] role_arn # The IAM service role that's associated with the environment account # connection. # @return [String] # # @!attribute [rw] status # The status of the environment account connection. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentAccountConnectionSummary AWS API Documentation # class EnvironmentAccountConnectionSummary < Struct.new( :arn, :environment_account_id, :environment_name, :id, :last_modified_at, :management_account_id, :requested_at, :role_arn, :status) SENSITIVE = [] include Aws::Structure end # A summary of the environment detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the environment. # @return [String] # # @!attribute [rw] created_at # The time when the environment was created. # @return [Time] # # @!attribute [rw] deployment_status # The environment deployment status. # @return [String] # # @!attribute [rw] deployment_status_message # An environment deployment status message. # @return [String] # # @!attribute [rw] description # The description of the environment. # @return [String] # # @!attribute [rw] environment_account_connection_id # The ID of the environment account connection that the environment is # associated with. # @return [String] # # @!attribute [rw] environment_account_id # The ID of the environment account that the environment # infrastructure resources are provisioned in. # @return [String] # # @!attribute [rw] last_deployment_attempted_at # The time when a deployment of the environment was last attempted. # @return [Time] # # @!attribute [rw] last_deployment_succeeded_at # The time when the environment was last deployed successfully. # @return [Time] # # @!attribute [rw] name # The name of the environment. # @return [String] # # @!attribute [rw] proton_service_role_arn # The Amazon Resource Name (ARN) of the Proton service role that # allows Proton to make calls to other services on your behalf. # @return [String] # # @!attribute [rw] provisioning # When included, indicates that the environment template is for # customer provisioned and managed infrastructure. # @return [String] # # @!attribute [rw] template_major_version # The major version of the environment template. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the environment template. # @return [String] # # @!attribute [rw] template_name # The name of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentSummary AWS API Documentation # class EnvironmentSummary < Struct.new( :arn, :created_at, :deployment_status, :deployment_status_message, :description, :environment_account_connection_id, :environment_account_id, :last_deployment_attempted_at, :last_deployment_succeeded_at, :name, :proton_service_role_arn, :provisioning, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:deployment_status_message, :description] include Aws::Structure end # The environment template data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the environment template. # @return [String] # # @!attribute [rw] created_at # The time when the environment template was created. # @return [Time] # # @!attribute [rw] description # A description of the environment template. # @return [String] # # @!attribute [rw] display_name # The name of the environment template as displayed in the developer # interface. # @return [String] # # @!attribute [rw] encryption_key # The customer provided encryption key for the environment template. # @return [String] # # @!attribute [rw] last_modified_at # The time when the environment template was last modified. # @return [Time] # # @!attribute [rw] name # The name of the environment template. # @return [String] # # @!attribute [rw] provisioning # When included, indicates that the environment template is for # customer provisioned and managed infrastructure. # @return [String] # # @!attribute [rw] recommended_version # The ID of the recommended version of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentTemplate AWS API Documentation # class EnvironmentTemplate < Struct.new( :arn, :created_at, :description, :display_name, :encryption_key, :last_modified_at, :name, :provisioning, :recommended_version) SENSITIVE = [:description, :display_name] include Aws::Structure end # A search filter for environment templates. # # @note When making an API call, you may pass EnvironmentTemplateFilter # data as a hash: # # { # major_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # Include `majorVersion` to filter search for a major version. # @return [String] # # @!attribute [rw] template_name # Include `templateName` to filter search for a template name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentTemplateFilter AWS API Documentation # class EnvironmentTemplateFilter < Struct.new( :major_version, :template_name) SENSITIVE = [] include Aws::Structure end # The environment template data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the environment template. # @return [String] # # @!attribute [rw] created_at # The time when the environment template was created. # @return [Time] # # @!attribute [rw] description # A description of the environment template. # @return [String] # # @!attribute [rw] display_name # The name of the environment template as displayed in the developer # interface. # @return [String] # # @!attribute [rw] last_modified_at # The time when the environment template was last modified. # @return [Time] # # @!attribute [rw] name # The name of the environment template. # @return [String] # # @!attribute [rw] provisioning # When included, indicates that the environment template is for # customer provisioned and managed infrastructure. # @return [String] # # @!attribute [rw] recommended_version # The recommended version of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentTemplateSummary AWS API Documentation # class EnvironmentTemplateSummary < Struct.new( :arn, :created_at, :description, :display_name, :last_modified_at, :name, :provisioning, :recommended_version) SENSITIVE = [:description, :display_name] include Aws::Structure end # The environment template version data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the version of an environment # template. # @return [String] # # @!attribute [rw] created_at # The time when the version of an environment template was created. # @return [Time] # # @!attribute [rw] description # A description of the minor version of an environment template. # @return [String] # # @!attribute [rw] last_modified_at # The time when the version of an environment template was last # modified. # @return [Time] # # @!attribute [rw] major_version # The latest major version that's associated with the version of an # environment template. # @return [String] # # @!attribute [rw] minor_version # The minor version of an environment template. # @return [String] # # @!attribute [rw] recommended_minor_version # The recommended minor version of the environment template. # @return [String] # # @!attribute [rw] schema # The schema of the version of an environment template. # @return [String] # # @!attribute [rw] status # The status of the version of an environment template. # @return [String] # # @!attribute [rw] status_message # The status message of the version of an environment template. # @return [String] # # @!attribute [rw] template_name # The name of the version of an environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentTemplateVersion AWS API Documentation # class EnvironmentTemplateVersion < Struct.new( :arn, :created_at, :description, :last_modified_at, :major_version, :minor_version, :recommended_minor_version, :schema, :status, :status_message, :template_name) SENSITIVE = [:description, :schema, :status_message] include Aws::Structure end # A summary of the version of an environment template detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the version of an environment # template. # @return [String] # # @!attribute [rw] created_at # The time when the version of an environment template was created. # @return [Time] # # @!attribute [rw] description # A description of the version of an environment template. # @return [String] # # @!attribute [rw] last_modified_at # The time when the version of an environment template was last # modified. # @return [Time] # # @!attribute [rw] major_version # The latest major version that's associated with the version of an # environment template. # @return [String] # # @!attribute [rw] minor_version # The version of an environment template. # @return [String] # # @!attribute [rw] recommended_minor_version # The recommended minor version of the environment template. # @return [String] # # @!attribute [rw] status # The status of the version of an environment template. # @return [String] # # @!attribute [rw] status_message # The status message of the version of an environment template. # @return [String] # # @!attribute [rw] template_name # The name of the version of an environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/EnvironmentTemplateVersionSummary AWS API Documentation # class EnvironmentTemplateVersionSummary < Struct.new( :arn, :created_at, :description, :last_modified_at, :major_version, :minor_version, :recommended_minor_version, :status, :status_message, :template_name) SENSITIVE = [:description, :status_message] include Aws::Structure end # @api private # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetAccountSettingsInput AWS API Documentation # class GetAccountSettingsInput < Aws::EmptyStructure; end # @!attribute [rw] account_settings # The Proton pipeline service role detail data that's returned by # Proton. # @return [Types::AccountSettings] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetAccountSettingsOutput AWS API Documentation # class GetAccountSettingsOutput < Struct.new( :account_settings) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetEnvironmentAccountConnectionInput # data as a hash: # # { # id: "EnvironmentAccountConnectionId", # required # } # # @!attribute [rw] id # The ID of the environment account connection. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentAccountConnectionInput AWS API Documentation # class GetEnvironmentAccountConnectionInput < Struct.new( :id) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connection # The environment account connection detail data that's returned by # Proton. # @return [Types::EnvironmentAccountConnection] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentAccountConnectionOutput AWS API Documentation # class GetEnvironmentAccountConnectionOutput < Struct.new( :environment_account_connection) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetEnvironmentInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the environment that you want to get the detail data # for. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentInput AWS API Documentation # class GetEnvironmentInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment # The environment detail data that's returned by Proton. # @return [Types::Environment] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentOutput AWS API Documentation # class GetEnvironmentOutput < Struct.new( :environment) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetEnvironmentTemplateInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the environment template that you want to get the detail # data for. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentTemplateInput AWS API Documentation # class GetEnvironmentTemplateInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_template # The environment template detail data that's returned by Proton. # @return [Types::EnvironmentTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentTemplateOutput AWS API Documentation # class GetEnvironmentTemplateOutput < Struct.new( :environment_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetEnvironmentTemplateVersionInput # data as a hash: # # { # major_version: "TemplateVersionPart", # required # minor_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # To view environment template major version detail data, include # `major Version`. # @return [String] # # @!attribute [rw] minor_version # To view environment template minor version detail data, include # `minorVersion`. # @return [String] # # @!attribute [rw] template_name # The name of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentTemplateVersionInput AWS API Documentation # class GetEnvironmentTemplateVersionInput < Struct.new( :major_version, :minor_version, :template_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_template_version # The environment template version detail data that's returned by # Proton. # @return [Types::EnvironmentTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetEnvironmentTemplateVersionOutput AWS API Documentation # class GetEnvironmentTemplateVersionOutput < Struct.new( :environment_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetRepositoryInput # data as a hash: # # { # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # } # # @!attribute [rw] name # The repository name, for example `myrepos/myrepo`. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetRepositoryInput AWS API Documentation # class GetRepositoryInput < Struct.new( :name, :provider) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] repository # The repository detail data that's returned by Proton. # @return [Types::Repository] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetRepositoryOutput AWS API Documentation # class GetRepositoryOutput < Struct.new( :repository) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetRepositorySyncStatusInput # data as a hash: # # { # branch: "GitBranchName", # required # repository_name: "RepositoryName", # required # repository_provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # sync_type: "TEMPLATE_SYNC", # required, accepts TEMPLATE_SYNC # } # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] repository_name # The repository name. # @return [String] # # @!attribute [rw] repository_provider # The repository provider. # @return [String] # # @!attribute [rw] sync_type # The repository sync type. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetRepositorySyncStatusInput AWS API Documentation # class GetRepositorySyncStatusInput < Struct.new( :branch, :repository_name, :repository_provider, :sync_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] latest_sync # The repository sync status detail data that's returned by Proton. # @return [Types::RepositorySyncAttempt] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetRepositorySyncStatusOutput AWS API Documentation # class GetRepositorySyncStatusOutput < Struct.new( :latest_sync) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetServiceInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the service that you want to get the detail data for. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceInput AWS API Documentation # class GetServiceInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetServiceInstanceInput # data as a hash: # # { # name: "ResourceName", # required # service_name: "ResourceName", # required # } # # @!attribute [rw] name # The name of a service instance that you want to get the detail data # for. # @return [String] # # @!attribute [rw] service_name # The name of the service that the service instance belongs to. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceInstanceInput AWS API Documentation # class GetServiceInstanceInput < Struct.new( :name, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service_instance # The service instance detail data that's returned by Proton. # @return [Types::ServiceInstance] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceInstanceOutput AWS API Documentation # class GetServiceInstanceOutput < Struct.new( :service_instance) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service # The service detail data that's returned by Proton. # @return [Types::Service] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceOutput AWS API Documentation # class GetServiceOutput < Struct.new( :service) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetServiceTemplateInput # data as a hash: # # { # name: "ResourceName", # required # } # # @!attribute [rw] name # The name of the service template that you want to get detail data # for. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceTemplateInput AWS API Documentation # class GetServiceTemplateInput < Struct.new( :name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service_template # The service template detail data that's returned by Proton. # @return [Types::ServiceTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceTemplateOutput AWS API Documentation # class GetServiceTemplateOutput < Struct.new( :service_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetServiceTemplateVersionInput # data as a hash: # # { # major_version: "TemplateVersionPart", # required # minor_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # To view service template major version detail data, include `major # Version`. # @return [String] # # @!attribute [rw] minor_version # To view service template minor version detail data, include # `minorVersion`. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceTemplateVersionInput AWS API Documentation # class GetServiceTemplateVersionInput < Struct.new( :major_version, :minor_version, :template_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service_template_version # The service template version detail data that's returned by Proton. # @return [Types::ServiceTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetServiceTemplateVersionOutput AWS API Documentation # class GetServiceTemplateVersionOutput < Struct.new( :service_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetTemplateSyncConfigInput # data as a hash: # # { # template_name: "ResourceName", # required # template_type: "ENVIRONMENT", # required, accepts ENVIRONMENT, SERVICE # } # # @!attribute [rw] template_name # The template name. # @return [String] # # @!attribute [rw] template_type # The template type. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetTemplateSyncConfigInput AWS API Documentation # class GetTemplateSyncConfigInput < Struct.new( :template_name, :template_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] template_sync_config # The template sync configuration detail data that's returned by # Proton. # @return [Types::TemplateSyncConfig] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetTemplateSyncConfigOutput AWS API Documentation # class GetTemplateSyncConfigOutput < Struct.new( :template_sync_config) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass GetTemplateSyncStatusInput # data as a hash: # # { # template_name: "ResourceName", # required # template_type: "ENVIRONMENT", # required, accepts ENVIRONMENT, SERVICE # template_version: "TemplateVersionPart", # required # } # # @!attribute [rw] template_name # The template name. # @return [String] # # @!attribute [rw] template_type # The template type. # @return [String] # # @!attribute [rw] template_version # The template version. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetTemplateSyncStatusInput AWS API Documentation # class GetTemplateSyncStatusInput < Struct.new( :template_name, :template_type, :template_version) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] desired_state # The template sync desired state that's returned by Proton. # @return [Types::Revision] # # @!attribute [rw] latest_successful_sync # The details of the last successful sync that's returned by Proton. # @return [Types::ResourceSyncAttempt] # # @!attribute [rw] latest_sync # The details of the last sync that's returned by Proton. # @return [Types::ResourceSyncAttempt] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/GetTemplateSyncStatusOutput AWS API Documentation # class GetTemplateSyncStatusOutput < Struct.new( :desired_state, :latest_successful_sync, :latest_sync) SENSITIVE = [] include Aws::Structure end # The request failed to register with the service. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/InternalServerException AWS API Documentation # class InternalServerException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end # @note When making an API call, you may pass ListEnvironmentAccountConnectionsInput # data as a hash: # # { # environment_name: "ResourceName", # max_results: 1, # next_token: "NextToken", # requested_by: "MANAGEMENT_ACCOUNT", # required, accepts MANAGEMENT_ACCOUNT, ENVIRONMENT_ACCOUNT # statuses: ["PENDING"], # accepts PENDING, CONNECTED, REJECTED # } # # @!attribute [rw] environment_name # The environment name that's associated with each listed environment # account connection. # @return [String] # # @!attribute [rw] max_results # The maximum number of environment account connections to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next environment account # connection in the array of environment account connections, after # the list of environment account connections that was previously # requested. # @return [String] # # @!attribute [rw] requested_by # The type of account making the `ListEnvironmentAccountConnections` # request. # @return [String] # # @!attribute [rw] statuses # The status details for each listed environment account connection. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentAccountConnectionsInput AWS API Documentation # class ListEnvironmentAccountConnectionsInput < Struct.new( :environment_name, :max_results, :next_token, :requested_by, :statuses) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connections # An array of environment account connections with details that's # returned by Proton. # @return [Array<Types::EnvironmentAccountConnectionSummary>] # # @!attribute [rw] next_token # A token to indicate the location of the next environment account # connection in the array of environment account connections, after # the current requested list of environment account connections. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentAccountConnectionsOutput AWS API Documentation # class ListEnvironmentAccountConnectionsOutput < Struct.new( :environment_account_connections, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListEnvironmentOutputsInput # data as a hash: # # { # environment_name: "ResourceName", # required # next_token: "EmptyNextToken", # } # # @!attribute [rw] environment_name # The environment name. # @return [String] # # @!attribute [rw] next_token # A token to indicate the location of the next environment output in # the array of environment outputs, after the list of environment # outputs that was previously requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentOutputsInput AWS API Documentation # class ListEnvironmentOutputsInput < Struct.new( :environment_name, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next environment output in # the array of environment outputs, after the current requested list # of environment outputs. # @return [String] # # @!attribute [rw] outputs # An array of environment outputs with detail data. # @return [Array<Types::Output>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentOutputsOutput AWS API Documentation # class ListEnvironmentOutputsOutput < Struct.new( :next_token, :outputs) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListEnvironmentProvisionedResourcesInput # data as a hash: # # { # environment_name: "ResourceName", # required # next_token: "EmptyNextToken", # } # # @!attribute [rw] environment_name # The environment name. # @return [String] # # @!attribute [rw] next_token # A token to indicate the location of the next environment provisioned # resource in the array of environment provisioned resources, after # the list of environment provisioned resources that was previously # requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentProvisionedResourcesInput AWS API Documentation # class ListEnvironmentProvisionedResourcesInput < Struct.new( :environment_name, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next environment provisioned # resource in the array of provisioned resources, after the current # requested list of environment provisioned resources. # @return [String] # # @!attribute [rw] provisioned_resources # An array of environment provisioned resources. # @return [Array<Types::ProvisionedResource>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentProvisionedResourcesOutput AWS API Documentation # class ListEnvironmentProvisionedResourcesOutput < Struct.new( :next_token, :provisioned_resources) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListEnvironmentTemplateVersionsInput # data as a hash: # # { # major_version: "TemplateVersionPart", # max_results: 1, # next_token: "NextToken", # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # To view a list of minor of versions under a major version of an # environment template, include `major Version`. # # To view a list of major versions of an environment template, # *exclude* `major Version`. # @return [String] # # @!attribute [rw] max_results # The maximum number of major or minor versions of an environment # template to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next major or minor version # in the array of major or minor versions of an environment template, # after the list of major or minor versions that was previously # requested. # @return [String] # # @!attribute [rw] template_name # The name of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentTemplateVersionsInput AWS API Documentation # class ListEnvironmentTemplateVersionsInput < Struct.new( :major_version, :max_results, :next_token, :template_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next major or minor version # in the array of major or minor versions of an environment template, # after the list of major or minor versions that was previously # requested. # @return [String] # # @!attribute [rw] template_versions # An array of major or minor versions of an environment template # detail data. # @return [Array<Types::EnvironmentTemplateVersionSummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentTemplateVersionsOutput AWS API Documentation # class ListEnvironmentTemplateVersionsOutput < Struct.new( :next_token, :template_versions) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListEnvironmentTemplatesInput # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] max_results # The maximum number of environment templates to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next environment template in # the array of environment templates, after the list of environment # templates that was previously requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentTemplatesInput AWS API Documentation # class ListEnvironmentTemplatesInput < Struct.new( :max_results, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next environment template in # the array of environment templates, after the current requested list # of environment templates. # @return [String] # # @!attribute [rw] templates # An array of environment templates with detail data. # @return [Array<Types::EnvironmentTemplateSummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentTemplatesOutput AWS API Documentation # class ListEnvironmentTemplatesOutput < Struct.new( :next_token, :templates) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListEnvironmentsInput # data as a hash: # # { # environment_templates: [ # { # major_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # }, # ], # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] environment_templates # An array of the versions of the environment template. # @return [Array<Types::EnvironmentTemplateFilter>] # # @!attribute [rw] max_results # The maximum number of environments to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next environment in the # array of environments, after the list of environments that was # previously requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentsInput AWS API Documentation # class ListEnvironmentsInput < Struct.new( :environment_templates, :max_results, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environments # An array of environment detail data summaries. # @return [Array<Types::EnvironmentSummary>] # # @!attribute [rw] next_token # A token to indicate the location of the next environment in the # array of environments, after the current requested list of # environments. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListEnvironmentsOutput AWS API Documentation # class ListEnvironmentsOutput < Struct.new( :environments, :next_token) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListRepositoriesInput # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] max_results # The maximum number of repositories to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next repository in the array # of repositories, after the list of repositories previously # requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListRepositoriesInput AWS API Documentation # class ListRepositoriesInput < Struct.new( :max_results, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next repository in the array # of repositories, after the current requested list of repositories. # @return [String] # # @!attribute [rw] repositories # An array of repositories. # @return [Array<Types::RepositorySummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListRepositoriesOutput AWS API Documentation # class ListRepositoriesOutput < Struct.new( :next_token, :repositories) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListRepositorySyncDefinitionsInput # data as a hash: # # { # next_token: "EmptyNextToken", # repository_name: "RepositoryName", # required # repository_provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # sync_type: "TEMPLATE_SYNC", # required, accepts TEMPLATE_SYNC # } # # @!attribute [rw] next_token # A token to indicate the location of the next repository sync # definition in the array of repository sync definitions, after the # list of repository sync definitions previously requested. # @return [String] # # @!attribute [rw] repository_name # The repository name. # @return [String] # # @!attribute [rw] repository_provider # The repository provider. # @return [String] # # @!attribute [rw] sync_type # The sync type. The only supported value is `TEMPLATE_SYNC`. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListRepositorySyncDefinitionsInput AWS API Documentation # class ListRepositorySyncDefinitionsInput < Struct.new( :next_token, :repository_name, :repository_provider, :sync_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next repository sync # definition in the array of repository sync definitions, after the # current requested list of repository sync definitions. # @return [String] # # @!attribute [rw] sync_definitions # An array of repository sync definitions. # @return [Array<Types::RepositorySyncDefinition>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListRepositorySyncDefinitionsOutput AWS API Documentation # class ListRepositorySyncDefinitionsOutput < Struct.new( :next_token, :sync_definitions) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServiceInstanceOutputsInput # data as a hash: # # { # next_token: "EmptyNextToken", # service_instance_name: "ResourceName", # required # service_name: "ResourceName", # required # } # # @!attribute [rw] next_token # A token to indicate the location of the next output in the array of # outputs, after the list of outputs that was previously requested. # @return [String] # # @!attribute [rw] service_instance_name # The service instance name. # @return [String] # # @!attribute [rw] service_name # The service name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceInstanceOutputsInput AWS API Documentation # class ListServiceInstanceOutputsInput < Struct.new( :next_token, :service_instance_name, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next output in the array of # outputs, after the current requested list of outputs. # @return [String] # # @!attribute [rw] outputs # An array of service instance infrastructure as code outputs. # @return [Array<Types::Output>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceInstanceOutputsOutput AWS API Documentation # class ListServiceInstanceOutputsOutput < Struct.new( :next_token, :outputs) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServiceInstanceProvisionedResourcesInput # data as a hash: # # { # next_token: "EmptyNextToken", # service_instance_name: "ResourceName", # required # service_name: "ResourceName", # required # } # # @!attribute [rw] next_token # A token to indicate the location of the next provisioned resource in # the array of provisioned resources, after the list of provisioned # resources that was previously requested. # @return [String] # # @!attribute [rw] service_instance_name # The service instance name. # @return [String] # # @!attribute [rw] service_name # The service name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceInstanceProvisionedResourcesInput AWS API Documentation # class ListServiceInstanceProvisionedResourcesInput < Struct.new( :next_token, :service_instance_name, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next provisioned resource in # the array of provisioned resources, after the current requested list # of provisioned resources. # @return [String] # # @!attribute [rw] provisioned_resources # An array of provisioned resources for a service instance. # @return [Array<Types::ProvisionedResource>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceInstanceProvisionedResourcesOutput AWS API Documentation # class ListServiceInstanceProvisionedResourcesOutput < Struct.new( :next_token, :provisioned_resources) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServiceInstancesInput # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # service_name: "ResourceName", # } # # @!attribute [rw] max_results # The maximum number of service instances to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next service in the array of # service instances, after the list of service instances that was # previously requested. # @return [String] # # @!attribute [rw] service_name # The name of the service that the service instance belongs to. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceInstancesInput AWS API Documentation # class ListServiceInstancesInput < Struct.new( :max_results, :next_token, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next service instance in the # array of service instances, after the current requested list of # service instances. # @return [String] # # @!attribute [rw] service_instances # An array of service instances with summaries of detail data. # @return [Array<Types::ServiceInstanceSummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceInstancesOutput AWS API Documentation # class ListServiceInstancesOutput < Struct.new( :next_token, :service_instances) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServicePipelineOutputsInput # data as a hash: # # { # next_token: "EmptyNextToken", # service_name: "ResourceName", # required # } # # @!attribute [rw] next_token # A token to indicate the location of the next output in the array of # outputs, after the list of outputs that was previously requested. # @return [String] # # @!attribute [rw] service_name # The service name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServicePipelineOutputsInput AWS API Documentation # class ListServicePipelineOutputsInput < Struct.new( :next_token, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next output in the array of # outputs, after the current requested list of outputs. # @return [String] # # @!attribute [rw] outputs # An array of outputs. # @return [Array<Types::Output>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServicePipelineOutputsOutput AWS API Documentation # class ListServicePipelineOutputsOutput < Struct.new( :next_token, :outputs) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServicePipelineProvisionedResourcesInput # data as a hash: # # { # next_token: "EmptyNextToken", # service_name: "ResourceName", # required # } # # @!attribute [rw] next_token # A token to indicate the location of the next provisioned resource in # the array of provisioned resources, after the list of provisioned # resources that was previously requested. # @return [String] # # @!attribute [rw] service_name # The service name. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServicePipelineProvisionedResourcesInput AWS API Documentation # class ListServicePipelineProvisionedResourcesInput < Struct.new( :next_token, :service_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next provisioned resource in # the array of provisioned resources, after the current requested list # of provisioned resources. # @return [String] # # @!attribute [rw] provisioned_resources # An array of provisioned resources for a service and pipeline. # @return [Array<Types::ProvisionedResource>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServicePipelineProvisionedResourcesOutput AWS API Documentation # class ListServicePipelineProvisionedResourcesOutput < Struct.new( :next_token, :provisioned_resources) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServiceTemplateVersionsInput # data as a hash: # # { # major_version: "TemplateVersionPart", # max_results: 1, # next_token: "NextToken", # template_name: "ResourceName", # required # } # # @!attribute [rw] major_version # To view a list of minor of versions under a major version of a # service template, include `major Version`. # # To view a list of major versions of a service template, *exclude* # `major Version`. # @return [String] # # @!attribute [rw] max_results # The maximum number of major or minor versions of a service template # to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next major or minor version # in the array of major or minor versions of a service template, after # the list of major or minor versions that was previously requested. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceTemplateVersionsInput AWS API Documentation # class ListServiceTemplateVersionsInput < Struct.new( :major_version, :max_results, :next_token, :template_name) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next major or minor version # in the array of major or minor versions of a service template, after # the current requested list of service major or minor versions. # @return [String] # # @!attribute [rw] template_versions # An array of major or minor versions of a service template with # detail data. # @return [Array<Types::ServiceTemplateVersionSummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceTemplateVersionsOutput AWS API Documentation # class ListServiceTemplateVersionsOutput < Struct.new( :next_token, :template_versions) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServiceTemplatesInput # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] max_results # The maximum number of service templates to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next service template in the # array of service templates, after the list of service templates # previously requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceTemplatesInput AWS API Documentation # class ListServiceTemplatesInput < Struct.new( :max_results, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next service template in the # array of service templates, after the current requested list of # service templates. # @return [String] # # @!attribute [rw] templates # An array of service templates with detail data. # @return [Array<Types::ServiceTemplateSummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServiceTemplatesOutput AWS API Documentation # class ListServiceTemplatesOutput < Struct.new( :next_token, :templates) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListServicesInput # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] max_results # The maximum number of services to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next service in the array of # services, after the list of services that was previously requested. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServicesInput AWS API Documentation # class ListServicesInput < Struct.new( :max_results, :next_token) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next service in the array of # services, after the current requested list of services. # @return [String] # # @!attribute [rw] services # An array of services with summaries of detail data. # @return [Array<Types::ServiceSummary>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListServicesOutput AWS API Documentation # class ListServicesOutput < Struct.new( :next_token, :services) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass ListTagsForResourceInput # data as a hash: # # { # max_results: 1, # next_token: "String", # resource_arn: "Arn", # required # } # # @!attribute [rw] max_results # The maximum number of tags to list. # @return [Integer] # # @!attribute [rw] next_token # A token to indicate the location of the next resource tag in the # array of resource tags, after the list of resource tags that was # previously requested. # @return [String] # # @!attribute [rw] resource_arn # The Amazon Resource Name (ARN) of the resource for the listed tags. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListTagsForResourceInput AWS API Documentation # class ListTagsForResourceInput < Struct.new( :max_results, :next_token, :resource_arn) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] next_token # A token to indicate the location of the next resource tag in the # array of resource tags, after the current requested list of resource # tags. # @return [String] # # @!attribute [rw] tags # An array of resource tags with detail data. # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ListTagsForResourceOutput AWS API Documentation # class ListTagsForResourceOutput < Struct.new( :next_token, :tags) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass NotifyResourceDeploymentStatusChangeInput # data as a hash: # # { # deployment_id: "DeploymentId", # outputs: [ # { # key: "OutputKey", # value_string: "OutputValueString", # }, # ], # resource_arn: "Arn", # required # status: "IN_PROGRESS", # required, accepts IN_PROGRESS, FAILED, SUCCEEDED # status_message: "SyntheticNotifyResourceDeploymentStatusChangeInputString", # } # # @!attribute [rw] deployment_id # The deployment ID for your provisioned resource. # @return [String] # # @!attribute [rw] outputs # The provisioned resource state change detail data that's returned # by Proton. # @return [Array<Types::Output>] # # @!attribute [rw] resource_arn # The provisioned resource Amazon Resource Name (ARN). # @return [String] # # @!attribute [rw] status # The status of your provisioned resource. # @return [String] # # @!attribute [rw] status_message # The deployment status message for your provisioned resource. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/NotifyResourceDeploymentStatusChangeInput AWS API Documentation # class NotifyResourceDeploymentStatusChangeInput < Struct.new( :deployment_id, :outputs, :resource_arn, :status, :status_message) SENSITIVE = [:status_message] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/NotifyResourceDeploymentStatusChangeOutput AWS API Documentation # class NotifyResourceDeploymentStatusChangeOutput < Aws::EmptyStructure; end # An infrastructure as code defined resource output. # # @note When making an API call, you may pass Output # data as a hash: # # { # key: "OutputKey", # value_string: "OutputValueString", # } # # @!attribute [rw] key # The output key. # @return [String] # # @!attribute [rw] value_string # The output value. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/Output AWS API Documentation # class Output < Struct.new( :key, :value_string) SENSITIVE = [] include Aws::Structure end # Detail data for a provisioned resource. # # @!attribute [rw] identifier # The provisioned resource identifier. # @return [String] # # @!attribute [rw] name # The provisioned resource name. # @return [String] # # @!attribute [rw] provisioning_engine # The resource provisioning engine. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ProvisionedResource AWS API Documentation # class ProvisionedResource < Struct.new( :identifier, :name, :provisioning_engine) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass RejectEnvironmentAccountConnectionInput # data as a hash: # # { # id: "EnvironmentAccountConnectionId", # required # } # # @!attribute [rw] id # The ID of the environment account connection to reject. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RejectEnvironmentAccountConnectionInput AWS API Documentation # class RejectEnvironmentAccountConnectionInput < Struct.new( :id) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connection # The environment connection account detail data that's returned by # Proton. # @return [Types::EnvironmentAccountConnection] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RejectEnvironmentAccountConnectionOutput AWS API Documentation # class RejectEnvironmentAccountConnectionOutput < Struct.new( :environment_account_connection) SENSITIVE = [] include Aws::Structure end # Detail date for a repository that has been registered with Proton. # # @!attribute [rw] arn # The repository Amazon Resource Name (ARN). # @return [String] # # @!attribute [rw] connection_arn # The repository Amazon Web Services CodeStar connection that connects # Proton to your repository. # @return [String] # # @!attribute [rw] encryption_key # Your customer Amazon Web Services KMS encryption key. # @return [String] # # @!attribute [rw] name # The repository name. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/Repository AWS API Documentation # class Repository < Struct.new( :arn, :connection_arn, :encryption_key, :name, :provider) SENSITIVE = [] include Aws::Structure end # Detail data for a repository branch. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more about # [Amazon Web Services Feature Preview terms][1], see section 2 on Beta # and Previews. # # # # [1]: https://aws.amazon.com/service-terms # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the repository branch. # @return [String] # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] name # The repository name. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RepositoryBranch AWS API Documentation # class RepositoryBranch < Struct.new( :arn, :branch, :name, :provider) SENSITIVE = [] include Aws::Structure end # Detail input data for a repository branch. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more about # [Amazon Web Services Feature Preview terms][1], see section 2 on Beta # and Previews. # # # # [1]: https://aws.amazon.com/service-terms # # @note When making an API call, you may pass RepositoryBranchInput # data as a hash: # # { # branch: "GitBranchName", # required # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # } # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] name # The repository name. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RepositoryBranchInput AWS API Documentation # class RepositoryBranchInput < Struct.new( :branch, :name, :provider) SENSITIVE = [] include Aws::Structure end # A summary of detail data for a registered repository. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) for a repository. # @return [String] # # @!attribute [rw] name # The repository name. # @return [String] # # @!attribute [rw] provider # The repository provider. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RepositorySummary AWS API Documentation # class RepositorySummary < Struct.new( :arn, :name, :provider) SENSITIVE = [] include Aws::Structure end # Detail data for a repository sync attempt activated by a push to a # repository. # # @!attribute [rw] events # Detail data for sync attempt events. # @return [Array<Types::RepositorySyncEvent>] # # @!attribute [rw] started_at # The time when the sync attempt started. # @return [Time] # # @!attribute [rw] status # The sync attempt status. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RepositorySyncAttempt AWS API Documentation # class RepositorySyncAttempt < Struct.new( :events, :started_at, :status) SENSITIVE = [] include Aws::Structure end # The repository sync definition. # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] directory # The directory in the repository. # @return [String] # # @!attribute [rw] parent # The resource that is synced from. # @return [String] # # @!attribute [rw] target # The resource that is synced to. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RepositorySyncDefinition AWS API Documentation # class RepositorySyncDefinition < Struct.new( :branch, :directory, :parent, :target) SENSITIVE = [] include Aws::Structure end # Repository sync event detail data for a sync attempt. # # @!attribute [rw] event # Event detail for a repository sync attempt. # @return [String] # # @!attribute [rw] external_id # The external ID of the sync event. # @return [String] # # @!attribute [rw] time # The time that the sync event occurred. # @return [Time] # # @!attribute [rw] type # The type of event. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/RepositorySyncEvent AWS API Documentation # class RepositorySyncEvent < Struct.new( :event, :external_id, :time, :type) SENSITIVE = [] include Aws::Structure end # The requested resource *wasn't* found. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ResourceNotFoundException AWS API Documentation # class ResourceNotFoundException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end # Detail data for a resource sync attempt activated by a push to a # repository. # # @!attribute [rw] events # An array of events with detail data. # @return [Array<Types::ResourceSyncEvent>] # # @!attribute [rw] initial_revision # Detail data for the initial repository commit, path and push. # @return [Types::Revision] # # @!attribute [rw] started_at # The time when the sync attempt started. # @return [Time] # # @!attribute [rw] status # The status of the sync attempt. # @return [String] # # @!attribute [rw] target # The resource that is synced to. # @return [String] # # @!attribute [rw] target_revision # Detail data for the target revision. # @return [Types::Revision] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ResourceSyncAttempt AWS API Documentation # class ResourceSyncAttempt < Struct.new( :events, :initial_revision, :started_at, :status, :target, :target_revision) SENSITIVE = [] include Aws::Structure end # Detail data for a resource sync event. # # @!attribute [rw] event # A resource sync event. # @return [String] # # @!attribute [rw] external_id # The external ID for the event. # @return [String] # # @!attribute [rw] time # The time when the event occurred. # @return [Time] # # @!attribute [rw] type # The type of event. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ResourceSyncEvent AWS API Documentation # class ResourceSyncEvent < Struct.new( :event, :external_id, :time, :type) SENSITIVE = [] include Aws::Structure end # Revision detail data for a commit and push that activates a sync # attempt # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] directory # The repository directory changed by a commit and push that activated # the sync attempt. # @return [String] # # @!attribute [rw] repository_name # The repository name. # @return [String] # # @!attribute [rw] repository_provider # The repository provider. # @return [String] # # @!attribute [rw] sha # The secure hash algorithm (SHA) hash for the revision. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/Revision AWS API Documentation # class Revision < Struct.new( :branch, :directory, :repository_name, :repository_provider, :sha) SENSITIVE = [] include Aws::Structure end # Template bundle S3 bucket data. # # @note When making an API call, you may pass S3ObjectSource # data as a hash: # # { # bucket: "S3Bucket", # required # key: "S3Key", # required # } # # @!attribute [rw] bucket # The name of the S3 bucket that contains a template bundle. # @return [String] # # @!attribute [rw] key # The path to the S3 bucket that contains a template bundle. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/S3ObjectSource AWS API Documentation # class S3ObjectSource < Struct.new( :bucket, :key) SENSITIVE = [] include Aws::Structure end # The service detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service. # @return [String] # # @!attribute [rw] branch_name # The name of the code repository branch that holds the code that's # deployed in Proton. # @return [String] # # @!attribute [rw] created_at # The time when the service was created. # @return [Time] # # @!attribute [rw] description # A description of a service. # @return [String] # # @!attribute [rw] last_modified_at # The time when the service was last modified. # @return [Time] # # @!attribute [rw] name # The name of the service. # @return [String] # # @!attribute [rw] pipeline # The service pipeline detail data. # @return [Types::ServicePipeline] # # @!attribute [rw] repository_connection_arn # The Amazon Resource Name (ARN) of the repository connection. For # more information, see [Set up a repository connection][1] in the # *Proton Administrator Guide* and [Setting up with Proton][2] in the # *Proton User Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/setting-up-for-service.html#setting-up-vcontrol # [2]: https://docs.aws.amazon.com/proton/latest/userguide/proton-setup.html#setup-repo-connection # @return [String] # # @!attribute [rw] repository_id # The ID of the source code repository. # @return [String] # # @!attribute [rw] spec # The formatted specification that defines the service. # @return [String] # # @!attribute [rw] status # The status of the service. # @return [String] # # @!attribute [rw] status_message # A service status message. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/Service AWS API Documentation # class Service < Struct.new( :arn, :branch_name, :created_at, :description, :last_modified_at, :name, :pipeline, :repository_connection_arn, :repository_id, :spec, :status, :status_message, :template_name) SENSITIVE = [:description, :spec, :status_message] include Aws::Structure end # The service instance detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service instance. # @return [String] # # @!attribute [rw] created_at # The time when the service instance was created. # @return [Time] # # @!attribute [rw] deployment_status # The service instance deployment status. # @return [String] # # @!attribute [rw] deployment_status_message # A service instance deployment status message. # @return [String] # # @!attribute [rw] environment_name # The name of the environment that the service instance was deployed # into. # @return [String] # # @!attribute [rw] last_deployment_attempted_at # The time when a deployment of the service instance was last # attempted. # @return [Time] # # @!attribute [rw] last_deployment_succeeded_at # The time when the service instance was last deployed successfully. # @return [Time] # # @!attribute [rw] name # The name of the service instance. # @return [String] # # @!attribute [rw] service_name # The name of the service that the service instance belongs to. # @return [String] # # @!attribute [rw] spec # The service spec that was used to create the service instance. # @return [String] # # @!attribute [rw] template_major_version # The major version of the service template that was used to create # the service instance. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the service template that was used to create # the service instance. # @return [String] # # @!attribute [rw] template_name # The name of the service template that was used to create the service # instance. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceInstance AWS API Documentation # class ServiceInstance < Struct.new( :arn, :created_at, :deployment_status, :deployment_status_message, :environment_name, :last_deployment_attempted_at, :last_deployment_succeeded_at, :name, :service_name, :spec, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:deployment_status_message, :spec] include Aws::Structure end # A summary of the service instance detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service instance. # @return [String] # # @!attribute [rw] created_at # The time when the service instance was created. # @return [Time] # # @!attribute [rw] deployment_status # The service instance deployment status. # @return [String] # # @!attribute [rw] deployment_status_message # A service instance deployment status message. # @return [String] # # @!attribute [rw] environment_name # The name of the environment that the service instance was deployed # into. # @return [String] # # @!attribute [rw] last_deployment_attempted_at # The time when a deployment of the service was last attempted. # @return [Time] # # @!attribute [rw] last_deployment_succeeded_at # The time when the service was last deployed successfully. # @return [Time] # # @!attribute [rw] name # The name of the service instance. # @return [String] # # @!attribute [rw] service_name # The name of the service that the service instance belongs to. # @return [String] # # @!attribute [rw] template_major_version # The service instance template major version. # @return [String] # # @!attribute [rw] template_minor_version # The service instance template minor version. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceInstanceSummary AWS API Documentation # class ServiceInstanceSummary < Struct.new( :arn, :created_at, :deployment_status, :deployment_status_message, :environment_name, :last_deployment_attempted_at, :last_deployment_succeeded_at, :name, :service_name, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:deployment_status_message] include Aws::Structure end # The service pipeline detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service pipeline. # @return [String] # # @!attribute [rw] created_at # The time when the service pipeline was created. # @return [Time] # # @!attribute [rw] deployment_status # The deployment status of the service pipeline. # @return [String] # # @!attribute [rw] deployment_status_message # A service pipeline deployment status message. # @return [String] # # @!attribute [rw] last_deployment_attempted_at # The time when a deployment of the service pipeline was last # attempted. # @return [Time] # # @!attribute [rw] last_deployment_succeeded_at # The time when the service pipeline was last deployed successfully. # @return [Time] # # @!attribute [rw] spec # The service spec that was used to create the service pipeline. # @return [String] # # @!attribute [rw] template_major_version # The major version of the service template that was used to create # the service pipeline. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the service template that was used to create # the service pipeline. # @return [String] # # @!attribute [rw] template_name # The name of the service template that was used to create the service # pipeline. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServicePipeline AWS API Documentation # class ServicePipeline < Struct.new( :arn, :created_at, :deployment_status, :deployment_status_message, :last_deployment_attempted_at, :last_deployment_succeeded_at, :spec, :template_major_version, :template_minor_version, :template_name) SENSITIVE = [:deployment_status_message, :spec] include Aws::Structure end # A quota was exceeded. For more information, see [Proton Quotas][1] in # the *Proton Administrator Guide*. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-limits.html # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceQuotaExceededException AWS API Documentation # class ServiceQuotaExceededException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end # A summary of the service detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service. # @return [String] # # @!attribute [rw] created_at # The time when the service was created. # @return [Time] # # @!attribute [rw] description # A description of the service. # @return [String] # # @!attribute [rw] last_modified_at # The time when the service was last modified. # @return [Time] # # @!attribute [rw] name # The name of the service. # @return [String] # # @!attribute [rw] status # The status of the service. # @return [String] # # @!attribute [rw] status_message # A service status message. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceSummary AWS API Documentation # class ServiceSummary < Struct.new( :arn, :created_at, :description, :last_modified_at, :name, :status, :status_message, :template_name) SENSITIVE = [:description, :status_message] include Aws::Structure end # The service template detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service template. # @return [String] # # @!attribute [rw] created_at # The time when the service template was created. # @return [Time] # # @!attribute [rw] description # A description of the service template. # @return [String] # # @!attribute [rw] display_name # The service template name as displayed in the developer interface. # @return [String] # # @!attribute [rw] encryption_key # The customer provided service template encryption key that's used # to encrypt data. # @return [String] # # @!attribute [rw] last_modified_at # The time when the service template was last modified. # @return [Time] # # @!attribute [rw] name # The name of the service template. # @return [String] # # @!attribute [rw] pipeline_provisioning # If `pipelineProvisioning` is `true`, a service pipeline is included # in the service template. Otherwise, a service pipeline *isn't* # included in the service template. # @return [String] # # @!attribute [rw] recommended_version # The recommended version of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceTemplate AWS API Documentation # class ServiceTemplate < Struct.new( :arn, :created_at, :description, :display_name, :encryption_key, :last_modified_at, :name, :pipeline_provisioning, :recommended_version) SENSITIVE = [:description, :display_name] include Aws::Structure end # The service template summary data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the service template. # @return [String] # # @!attribute [rw] created_at # The time when the service template was created. # @return [Time] # # @!attribute [rw] description # A description of the service template. # @return [String] # # @!attribute [rw] display_name # The service template name as displayed in the developer interface. # @return [String] # # @!attribute [rw] last_modified_at # The time when the service template was last modified. # @return [Time] # # @!attribute [rw] name # The name of the service template. # @return [String] # # @!attribute [rw] pipeline_provisioning # If `pipelineProvisioning` is `true`, a service pipeline is included # in the service template, otherwise a service pipeline *isn't* # included in the service template. # @return [String] # # @!attribute [rw] recommended_version # The recommended version of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceTemplateSummary AWS API Documentation # class ServiceTemplateSummary < Struct.new( :arn, :created_at, :description, :display_name, :last_modified_at, :name, :pipeline_provisioning, :recommended_version) SENSITIVE = [:description, :display_name] include Aws::Structure end # The version of a service template detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the version of a service template. # @return [String] # # @!attribute [rw] compatible_environment_templates # An array of compatible environment template names for the major # version of a service template. # @return [Array<Types::CompatibleEnvironmentTemplate>] # # @!attribute [rw] created_at # The time when the version of a service template was created. # @return [Time] # # @!attribute [rw] description # A description of the version of a service template. # @return [String] # # @!attribute [rw] last_modified_at # The time when the version of a service template was last modified. # @return [Time] # # @!attribute [rw] major_version # The latest major version that's associated with the version of a # service template. # @return [String] # # @!attribute [rw] minor_version # The minor version of a service template. # @return [String] # # @!attribute [rw] recommended_minor_version # The recommended minor version of the service template. # @return [String] # # @!attribute [rw] schema # The schema of the version of a service template. # @return [String] # # @!attribute [rw] status # The service template version status. # @return [String] # # @!attribute [rw] status_message # A service template version status message. # @return [String] # # @!attribute [rw] template_name # The name of the version of a service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceTemplateVersion AWS API Documentation # class ServiceTemplateVersion < Struct.new( :arn, :compatible_environment_templates, :created_at, :description, :last_modified_at, :major_version, :minor_version, :recommended_minor_version, :schema, :status, :status_message, :template_name) SENSITIVE = [:description, :schema, :status_message] include Aws::Structure end # A summary of the service template version detail data. # # @!attribute [rw] arn # The Amazon Resource Name (ARN) of the version of a service template. # @return [String] # # @!attribute [rw] created_at # The time when the version of a service template was created. # @return [Time] # # @!attribute [rw] description # A description of the version of a service template. # @return [String] # # @!attribute [rw] last_modified_at # The time when the version of a service template was last modified. # @return [Time] # # @!attribute [rw] major_version # The latest major version that's associated with the version of a # service template. # @return [String] # # @!attribute [rw] minor_version # The minor version of a service template. # @return [String] # # @!attribute [rw] recommended_minor_version # The recommended minor version of the service template. # @return [String] # # @!attribute [rw] status # The service template minor version status. # @return [String] # # @!attribute [rw] status_message # A service template minor version status message. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ServiceTemplateVersionSummary AWS API Documentation # class ServiceTemplateVersionSummary < Struct.new( :arn, :created_at, :description, :last_modified_at, :major_version, :minor_version, :recommended_minor_version, :status, :status_message, :template_name) SENSITIVE = [:description, :status_message] include Aws::Structure end # A description of a resource tag. # # @note When making an API call, you may pass Tag # data as a hash: # # { # key: "TagKey", # required # value: "TagValue", # required # } # # @!attribute [rw] key # The key of the resource tag. # @return [String] # # @!attribute [rw] value # The value of the resource tag. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/Tag AWS API Documentation # class Tag < Struct.new( :key, :value) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass TagResourceInput # data as a hash: # # { # resource_arn: "Arn", # required # tags: [ # required # { # key: "TagKey", # required # value: "TagValue", # required # }, # ], # } # # @!attribute [rw] resource_arn # The Amazon Resource Name (ARN) of the resource that the resource tag # is applied to. # @return [String] # # @!attribute [rw] tags # An array of resource tags to apply to a resource. # @return [Array<Types::Tag>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/TagResourceInput AWS API Documentation # class TagResourceInput < Struct.new( :resource_arn, :tags) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/TagResourceOutput AWS API Documentation # class TagResourceOutput < Aws::EmptyStructure; end # The detail data for a template sync configuration. # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] repository_name # The name of the repository, for example `myrepos/myrepo`. # @return [String] # # @!attribute [rw] repository_provider # The repository provider. # @return [String] # # @!attribute [rw] subdirectory # A subdirectory path to your template bundle version. # @return [String] # # @!attribute [rw] template_name # The template name. # @return [String] # # @!attribute [rw] template_type # The template type. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/TemplateSyncConfig AWS API Documentation # class TemplateSyncConfig < Struct.new( :branch, :repository_name, :repository_provider, :subdirectory, :template_name, :template_type) SENSITIVE = [] include Aws::Structure end # Template version source data. # # @note TemplateVersionSourceInput is a union - when making an API calls you must set exactly one of the members. # # @!attribute [rw] s3 # An S3 source object that includes the template bundle S3 path and # name for a template minor version. # @return [Types::S3ObjectSource] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/TemplateVersionSourceInput AWS API Documentation # class TemplateVersionSourceInput < Struct.new( :s3, :unknown) SENSITIVE = [] include Aws::Structure include Aws::Structure::Union class S3 < TemplateVersionSourceInput; end class Unknown < TemplateVersionSourceInput; end end # The request was denied due to request throttling. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ThrottlingException AWS API Documentation # class ThrottlingException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end # @note When making an API call, you may pass UntagResourceInput # data as a hash: # # { # resource_arn: "Arn", # required # tag_keys: ["TagKey"], # required # } # # @!attribute [rw] resource_arn # The Amazon Resource Name (ARN) of the resource that the tag is to be # removed from. # @return [String] # # @!attribute [rw] tag_keys # An array of tag keys indicating the resource tags to be removed from # the resource. # @return [Array<String>] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UntagResourceInput AWS API Documentation # class UntagResourceInput < Struct.new( :resource_arn, :tag_keys) SENSITIVE = [] include Aws::Structure end # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UntagResourceOutput AWS API Documentation # class UntagResourceOutput < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateAccountSettingsInput # data as a hash: # # { # pipeline_provisioning_repository: { # branch: "GitBranchName", # required # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # }, # pipeline_service_role_arn: "PipelineRoleArn", # } # # @!attribute [rw] pipeline_provisioning_repository # The repository that you provide with pull request provisioning. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [Types::RepositoryBranchInput] # # @!attribute [rw] pipeline_service_role_arn # The Amazon Resource Name (ARN) of the Proton pipeline service role. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateAccountSettingsInput AWS API Documentation # class UpdateAccountSettingsInput < Struct.new( :pipeline_provisioning_repository, :pipeline_service_role_arn) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] account_settings # The Proton pipeline service role repository detail data that's # returned by Proton. # @return [Types::AccountSettings] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateAccountSettingsOutput AWS API Documentation # class UpdateAccountSettingsOutput < Struct.new( :account_settings) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateEnvironmentAccountConnectionInput # data as a hash: # # { # id: "EnvironmentAccountConnectionId", # required # role_arn: "Arn", # required # } # # @!attribute [rw] id # The ID of the environment account connection to update. # @return [String] # # @!attribute [rw] role_arn # The Amazon Resource Name (ARN) of the IAM service role that is # associated with the environment account connection to update. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentAccountConnectionInput AWS API Documentation # class UpdateEnvironmentAccountConnectionInput < Struct.new( :id, :role_arn) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] environment_account_connection # The environment account connection detail data that's returned by # Proton. # @return [Types::EnvironmentAccountConnection] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentAccountConnectionOutput AWS API Documentation # class UpdateEnvironmentAccountConnectionOutput < Struct.new( :environment_account_connection) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateEnvironmentInput # data as a hash: # # { # deployment_type: "NONE", # required, accepts NONE, CURRENT_VERSION, MINOR_VERSION, MAJOR_VERSION # description: "Description", # environment_account_connection_id: "EnvironmentAccountConnectionId", # name: "ResourceName", # required # proton_service_role_arn: "Arn", # provisioning_repository: { # branch: "GitBranchName", # required # name: "RepositoryName", # required # provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # }, # spec: "SpecContents", # template_major_version: "TemplateVersionPart", # template_minor_version: "TemplateVersionPart", # } # # @!attribute [rw] deployment_type # There are four modes for updating an environment as described in the # following. The `deploymentType` field defines the mode. # # # # : `NONE` # # In this mode, a deployment *doesn't* occur. Only the requested # metadata parameters are updated. # # # # : `CURRENT_VERSION` # # In this mode, the environment is deployed and updated with the new # spec that you provide. Only requested parameters are updated. # *Don’t* include minor or major version parameters when you use # this `deployment-type`. # # # # : `MINOR_VERSION` # # In this mode, the environment is deployed and updated with the # published, recommended (latest) minor version of the current major # version in use, by default. You can also specify a different minor # version of the current major version in use. # # # # : `MAJOR_VERSION` # # In this mode, the environment is deployed and updated with the # published, recommended (latest) major and minor version of the # current template, by default. You can also specify a different # major version that is higher than the major version in use and a # minor version (optional). # @return [String] # # @!attribute [rw] description # A description of the environment update. # @return [String] # # @!attribute [rw] environment_account_connection_id # The ID of the environment account connection. # # You can only update to a new environment account connection if it # was created in the same environment account that the current # environment account connection was created in and is associated with # the current environment. # @return [String] # # @!attribute [rw] name # The name of the environment to update. # @return [String] # # @!attribute [rw] proton_service_role_arn # The Amazon Resource Name (ARN) of the Proton service role that # allows Proton to make API calls to other services your behalf. # @return [String] # # @!attribute [rw] provisioning_repository # The repository that you provide with pull request provisioning. # # Provisioning by pull request is currently in feature preview and is # only usable with Terraform based Proton Templates. To learn more # about [Amazon Web Services Feature Preview terms][1], see section 2 # on Beta and Previews. # # # # [1]: https://aws.amazon.com/service-terms # @return [Types::RepositoryBranchInput] # # @!attribute [rw] spec # The formatted specification that defines the update. # @return [String] # # @!attribute [rw] template_major_version # The major version of the environment to update. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the environment to update. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentInput AWS API Documentation # class UpdateEnvironmentInput < Struct.new( :deployment_type, :description, :environment_account_connection_id, :name, :proton_service_role_arn, :provisioning_repository, :spec, :template_major_version, :template_minor_version) SENSITIVE = [:description, :spec] include Aws::Structure end # @!attribute [rw] environment # The environment detail data that's returned by Proton. # @return [Types::Environment] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentOutput AWS API Documentation # class UpdateEnvironmentOutput < Struct.new( :environment) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateEnvironmentTemplateInput # data as a hash: # # { # description: "Description", # display_name: "DisplayName", # name: "ResourceName", # required # } # # @!attribute [rw] description # A description of the environment template update. # @return [String] # # @!attribute [rw] display_name # The name of the environment template to update as displayed in the # developer interface. # @return [String] # # @!attribute [rw] name # The name of the environment template to update. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentTemplateInput AWS API Documentation # class UpdateEnvironmentTemplateInput < Struct.new( :description, :display_name, :name) SENSITIVE = [:description, :display_name] include Aws::Structure end # @!attribute [rw] environment_template # The environment template detail data that's returned by Proton. # @return [Types::EnvironmentTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentTemplateOutput AWS API Documentation # class UpdateEnvironmentTemplateOutput < Struct.new( :environment_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateEnvironmentTemplateVersionInput # data as a hash: # # { # description: "Description", # major_version: "TemplateVersionPart", # required # minor_version: "TemplateVersionPart", # required # status: "REGISTRATION_IN_PROGRESS", # accepts REGISTRATION_IN_PROGRESS, REGISTRATION_FAILED, DRAFT, PUBLISHED # template_name: "ResourceName", # required # } # # @!attribute [rw] description # A description of environment template version to update. # @return [String] # # @!attribute [rw] major_version # To update a major version of an environment template, include `major # Version`. # @return [String] # # @!attribute [rw] minor_version # To update a minor version of an environment template, include # `minorVersion`. # @return [String] # # @!attribute [rw] status # The status of the environment template minor version to update. # @return [String] # # @!attribute [rw] template_name # The name of the environment template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentTemplateVersionInput AWS API Documentation # class UpdateEnvironmentTemplateVersionInput < Struct.new( :description, :major_version, :minor_version, :status, :template_name) SENSITIVE = [:description] include Aws::Structure end # @!attribute [rw] environment_template_version # The environment template version detail data that's returned by # Proton. # @return [Types::EnvironmentTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateEnvironmentTemplateVersionOutput AWS API Documentation # class UpdateEnvironmentTemplateVersionOutput < Struct.new( :environment_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateServiceInput # data as a hash: # # { # description: "Description", # name: "ResourceName", # required # spec: "SpecContents", # } # # @!attribute [rw] description # The edited service description. # @return [String] # # @!attribute [rw] name # The name of the service to edit. # @return [String] # # @!attribute [rw] spec # Lists the service instances to add and the existing service # instances to remain. Omit the existing service instances to delete # from the list. *Don't* include edits to the existing service # instances or pipeline. For more information, see *Edit a service* in # the [Proton Administrator Guide][1] or the [Proton User Guide][2]. # # # # [1]: https://docs.aws.amazon.com/proton/latest/adminguide/ag-svc-update.html # [2]: https://docs.aws.amazon.com/proton/latest/userguide/ug-svc-update.html # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceInput AWS API Documentation # class UpdateServiceInput < Struct.new( :description, :name, :spec) SENSITIVE = [:description, :spec] include Aws::Structure end # @note When making an API call, you may pass UpdateServiceInstanceInput # data as a hash: # # { # deployment_type: "NONE", # required, accepts NONE, CURRENT_VERSION, MINOR_VERSION, MAJOR_VERSION # name: "ResourceName", # required # service_name: "ResourceName", # required # spec: "SpecContents", # template_major_version: "TemplateVersionPart", # template_minor_version: "TemplateVersionPart", # } # # @!attribute [rw] deployment_type # The deployment type. # # There are four modes for updating a service instance as described in # the following. The `deploymentType` field defines the mode. # # # # : `NONE` # # In this mode, a deployment *doesn't* occur. Only the requested # metadata parameters are updated. # # # # : `CURRENT_VERSION` # # In this mode, the service instance is deployed and updated with # the new spec that you provide. Only requested parameters are # updated. *Don’t* include minor or major version parameters when # you use this `deployment-type`. # # # # : `MINOR_VERSION` # # In this mode, the service instance is deployed and updated with # the published, recommended (latest) minor version of the current # major version in use, by default. You can also specify a different # minor version of the current major version in use. # # # # : `MAJOR_VERSION` # # In this mode, the service instance is deployed and updated with # the published, recommended (latest) major and minor version of the # current template, by default. You can also specify a different # major version that is higher than the major version in use and a # minor version (optional). # @return [String] # # @!attribute [rw] name # The name of the service instance to update. # @return [String] # # @!attribute [rw] service_name # The name of the service that the service instance belongs to. # @return [String] # # @!attribute [rw] spec # The formatted specification that defines the service instance # update. # @return [String] # # @!attribute [rw] template_major_version # The major version of the service template to update. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the service template to update. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceInstanceInput AWS API Documentation # class UpdateServiceInstanceInput < Struct.new( :deployment_type, :name, :service_name, :spec, :template_major_version, :template_minor_version) SENSITIVE = [:spec] include Aws::Structure end # @!attribute [rw] service_instance # The service instance summary data returned by Proton. # @return [Types::ServiceInstance] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceInstanceOutput AWS API Documentation # class UpdateServiceInstanceOutput < Struct.new( :service_instance) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] service # The service detail data that's returned by Proton. # @return [Types::Service] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceOutput AWS API Documentation # class UpdateServiceOutput < Struct.new( :service) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateServicePipelineInput # data as a hash: # # { # deployment_type: "NONE", # required, accepts NONE, CURRENT_VERSION, MINOR_VERSION, MAJOR_VERSION # service_name: "ResourceName", # required # spec: "SpecContents", # required # template_major_version: "TemplateVersionPart", # template_minor_version: "TemplateVersionPart", # } # # @!attribute [rw] deployment_type # The deployment type. # # There are four modes for updating a service pipeline as described in # the following. The `deploymentType` field defines the mode. # # # # : `NONE` # # In this mode, a deployment *doesn't* occur. Only the requested # metadata parameters are updated. # # # # : `CURRENT_VERSION` # # In this mode, the service pipeline is deployed and updated with # the new spec that you provide. Only requested parameters are # updated. *Don’t* include minor or major version parameters when # you use this `deployment-type`. # # # # : `MINOR_VERSION` # # In this mode, the service pipeline is deployed and updated with # the published, recommended (latest) minor version of the current # major version in use, by default. You can also specify a different # minor version of the current major version in use. # # # # : `MAJOR_VERSION` # # In this mode, the service pipeline is deployed and updated with # the published, recommended (latest) major and minor version of the # current template, by default. You can also specify a different # major version that is higher than the major version in use and a # minor version (optional). # @return [String] # # @!attribute [rw] service_name # The name of the service to that the pipeline is associated with. # @return [String] # # @!attribute [rw] spec # The spec for the service pipeline to update. # @return [String] # # @!attribute [rw] template_major_version # The major version of the service template that was used to create # the service that the pipeline is associated with. # @return [String] # # @!attribute [rw] template_minor_version # The minor version of the service template that was used to create # the service that the pipeline is associated with. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServicePipelineInput AWS API Documentation # class UpdateServicePipelineInput < Struct.new( :deployment_type, :service_name, :spec, :template_major_version, :template_minor_version) SENSITIVE = [:spec] include Aws::Structure end # @!attribute [rw] pipeline # The pipeline details returned by Proton. # @return [Types::ServicePipeline] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServicePipelineOutput AWS API Documentation # class UpdateServicePipelineOutput < Struct.new( :pipeline) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateServiceTemplateInput # data as a hash: # # { # description: "Description", # display_name: "DisplayName", # name: "ResourceName", # required # } # # @!attribute [rw] description # A description of the service template update. # @return [String] # # @!attribute [rw] display_name # The name of the service template to update as displayed in the # developer interface. # @return [String] # # @!attribute [rw] name # The name of the service template to update. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceTemplateInput AWS API Documentation # class UpdateServiceTemplateInput < Struct.new( :description, :display_name, :name) SENSITIVE = [:description, :display_name] include Aws::Structure end # @!attribute [rw] service_template # The service template detail data that's returned by Proton. # @return [Types::ServiceTemplate] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceTemplateOutput AWS API Documentation # class UpdateServiceTemplateOutput < Struct.new( :service_template) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateServiceTemplateVersionInput # data as a hash: # # { # compatible_environment_templates: [ # { # major_version: "TemplateVersionPart", # required # template_name: "ResourceName", # required # }, # ], # description: "Description", # major_version: "TemplateVersionPart", # required # minor_version: "TemplateVersionPart", # required # status: "REGISTRATION_IN_PROGRESS", # accepts REGISTRATION_IN_PROGRESS, REGISTRATION_FAILED, DRAFT, PUBLISHED # template_name: "ResourceName", # required # } # # @!attribute [rw] compatible_environment_templates # An array of compatible environment names for a service template # major or minor version to update. # @return [Array<Types::CompatibleEnvironmentTemplateInput>] # # @!attribute [rw] description # A description of a service template version to update. # @return [String] # # @!attribute [rw] major_version # To update a major version of a service template, include `major # Version`. # @return [String] # # @!attribute [rw] minor_version # To update a minor version of a service template, include # `minorVersion`. # @return [String] # # @!attribute [rw] status # The status of the service template minor version to update. # @return [String] # # @!attribute [rw] template_name # The name of the service template. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceTemplateVersionInput AWS API Documentation # class UpdateServiceTemplateVersionInput < Struct.new( :compatible_environment_templates, :description, :major_version, :minor_version, :status, :template_name) SENSITIVE = [:description] include Aws::Structure end # @!attribute [rw] service_template_version # The service template version detail data that's returned by Proton. # @return [Types::ServiceTemplateVersion] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateServiceTemplateVersionOutput AWS API Documentation # class UpdateServiceTemplateVersionOutput < Struct.new( :service_template_version) SENSITIVE = [] include Aws::Structure end # @note When making an API call, you may pass UpdateTemplateSyncConfigInput # data as a hash: # # { # branch: "GitBranchName", # required # repository_name: "RepositoryName", # required # repository_provider: "GITHUB", # required, accepts GITHUB, GITHUB_ENTERPRISE, BITBUCKET # subdirectory: "Subdirectory", # template_name: "ResourceName", # required # template_type: "ENVIRONMENT", # required, accepts ENVIRONMENT, SERVICE # } # # @!attribute [rw] branch # The repository branch. # @return [String] # # @!attribute [rw] repository_name # The name of the repository, for example `myrepos/myrepo`. # @return [String] # # @!attribute [rw] repository_provider # The repository provider. # @return [String] # # @!attribute [rw] subdirectory # A subdirectory path to your template bundle version. When included, # limits the template bundle search to this repository directory. # @return [String] # # @!attribute [rw] template_name # The synced template name. # @return [String] # # @!attribute [rw] template_type # The synced template type. # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateTemplateSyncConfigInput AWS API Documentation # class UpdateTemplateSyncConfigInput < Struct.new( :branch, :repository_name, :repository_provider, :subdirectory, :template_name, :template_type) SENSITIVE = [] include Aws::Structure end # @!attribute [rw] template_sync_config # The template sync configuration detail data that's returned by # Proton. # @return [Types::TemplateSyncConfig] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/UpdateTemplateSyncConfigOutput AWS API Documentation # class UpdateTemplateSyncConfigOutput < Struct.new( :template_sync_config) SENSITIVE = [] include Aws::Structure end # The input is invalid or an out-of-range value was supplied for the # input parameter. # # @!attribute [rw] message # @return [String] # # @see http://docs.aws.amazon.com/goto/WebAPI/proton-2020-07-20/ValidationException AWS API Documentation # class ValidationException < Struct.new( :message) SENSITIVE = [:message] include Aws::Structure end end end
32.771652
135
0.628857
87c8dd82a082c4fad9d3272366289196be595497
230
require_dependency "sudo_mode/application_controller" module SudoMode class ConfirmationController < ApplicationController def new @submit_path = params[:redirect_to] @method = params[:method] end end end
20.909091
54
0.747826
0377daa7d3bcfc71efeecc29f9ed258eee6215e8
128
require "minitest/autorun" require "octicons" def octicon(symbol, options = {}) ::Octicons::Octicon.new(symbol, options) end
18.285714
42
0.734375
38fb32de920fa4065cd48b39a4b70ff9ae6c5a57
72
module Administrador class ApplicationJob < ActiveJob::Base end end
14.4
40
0.791667
6a1fee109941eb4f617c6ebe641d72963b3fabeb
418
FactoryGirl.define do factory :comic do ISBN13 "9781845764944" ISBN10 "1845764943" title "The Boys #1" release_date 2007 edition 1 language "EN" format "Colour comic strip" shape "258 x 170mm" pages 152 price 9.95 description "Meet Billy Butcher. He’s not a nice man, and neither are his team: the Frenchman, Mother’s Milk, and the Female" borrowd false end end
24.588235
129
0.672249
1d837293d1009c5192162ab6f13366c9b368d6cb
185
require 'minitest/autorun' require 'minitest/rg' require './lib/codemark.rb' INTRO_RMD = File.read("./spec/fixtures/sem-intro.Rmd") INTRO_R = File.read("./spec/fixtures/sem-intro.R")
23.125
54
0.72973
ed31ea18cd2f01d65c6f68fce05ba20f4ddf0949
494
class Backend::Framework::Adapters::HttpController < ApplicationController def index @game = Game.where('team_id_home=? OR team_id_away=?', params[:team_id]) end def details end def start_match cmd = Framework::Commands::StartNewMatch.new(game_params) execute(cmd) head :ok end def end_match end def results end private def game_params {team_h: params[:home], team_a: params[:away], date: params[:date], time: params[:time] } end end
14.969697
93
0.678138
1d9be44a2c42269439744d398ea92b95e09c66f9
490
# == Schema Information # # Table name: contacts # # id :integer not null, primary key # date_on :date # content :text # means :string # owner :string # lead_id :integer # created_at :datetime not null # updated_at :datetime not null # # Indexes # # index_contacts_on_lead_id (lead_id) # class Contact < ActiveRecord::Base belongs_to :lead validates :date_on, presence: true default_scope { order(date_on: :desc) } end
18.846154
53
0.630612
ac3b71d5817637a9bf8754d28c284f74b11e41dc
404
class <%= migration_class_name %> < ActiveRecord::Migration def self.up create_table :<%= table_name %> do |t| t.string :locale t.string :key t.text :value t.boolean :is_proc, :default => false t.timestamps end add_index :<%= table_name %>, :locale add_index :<%= table_name %>, :key end def self.down drop_table :<%= table_name %> end end
22.444444
59
0.596535
790ecffa127d005a30b9d58800b2bc16c0be654d
1,616
# encoding: utf-8 module Mongoid module Relations module Touchable extend ActiveSupport::Concern module ClassMethods # Add the metadata to the touchable relations if the touch option was # provided. # # @example Add the touchable. # Model.touchable(meta) # # @param [ Metadata ] metadata The relation metadata. # # @return [ Class ] The model class. # # @since 3.0.0 def touchable(metadata) if metadata.touchable? name = metadata.name method_name = define_relation_touch_method(name) after_create method_name after_destroy method_name after_touch method_name end self end private # Define the method that will get called for touching belongs_to # relations. # # @api private # # @example Define the touch relation. # Model.define_relation_touch_method(:band) # # @param [ Symbol ] name The name of the relation. # # @since 3.1.0 # # @return [ Symbol ] The method name. def define_relation_touch_method(name) method_name = "touch_#{name}_after_create_or_destroy" class_eval <<-TOUCH def #{method_name} without_autobuild do relation = __send__(:#{name}) relation.touch if relation end end TOUCH method_name.to_sym end end end end end
26.064516
77
0.543936
ffe0676471eff553ee47d89110d8c519fbeaf972
328
class ActivityComment < ApplicationRecord audited associated_with: :activity, on: [:destroy] belongs_to :activity, counter_cache: true, touch: true belongs_to :person validates :body, presence: true PERMITTED_ATTRIBUTES = [:body, :created_at, :overwrite, :person_id, :updated_at, :updated_in_db_at, :id].freeze end
29.818182
113
0.762195
2117f88d40095adee457b6687c132235faac5b73
196
# frozen_string_literal: true # Generated via # `rails generate hyrax:work ConferenceItem` module Hyrax module Actors class ConferenceItemActor < Hyrax::Actors::BaseActor end end end
19.6
56
0.760204
ac5cff0586a43be253c0f5731b03479aa6412553
979
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads/v9/services/group_placement_view_service.proto require 'google/ads/google_ads/v9/resources/group_placement_view_pb' require 'google/api/annotations_pb' require 'google/api/client_pb' require 'google/api/field_behavior_pb' require 'google/api/resource_pb' require 'google/protobuf' Google::Protobuf::DescriptorPool.generated_pool.build do add_file("google/ads/googleads/v9/services/group_placement_view_service.proto", :syntax => :proto3) do add_message "google.ads.googleads.v9.services.GetGroupPlacementViewRequest" do optional :resource_name, :string, 1 end end end module Google module Ads module GoogleAds module V9 module Services GetGroupPlacementViewRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.ads.googleads.v9.services.GetGroupPlacementViewRequest").msgclass end end end end end
32.633333
171
0.775281
1dfee99d7ff84349a352ced6fceb883f384aefbb
449
# Copyright 2014 Mainio Tech Ltd. # # @author Antti Hukkanen # @license See LICENSE (project root) class RemoteController < ApplicationController before_action :set_project private # Use callbacks to share common setup or constraints between actions. def set_project @project = Project.find(params[:project_id]) unless @project.nil? GRemote::DnsModel.initialize_api(@project) end end end
21.380952
73
0.694878
ab3a4a736ea9e420fd87e8ab4c5c917e6444a7f6
1,813
#-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2013 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See doc/COPYRIGHT.rdoc for more details. #++ class CreateTimelinesDefaultPlanningElementTypes < ActiveRecord::Migration def self.up create_table :timelines_default_planning_element_types do |t| t.belongs_to :project_type t.belongs_to :planning_element_type t.timestamps end add_index :timelines_default_planning_element_types, :project_type_id, :name => "index_default_pe_types_on_project_type_id" add_index :timelines_default_planning_element_types, :planning_element_type_id, :name => "index_default_pe_types_on_pe_type_id" end def self.down drop_table :timelines_default_planning_element_types end end
38.574468
131
0.777716
18c0db29884b55ed1771786e22bfbe9e1710b9f2
616
class Quality include Mongoid::Document include Mongoid::Timestamps extend Dragonfly::Model field :name, :type => String field :link, :type => String field :image_uid, :type => String dragonfly_accessor :image belongs_to :gathering, index: true belongs_to :account, index: true validates_presence_of :name, :link has_many :cultivations, :dependent => :destroy def self.admin_fields { :name => :text, :link => :url, :image => :image, :gathering_id => :lookup, :account_id => :lookup, :cultivations => :collection } end end
20.533333
48
0.62987
e8600c48725899b40114caeb8acc90e2af4c8b98
759
module Kratom module LayoutEmbedded private def render_with_layout layout.render { render } end def layout site.templates.get(layout_name) rescue MissingResourceError => e raise MissingResourceError, missing_layout_message(layout_name) end def missing_layout_message(layout_name) "Error rendering #{name}: \n" + if layout_name == 'default' "No default template is specified! Create a new template "\ "called default in #{config.paths.templates}." else "No layout with name #{layout_name} found "\ "in #{config.paths.templates}." end end def layout_name meta.has_key?(:layout) ? meta[:layout] : 'default' end end end
24.483871
70
0.635046
796299a69762b91b02758ec9c62c6760dea7b9e1
86
module DbdDataEngine class ApplicationController < ActionController::Base end end
17.2
54
0.825581
5d2ff1a22bda43f87a20be31dc5b7e8a919c81f4
45
module FastTools VERSION = "0.1.0.pre" end
11.25
23
0.688889
bf696ec41d5d6878bfb4db0c53caae66cb4f6142
1,338
# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'looker-sdk/version' Gem::Specification.new do |s| s.name = 'looker-sdk' s.version = LookerSDK::VERSION s.date = "#{Time.now.strftime('%F')}" s.authors = ['Looker'] s.email = '[email protected]' s.homepage = 'https://github.com/looker/looker-sdk-ruby' s.summary = %q{Looker Ruby SDK} s.description = 'Use this SDK to access the Looker API. The Looker API provides functions to perform administrative '+ 'tasks such as provisioning users, configuring database connections, and so on. It also enables you to leverage '+ 'the Looker data analytics engine to fetch data or render visualizations defined in your Looker data models. '+ 'For more information, see https://looker.com.' s.license = 'MIT' s.required_ruby_version = '>= 2.0' s.requirements = 'Looker version 4.0 or later' # informational s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = %w(lib) s.add_dependency 'jruby-openssl' if s.platform == :jruby s.add_dependency 'sawyer', '~> 0.8' s.add_dependency 'faraday', ['>= 0.9.0', '< 2.0'] end
46.137931
120
0.64574
bfbff8412a64eee7bbb43c740d1d32933d7a55df
1,306
Pod::Spec.new do |s| s.name = 'Validator' s.platform = :ios s.ios.deployment_target = '9.0' s.tvos.deployment_target = '10.0' s.version = '3.1.1' s.summary = 'Validator is a user input validation library written in Swift.' s.description = <<-DESC Validator is a user input validation library written in Swift. Features: [x] Validation rules: [x] Required [x] Equality [x] Comparison [x] Length (min, max, range) [x] Pattern (email, password constraints and more...) [x] Contains [x] URL [x] Payment card (Luhn validated, accepted types) [x] Condition (quickly write your own) [x] Swift standard library type extensions with one API (not just strings!) [x] UIKit element extensions [x] Open validation error types [x] An open protocol-oriented implementation [x] Comprehensive test coverage [x] Comprehensive code documentation DESC s.homepage = 'https://github.com/adamwaite/Validator' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Adam Waite' => '[email protected]' } s.social_media_url = 'http://twitter.com/AdamWaite' s.source = { :git => 'https://github.com/adamwaite/Validator.git', :tag => 'v3.1.1' } s.source_files = 'Validator', 'Validator/Sources/**/*.swift' s.framework = 'UIKit' end
32.65
87
0.669985
79c8019f2a92bee8c32e09b859f3dd64a3c533cf
899
cask 'colorsnapper' do version '1.5.1' sha256 '7e14a69e521153d9aa6fb8c75932b52e1ddb0f60b00178123fc0636b32010016' # cs2-binaries.s3.amazonaws.com was verified as official when first introduced to the cask url "https://cs2-binaries.s3.amazonaws.com/ColorSnapper2-#{version.dots_to_underscores}.zip" appcast 'https://cs2-appcast.s3.amazonaws.com/appcast.xml' name 'ColorSnapper 2' homepage 'https://colorsnapper.com/' app 'ColorSnapper2.app' uninstall quit: 'com.koolesache.ColorSnapper2' zap trash: [ '~/Library/Application Support/ColorSnapper2', '~/Library/Application Support/com.koolesache.ColorSnapper2', '~/Library/Caches/com.koolesache.ColorSnapper2', '~/Library/Cookies/com.koolesache.ColorSnapper2.binarycookies', '~/Library/Preferences/com.koolesache.ColorSnapper2.plist', ] end
39.086957
94
0.708565
1afafe58188ba9c578a7ce1414304db85e2f5f88
1,139
Gem::Specification.new do |s| s.name = 'logstash-input-bitbucket' s.version = '0.1.0' s.licenses = ['Apache-2.0'] s.summary = 'BitBucket input plugin' s.description = 'Import data from BitBucket server to aggregate analytic data' s.homepage = 'http://liatr.io' s.authors = ['Chris Schreiber'] s.email = '[email protected]' s.require_paths = ['lib'] # Files s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT'] # Tests s.test_files = s.files.grep(%r{^(test|spec|features)/}) # Special flag to let us know this is actually a logstash plugin s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" } # Gem dependencies s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0" s.add_runtime_dependency 'logstash-mixin-http_client', "~> 6.0" s.add_runtime_dependency 'rufus-scheduler', "~>3.0" s.add_runtime_dependency 'stud', '~> 0.0' s.add_development_dependency 'logstash-devutils', '~> 1.3' s.add_development_dependency 'logstash-codec-json', '~> 3.0' end
39.275862
120
0.644425
bf6ea4e9649a692177e17f8e43ebce8a6b856e5b
3,519
class Mapnik < Formula desc "Toolkit for developing mapping applications" homepage "https://mapnik.org/" url "https://github.com/mapnik/mapnik/releases/download/v3.1.0/mapnik-v3.1.0.tar.bz2" sha256 "43d76182d2a975212b4ad11524c74e577576c11039fdab5286b828397d8e6261" license "LGPL-2.1-or-later" revision 7 head "https://github.com/mapnik/mapnik.git", branch: "master" livecheck do url :stable strategy :github_latest end bottle do sha256 cellar: :any, arm64_monterey: "f75f2bf4dc6654ec494ba60f11c69e1e2e37319b54eaef496fa393122559ddea" sha256 cellar: :any, arm64_big_sur: "cdd140c9ac7b3237c30e57fddf5be28a3299e08981206a01547e9d108697fac9" sha256 cellar: :any, monterey: "06b23564d22c0ada831fbb6b99c1d84497e887d58f352d233c13671db8d97ee2" sha256 cellar: :any, big_sur: "325112aaaed31601d2d5164f62aa326037efa40131e00e960e5162c8b9cecea2" sha256 cellar: :any, catalina: "e6821246dac145001f0d7f04d63f2a14161ac61302efa22e4ca0544258076433" sha256 cellar: :any_skip_relocation, x86_64_linux: "f1a360d13e752a6029eef96a4d7723922e8e7e40c75970e4ce78199ebfe9e325" end depends_on "pkg-config" => :build depends_on "[email protected]" => :build depends_on "boost" depends_on "cairo" depends_on "freetype" depends_on "gdal" depends_on "harfbuzz" depends_on "icu4c" depends_on "jpeg" depends_on "libpng" depends_on "libtiff" depends_on "postgresql" depends_on "proj@7" depends_on "webp" def install ENV.cxx11 ENV["PYTHON"] = Formula["[email protected]"].opt_bin/"python3" # Work around "error: no member named 'signbit' in the global namespace" # encountered when trying to detect boost regex in configure ENV.delete("SDKROOT") if DevelopmentTools.clang_build_version >= 900 # Use Proj 6.0.0 compatibility headers # https://github.com/mapnik/mapnik/issues/4036 ENV.append_to_cflags "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" boost = Formula["boost"].opt_prefix freetype = Formula["freetype"].opt_prefix harfbuzz = Formula["harfbuzz"].opt_prefix icu = Formula["icu4c"].opt_prefix jpeg = Formula["jpeg"].opt_prefix libpng = Formula["libpng"].opt_prefix libtiff = Formula["libtiff"].opt_prefix proj = Formula["proj"].opt_prefix webp = Formula["webp"].opt_prefix args = %W[ CC=#{ENV.cc} CXX=#{ENV.cxx} PREFIX=#{prefix} BOOST_INCLUDES=#{boost}/include BOOST_LIBS=#{boost}/lib CAIRO=True CPP_TESTS=False FREETYPE_CONFIG=#{freetype}/bin/freetype-config GDAL_CONFIG=#{Formula["gdal"].opt_bin}/gdal-config HB_INCLUDES=#{harfbuzz}/include HB_LIBS=#{harfbuzz}/lib ICU_INCLUDES=#{icu}/include ICU_LIBS=#{icu}/lib INPUT_PLUGINS=all JPEG_INCLUDES=#{jpeg}/include JPEG_LIBS=#{jpeg}/lib NIK2IMG=False PG_CONFIG=#{Formula["postgresql"].opt_bin}/pg_config PNG_INCLUDES=#{libpng}/include PNG_LIBS=#{libpng}/lib PROJ_INCLUDES=#{proj}/include PROJ_LIBS=#{proj}/lib TIFF_INCLUDES=#{libtiff}/include TIFF_LIBS=#{libtiff}/lib WEBP_INCLUDES=#{webp}/include WEBP_LIBS=#{webp}/lib ] inreplace "Makefile", "PYTHON = python", "PYTHON = python3" system "./configure", *args system "make" system "make", "install" end test do output = shell_output("#{bin}/mapnik-config --prefix").chomp assert_equal prefix.to_s, output end end
34.165049
123
0.693379
ff7ec0d572f9038e32195602920af9183361d49a
5,506
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. require 'date' # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength module OCI # A specific OCI service supported by resource limits. class Limits::Models::ServiceSummary # The service name. Use this when calling the other APIs. # @return [String] attr_accessor :name # The friendly service name. # @return [String] attr_accessor :description # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'name': :'name', 'description': :'description' # rubocop:enable Style/SymbolLiteral } end # Attribute type mapping. def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'name': :'String', 'description': :'String' # rubocop:enable Style/SymbolLiteral } end # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral # Initializes the object # @param [Hash] attributes Model attributes in the form of hash # @option attributes [String] :name The value to assign to the {#name} property # @option attributes [String] :description The value to assign to the {#description} property def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.name = attributes[:'name'] if attributes[:'name'] self.description = attributes[:'description'] if attributes[:'description'] end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines # Checks equality by comparing each attribute. # @param [Object] other the other object to be compared def ==(other) return true if equal?(other) self.class == other.class && name == other.name && description == other.description end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines # @see the `==` method # @param [Object] other the other object to be compared def eql?(other) self == other end # rubocop:disable Metrics/AbcSize, Layout/EmptyLines # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [name, description].hash end # rubocop:enable Metrics/AbcSize, Layout/EmptyLines # rubocop:disable Metrics/AbcSize, Layout/EmptyLines # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # rubocop:enable Metrics/AbcSize, Layout/EmptyLines # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end private # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
34.198758
245
0.666364
e890a6678f540729ce7bd5a16d2ac91057f79e4a
15,016
# coding: utf-8 # Usage: # $ gem install rmath3d_plain # $ ruby test_convex_decomposition.rb require 'pp' require 'opengl' require 'glfw' require 'rmath3d/rmath3d_plain' require_relative 'nanovg' require_relative 'compgeom/convex_partitioning' require_relative 'compgeom/intersection' OpenGL.load_lib() GLFW.load_lib() NanoVG.load_dll('libnanovg_gl3.dylib', render_backend: :gl3) include OpenGL include GLFW include NanoVG include RMath3D class FontPlane def initialize @fonts = [] end def load(vg, name="sans", ttf="data/GenShinGothic-Bold.ttf") font_handle = nvgCreateFont(vg, name, ttf) if font_handle == -1 puts "Could not add font." return -1 end @fonts << font_handle end def render(vg, x, y, width, height, text, name: "sans", color: nvgRGBA(255,255,255,255)) rows_buf = FFI::MemoryPointer.new(NVGtextRow, 3) glyphs_buf = FFI::MemoryPointer.new(NVGglyphPosition, 100) lineh_buf = ' ' lineh = 0.0 nvgSave(vg) nvgFontSize(vg, 44.0) nvgFontFace(vg, name) nvgTextAlign(vg, NVG_ALIGN_LEFT|NVG_ALIGN_TOP) nvgTextMetrics(vg, nil, nil, lineh_buf) lineh = lineh_buf.unpack('F')[0] text_start = text text_end = nil while ((nrows = nvgTextBreakLines(vg, text_start, text_end, width, rows_buf, 3))) rows = nrows.times.collect do |i| NVGtextRow.new(rows_buf + i * NVGtextRow.size) end nrows.times do |i| row = rows[i] nvgBeginPath(vg) # nvgFillColor(vg, nvgRGBA(255,255,255, 0)) # nvgRect(vg, x, y, row[:width], lineh) # nvgFill(vg) nvgFillColor(vg, color) nvgText(vg, x, y, row[:start], row[:end]) y += lineh end if rows.length > 0 text_start = rows[nrows-1][:next] else break end end nvgRestore(vg) end end class Graph attr_accessor :nodes, :polygon_indices, :polygon def initialize @nodes = [] @polygon = [] @undo_insert_index = -1 @node_radius = 10.0 @polygon_indices = [] @hull_indices = [] end def add_node(x, y) @nodes << RVec2.new(x, y) @polygon << @nodes.last end def connecter_edge?(edge, same_edge_pair) is_connecter_edge = false edge_sorted = edge.sort same_edge_pair.each do |edge_pair| if edge_pair[0].sort == edge_sorted || edge_pair[1].sort == edge_sorted is_connecter_edge = true break end end return is_connecter_edge end private :connecter_edge? def insert_node(point_x, point_y) if @polygon.length < 3 add_node(point_x, point_y) if @polygon.length == 3 && Triangle.ccw(@polygon[0], @polygon[1], @polygon[2]) > 0 @polygon[1], @polygon[2] = @polygon[2], @polygon[1] end return end point = RVec2.new(point_x, point_y) edges = [] @polygon.length.times do |i| edges << [i, (i + 1) % @polygon.length] # TODO : Remove duplicate edge end # Calculate distance from point to all edges. distances = Array.new(@polygon.length) { -Float::MAX } edges.each_with_index do |edge, i| distances[i] = SegmentIntersection.distance_from_point(point, @polygon[edge[0]], @polygon[edge[1]]) end # Find nearest edge and insert new Node as a dividing point. insertion_index = -1 same_edge_pair = [] # store connecter edges edges.each_with_index do |edge_a, idx_a| edges.each_with_index do |edge_b, idx_b| next if idx_a >= idx_b if (@polygon[edge_a[0]] == @polygon[edge_b[0]] && @polygon[edge_a[1]] == @polygon[edge_b[1]]) || (@polygon[edge_a[0]] == @polygon[edge_b[1]] && @polygon[edge_a[1]] == @polygon[edge_b[0]]) same_edge_pair << [edge_a, edge_b] end end end minimum_distances = distances.min_by(2) {|d| d} if (minimum_distances[0] - minimum_distances[1]).abs > 1.0e-6 # Found one nearest edge. i = distances.find_index( minimum_distances[0] ) nearest_edge = edges[i] is_connecter_edge = connecter_edge?(nearest_edge, same_edge_pair) if not is_connecter_edge # Normal edge self_intersect = SegmentIntersection.check(@polygon + [point], edges - [nearest_edge] + [[nearest_edge[0], @polygon.length], [@polygon.length, nearest_edge[1]]]) if not self_intersect insertion_index = i end else # Connecter edge indices = [] distances.each_with_index do |d, i| if d == minimum_distances[0] indices << i end end p "indices.length == #{indices.length}, != 2" if indices.length != 2 nearest_edges = [edges[indices[0]], edges[indices[1]]] e0_ccw = Triangle.ccw(@polygon[nearest_edges[0][0]], point, @polygon[nearest_edges[0][1]]) > 0 e1_ccw = Triangle.ccw(@polygon[nearest_edges[1][0]], point, @polygon[nearest_edges[1][1]]) > 0 if e0_ccw insertion_index = indices[0] else # e1_ccw insertion_index = indices[1] end end else # If two or more nearest edges found... # TODO : implement # for vertex voronoi case # [DONE] for connecter edge case # Inside polygon connecter edge indices = [] distances.each_with_index do |d, i| if (d - minimum_distances[0]).abs <= 1.0e-6 indices << i end end p "indices.length != 2" if indices.length != 2 nearest_edges = [edges[indices[0]], edges[indices[1]]] is_connecter_edge = false if (@polygon[nearest_edges[0][0]] == @polygon[nearest_edges[1][0]] && @polygon[nearest_edges[0][1]] == @polygon[nearest_edges[1][1]]) || (@polygon[nearest_edges[0][1]] == @polygon[nearest_edges[1][0]] && @polygon[nearest_edges[0][0]] == @polygon[nearest_edges[1][1]]) is_connecter_edge = true end if not is_connecter_edge # the input point is placed in the vertex Voronoi region # p nearest_edges else # Divide one of the edges that never break the graph ordering (the one should make a counter-clockwise triangle with the input point) e0_ccw = Triangle.ccw(@polygon[nearest_edges[0][0]], point, @polygon[nearest_edges[0][1]]) > 0 e1_ccw = Triangle.ccw(@polygon[nearest_edges[1][0]], point, @polygon[nearest_edges[1][1]]) > 0 if e0_ccw insertion_index = indices[0] else # e1_ccw insertion_index = indices[1] end end end if insertion_index == -1 # puts "fail" return end @nodes << RVec2.new(point_x, point_y) @polygon.insert( insertion_index + 1, @nodes.last ) # @undo_insert_index = insertion_index + 1 end def undo_insert if @undo_insert_index >= 0 @nodes.delete_at(@undo_insert_index) @undo_insert_index = -1 if $outer_graph.nodes.length <= 2 $outer_graph.clear else $outer_graph.decompose($convex_decomposition_mode) end end end def node_removable?(node_index) # # TODO : Original implementation is for @node, not for @polygon. Fix it. # segment_indices = [] new_edge_index = [] node = @nodes[node_index] @polygon.length.times do |i| # TODO : Remove duplicate edge if @polygon[i] == node new_edge_index << (i + 1) % @polygon.length next end if @polygon[(i + 1) % @polygon.length] == node new_edge_index << i next end # p new_edge_index.length segment_indices << [i, (i + 1) % @polygon.length] end return SegmentIntersection.check(@polygon, segment_indices + [new_edge_index]) == false end def remove_nearest_node(point_x, point_y) return if @nodes.empty? distances = Array.new(@nodes.length) { -Float::MAX } @nodes.each_with_index do |node_current, index| distances[index] = (node_current.x - point_x)**2 + (node_current.y - point_y)**2 end minimum_distance = distances.min_by {|d| d} if minimum_distance <= @node_radius ** 2 nearest_node_index = distances.find_index( minimum_distance ) @undo_insert_index = -1 if node_removable?(nearest_node_index) @polygon.delete_if {|p| p == @nodes[nearest_node_index]} @nodes.delete_at(nearest_node_index) else puts "[WARN] remove_nearest_node : Failed. Removing the node #{nearest_node_index} will make self-intersecting polygon." end end end def decompose(convex_mode = true) return false if @nodes.length < 3 indices = convex_mode ? ConvexPartitioning.decompose(@polygon) : ConvexPartitioning.triangulate(@polygon) @polygon_indices = indices == nil ? [] : indices end def clear @nodes.clear @polygon.clear @polygon_indices.clear if @polygon_indices != nil end def render(vg, render_edge: true, render_node: true, color_scheme: :outer) # Polygons if @polygon_indices.length > 0 color = nvgRGBA(0,255,0, 255) lw = @node_radius * 0.5 @polygon_indices.each do |indices| nvgLineCap(vg, NVG_ROUND) nvgLineJoin(vg, NVG_ROUND) nvgBeginPath(vg) indices.each_with_index do |index, i| if i == 0 nvgMoveTo(vg, @polygon[index].x, @polygon[index].y) else nvgLineTo(vg, @polygon[index].x, @polygon[index].y) end end nvgClosePath(vg) color = nvgRGBA(0,255,0, 64) nvgFillColor(vg, color) nvgFill(vg) color = $convex_decomposition_mode ? nvgRGBA(255,255,0, 255) : nvgRGBA(255,128,0, 255) nvgStrokeColor(vg, color) nvgStrokeWidth(vg, lw) nvgStroke(vg) end end # Edges if render_edge and @nodes.length >= 2 color = color_scheme == :outer ? nvgRGBA(0,0,255, 255) : nvgRGBA(255,0,0, 255) lw = @node_radius * 0.5 nvgLineCap(vg, NVG_ROUND) nvgLineJoin(vg, NVG_ROUND) nvgBeginPath(vg) @polygon.length.times do |i| if i == 0 nvgMoveTo(vg, @polygon[0].x, @polygon[0].y) else nvgLineTo(vg, @polygon[i].x, @polygon[i].y) end end nvgClosePath(vg) nvgStrokeColor(vg, color) nvgStrokeWidth(vg, lw) nvgStroke(vg) end # Nodes if render_node and @nodes.length > 0 color = color_scheme == :outer ? nvgRGBA(0,192,255, 255) : nvgRGBA(255,192,0, 255) nvgBeginPath(vg) @nodes.each do |node| nvgCircle(vg, node.x, node.y, @node_radius) nvgFillColor(vg, color) end nvgFill(vg) end end end $font_plane = FontPlane.new $convex_docomposition_mode = true $outer_graph = Graph.new $inner_graph = Graph.new $current_graph = $outer_graph key = GLFW::create_callback(:GLFWkeyfun) do |window, key, scancode, action, mods| if key == GLFW_KEY_ESCAPE && action == GLFW_PRESS # Press ESC to exit. glfwSetWindowShouldClose(window, GL_TRUE) elsif key == GLFW_KEY_SPACE && action == GLFW_PRESS $current_graph = $current_graph == $inner_graph ? $outer_graph : $inner_graph elsif key == GLFW_KEY_D && action == GLFW_PRESS # Press 'D' to switch convex decomposition mode. $convex_decomposition_mode = !$convex_decomposition_mode $outer_graph.decompose($convex_decomposition_mode) elsif key == GLFW_KEY_R && action == GLFW_PRESS # Press 'R' to clear graph. $current_graph.clear elsif key == GLFW_KEY_M && action == GLFW_PRESS # Press 'M' to merge inner polygon. if $outer_graph.polygon.length >= 3 && $inner_graph.polygon.length >= 3 $outer_graph.polygon, appended_nodes = ConvexPartitioning.merge_inner_polygon($outer_graph.polygon, $inner_graph.polygon) $outer_graph.nodes.concat(appended_nodes) $outer_graph.decompose($convex_decomposition_mode) end elsif key == GLFW_KEY_Z && action == GLFW_PRESS && (mods & GLFW_MOD_CONTROL != 0) # Remove the last node your added by Ctrl-Z. $current_graph.undo_insert end end mouse = GLFW::create_callback(:GLFWmousebuttonfun) do |window_handle, button, action, mods| if button == GLFW_MOUSE_BUTTON_LEFT && action == 0 mx_buf = ' ' * 8 my_buf = ' ' * 8 glfwGetCursorPos(window_handle, mx_buf, my_buf) mx = mx_buf.unpack('D')[0] my = my_buf.unpack('D')[0] if (mods & GLFW_MOD_SHIFT) != 0 $current_graph.remove_nearest_node(mx, my) if $current_graph.nodes.length <= 2 $current_graph.clear else $current_graph.decompose($convex_decomposition_mode) end else $current_graph.insert_node(mx, my) $current_graph.decompose($convex_decomposition_mode) end end end if __FILE__ == $0 if glfwInit() == GL_FALSE puts("Failed to init GLFW.") exit end # glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2) # glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0) glfwDefaultWindowHints() glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE) glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE) glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4) glfwWindowHint(GLFW_DECORATED, 0) window = glfwCreateWindow( 1280, 720, "Hertel-Mehlhorn Algorithm", nil, nil ) if window == 0 glfwTerminate() exit end glfwSetKeyCallback( window, key ) glfwSetMouseButtonCallback( window, mouse ) glfwMakeContextCurrent( window ) nvgSetupGL3() vg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES) if vg == nil puts("Could not init nanovg.") exit end winWidth_buf = ' ' winHeight_buf = ' ' fbWidth_buf = ' ' fbHeight_buf = ' ' $font_plane.load(vg, "sans", "data/GenShinGothic-Normal.ttf") glfwSwapInterval(0) glfwSetTime(0) total_time = 0.0 prevt = glfwGetTime() while glfwWindowShouldClose( window ) == 0 t = glfwGetTime() dt = t - prevt # 1.0 / 60.0 prevt = t total_time += dt glfwGetWindowSize(window, winWidth_buf, winHeight_buf) glfwGetFramebufferSize(window, fbWidth_buf, fbHeight_buf) winWidth = winWidth_buf.unpack('L')[0] winHeight = winHeight_buf.unpack('L')[0] fbWidth = fbWidth_buf.unpack('L')[0] fbHeight = fbHeight_buf.unpack('L')[0] pxRatio = fbWidth.to_f / winWidth.to_f glViewport(0, 0, fbWidth, fbHeight) glClearColor(0.8, 0.8, 0.8, 1.0) glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) nvgBeginFrame(vg, winWidth, winHeight, pxRatio) nvgSave(vg) $outer_graph.render(vg, color_scheme: :outer) $inner_graph.render(vg, color_scheme: :inner) $font_plane.render(vg, winWidth - 1200, 10, 1150, 700, "[Edit Mode] #{$current_graph==$outer_graph ? 'Outer Polygon' : 'Inner Polygon'}", color: nvgRGBA(32,128,64,255)) $font_plane.render(vg, winWidth - 1200, 60, 1150, 700, "[Decomposition] #{$convex_decomposition_mode ? 'Convex' : 'Triangle'}", color: nvgRGBA(32,128,64,255)) nvgRestore(vg) nvgEndFrame(vg) glfwSwapBuffers( window ) glfwPollEvents() end nvgDeleteGL3(vg) glfwTerminate() end
30.335354
273
0.642914
01d6ef577956338921761b18e2a6a7fe8a552670
183
class TestMrubyRustRegexp < MTest::Unit::TestCase def test_escape assert_equal RustRegexp.escape('\\'), '\\\\' assert_equal RustRegexp.escape('fucking'), 'christ' end end
26.142857
55
0.710383
79c4ad41811507249a840cc6f84db32bedcf43f8
270
class CreateLogins < ActiveRecord::Migration[5.2] def change create_table :logins, id: :uuid do |t| t.references :user, foreign_key: true, type: :uuid t.references :service_provider, polymorphic: true, type: :uuid t.timestamps end end end
24.545455
68
0.681481
bb8b5bc7bc78e3827050e3c27697b855ae2eb8a9
623
# frozen_string_literal: true # == Schema Information # # Table name: alchemy_essence_htmls # # id :integer not null, primary key # source :text # creator_id :integer # updater_id :integer # created_at :datetime not null # updated_at :datetime not null # module Alchemy class EssenceHtml < BaseRecord acts_as_essence ingredient_column: 'source' # Returns the first x (default = 30) (HTML escaped) characters from self.source for the Element#preview_text method. def preview_text(maxlength = 30) ::CGI.escapeHTML(source.to_s)[0..maxlength] end end end
24.92
120
0.686998
ffabc13cf8e7e9778d8965065d212c5fb460631b
6,920
=begin #Site Manager API #Site Manager API The version of the OpenAPI document: 1.0.0 Contact: [email protected] Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.0.0-SNAPSHOT =end require 'date' module OpenapiClient # NativeCapability class NativeCapability # name attr_accessor :name # published attr_accessor :published attr_accessor :system_type # uuid attr_accessor :uuid # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'name' => :'name', :'published' => :'published', :'system_type' => :'system_type', :'uuid' => :'uuid' } end # Attribute type mapping. def self.openapi_types { :'name' => :'String', :'published' => :'Boolean', :'system_type' => :'SystemType', :'uuid' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::NativeCapability` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NativeCapability`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'published') self.published = attributes[:'published'] else self.published = true end if attributes.key?(:'system_type') self.system_type = attributes[:'system_type'] end if attributes.key?(:'uuid') self.uuid = attributes[:'uuid'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && published == o.published && system_type == o.system_type && uuid == o.uuid end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [name, published, system_type, uuid].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model OpenapiClient.const_get(type).build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end
28.833333
209
0.612861
335f0cc4cb9106b245756ff13224997aae6d9004
1,951
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2020_06_01 module Models # # Describes the destination of connection monitor. # class ConnectionMonitorDestination include MsRestAzure # @return [String] The ID of the resource used as the destination by # connection monitor. attr_accessor :resource_id # @return [String] Address of the connection monitor destination (IP or # domain name). attr_accessor :address # @return [Integer] The destination port used by connection monitor. attr_accessor :port # # Mapper for ConnectionMonitorDestination class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'ConnectionMonitorDestination', type: { name: 'Composite', class_name: 'ConnectionMonitorDestination', model_properties: { resource_id: { client_side_validation: true, required: false, serialized_name: 'resourceId', type: { name: 'String' } }, address: { client_side_validation: true, required: false, serialized_name: 'address', type: { name: 'String' } }, port: { client_side_validation: true, required: false, serialized_name: 'port', type: { name: 'Number' } } } } } end end end end
27.478873
77
0.530497
e21ef6fdc28535d9f24810e90452c63fb20a3f49
1,956
require_relative 'pieces' require_relative '../chess_utils/chess_utils' class Board include ChessUtils include ChessUtils::Renderable def initialize @rows = Array.new(SIZE) { Array.new(SIZE) } end def [](pos) row, col = pos rows[row][col] end def []=(pos, piece) row, col = pos rows[row][col] = piece end def move_piece(piece, pos) self[pos] = piece self[piece.pos] = nil piece.pos = pos end def in_range?(pos) pos.all? { |coord| coord.between?(0, SIZE - 1) } end def in_check?(color) king = pieces.find do |piece| piece.is_a?(King) && piece.color == color end opposing_pieces = pieces.reject { |piece| piece.color == color } opposing_pieces.any? do |piece| piece.moves.any? { |move| move == king.pos } end end def pieces rows.flatten.compact end def dup duped_board = self.class.new pieces.each do |piece| piece.class.new(duped_board, piece.color, piece.pos) end duped_board end def empty?(pos) self[pos].nil? end def piece?(pos) self[pos].is_a?(Piece) end def checkmate?(color) pieces = self.pieces.select { |piece| piece.color == color } in_check?(color) && pieces.all? { |piece| piece.valid_moves.empty? } end def fill_rows positions.map do |coord, piece| piece.new(self, :black, [0, coord]) piece.new(self, :white, [(SIZE - 1), coord]) end (0...SIZE).each do |coord| Pawn.new(self, :black, [1, coord]) Pawn.new(self, :white, [(SIZE - 2), coord]) end end def add_piece(piece, pos) raise 'space not empty' unless empty?(pos) self[pos] = piece end protected attr_reader :rows private def positions STARTING_POSITIONS.inject({}) do |positions, (coord, piece)| positions.merge(coord => constantize(piece)) end end def constantize(piece) Object.const_get(piece.to_s.capitalize) end end
18.628571
72
0.623211
03e3ca9e593ca0e3c9aea4804dfe919779643846
3,614
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] before_action :require_login before_action :check_if_admin # GET /users # GET /users.json def index @title = 'Home' @this_user = Admin.find(session[:user_id]) @users = User.all @categories = Category.all end # GET /users/1 # GET /users/1.json def show @title = 'View User' end # GET /users/new def new @title = 'New' @user = Admin.new end # GET /users/1/edit def edit @title = 'Edit User' end # POST /users # POST /users.json def create @user = Admin.new(user_params) respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render :show, status: :created, location: @user } else format.html { render :new } format.json { render json: @user.errors, status: :unprocessable_entity } end end end # PATCH/PUT /users/1 # PATCH/PUT /users/1.json def update if (@user.username == "super") redirect_home else respond_to do |format| if @user.update(user_params_update) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end end def update_password @user = User.find(params[:id]) if (@user.username == "super") redirect_home else respond_to do |format| if @user.update(user_params_update_password) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :new_pass } format.json { render json: @user.errors, status: :unprocessable_entity } end end end end # DELETE /users/1 # DELETE /users/1.json def destroy if (@user.username == "super") redirect_home else @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'User was successfully removed.' } format.json { head :no_content } end end end def destroy_jobseeker @user = Jobseeker.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'User was successfully removed.' } format.json { head :no_content } end end def new_pass @title = 'Change Password' @user = User.find(params[:id]) end def view_jobseeker @title = 'View Job Seeker' @job_seeker = Jobseeker.find(params[:id]) end private # Use callbacks to share common setup or constraints between actions. def set_user @user = Admin.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def user_params params.require(:admin).permit(:name, :email, :username, :password_hash, :password, :password_confirmation, :password_salt, :phone, :type) end def user_params_update params.require(:admin).permit(:name, :email, :username, :phone, :type) end def user_params_update_password if(params[:admin]) params.require(:admin).permit(:password, :password_confirmation) elsif(params[:employer]) params.require(:employer).permit(:password, :password_confirmation) end end end
25.814286
143
0.637797
1d4cc20a46772fcf18834b9caca80b0b27052fe4
135
require 'rails_helper' RSpec.describe Products::Product, type: :model do pending "add some examples to (or delete) #{__FILE__}" end
22.5
56
0.748148
e99c18edfcf2cc5e152aac5740089a6681cfa8cf
1,251
module Dothoop class ProfileResource < ResourceKit::Resource include ErrorHandlingResourcable resources do # GET /profile action :all do verb :get path "#{Dothoop.configuration.path_url}/profile" handler(200) { |response| ProfileMapping.extract_collection(response.body, :read) } end # GET /profile/:profile_id action :find do verb :get path "#{Dothoop.configuration.path_url}/profile/:profile_id" handler(200) { |response| ProfileMapping.extract_single(response.body, :read) } end # POST /profile action :create do verb :post body { |object| ProfileMapping.representation_for(:create, object) } path "#{Dothoop.configuration.path_url}/profile" handler(201) { |response| ProfileMapping.extract_single(response.body, :read) } end # PATCH /profile/:profile_id action :patch do verb :patch body { |object| ProfileMapping.hash_for(:create, object).select{ |_, value| !value.nil? }.to_json } path "#{Dothoop.configuration.path_url}/profile/:profile_id" handler(200) { |response| ProfileMapping.extract_single(response.body, :read) } end end end end
30.512195
107
0.649081
ed11a0fe20a6da1a52d073955ebb9da478d81f0f
2,482
class Elm < Formula desc "Functional programming language for building browser-based GUIs" homepage "https://elm-lang.org" url "https://github.com/elm/compiler/archive/0.19.1.tar.gz" sha256 "aa161caca775cef1bbb04bcdeb4471d3aabcf87b6d9d9d5b0d62d3052e8250b1" license "BSD-3-Clause" bottle do cellar :any_skip_relocation rebuild 1 sha256 "04efe8b2f66b7904b05578e59a07300e8f070521a87ab0733433609da531f29d" => :big_sur sha256 "bb6cd6a1bd9b3a7f280791b2ffba6631efa784f9068f48c4d6f9e64d756a4b2a" => :catalina sha256 "03d2874b915186af4361360b5a3f3d9a9734046b97d46607b34a4e8f0d5228c2" => :mojave sha256 "0f72256bd128162b16d8bcb53284c52a9ce0ac52a63896f641a72e0ab097674c" => :x86_64_linux end depends_on "cabal-install" => :build depends_on "[email protected]" => :build uses_from_macos "ncurses" uses_from_macos "zlib" patch do # elm's tarball is not a proper cabal tarball, it contains multiple cabal files. # Add `cabal.project` lets cabal-install treat this tarball as cabal project correctly. # https://github.com/elm/compiler/pull/2159 url "https://github.com/elm/compiler/commit/eb566e901a419a6620e43c18faf89f57f0827124.patch?full_index=1" sha256 "556ff15fb4d8e5ca6e853280e35389c8875fa31a543204b315b55ec2ac967624" end def install system "cabal", "v2-update" system "cabal", "v2-install", *std_cabal_v2_args end test do # create elm.json elm_json_path = testpath/"elm.json" elm_json_path.write <<~EOS { "type": "application", "source-directories": [ "." ], "elm-version": "0.19.1", "dependencies": { "direct": { "elm/browser": "1.0.0", "elm/core": "1.0.0", "elm/html": "1.0.0" }, "indirect": { "elm/json": "1.0.0", "elm/time": "1.0.0", "elm/url": "1.0.0", "elm/virtual-dom": "1.0.0" } }, "test-dependencies": { "direct": {}, "indirect": {} } } EOS src_path = testpath/"Hello.elm" src_path.write <<~EOS module Hello exposing (main) import Html exposing (text) main = text "Hello, world!" EOS out_path = testpath/"index.html" system bin/"elm", "make", src_path, "--output=#{out_path}" assert_predicate out_path, :exist? end end
31.820513
108
0.61805
61af797f97194ec649b4a487c9f98708ce6d046d
2,689
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::DataBox::Mgmt::V2018_01_01 module Models # # Operation Collection. # class OperationList include MsRestAzure include MsRest::JSONable # @return [Array<Operation>] List of operations. attr_accessor :value # @return [String] Link for the next set of operations. attr_accessor :next_link # return [Proc] with next page method call. attr_accessor :next_method # # Gets the rest of the items for the request, enabling auto-pagination. # # @return [Array<Operation>] operation results. # def get_all_items items = @value page = self while page.next_link != nil && !page.next_link.strip.empty? do page = page.get_next_page items.concat(page.value) end items end # # Gets the next page of results. # # @return [OperationList] with next page content. # def get_next_page response = @next_method.call(@next_link).value! unless @next_method.nil? unless response.nil? @next_link = response.body.next_link @value = response.body.value self end end # # Mapper for OperationList class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'OperationList', type: { name: 'Composite', class_name: 'OperationList', model_properties: { value: { client_side_validation: true, required: false, read_only: true, serialized_name: 'value', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'OperationElementType', type: { name: 'Composite', class_name: 'Operation' } } } }, next_link: { client_side_validation: true, required: false, serialized_name: 'nextLink', type: { name: 'String' } } } } } end end end end
27.161616
80
0.509483
086bf8aad72540582bcc0e3c1fbab7db24300d49
92
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "server_side_validation"
30.666667
58
0.771739