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
|
---|---|---|---|---|---|
26ae2d9396a38661514ae70faa06410709d01e82 | 880 | module ID3Tag
module Frames
module V2
class FrameFabricator
class << self
def fabricate(id, content, flags, major_version_number)
new(id, content, flags, major_version_number).fabricate
end
end
def initialize(id, content, flags, major_version_number)
@id, @content, @flags, @major_version_number = id, content, flags, major_version_number
end
def fabricate
frame_class.new(@id, @content, @flags, @major_version_number)
end
def frame_class
case @id
when /^(TCON|TCO)$/
GenreFrame
when /^T/
TextFrame
when /^(COM|COMM)$/
CommentsFrame
when /^UFID$/
UniqueFileIdFrame
else
BasicFrame
end
end
end
end
end
end
| 23.783784 | 97 | 0.540909 |
0881f7a9552a3519de81ce03cb621dec095656d6 | 621 | require_relative 'game'
require_relative 'user'
include Codebreaker
# a = Game.new
# i.start
# # puts "Attempts: #{count}"
# # puts "secret code: #{i.start}"
# puts "user code: #{i.input_user_code}"
# # puts "user code: #{i.valid_input}"
# # puts "count plus : #{i.count_plus}"
# # puts "count minus : #{i.count_minus}"
# # puts "count_plus_and_minus : #{i.count_plus_and_minus}"
# # puts "One of code number: #{i.take_hint!}"
# # puts "hints : #{i.hint}"
# puts "hint! #{i.take_hint!}"
# i.attempts
# puts i.win?
"_________________________________________________________"
game = Codebreaker::Game.new
game.new_game
| 24.84 | 59 | 0.68438 |
3318dff4e54f4bbc91bd094e0e8574f0b0f24b3e | 2,231 | # frozen_string_literal: true
require 'dry/struct'
require 'middleman/docsite/types'
module Middleman
module Docsite
class Project < Dry::Struct
Types = Middleman::Docsite::Types
transform_keys(&:to_sym)
transform_types do |type|
if type.default?
type.constructor do |value|
value.nil? ? Dry::Types::Undefined : value
end
else
type
end
end
attribute :name, Types::String
attribute? :slug, Types::String
attribute? :repo, Types::Repo
attribute? :versions, Types::Versions
alias_method :to_s, :slug
def repo?
!repo.nil?
end
def repo_url
repo.is_a?(Hash) ? repo[:url] : repo
end
def slug
@attributes[:slug] || name
end
def version_from_branch(branch)
versions.detect { |version| version[:branch].eql?(branch) }.fetch(:value)
end
def latest_version
(versions
.map { |v| v.is_a?(Hash) ? v[:value] : v }
.reject { |value| value.eql?('master') }
.map(&Gem::Version.method(:new))
.max || 'master').to_s
end
def github_url
"https://github.com/#{org}/#{name}"
end
def rubygems_url
"https://rubygems.org/gems/#{name}"
end
def version_badge
"https://badge.fury.io/rb/#{name}.svg"
end
def ci_badge
"https://img.shields.io/travis/#{org}/#{name}/master.svg?style=flat"
end
def codeclimate_url
"https://codeclimate.com/github/#{org}/#{name}"
end
def codeclimate_badge
"https://codeclimate.com/github/#{org}/#{name}/badges/gpa.svg"
end
def coverage_badge
"https://codeclimate.com/github/#{org}/#{name}/badges/coverage.svg"
end
def inch_url
"https://inch-ci.org/github/#{org}/#{name}"
end
def inch_badge
"https://inch-ci.org/github/#{org}/#{name}.svg?branch=master&style=flat"
end
def api_url
"#{api_host_url}/#{name}"
end
def api_host_url
Docsite.development? ? 'http://localhost:4000/docs' : "https://api.#{org}.org"
end
end
end
end
| 22.31 | 86 | 0.561183 |
391a29cb6b8033de150b8c6dcf1c31aebe60a9b8 | 2,555 | exclude :test_arity , "needs investigation"
exclude :test_arity2 , "needs investigation"
exclude :test_binding , "needs investigation"
exclude :test_binding2 , "needs investigation"
exclude :test_binding_receiver , "needs investigation"
exclude :test_bound_parameters , "needs investigation"
exclude :test_curry , "needs investigation"
exclude :test_curry_from_knownbug , "needs investigation"
exclude :test_curry_instance_exec , "needs investigation"
exclude :test_curry_optional_params , "needs investigation"
exclude :test_curry_ski_fib , "needs investigation"
exclude :test_curry_with_trace , "needs investigation"
exclude :test_dup_clone , "needs investigation"
exclude :test_local_variable_defined? , "needs investigation"
exclude :test_local_variable_set , "needs investigation"
exclude :test_local_variables , "needs investigation"
exclude :test_localjump_error , "needs investigation"
exclude :test_method_to_proc , "needs investigation"
exclude :test_overridden_lambda , "needs investigation"
exclude :test_overridden_proc , "needs investigation"
exclude :test_parameters , "needs investigation"
exclude :test_proc_args_opt , "needs investigation"
exclude :test_proc_args_opt_post , "needs investigation"
exclude :test_proc_args_opt_post_block , "needs investigation"
exclude :test_proc_args_opt_rest , "needs investigation"
exclude :test_proc_args_opt_rest_post , "needs investigation"
exclude :test_proc_args_opt_rest_post_block , "needs investigation"
exclude :test_proc_args_pos_opt , "needs investigation"
exclude :test_proc_args_pos_opt_post , "needs investigation"
exclude :test_proc_args_pos_opt_post_block , "needs investigation"
exclude :test_proc_args_pos_opt_rest , "needs investigation"
exclude :test_proc_args_pos_opt_rest_post , "needs investigation"
exclude :test_proc_args_pos_opt_rest_post_block , "needs investigation"
exclude :test_proc_args_pos_rest_post , "needs investigation"
exclude :test_proc_args_pos_rest_post_block , "needs investigation"
exclude :test_proc_args_rest_post , "needs investigation"
exclude :test_proc_args_rest_post_block , "needs investigation"
exclude :test_proc_lambda , "needs investigation"
exclude :test_proc_location , "needs investigation"
exclude :test_safe , "needs investigation"
exclude :test_to_proc , "needs investigation"
exclude :test_to_s , "needs investigation"
exclude :test_proc_args_opt_signle , "needs investigation"
exclude :"test_curry_binding", "needs investigation"
exclude :"test_proc_args_opt_single", "needs investigation"
exclude :"test_proc_mark", "needs investigation"
| 54.361702 | 71 | 0.836399 |
f775223d4926dc97f02679f9f1caa4329711a3aa | 118 | require 'test_helper'
class BeltTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 14.75 | 40 | 0.694915 |
ed50c17815d70446ed001c994f9795ef11f28df6 | 12,179 | # frozen_string_literal: true
require "excon"
require "toml-rb"
require "open3"
require "dependabot/dependency"
require "dependabot/errors"
require "dependabot/shared_helpers"
require "dependabot/python/file_parser"
require "dependabot/python/file_parser/python_requirement_parser"
require "dependabot/python/file_updater/pyproject_preparer"
require "dependabot/python/update_checker"
require "dependabot/python/version"
require "dependabot/python/requirement"
require "dependabot/python/native_helpers"
require "dependabot/python/python_versions"
require "dependabot/python/authed_url_builder"
require "dependabot/python/name_normaliser"
module Dependabot
module Python
class UpdateChecker
# This class does version resolution for pyproject.toml files.
class PoetryVersionResolver
GIT_REFERENCE_NOT_FOUND_REGEX = /
'git'.*pypoetry-git-(?<name>.+?).{8}',
'checkout',
'(?<tag>.+?)'
/x.freeze
GIT_DEPENDENCY_UNREACHABLE_REGEX = /
'\['git',
\s+'clone',
\s+'--recurse-submodules',
\s+'(?<url>.+?)'.*
\s+exit\s+status\s+128
/mx.freeze
attr_reader :dependency, :dependency_files, :credentials
def initialize(dependency:, dependency_files:, credentials:)
@dependency = dependency
@dependency_files = dependency_files
@credentials = credentials
end
def latest_resolvable_version(requirement: nil)
version_string =
fetch_latest_resolvable_version_string(requirement: requirement)
version_string.nil? ? nil : Python::Version.new(version_string)
end
def resolvable?(version:)
@resolvable ||= {}
return @resolvable[version] if @resolvable.key?(version)
if fetch_latest_resolvable_version_string(requirement: "==#{version}")
@resolvable[version] = true
else
@resolvable[version] = false
end
rescue SharedHelpers::HelperSubprocessFailed => e
raise unless e.message.include?("SolverProblemError")
@resolvable[version] = false
end
private
def fetch_latest_resolvable_version_string(requirement:)
@latest_resolvable_version_string ||= {}
if @latest_resolvable_version_string.key?(requirement)
return @latest_resolvable_version_string[requirement]
end
@latest_resolvable_version_string[requirement] ||=
SharedHelpers.in_a_temporary_directory do
SharedHelpers.with_git_configured(credentials: credentials) do
write_temporary_dependency_files(updated_req: requirement)
if python_version && !pre_installed_python?(python_version)
run_poetry_command("pyenv install -s #{python_version}")
run_poetry_command(
"pyenv exec pip install -r "\
"#{NativeHelpers.python_requirements_path}"
)
end
# Shell out to Poetry, which handles everything for us.
run_poetry_command(poetry_update_command)
updated_lockfile =
if File.exist?("poetry.lock") then File.read("poetry.lock")
else File.read("pyproject.lock")
end
updated_lockfile = TomlRB.parse(updated_lockfile)
fetch_version_from_parsed_lockfile(updated_lockfile)
rescue SharedHelpers::HelperSubprocessFailed => e
handle_poetry_errors(e)
end
end
end
def fetch_version_from_parsed_lockfile(updated_lockfile)
version =
updated_lockfile.fetch("package", []).
find { |d| d["name"] && normalise(d["name"]) == dependency.name }&.
fetch("version")
return version unless version.nil? && dependency.top_level?
raise "No version in lockfile!"
end
def handle_poetry_errors(error)
if error.message.gsub(/\s/, "").match?(GIT_REFERENCE_NOT_FOUND_REGEX)
message = error.message.gsub(/\s/, "")
name = message.match(GIT_REFERENCE_NOT_FOUND_REGEX).
named_captures.fetch("name")
raise GitDependencyReferenceNotFound, name
end
if error.message.match?(GIT_DEPENDENCY_UNREACHABLE_REGEX)
url = error.message.match(GIT_DEPENDENCY_UNREACHABLE_REGEX).
named_captures.fetch("url")
raise GitDependenciesNotReachable, url
end
raise unless error.message.include?("SolverProblemError") ||
error.message.include?("PackageNotFound")
check_original_requirements_resolvable
# If the original requirements are resolvable but the new version
# would break Python version compatibility the update is blocked
return if error.message.include?("support the following Python")
# If any kind of other error is now occurring as a result of our
# change then we want to hear about it
raise
end
# Using `--lock` avoids doing an install.
# Using `--no-interaction` avoids asking for passwords.
def poetry_update_command
"pyenv exec poetry update #{dependency.name} --lock --no-interaction"
end
def check_original_requirements_resolvable
return @original_reqs_resolvable if @original_reqs_resolvable
SharedHelpers.in_a_temporary_directory do
SharedHelpers.with_git_configured(credentials: credentials) do
write_temporary_dependency_files(update_pyproject: false)
run_poetry_command(poetry_update_command)
@original_reqs_resolvable = true
rescue SharedHelpers::HelperSubprocessFailed => e
raise unless e.message.include?("SolverProblemError") ||
e.message.include?("PackageNotFound")
msg = clean_error_message(e.message)
raise DependencyFileNotResolvable, msg
end
end
end
def clean_error_message(message)
# Redact any URLs, as they may include credentials
message.gsub(/http.*?(?=\s)/, "<redacted>")
end
def write_temporary_dependency_files(updated_req: nil,
update_pyproject: true)
dependency_files.each do |file|
path = file.name
FileUtils.mkdir_p(Pathname.new(path).dirname)
File.write(path, file.content)
end
# Overwrite the .python-version with updated content
File.write(".python-version", python_version) if python_version
# Overwrite the pyproject with updated content
if update_pyproject
File.write(
"pyproject.toml",
updated_pyproject_content(updated_requirement: updated_req)
)
else
File.write("pyproject.toml", sanitized_pyproject_content)
end
end
def python_version
requirements = python_requirement_parser.user_specified_requirements
requirements = requirements.
map { |r| Python::Requirement.requirements_array(r) }
version = PythonVersions::SUPPORTED_VERSIONS_TO_ITERATE.find do |v|
requirements.all? do |reqs|
reqs.any? { |r| r.satisfied_by?(Python::Version.new(v)) }
end
end
return version if version
msg = "Dependabot detected the following Python requirements "\
"for your project: '#{requirements}'.\n\nCurrently, the "\
"following Python versions are supported in Dependabot: "\
"#{PythonVersions::SUPPORTED_VERSIONS.join(', ')}."
raise DependencyFileNotResolvable, msg
end
def python_requirement_parser
@python_requirement_parser ||=
FileParser::PythonRequirementParser.new(
dependency_files: dependency_files
)
end
def pre_installed_python?(version)
PythonVersions::PRE_INSTALLED_PYTHON_VERSIONS.include?(version)
end
def updated_pyproject_content(updated_requirement:)
content = pyproject.content
content = sanitize_pyproject_content(content)
content = add_private_sources(content)
content = freeze_other_dependencies(content)
content = set_target_dependency_req(content, updated_requirement)
content
end
def sanitized_pyproject_content
content = pyproject.content
content = sanitize_pyproject_content(content)
content = add_private_sources(content)
content
end
def sanitize_pyproject_content(pyproject_content)
Python::FileUpdater::PyprojectPreparer.
new(pyproject_content: pyproject_content).
sanitize
end
def add_private_sources(pyproject_content)
Python::FileUpdater::PyprojectPreparer.
new(pyproject_content: pyproject_content).
replace_sources(credentials)
end
def freeze_other_dependencies(pyproject_content)
Python::FileUpdater::PyprojectPreparer.
new(pyproject_content: pyproject_content, lockfile: lockfile).
freeze_top_level_dependencies_except([dependency])
end
def set_target_dependency_req(pyproject_content, updated_requirement)
return pyproject_content unless updated_requirement
pyproject_object = TomlRB.parse(pyproject_content)
poetry_object = pyproject_object.dig("tool", "poetry")
%w(dependencies dev-dependencies).each do |type|
names = poetry_object[type]&.keys || []
pkg_name = names.find { |nm| normalise(nm) == dependency.name }
next unless pkg_name
if poetry_object.dig(type, pkg_name).is_a?(Hash)
poetry_object[type][pkg_name]["version"] = updated_requirement
else
poetry_object[type][pkg_name] = updated_requirement
end
end
# If this is a sub-dependency, add the new requirement
unless dependency.requirements.find { |r| r[:file] == pyproject.name }
poetry_object[subdep_type] ||= {}
poetry_object[subdep_type][dependency.name] = updated_requirement
end
TomlRB.dump(pyproject_object)
end
def subdep_type
category =
TomlRB.parse(lockfile.content).fetch("package", []).
find { |dets| normalise(dets.fetch("name")) == dependency.name }.
fetch("category")
category == "dev" ? "dev-dependencies" : "dependencies"
end
def pyproject
dependency_files.find { |f| f.name == "pyproject.toml" }
end
def pyproject_lock
dependency_files.find { |f| f.name == "pyproject.lock" }
end
def poetry_lock
dependency_files.find { |f| f.name == "poetry.lock" }
end
def lockfile
poetry_lock || pyproject_lock
end
def run_poetry_command(command)
start = Time.now
command = SharedHelpers.escape_command(command)
stdout, process = Open3.capture2e(command)
time_taken = Time.now - start
# Raise an error with the output from the shell session if Pipenv
# returns a non-zero status
return if process.success?
raise SharedHelpers::HelperSubprocessFailed.new(
message: stdout,
error_context: {
command: command,
time_taken: time_taken,
process_exit_value: process.to_s
}
)
end
def normalise(name)
NameNormaliser.normalise(name)
end
end
end
end
end
| 35.820588 | 80 | 0.617703 |
1a1235c3b0609513f48ded2bb17a85cf39d44298 | 151 | require 'rails_helper'
RSpec.describe "static_pages/search.html.haml", :type => :view do
pending "add some examples to (or delete) #{__FILE__}"
end
| 25.166667 | 65 | 0.735099 |
0117c9f5d72a38c85179f42c981737119597e568 | 6,863 | ########################################################
# Defines the main methods that are necessary to filter out reads based on similarity with an entry in a given database
########################################################
class PluginUserFilter < Plugin
#Returns an array with the errors due to parameters are missing
def check_params
#Priority, base ram
cores = []
priority = 2
ram = []
base_ram = 720 #mb
#Array to store errors
errors=[]
#Check params (errors,param_name,param_class,default_value,comment)
@params.check_param(errors,'user_filter_db','DB','','Databases to use in Filtering: internal name or full path to fasta file or full path to a folder containing an external database in fasta format',@stbb_db)
@params.check_param(errors,'user_filter_minratio','String','0.56','Minimal ratio of sequence of interest kmers in a read to be filtered')
@params.check_param(errors,'user_filter_species','String',nil,'list of species (fasta files names in database comma separated) to filter out')
@params.check_param(errors,'user_filter_aditional_params','String',nil,'Aditional BBsplit parameters, add them together between quotation marks and separated by one space')
#Set resources
if errors.empty?
#Adds 1 core for each database
@params.get_param('user_filter_db').split(/ |,/).each do |database|
cores << 1
ram << (@stbb_db.get_info(database,'index_size')/2.0**20).round(0) + base_ram
end
@params.resource('set_requirements',{ 'plugin' => 'PluginContaminants','opts' => {'cores' => cores,'priority' => priority,'ram'=>ram}})
end
@params.resource('set_requirements',{ 'plugin' => 'PluginUserFilter','opts' => {'cores' => cores,'priority' => priority,'ram'=>ram}})
#Make filtered directory
Dir.mkdir(File.join(File.expand_path(OUTPUT_PATH),'filtered_files')) if !Dir.exist?(File.join(File.expand_path(OUTPUT_PATH),'filtered_files'))
return errors
end
#Get options
def get_options
#Creates an array to store individual options for every database in contaminants_dbs
opts = Array.new
#Iteration to assemble individual options
@params.get_param('user_filter_db').split(/ |,/).each do |db|
# Add hash to array
opts << get_filtering_module(db,'user_filter')
end
#Return
return opts
end
#Get module
def get_filtering_module(db,plugin)
module_options = super
#Species to filter out
user_filter_species = @params.get_param('user_filter_species')
#output files suffix
@suffix = ['_pre_out',@params.get_param('sample_type') == 'paired' ? '_#' : '',@params.get_param('suffix')].join('')
# Adding details to filter out species. Check species if needed
if !user_filter_species.nil?
user_filter_species.split(/,/).each do |species|
module_options["out_#{species.split(" ").join("_")}"] = "#{File.join(File.expand_path(OUTPUT_PATH),"filtered_files")}/#{species.split(" ").join("_")}#{@suffix}" if @stbb_db.get_info(db,'list').include?(species)
end
else
module_options['basename'] = "#{File.join(File.expand_path(OUTPUT_PATH),"filtered_files")}/%#{@suffix}"
end
return module_options
end
#Get cmd
def get_cmd(result_hash)
#Load all databases cmds
full_cmd = Array.new
result_hash['opts'].each do |opt_hash|
full_cmd << @bbtools.load_bbsplit(opt_hash)
end
#Return
return full_cmd.join(' | ')
end
#Get stats
def get_stats(stats_files,stats)
stats["plugin_user_filter"] = {} if !stats.key?('plugin_user_filter')
stats["plugin_user_filter"]["filtered_sequences_count"] = 0 if !stats['plugin_user_filter'].key?('filtered_sequences_count')
stats["plugin_user_filter"]["filtering_ids"] = {} if !stats['plugin_user_filter'].key?('filtering_ids')
#Regexp
regexp_str = "^(?!\s*#).+"
#For every database refstats
stats_files['stats'].each do |refstats_file|
lines = super(regexp_str,refstats_file)
lines.each do |line|
splitted_line = line.split(/\t/)
nreads = splitted_line[5].to_i + splitted_line[6].to_i
stats["plugin_user_filter"]["filtering_ids"][splitted_line[0]] = nreads
stats["plugin_user_filter"]["filtered_sequences_count"] += nreads
end
end
end
#Get report!
def get_report(json,data)
super
with = json['plugin_user_filter']['filtered_sequences_count']
without = json['sequences']['input_count'] - with
data['plugin_user_filter_percent'] = [
['content','count'],
['nonfiltered reads',without],
['filtered reads',with]
]
data['plugin_user_filter_ids'] = []
data['plugin_user_filter_ids'] << json['plugin_user_filter']['filtering_ids'].keys
data['plugin_user_filter_ids'] << json['plugin_user_filter']['filtering_ids'].values
@plugin << %( <div style="overflow: hidden" class="flex-row">)
@plugin << %( <div class="flex-canvas-50">)
@plugin << %( <%=pie(id:'plugin_user_filter_percent', header: true, row_names: true, title:"Filtered reads presence", config: { 'pieSegmentPrecision' => 2 })%>)
@plugin << %( </div>)
@plugin << %( <div class="flex-canvas-50">)
@plugin << %( <%=barplot(id:'plugin_user_filter_ids', header: true, title:"Filtered reads", x_label: 'Nreads', config: { 'showLegend' => false })%>)
@plugin << %( </div>)
@plugin << %( </div>)
return @plugin
end
#CLEAN UP
def clean_up
#Apply minlength to filtered files!
filtered_files = Dir[File.join(File.expand_path(OUTPUT_PATH),"filtered_files","*.fastq*")].sort
return if filtered_files.empty?
slice_size = @params.get_param('sample_type') == 'paired' ? 2:1
filtered_files = filtered_files.each_slice(slice_size).to_a
remove_short_reads(filtered_files,'pre_','')
#Remove emptied files
remove_empty_files(Dir[File.join(File.expand_path(OUTPUT_PATH),"filtered_files","*.fastq*")].sort)
end
def remove_empty_files(files)
files.each do |fastq_file|
#Test if file is empty
openfile = @params.get_param('write_in_gzip') ? Zlib::GzipReader.new(open(fastq_file)) : open(fastq_file)
res = true
openfile.each_line do |line|
if !line.empty?
res = false
break
end
end
openfile.close
FileUtils.rm(fastq_file) if res
end
end
def remove_short_reads(files,to_remove,to_add)
files.each do |file_array|
outfiles = file_array.map { |file| file.sub(/#{to_remove}/,to_add) }
h = { 'in' => file_array[0],'out' => outfiles[0],'minlength' => @params.get_param('minlength'),'ow' => 't','redirection' => ['2>','/dev/null']}
if @params.get_param('sample_type') == 'paired' && outfiles.count == 2
h['in2'] = file_array[1]
h['out2'] = outfiles[1]
h['int'] = 'f'
end
system(@bbtools.load_reformat(h))
file_array.each_with_index { |file,i| FileUtils.rm(file) if File.exist?(outfiles[i]) }
end
end
end
| 43.99359 | 214 | 0.673029 |
b946657e4faedb89495459cf3ded3c7ed6a5cea9 | 88 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'best_hiking_trails'
| 29.333333 | 58 | 0.761364 |
6101c0aa166d43766de65ff3379e9d30dd92a79b | 1,639 | module ApHelper
def action_type_text(ap)
if ap.action_type == 0 then return "花壇の世話"
elsif ap.action_type == 1 then return "庭園の散策"
elsif ap.action_type == 2 then return "島の探検"
elsif ap.action_type == 3 then return "練習戦"
end
end
def progress_text(ap)
if ap.progress >= 0 then return ap.progress
elsif ap.progress == -1 then return ""
elsif ap.progress == -11 then return "メイン"
else
return "?"
end
end
def battle_result_text(ap)
if ap.battle_result == -2 then return "なし"
elsif ap.battle_result == 1 then return "勝利"
elsif ap.battle_result == 0 then return "引分"
elsif ap.battle_result == -1 then return "敗北"
else
return "?"
end
end
def flag_text(text)
if text == 0 then return ""
elsif text == 1 then return "○"
end
end
def party_members(members)
if !members then
return
end
members.each do |member|
if member.e_no == 10001 then
haml_concat "ひつじ"
haml_tag :br
else
haml_concat member.pc_name.name if member.pc_name
haml_concat "(" + sprintf("%d", member.e_no) + ")"
haml_tag :br
end
end
end
def enemy_members(members)
if !members then
return
end
members.each do |member|
haml_concat member.enemy.name if member.enemy
haml_concat member.suffix.name if member.enemy
haml_tag :br
end
end
end
| 25.609375 | 62 | 0.541184 |
d5cfe7d3aba3bb3962567a82d0beadf8ab13fcaa | 6,725 | class EventsController < ApplicationController
before_action :authenticate_user!, except: [:calendar, :index, :archive, :fullcalendar]
before_action :set_item, only: [:show, :edit, :update, :destroy]
def index
@events = Instance.published.future.order(:start_at)
end
def archive
@events = Instance.kuusi_palaa.published.past.order(start_at: :desc)
render template: 'events/index'
end
def calendar
# events = Event.none
# events = Event.published.between(params['start'], params['end']) if (params['start'] && params['end'])
@events = []
# @events += events.map{|x| x.instances.published}.flatten
@events += Instance.calendered.published.between(params['start'], params['end']) if (params['start'] && params['end'])
@events.uniq!
@events.flatten!
# @events += events.reject{|x| !x.one_day? }
if params[:format] == 'ics'
require 'icalendar/tzinfo'
@cal = Icalendar::Calendar.new
@cal.prodid = '-//Kuusi Palaa, Helsinki//NONSGML ExportToCalendar//EN'
tzid = "Europe/Helsinki"
tz = TZInfo::Timezone.get tzid
if @events.empty?
@events = Instance.kuusi_palaa.calendered.published.not_cancelled
end
@events = @events.to_a
@events.flatten!
@events.each do |event|
@cal.event do |e|
next if event.start_at.blank?
e.dtstart = Icalendar::Values::DateTime.new(event.start_at, 'tzid' => tzid)
e.dtend = Icalendar::Values::DateTime.new(event.end_at, 'tzid' => tzid)
e.summary = event.name
e.location = 'Kuusi Palaa, Kolmas linja 7, Helsinki'
e.description = ActionController::Base.helpers.strip_tags( event.description )
e.ip_class = 'PUBLIC'
if event.slug =='closed'
e.url = e.uid = 'https://kuusipalaa.fi/posts/courtyard-closed-thursday-31-may'
else
e.url = e.uid = 'https://kuusipalaa.fi/events/' + event.event.slug + '/' + event.slug
end
end
end
@cal.publish
end
set_meta_tags title: 'Calendar'
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @events }
format.ics {
render :plain => @cal.to_ical }
end
end
def create
# if params[:event][:image]
# else
# # no image upload so use idea image
# idea = Idea.find(params[:event][:idea_id])
# if idea.image?
# params[:event][:remote_image_url] = idea.image.url.gsub(/development/, 'production')
# end
# end
# now, grab image on the server side and let them change it afterwards
api = BiathlonApi.new
success = api.api_post("/events", {user_email: current_user.email,
user_token: current_user.authentication_token, event: params[:event].permit!.to_hash}
)
if success["id"]
Activity.create(item: Event.find(success['id']).instances.first, user: current_user, contributor_type: params['event']['primary_sponsor_type'], contributor_id: params['event']['primary_sponsor_id'], description: 'published_event')
redirect_to "/events/#{success['id']}"
elsif success["error"]
flash[:error] = success["error"]
redirect_to idea_path(params[:event][:idea_id])
end
end
def fullcalendar
# events = Event.none
# events = Event.published.between(params['start'], params['end']) if (params['start'] && params['end'])
@events = []
# @events += events.map{|x| x.instances.published}.flatten
@events += Instance.calendered.published.between(params['start'], params['end']) if (params['start'] && params['end'])
@events += Idea.active.timed.unconverted.between(params['start'], params['end']) if (params['start'] && params['end'])
@events += Roombooking.between(params['start'], params['end']) if (params['start'] && params['end'])
@events.uniq!
@events.flatten!
closed = Instance.new(start_at: '2018-07-01 00:00:01', end_at: '2018-12-31 23:59:59')
closed.name = 'Kuusi Palaa will close permanently without enough stakeholders to support it!'
closed.slug = 'closed'
@events << closed
# @events += events.reject{|x| !x.one_day? }
if params[:format] == 'ics'
require 'icalendar/tzinfo'
@cal = Icalendar::Calendar.new
@cal.prodid = '-//Kuusi Palaa, Helsinki//NONSGML ExportToCalendar//EN'
tzid = "Europe/Helsinki"
tz = TZInfo::Timezone.get tzid
@events.delete_if{|x| x.cancelled == true }.each do |event|
@cal.event do |e|
e.dtstart = Icalendar::Values::DateTime.new(event.start_at, 'tzid' => tzid)
e.dtend = Icalendar::Values::DateTime.new(event.end_at, 'tzid' => tzid)
e.summary = event.name
e.location = 'Kuusi Palaa, Kolmas linja 7, Helsinki'
e.description = strip_tags event.description
e.ip_class = 'PUBLIC'
e.url = e.uid = 'https://kuusipalaa.fi/events/' + event.event.slug + '/' + event.slug
end
end
@cal.publish
end
set_meta_tags title: 'Calendar'
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @events }
format.ics { render :text => @cal.to_ical }
end
end
def show
@event = Event.friendly.find(params[:id])
if @event.start_at < "2018-02-01"
redirect_to "https://temporary.fi/events/" + @event.slug
end
set_meta_tags title: @event.name
end
def update
if can? :update, @event
if @event.update_attributes(event_params)
flash[:notice] = t(:event_has_been_updated)
else
flash[:error] = t(:error_updating_event) + @event.errors.full_messages
end
else
flash[:error] = t(:generic_error)
end
redirect_to @event
end
private
def event_params
params.require(:event).permit(:place_id, :start_at, :end_at, :sequence, :published, :image, :primary_sponsor_id, :primary_sponsor_type,
:secondary_sponsor_id, :cost_euros, :cost_bb, :idea_id, :remote_image_url,
instances_attributes: [:id, :_destroy, :event_id, :cost_bb, :price_public, :start_at, :end_at, :image,
:custom_bb_fee,
:room_needed, :allow_others, :price_stakeholders, :place_id,
translations_attributes: [:id, :locale, :_destroy, :name, :description]],
translations_attributes: [:name, :description, :id, :locale])
end
def set_item
@event = Event.friendly.find(params[:id])
redirect_to action: action_name, id: @event.friendly_id, status: 301 unless @event.friendly_id == params[:id]
end
end | 37.361111 | 237 | 0.623048 |
18e30fcfdece8f46400b187ad0d6dea9a3a22458 | 9,498 | # encoding: utf-8
# author: Dominik Richter
# author: Christoph Hartmann
require 'uri'
require 'openssl'
require 'tempfile'
require 'open-uri'
module Fetchers
class Url < Inspec.fetcher(1)
MIME_TYPES = {
'application/x-zip-compressed' => '.zip',
'application/zip' => '.zip',
'application/x-gzip' => '.tar.gz',
'application/gzip' => '.tar.gz',
}.freeze
name 'url'
priority 200
def self.resolve(target, opts = {})
if target.is_a?(Hash) && target.key?(:url)
resolve_from_string(target[:url], opts, target[:username], target[:password])
elsif target.is_a?(String)
resolve_from_string(target, opts)
end
end
def self.resolve_from_string(target, opts, username = nil, password = nil)
uri = URI.parse(target)
return nil if uri.nil? or uri.scheme.nil?
return nil unless %{ http https }.include? uri.scheme
target = transform(target)
opts[:username] = username if username
opts[:password] = password if password
new(target, opts)
rescue URI::Error
nil
end
# Transforms a browser github/bitbucket url to github/bitbucket tar url
# We distinguish between three different Github/Bitbucket URL types:
# - Master URL
# - Branch URL
# - Commit URL
#
# master url:
# https://github.com/nathenharvey/tmp_compliance_profile/ is transformed to
# https://github.com/nathenharvey/tmp_compliance_profile/archive/master.tar.gz
# https://bitbucket.org/username/repo is transformed to
# https://bitbucket.org/username/repo/get/master.tar.gz
#
# branch:
# https://github.com/hardening-io/tests-os-hardening/tree/2.0 is transformed to
# https://github.com/hardening-io/tests-os-hardening/archive/2.0.tar.gz
# https://bitbucket.org/username/repo/branch/branchname is transformed to
# https://bitbucket.org/username/repo/get/newbranch.tar.gz
#
# commit:
# https://github.com/hardening-io/tests-os-hardening/tree/48bd4388ddffde68badd83aefa654e7af3231876
# is transformed to
# https://github.com/hardening-io/tests-os-hardening/archive/48bd4388ddffde68badd83aefa654e7af3231876.tar.gz
# https://bitbucket.org/username/repo/commits/95ce1f83d5bbe9eec34c5973f6894617e8d6d8cc is transformed to
# https://bitbucket.org/username/repo/get/95ce1f83d5bbe9eec34c5973f6894617e8d6d8cc.tar.gz
GITHUB_URL_REGEX = %r{^https?://(www\.)?github\.com/(?<user>[\w-]+)/(?<repo>[\w-]+)(\.git)?(/)?$}
GITHUB_URL_WITH_TREE_REGEX = %r{^https?://(www\.)?github\.com/(?<user>[\w-]+)/(?<repo>[\w-]+)/tree/(?<commit>[\w\.]+)(/)?$}
BITBUCKET_URL_REGEX = %r{^https?://(www\.)?bitbucket\.org/(?<user>[\w-]+)/(?<repo>[\w-]+)(\.git)?(/)?$}
BITBUCKET_URL_BRANCH_REGEX = %r{^https?://(www\.)?bitbucket\.org/(?<user>[\w-]+)/(?<repo>[\w-]+)/branch/(?<branch>[\w\.]+)(/)?$}
BITBUCKET_URL_COMMIT_REGEX = %r{^https?://(www\.)?bitbucket\.org/(?<user>[\w-]+)/(?<repo>[\w-]+)/commits/(?<commit>[\w\.]+)(/)?$}
def self.transform(target)
transformed_target = if m = GITHUB_URL_REGEX.match(target) # rubocop:disable Lint/AssignmentInCondition
"https://github.com/#{m[:user]}/#{m[:repo]}/archive/master.tar.gz"
elsif m = GITHUB_URL_WITH_TREE_REGEX.match(target) # rubocop:disable Lint/AssignmentInCondition
"https://github.com/#{m[:user]}/#{m[:repo]}/archive/#{m[:commit]}.tar.gz"
elsif m = BITBUCKET_URL_REGEX.match(target) # rubocop:disable Lint/AssignmentInCondition
"https://bitbucket.org/#{m[:user]}/#{m[:repo]}/get/master.tar.gz"
elsif m = BITBUCKET_URL_BRANCH_REGEX.match(target) # rubocop:disable Lint/AssignmentInCondition
"https://bitbucket.org/#{m[:user]}/#{m[:repo]}/get/#{m[:branch]}.tar.gz"
elsif m = BITBUCKET_URL_COMMIT_REGEX.match(target) # rubocop:disable Lint/AssignmentInCondition
"https://bitbucket.org/#{m[:user]}/#{m[:repo]}/get/#{m[:commit]}.tar.gz"
end
if transformed_target
Inspec::Log.warn("URL target #{target} transformed to #{transformed_target}. Consider using the git fetcher")
transformed_target
else
target
end
end
attr_reader :files, :archive_path
def initialize(url, opts)
@target = url
@target_uri = parse_uri(@target)
@insecure = opts['insecure']
@token = opts['token']
@config = opts
@archive_path = nil
@temp_archive_path = nil
end
def fetch(path)
@archive_path ||= download_archive(path)
end
def resolved_source
@resolved_source ||= { url: @target, sha256: sha256 }
end
def cache_key
@archive_shasum ||= sha256
end
def to_s
@target
end
private
def parse_uri(target)
return URI.parse(target) if target.is_a?(String)
URI.parse(target[:url])
end
def sha256
file = @archive_path || temp_archive_path
OpenSSL::Digest::SHA256.digest(File.read(file)).unpack('H*')[0]
end
def file_type_from_remote(remote)
content_type = remote.meta['content-type']
file_type = MIME_TYPES[content_type]
if file_type.nil?
Inspec::Log.warn("Unrecognized content type: #{content_type}. Assuming tar.gz")
file_type = '.tar.gz'
end
file_type
end
def temp_archive_path
@temp_archive_path ||= if @config['server_type'] == 'automate2'
download_automate2_archive_to_temp
else
download_archive_to_temp
end
end
def download_automate2_archive_to_temp
return @temp_archive_path if !@temp_archive_path.nil?
Inspec::Log.debug("Fetching URL: #{@target}")
json = {
owner: @config['profile'][0],
name: @config['profile'][1],
version: @config['profile'][2],
}.to_json
opts = http_opts
opts[:use_ssl] = @target_uri.scheme == 'https'
if @insecure
opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
else
opts[:verify_mode] = OpenSSL::SSL::VERIFY_PEER
end
req = Net::HTTP::Post.new(@target_uri)
opts.each do |key, value|
req.add_field(key, value)
end
req.body = json
res = Net::HTTP.start(@target_uri.host, @target_uri.port, opts) { |http|
http.request(req)
}
@archive_type = '.tar.gz'
archive = Tempfile.new(['inspec-dl-', @archive_type])
archive.binmode
archive.write(res.body)
archive.rewind
archive.close
Inspec::Log.debug("Archive stored at temporary location: #{archive.path}")
@temp_archive_path = archive.path
end
# Downloads archive to temporary file with side effect :( of setting @archive_type
def download_archive_to_temp
return @temp_archive_path if !@temp_archive_path.nil?
Inspec::Log.debug("Fetching URL: #{@target}")
remote = open_via_uri(@target)
@archive_type = file_type_from_remote(remote) # side effect :(
archive = Tempfile.new(['inspec-dl-', @archive_type])
archive.binmode
archive.write(remote.read)
archive.rewind
archive.close
Inspec::Log.debug("Archive stored at temporary location: #{archive.path}")
@temp_archive_path = archive.path
end
def open_via_uri(target)
opts = http_opts
if opts[:http_basic_authentication]
# OpenURI does not support userinfo so we need to remove it
open(target.sub("#{@target_uri.userinfo}@", ''), opts)
else
open(target, opts)
end
end
def download_archive(path)
temp_archive_path
final_path = "#{path}#{@archive_type}"
FileUtils.mkdir_p(File.dirname(final_path))
FileUtils.mv(temp_archive_path, final_path)
Inspec::Log.debug("Fetched archive moved to: #{final_path}")
@temp_archive_path = nil
final_path
end
def http_opts
opts = {}
opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE if @insecure
if @config['server_type'] =~ /automate/
opts['chef-delivery-enterprise'] = @config['automate']['ent']
if @config['automate']['token_type'] == 'dctoken'
opts['x-data-collector-token'] = @config['token']
else
opts['chef-delivery-user'] = @config['user']
opts['chef-delivery-token'] = @config['token']
end
elsif @token
opts['Authorization'] = "Bearer #{@token}"
end
username = @config[:username] || @target_uri.user
password = @config[:password] || @target_uri.password
opts[:http_basic_authentication] = [username, password] if username
# Do not send any headers that have nil values.
# Net::HTTP does not gracefully handle this situation.
check_for_missing_values!(opts)
opts
end
def check_for_missing_values!(opts)
keys_missing_values = opts.keys.delete_if do |k|
if opts[k].nil?
false
elsif opts[k].respond_to?(:empty?) && opts[k].empty?
false
else
true
end
end
raise 'Unable to fetch profile - the following HTTP headers have no value: ' \
"#{keys_missing_values.join(', ')}" unless keys_missing_values.empty?
end
end
end
| 35.177778 | 133 | 0.617498 |
bbccdf70a2cdb51cf18ac0d65bcf83121f33c88a | 559 | require 'active_model'
module CreditCardChecker
# Validator for credit card numbers using the Luhn algorithm
class CardNumberValidator
include ActiveModel::Validations
attr_reader :number_array
def initialize(number)
@number_array = number.chars.map(&:to_i)
end
def number_valid?
check = @number_array.pop
sum = @number_array.reverse.each_slice(2).map do |left_num, right_num|
[(left_num * 2).divmod(10), right_num]
end.push(check).flatten.compact.inject(:+)
sum % 10 == 0
end
end
end | 22.36 | 76 | 0.685152 |
e9ba868c53fba86d7fca5c42ffb5b03dd653ccae | 584 | require "base64"
module TerraspacePluginAzurerm::Interfaces::Helper
class Secret
extend Memoist
include TerraspacePluginAzurerm::Logging
include TerraspacePluginAzurerm::Clients::Options
def initialize(mod, options={})
@mod, @options = mod, options
@base64 = options[:base64]
end
# opts: version, vault
def fetch(name, opts={})
value = fetcher.fetch(name, opts)
value = Base64.strict_encode64(value).strip if @base64
value
end
def fetcher
Fetcher.new(@mod, @options)
end
memoize :fetcher
end
end
| 21.62963 | 60 | 0.667808 |
914d63b6db5127981a8a7cba83159dfbd993f316 | 2,989 | # (c) Copyright 2017 Ribose Inc.
#
# This is a middleware to check for invalid user's request path and request
# parameters.
module Rack
class Cleanser
class InvalidURIEncoding
include Regexps
# Escapes lone percent signs, that is percent sign characters which are
# not followed by two hex digits
def fix_lone_percent_signs(string_to_fix)
if LONE_PERCENT_SIGN =~ string_to_fix.to_s
string_to_fix.gsub!(LONE_PERCENT_SIGN, "%25")
end
end
# General Checking for user's input params
# throw 404 if params contain abnormal input
def check_encoding(query)
# make sure all params have valid encoding
all_values_for_hash(query).each do |param|
if param.respond_to?(:valid_encoding?) && !param.valid_encoding?
halt_with_404
end
end
end
def check_nested(query)
Rack::Utils.parse_nested_query(query)
rescue
halt_with_404
end
# to get all values from a nested hash (i.e a hash contains hashes/arrays)
# e.g. {:a => 1, :b => {:ba => 2, :bb => [3, 4]}} gives you [1, 2, 3, 4]
def all_values_for_hash(hash)
result = []
hash.values.each do |hash_value|
case hash_value
when Hash
result += all_values_for_hash(hash_value)
when Array
# convert the array to hash
sub_hash = Hash[
hash_value.flatten.map.with_index do |value, index|
[index, value]
end
]
result += all_values_for_hash(sub_hash)
else
result << hash_value
end
end
result
end
def [](env)
# Check and clean up trailing % characters by replacing them with their
# encoded equivalent %25
%w[
HTTP_REFERER
PATH_INFO
QUERY_STRING
REQUEST_PATH
REQUEST_URI
HTTP_X_FORWARDED_HOST
].each do |key|
fix_lone_percent_signs(env[key])
check_nested(env[key])
end
# use these methods to get params as there is conflict with openresty
# request_params = Rack::Request.new(env).params
post_params = if (env["CONTENT_TYPE"] || "") =~ CONTENT_TYPE_MULTIPART_FORM
{}
else
Rack::Utils.parse_query(env["rack.input"].read, "&")
end
get_params = Rack::Utils.parse_query(env["QUERY_STRING"], "&")
request_params = {}.merge(get_params).merge(post_params)
# Because env['rack.input'] is String IO object, so we need to rewind
# that to ensure it can be read again by others.
env["rack.input"].rewind
check_encoding(request_params)
end
def halt_with_404
msg = "Page not found"
Rack::Cleanser::halt_with_error(404, msg)
end
end
end
end
| 30.191919 | 83 | 0.578789 |
799b6149ca61a94a2f7ae2b46b8751977c1d7807 | 147 | require File.expand_path('../../../../spec_helper', __FILE__)
describe "Net::HTTP#trace" do
it "needs to be reviewed for spec completeness"
end
| 24.5 | 61 | 0.707483 |
5d9c29522f7c8d0da309aea79fd00e198eaf8ff1 | 24,955 | #
# Author:: Adam Jacob (<[email protected]>)
# Author:: Chris Read <[email protected]>
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# 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.
#
Ohai.plugin(:Network) do
provides "network", "network/interfaces"
provides "counters/network", "counters/network/interfaces"
provides "ipaddress", "ip6address", "macaddress"
def linux_encaps_lookup(encap)
return "Loopback" if encap.eql?("Local Loopback") || encap.eql?("loopback")
return "PPP" if encap.eql?("Point-to-Point Protocol")
return "SLIP" if encap.eql?("Serial Line IP")
return "VJSLIP" if encap.eql?("VJ Serial Line IP")
return "IPIP" if encap.eql?("IPIP Tunnel")
return "6to4" if encap.eql?("IPv6-in-IPv4")
return "Ethernet" if encap.eql?("ether")
encap
end
def ipv6_enabled?
File.exist? "/proc/net/if_inet6"
end
def iproute2_binary_available?
["/sbin/ip", "/usr/bin/ip", "/bin/ip"].any? { |path| File.exist?(path) }
end
def find_ethtool_binary
["/sbin/ethtool", "/usr/sbin/ethtool"].find { |path| File.exist?(path) }
end
def is_openvz?
::File.directory?("/proc/vz")
end
def is_openvz_host?
is_openvz? && ::File.directory?("/proc/bc")
end
def extract_neighbors(family, iface, neigh_attr)
so = shell_out("ip -f #{family[:name]} neigh show")
so.stdout.lines do |line|
if line =~ /^([a-f0-9\:\.]+)\s+dev\s+([^\s]+)\s+lladdr\s+([a-fA-F0-9\:]+)/
interface = iface[$2]
unless interface
Ohai::Log.warn("neighbor list has entries for unknown interface #{interface}")
next
end
interface[neigh_attr] = Mash.new unless interface[neigh_attr]
interface[neigh_attr][$1] = $3.downcase
end
end
iface
end
# checking the routing tables
# why ?
# 1) to set the default gateway and default interfaces attributes
# 2) on some occasions, the best way to select node[:ipaddress] is to look at
# the routing table source field.
# 3) and since we're at it, let's populate some :routes attributes
# (going to do that for both inet and inet6 addresses)
def check_routing_table(family, iface, default_route_table)
so = shell_out("ip -o -f #{family[:name]} route show table #{default_route_table}")
so.stdout.lines do |line|
line.strip!
Ohai::Log.debug("Plugin Network: Parsing #{line}")
if line =~ /\\/
parts = line.split('\\')
route_dest = parts.shift.strip
route_endings = parts
elsif line =~ /^([^\s]+)\s(.*)$/
route_dest = $1
route_endings = [$2]
else
next
end
route_endings.each do |route_ending|
if route_ending =~ /\bdev\s+([^\s]+)\b/
route_int = $1
else
Ohai::Log.debug("Plugin Network: Skipping route entry without a device: '#{line}'")
next
end
route_int = "venet0:0" if is_openvz? && !is_openvz_host? && route_int == "venet0" && iface["venet0:0"]
unless iface[route_int]
Ohai::Log.debug("Plugin Network: Skipping previously unseen interface from 'ip route show': #{route_int}")
next
end
route_entry = Mash.new(:destination => route_dest,
:family => family[:name])
%w{via scope metric proto src}.each do |k|
route_entry[k] = $1 if route_ending =~ /\b#{k}\s+([^\s]+)\b/
end
# a sanity check, especially for Linux-VServer, OpenVZ and LXC:
# don't report the route entry if the src address isn't set on the node
# unless the interface has no addresses of this type at all
if route_entry[:src]
addr = iface[route_int][:addresses]
unless addr.nil? || addr.has_key?(route_entry[:src]) ||
addr.values.all? { |a| a["family"] != family[:name] }
Ohai::Log.debug("Plugin Network: Skipping route entry whose src does not match the interface IP")
next
end
end
iface[route_int][:routes] = Array.new unless iface[route_int][:routes]
iface[route_int][:routes] << route_entry
end
end
iface
end
# now looking at the routes to set the default attributes
# for information, default routes can be of this form :
# - default via 10.0.2.4 dev br0
# - default dev br0 scope link
# - default dev eth0 scope link src 1.1.1.1
# - default via 10.0.3.1 dev eth1 src 10.0.3.2 metric 10
# - default via 10.0.4.1 dev eth2 src 10.0.4.2 metric 20
# using a temporary var to hold routes and their interface name
def parse_routes(family, iface)
iface.collect do |i, iv|
iv[:routes].collect do |r|
r.merge(:dev => i) if r[:family] == family[:name]
end.compact if iv[:routes]
end.compact.flatten
end
# determine layer 1 details for the interface using ethtool
def ethernet_layer_one(iface)
return iface unless ethtool_binary = find_ethtool_binary
keys = %w{ Speed Duplex Port Transceiver Auto-negotiation MDI-X }
iface.each_key do |tmp_int|
next unless iface[tmp_int][:encapsulation] == "Ethernet"
so = shell_out("#{ethtool_binary} #{tmp_int}")
so.stdout.lines do |line|
line.chomp!
Ohai::Log.debug("Plugin Network: Parsing ethtool output: #{line}")
line.lstrip!
k, v = line.split(": ")
next unless keys.include? k
k.downcase!.tr!("-", "_")
if k == "speed"
k = "link_speed" # This is not necessarily the maximum speed the NIC supports
v = v[/\d+/].to_i
end
iface[tmp_int][k] = v
end
end
iface
end
# determine ring parameters for the interface using ethtool
def ethernet_ring_parameters(iface)
return iface unless ethtool_binary = find_ethtool_binary
iface.each_key do |tmp_int|
next unless iface[tmp_int][:encapsulation] == "Ethernet"
so = shell_out("#{ethtool_binary} -g #{tmp_int}")
Ohai::Log.debug("Plugin Network: Parsing ethtool output: #{so.stdout}")
type = nil
iface[tmp_int]["ring_params"] = {}
so.stdout.lines.each do |line|
next if line.start_with?("Ring parameters for")
next if line.strip.nil?
if line =~ /Pre-set maximums/
type = "max"
next
end
if line =~ /Current hardware settings/
type = "current"
next
end
key, val = line.split(/:\s+/)
if type && val
ring_key = "#{type}_#{key.downcase.tr(' ', '_')}"
iface[tmp_int]["ring_params"][ring_key] = val.to_i
end
end
end
iface
end
# determine link stats, vlans, queue length, and state for an interface using ip
def link_statistics(iface, net_counters)
so = shell_out("ip -d -s link")
tmp_int = nil
on_rx = true
so.stdout.lines do |line|
if line =~ IPROUTE_INT_REGEX
tmp_int = $2
iface[tmp_int] = Mash.new unless iface[tmp_int]
net_counters[tmp_int] = Mash.new unless net_counters[tmp_int]
end
if line =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/
int = on_rx ? :rx : :tx
net_counters[tmp_int][int] = Mash.new unless net_counters[tmp_int][int]
net_counters[tmp_int][int][:bytes] = $1
net_counters[tmp_int][int][:packets] = $2
net_counters[tmp_int][int][:errors] = $3
net_counters[tmp_int][int][:drop] = $4
if int == :rx
net_counters[tmp_int][int][:overrun] = $5
else
net_counters[tmp_int][int][:carrier] = $5
net_counters[tmp_int][int][:collisions] = $6
end
on_rx = !on_rx
end
if line =~ /qlen (\d+)/
net_counters[tmp_int][:tx] = Mash.new unless net_counters[tmp_int][:tx]
net_counters[tmp_int][:tx][:queuelen] = $1
end
if line =~ /vlan id (\d+)/ || line =~ /vlan protocol ([\w\.]+) id (\d+)/
if $2
tmp_prot = $1
tmp_id = $2
else
tmp_id = $1
end
iface[tmp_int][:vlan] = Mash.new unless iface[tmp_int][:vlan]
iface[tmp_int][:vlan][:id] = tmp_id
iface[tmp_int][:vlan][:protocol] = tmp_prot if tmp_prot
vlan_flags = line.scan(/(REORDER_HDR|GVRP|LOOSE_BINDING)/)
if vlan_flags.length > 0
iface[tmp_int][:vlan][:flags] = vlan_flags.flatten.uniq
end
end
if line =~ /state (\w+)/
iface[tmp_int]["state"] = $1.downcase
end
end
iface
end
def match_iproute(iface, line, cint)
if line =~ IPROUTE_INT_REGEX
cint = $2
iface[cint] = Mash.new
if cint =~ /^(\w+)(\d+.*)/
iface[cint][:type] = $1
iface[cint][:number] = $2
end
if line =~ /mtu (\d+)/
iface[cint][:mtu] = $1
end
flags = line.scan(/(UP|BROADCAST|DEBUG|LOOPBACK|POINTTOPOINT|NOTRAILERS|LOWER_UP|NOARP|PROMISC|ALLMULTI|SLAVE|MASTER|MULTICAST|DYNAMIC)/)
if flags.length > 1
iface[cint][:flags] = flags.flatten.uniq
end
end
cint
end
def parse_ip_addr(iface)
so = shell_out("ip addr")
cint = nil
so.stdout.lines do |line|
cint = match_iproute(iface, line, cint)
parse_ip_addr_link_line(cint, iface, line)
cint = parse_ip_addr_inet_line(cint, iface, line)
parse_ip_addr_inet6_line(cint, iface, line)
end
end
def parse_ip_addr_link_line(cint, iface, line)
if line =~ /link\/(\w+) ([\da-f\:]+) /
iface[cint][:encapsulation] = linux_encaps_lookup($1)
unless $2 == "00:00:00:00:00:00"
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
iface[cint][:addresses][$2.upcase] = { "family" => "lladdr" }
end
end
end
def parse_ip_addr_inet_line(cint, iface, line)
if line =~ /inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(\/(\d{1,2}))?/
tmp_addr, tmp_prefix = $1, $3
tmp_prefix ||= "32"
original_int = nil
# Are we a formerly aliased interface?
if line =~ /#{cint}:(\d+)$/
sub_int = $1
alias_int = "#{cint}:#{sub_int}"
original_int = cint
cint = alias_int
end
iface[cint] = Mash.new unless iface[cint] # Create the fake alias interface if needed
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
iface[cint][:addresses][tmp_addr] = { "family" => "inet", "prefixlen" => tmp_prefix }
iface[cint][:addresses][tmp_addr][:netmask] = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
if line =~ /peer (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses][tmp_addr][:peer] = $1
end
if line =~ /brd (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses][tmp_addr][:broadcast] = $1
end
if line =~ /scope (\w+)/
iface[cint][:addresses][tmp_addr][:scope] = ($1.eql?("host") ? "Node" : $1.capitalize)
end
# If we found we were an alias interface, restore cint to its original value
cint = original_int unless original_int.nil?
end
cint
end
def parse_ip_addr_inet6_line(cint, iface, line)
if line =~ /inet6 ([a-f0-9\:]+)\/(\d+) scope (\w+)( .*)?/
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
tmp_addr = $1
tags = $4 || ""
tags = tags.split(" ")
iface[cint][:addresses][tmp_addr] = {
"family" => "inet6",
"prefixlen" => $2,
"scope" => ($3.eql?("host") ? "Node" : $3.capitalize),
"tags" => tags,
}
end
end
# returns the macaddress for interface from a hash of interfaces (iface elsewhere in this file)
def get_mac_for_interface(interfaces, interface)
interfaces[interface][:addresses].select { |k, v| v["family"] == "lladdr" }.first.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?("NOARP")
end
# returns the default route with the lowest metric (unspecified metric is 0)
def choose_default_route(routes)
routes.select do |r|
r[:destination] == "default"
end.sort do |x, y|
(x[:metric].nil? ? 0 : x[:metric].to_i) <=> (y[:metric].nil? ? 0 : y[:metric].to_i)
end.first
end
def interface_has_no_addresses_in_family?(iface, family)
return true if iface[:addresses].nil?
iface[:addresses].values.all? { |addr| addr["family"] != family }
end
def interface_have_address?(iface, address)
return false if iface[:addresses].nil?
iface[:addresses].key?(address)
end
def interface_address_not_link_level?(iface, address)
!iface[:addresses][address][:scope].casecmp("link").zero?
end
def interface_valid_for_route?(iface, address, family)
return true if interface_has_no_addresses_in_family?(iface, family)
interface_have_address?(iface, address) && interface_address_not_link_level?(iface, address)
end
def route_is_valid_default_route?(route, default_route)
# if the route destination is a default route, it's good
return true if route[:destination] == "default"
# the default route has a gateway and the route matches the gateway
!default_route[:via].nil? && IPAddress(route[:destination]).include?(IPAddress(default_route[:via]))
end
# ipv4/ipv6 routes are different enough that having a single algorithm to select the favored route for both creates unnecessary complexity
# this method attempts to deduce the route that is most important to the user, which is later used to deduce the favored values for {ip,mac,ip6}address
# we only consider routes that are default routes, or those routes that get us to the gateway for a default route
def favored_default_route(routes, iface, default_route, family)
routes.select do |r|
if family[:name] == "inet"
# the route must have a source address
next if r[:src].nil? || r[:src].empty?
# the interface specified in the route must exist
route_interface = iface[r[:dev]]
next if route_interface.nil? # the interface specified in the route must exist
# the interface must have no addresses, or if it has the source address, the address must not
# be a link-level address
next unless interface_valid_for_route?(route_interface, r[:src], "inet")
# the route must either be a default route, or it must have a gateway which is accessible via the route
next unless route_is_valid_default_route?(r, default_route)
true
elsif family[:name] == "inet6"
iface[r[:dev]] &&
iface[r[:dev]][:state] == "up" &&
route_is_valid_default_route?(r, default_route)
end
end.sort_by do |r|
# sorting the selected routes:
# - getting default routes first
# - then sort by metric
# - then by prefixlen
[
r[:destination] == "default" ? 0 : 1,
r[:metric].nil? ? 0 : r[:metric].to_i,
# for some reason IPAddress doesn't accept "::/0", it doesn't like prefix==0
# just a quick workaround: use 0 if IPAddress fails
begin
IPAddress( r[:destination] == "default" ? family[:default_route] : r[:destination] ).prefix
rescue
0
end,
]
end.first
end
# Both the network plugin and this plugin (linux/network) are run on linux. This plugin runs first.
# If the 'ip' binary is available, this plugin may set {ip,mac,ip6}address. The network plugin should not overwrite these.
# The older code section below that relies on the deprecated net-tools, e.g. netstat and ifconfig, provides less functionality.
collect_data(:linux) do
require "ipaddr"
iface = Mash.new
net_counters = Mash.new
network Mash.new unless network
network[:interfaces] = Mash.new unless network[:interfaces]
counters Mash.new unless counters
counters[:network] = Mash.new unless counters[:network]
# ohai.plugin[:network][:default_route_table] = 'default'
if configuration(:default_route_table).nil? || configuration(:default_route_table).empty?
default_route_table = "main"
else
default_route_table = configuration(:default_route_table)
end
Ohai::Log.debug("Plugin Network: default route table is '#{default_route_table}'")
# Match the lead line for an interface from iproute2
# 3: eth0.11@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
# The '@eth0:' portion doesn't exist on primary interfaces and thus is optional in the regex
IPROUTE_INT_REGEX = /^(\d+): ([0-9a-zA-Z@:\.\-_]*?)(@[0-9a-zA-Z]+|):\s/ unless defined? IPROUTE_INT_REGEX
if iproute2_binary_available?
# families to get default routes from
families = [{
:name => "inet",
:default_route => "0.0.0.0/0",
:default_prefix => :default,
:neighbour_attribute => :arp,
}]
families << {
:name => "inet6",
:default_route => "::/0",
:default_prefix => :default_inet6,
:neighbour_attribute => :neighbour_inet6,
} if ipv6_enabled?
parse_ip_addr(iface)
iface = link_statistics(iface, net_counters)
families.each do |family|
neigh_attr = family[:neighbour_attribute]
default_prefix = family[:default_prefix]
iface = extract_neighbors(family, iface, neigh_attr)
iface = check_routing_table(family, iface, default_route_table)
routes = parse_routes(family, iface)
default_route = choose_default_route(routes)
if default_route.nil? || default_route.empty?
attribute_name = if family[:name] == "inet"
"default_interface"
else
"default_#{family[:name]}_interface"
end
Ohai::Log.debug("Plugin Network: Unable to determine '#{attribute_name}' as no default routes were found for that interface family")
else
network["#{default_prefix}_interface"] = default_route[:dev]
Ohai::Log.debug("Plugin Network: #{default_prefix}_interface set to #{default_route[:dev]}")
# setting gateway to 0.0.0.0 or :: if the default route is a link level one
network["#{default_prefix}_gateway"] = default_route[:via] ? default_route[:via] : family[:default_route].chomp("/0")
Ohai::Log.debug("Plugin Network: #{default_prefix}_gateway set to #{network["#{default_prefix}_gateway"]}")
# deduce the default route the user most likely cares about to pick {ip,mac,ip6}address below
favored_route = favored_default_route(routes, iface, default_route, family)
# FIXME: This entire block should go away, and the network plugin should be the sole source of {ip,ip6,mac}address
# since we're at it, let's populate {ip,mac,ip6}address with the best values
# if we don't set these, the network plugin may set them afterwards
if favored_route && !favored_route.empty?
if family[:name] == "inet"
ipaddress favored_route[:src]
m = get_mac_for_interface(iface, favored_route[:dev])
Ohai::Log.debug("Plugin Network: Overwriting macaddress #{macaddress} with #{m} from interface #{favored_route[:dev]}") if macaddress
macaddress m
elsif family[:name] == "inet6"
# this rarely does anything since we rarely have src for ipv6, so this usually falls back on the network plugin
ip6address favored_route[:src]
if macaddress
Ohai::Log.debug("Plugin Network: Not setting macaddress from ipv6 interface #{favored_route[:dev]} because macaddress is already set")
else
macaddress get_mac_for_interface(iface, favored_route[:dev])
end
end
else
Ohai::Log.debug("Plugin Network: Unable to deduce the favored default route for family '#{family[:name]}' despite finding a default route, and is not setting ipaddress/ip6address/macaddress. the network plugin may provide fallbacks.")
Ohai::Log.debug("Plugin Network: This potential default route was excluded: #{default_route}")
end
end
end # end families.each
else # ip binary not available, falling back to net-tools, e.g. route, ifconfig
begin
so = shell_out("route -n")
route_result = so.stdout.split($/).grep( /^0.0.0.0/ )[0].split( /[ \t]+/ )
network[:default_gateway], network[:default_interface] = route_result.values_at(1, 7)
rescue Ohai::Exceptions::Exec
Ohai::Log.debug("Plugin Network: Unable to determine default interface")
end
so = shell_out("ifconfig -a")
cint = nil
so.stdout.lines do |line|
tmp_addr = nil
# dev_valid_name in the kernel only excludes slashes, nulls, spaces
# http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=blob;f=net/core/dev.c#l851
if line =~ /^([0-9a-zA-Z@\.\:\-_]+)\s+/
cint = $1
iface[cint] = Mash.new
if cint =~ /^(\w+)(\d+.*)/
iface[cint][:type] = $1
iface[cint][:number] = $2
end
end
if line =~ /Link encap:(Local Loopback)/ || line =~ /Link encap:(.+?)\s/
iface[cint][:encapsulation] = linux_encaps_lookup($1)
end
if line =~ /HWaddr (.+?)\s/
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
iface[cint][:addresses][$1] = { "family" => "lladdr" }
end
if line =~ /inet addr:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
iface[cint][:addresses][$1] = { "family" => "inet" }
tmp_addr = $1
end
if line =~ /inet6 addr: ([a-f0-9\:]+)\/(\d+) Scope:(\w+)/
iface[cint][:addresses] = Mash.new unless iface[cint][:addresses]
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $2, "scope" => ($3.eql?("Host") ? "Node" : $3) }
end
if line =~ /Bcast:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses][tmp_addr]["broadcast"] = $1
end
if line =~ /Mask:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:addresses][tmp_addr]["netmask"] = $1
end
flags = line.scan(/(UP|BROADCAST|DEBUG|LOOPBACK|POINTTOPOINT|NOTRAILERS|RUNNING|NOARP|PROMISC|ALLMULTI|SLAVE|MASTER|MULTICAST|DYNAMIC)\s/)
if flags.length > 1
iface[cint][:flags] = flags.flatten
end
if line =~ /MTU:(\d+)/
iface[cint][:mtu] = $1
end
if line =~ /P-t-P:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
iface[cint][:peer] = $1
end
if line =~ /RX packets:(\d+) errors:(\d+) dropped:(\d+) overruns:(\d+) frame:(\d+)/
net_counters[cint] = Mash.new unless net_counters[cint]
net_counters[cint][:rx] = { "packets" => $1, "errors" => $2, "drop" => $3, "overrun" => $4, "frame" => $5 }
end
if line =~ /TX packets:(\d+) errors:(\d+) dropped:(\d+) overruns:(\d+) carrier:(\d+)/
net_counters[cint][:tx] = { "packets" => $1, "errors" => $2, "drop" => $3, "overrun" => $4, "carrier" => $5 }
end
if line =~ /collisions:(\d+)/
net_counters[cint][:tx]["collisions"] = $1
end
if line =~ /txqueuelen:(\d+)/
net_counters[cint][:tx]["queuelen"] = $1
end
if line =~ /RX bytes:(\d+) \((\d+?\.\d+ .+?)\)/
net_counters[cint][:rx]["bytes"] = $1
end
if line =~ /TX bytes:(\d+) \((\d+?\.\d+ .+?)\)/
net_counters[cint][:tx]["bytes"] = $1
end
end
so = shell_out("arp -an")
so.stdout.lines do |line|
if line =~ /^\S+ \((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) \[(\w+)\] on ([0-9a-zA-Z\.\:\-]+)/
next unless iface[$4] # this should never happen
iface[$4][:arp] = Mash.new unless iface[$4][:arp]
iface[$4][:arp][$1] = $2.downcase
end
end
end # end "ip else net-tools" block
iface = ethernet_layer_one(iface)
iface = ethernet_ring_parameters(iface)
counters[:network][:interfaces] = net_counters
network["interfaces"] = iface
end
end
| 39.053208 | 246 | 0.602645 |
e88c70ac63b2d529c08b2974fe917299e7ece648 | 6,375 | module Citron
# Test Case encapsulates a collection of
# unit tests organized into groups of contexts.
#
class TestCase < World
class << self
# Brief description of the test case.
attr :label
# Symbol list of tags. Trailing element may be Hash
# of `symbol => object`.
attr :tags
# List of tests and sub-cases.
attr :tests
# Code unit that is subject of test case.
attr :unit
# Initialize new TestCase.
#
def __set__(settings={}, &block)
@label = settings[:label]
@tags = settings[:tags]
@skip = settings[:skip]
@unit = calc_unit(@label)
@tests = []
class_eval(&block)
end
#
#
#
def calc_unit(label)
case label
when Module, Class
@label
when /^(\.|\#|\:\:)\w+/
if Module === superclass.unit
[superclass.unit, @label].join('')
else
@label
end
end
end
#
# Subclasses of TestCase can override this to describe
# the type of test case they define.
#
# @return [String]
#
#def type
# 'TestCase'
#end
#
# Add new test or sub-case.
#
# @param [Class<TestCase>,TestProc] test_obejct
# Test sub-case or procedure to add to this case.
#
def <<(test_object)
@tests ||= []
@tests << test_object
end
#
#def call
# yield
#end
#
# Is test case to be skipped?
#
# @return [Boolean,String]
# If +false+ or +nil+ if not skipped, otherwise
# +true+ or a string explain why to skip.
#
def skip?
@skip
end
#
# Set test case to be skipped.
#
# @param [Boolean,String] reason
# Set to +false+ or +nil+ if not skipped, otherwise
# +true+ or a string explain why to skip.
#
def skip=(reason)
@skip = reason
end
#
# Create a sub-case.
#
# @param [String] label
# The breif description of the test case.
#
# @param [Array<Symbol,Hash>] tags
# List of symbols with optional trailing `symbol=>object` hash.
# These can be used as a means of filtering tests.
#
def Context(label, *tags, &block)
context = Class.new(self)
context.__set__(
:skip => @_skip,
:label => label,
:tags => tags,
&block
)
self << context
context
end
alias :context :Context
# TODO: Alias context as concern ?
#alias :concern, :Context
#alias :Concern, :Context
#
# Create a test, or a parameterized test.
#
# @param [String] label
# The breif description of the test case.
#
# @param [Array<Symbol,Hash>] tags
# List of symbols with optional trailing `symbol=>object` hash.
# These can be used as a means of filtering tests.
#
def Test(label=nil, *tags, &procedure)
file, line, _ = *caller[0].split(':')
settings = {
:context => self,
:skip => @_skip,
:label => label,
:tags => tags,
:file => file,
:line => line
}
if procedure.arity == 0 || (RUBY_VERSION < '1.9' && procedure.arity == -1)
test = TestProc.new(settings, &procedure)
self << test
@_test = nil
return test
else
@_test = [settings, procedure]
end
end
alias :test :Test
#
# Actualize a parameterized test.
#
# @todo Better name than `Ok` ?
#
def Ok(*args)
settings, procedure = *@_test
test = TestProc.new(settings) do
procedure.call(*args)
end
self << test
return test
end
alias :ok :Ok
#
# Setup is used to set things up for each unit test.
# The setup procedure is run before each unit.
#
# @param [String] label
# A brief description of what the setup procedure sets-up.
#
def Setup(label=nil, &proc)
define_method(:setup, &proc)
# if the setup is reset, then so should the teardown
define_method(:teardown){}
end
alias :setup :Setup
#
# Teardown procedure is used to clean-up after each unit test.
#
def Teardown(&proc)
define_method(:teardown, &proc)
end
alias :teardown :Teardown
#
# Mark tests or sub-cases to be skipped. If block is given, then
# tests defined within the block are skipped. Without a block
# all subsquent tests defined in a context will be skipped.
#
# @param [Boolean,String] reason
# Set to +false+ or +nil+ if not skipped, otherwise
# +true+ or a string explain why to skip.
#
# @example
# skip("awaiting new feature") do
# test "some test" do
# ...
# end
# end
#
# @example
# skip("not on jruby") if jruby?
# test "some test" do
# ...
# end
#
def Skip(reason=true, &block)
if block
@_skip = reason
block.call if block
@_skip = false
else
@_skip = reason
end
end
alias :skip :Skip
alias :inspect :to_s
#
# Test case label.
#
# @return [String]
#
def to_s
label.to_s
end
end
#
# Iterate over each test and sub-case.
#
def each
self.class.tests.each do |test_object|
case test_object
when Class #TestCase
yield(test_object.new)
when TestProc
yield(test_object.for(self))
end
end
end
#
# Number of tests and sub-cases.
#
# @return [Fixnum] size
#
def size
self.class.tests.size
end
#
# Test case label.
#
# @return [String]
#
def to_s
self.class.label.to_s
end
#
# Dummy method for setup.
#
def setup
end
#
# Dummy method for teardown.
#
def teardown
end
end
end
| 20.901639 | 82 | 0.504471 |
1de3f6043d975a3d4fb987345cafbc6504e169a6 | 986 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_12_17_014042) do
create_table "spells", force: :cascade do |t|
t.string "name"
t.string "description"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
end
| 42.869565 | 86 | 0.766734 |
e2cf85216830d5a9e2d7d7f523db580d264cba25 | 158 | # This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails318::Application
| 31.6 | 67 | 0.772152 |
266be35211ac89dc8375ad1f71e6bc6b0fd61b26 | 354 | module Merb
VERSION = '0.9.6' unless defined?(Merb::VERSION)
# Merb::RELEASE meanings:
# 'dev' : unreleased
# 'pre' : pre-release Gem candidates
# nil : released
# You should never check in to trunk with this changed. It should
# stay 'dev'. Change it to nil in release tags.
RELEASE = 'dev' unless defined?(Merb::RELEASE)
end
| 29.5 | 68 | 0.661017 |
d5c4fef3d02cf698822e077ce62636085127e1d3 | 8,127 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require 'azure_mgmt_storagecache'
module Azure::Profiles::Latest
module StorageCache
module Mgmt
Operations = Azure::StorageCache::Mgmt::V2019_11_01::Operations
Skus = Azure::StorageCache::Mgmt::V2019_11_01::Skus
UsageModels = Azure::StorageCache::Mgmt::V2019_11_01::UsageModels
Caches = Azure::StorageCache::Mgmt::V2019_11_01::Caches
StorageTargets = Azure::StorageCache::Mgmt::V2019_11_01::StorageTargets
module Models
ClfsTarget = Azure::StorageCache::Mgmt::V2019_11_01::Models::ClfsTarget
UnknownTarget = Azure::StorageCache::Mgmt::V2019_11_01::Models::UnknownTarget
ApiOperation = Azure::StorageCache::Mgmt::V2019_11_01::Models::ApiOperation
ResourceSkuCapabilities = Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSkuCapabilities
CloudErrorBody = Azure::StorageCache::Mgmt::V2019_11_01::Models::CloudErrorBody
ResourceSkuLocationInfo = Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSkuLocationInfo
CacheHealth = Azure::StorageCache::Mgmt::V2019_11_01::Models::CacheHealth
Restriction = Azure::StorageCache::Mgmt::V2019_11_01::Models::Restriction
CacheSku = Azure::StorageCache::Mgmt::V2019_11_01::Models::CacheSku
ResourceSku = Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSku
CachesListResult = Azure::StorageCache::Mgmt::V2019_11_01::Models::CachesListResult
ResourceSkusResult = Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSkusResult
ApiOperationDisplay = Azure::StorageCache::Mgmt::V2019_11_01::Models::ApiOperationDisplay
NamespaceJunction = Azure::StorageCache::Mgmt::V2019_11_01::Models::NamespaceJunction
CloudError = Azure::StorageCache::Mgmt::V2019_11_01::Models::CloudError
StorageTarget = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget
Cache = Azure::StorageCache::Mgmt::V2019_11_01::Models::Cache
StorageTargetsResult = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTargetsResult
ApiOperationListResult = Azure::StorageCache::Mgmt::V2019_11_01::Models::ApiOperationListResult
UsageModelDisplay = Azure::StorageCache::Mgmt::V2019_11_01::Models::UsageModelDisplay
Nfs3Target = Azure::StorageCache::Mgmt::V2019_11_01::Models::Nfs3Target
UsageModel = Azure::StorageCache::Mgmt::V2019_11_01::Models::UsageModel
CacheUpgradeStatus = Azure::StorageCache::Mgmt::V2019_11_01::Models::CacheUpgradeStatus
UsageModelsResult = Azure::StorageCache::Mgmt::V2019_11_01::Models::UsageModelsResult
HealthStateType = Azure::StorageCache::Mgmt::V2019_11_01::Models::HealthStateType
ProvisioningStateType = Azure::StorageCache::Mgmt::V2019_11_01::Models::ProvisioningStateType
FirmwareStatusType = Azure::StorageCache::Mgmt::V2019_11_01::Models::FirmwareStatusType
ReasonCode = Azure::StorageCache::Mgmt::V2019_11_01::Models::ReasonCode
StorageTargetType = Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTargetType
end
class StorageCacheManagementClass
attr_reader :operations, :skus, :usage_models, :caches, :storage_targets, :configurable, :base_url, :options, :model_classes
def initialize(configurable, base_url=nil, options=nil)
@configurable, @base_url, @options = configurable, base_url, options
@client_0 = Azure::StorageCache::Mgmt::V2019_11_01::StorageCacheManagementClient.new(configurable.credentials, base_url, options)
if(@client_0.respond_to?(:subscription_id))
@client_0.subscription_id = configurable.subscription_id
end
add_telemetry(@client_0)
@operations = @client_0.operations
@skus = @client_0.skus
@usage_models = @client_0.usage_models
@caches = @client_0.caches
@storage_targets = @client_0.storage_targets
@model_classes = ModelClasses.new
end
def add_telemetry(client)
profile_information = "Profiles/azure_sdk/#{Azure::VERSION}/Latest/StorageCache/Mgmt"
client.add_user_agent_information(profile_information)
end
def method_missing(method, *args)
if @client_0.respond_to?method
@client_0.send(method, *args)
else
super
end
end
class ModelClasses
def clfs_target
Azure::StorageCache::Mgmt::V2019_11_01::Models::ClfsTarget
end
def unknown_target
Azure::StorageCache::Mgmt::V2019_11_01::Models::UnknownTarget
end
def api_operation
Azure::StorageCache::Mgmt::V2019_11_01::Models::ApiOperation
end
def resource_sku_capabilities
Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSkuCapabilities
end
def cloud_error_body
Azure::StorageCache::Mgmt::V2019_11_01::Models::CloudErrorBody
end
def resource_sku_location_info
Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSkuLocationInfo
end
def cache_health
Azure::StorageCache::Mgmt::V2019_11_01::Models::CacheHealth
end
def restriction
Azure::StorageCache::Mgmt::V2019_11_01::Models::Restriction
end
def cache_sku
Azure::StorageCache::Mgmt::V2019_11_01::Models::CacheSku
end
def resource_sku
Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSku
end
def caches_list_result
Azure::StorageCache::Mgmt::V2019_11_01::Models::CachesListResult
end
def resource_skus_result
Azure::StorageCache::Mgmt::V2019_11_01::Models::ResourceSkusResult
end
def api_operation_display
Azure::StorageCache::Mgmt::V2019_11_01::Models::ApiOperationDisplay
end
def namespace_junction
Azure::StorageCache::Mgmt::V2019_11_01::Models::NamespaceJunction
end
def cloud_error
Azure::StorageCache::Mgmt::V2019_11_01::Models::CloudError
end
def storage_target
Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTarget
end
def cache
Azure::StorageCache::Mgmt::V2019_11_01::Models::Cache
end
def storage_targets_result
Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTargetsResult
end
def api_operation_list_result
Azure::StorageCache::Mgmt::V2019_11_01::Models::ApiOperationListResult
end
def usage_model_display
Azure::StorageCache::Mgmt::V2019_11_01::Models::UsageModelDisplay
end
def nfs3_target
Azure::StorageCache::Mgmt::V2019_11_01::Models::Nfs3Target
end
def usage_model
Azure::StorageCache::Mgmt::V2019_11_01::Models::UsageModel
end
def cache_upgrade_status
Azure::StorageCache::Mgmt::V2019_11_01::Models::CacheUpgradeStatus
end
def usage_models_result
Azure::StorageCache::Mgmt::V2019_11_01::Models::UsageModelsResult
end
def health_state_type
Azure::StorageCache::Mgmt::V2019_11_01::Models::HealthStateType
end
def provisioning_state_type
Azure::StorageCache::Mgmt::V2019_11_01::Models::ProvisioningStateType
end
def firmware_status_type
Azure::StorageCache::Mgmt::V2019_11_01::Models::FirmwareStatusType
end
def reason_code
Azure::StorageCache::Mgmt::V2019_11_01::Models::ReasonCode
end
def storage_target_type
Azure::StorageCache::Mgmt::V2019_11_01::Models::StorageTargetType
end
end
end
end
end
end
| 46.706897 | 139 | 0.677003 |
61bbbbb9030cb39eefd87ea02e0aa79f766c37c0 | 118 | class ListensController < ApplicationController
def index
@listens = Listen.recent.page params[:page]
end
end
| 19.666667 | 47 | 0.762712 |
1c8fcdd185c8a3036dd6dee04e59a10d5306859b | 758 | require 'logger'
class DigestAuthServlet < WEBrick::HTTPServlet::AbstractServlet
htpd = nil
Tempfile.open 'digest.htpasswd' do |io|
htpd = WEBrick::HTTPAuth::Htdigest.new(io.path)
htpd.set_passwd('Blah', 'user', 'pass')
end
@@authenticator = WEBrick::HTTPAuth::DigestAuth.new({
:UserDB => htpd,
:Realm => 'Blah',
:Algorithm => 'MD5',
:Logger => Logger.new(nil)
})
def do_GET req, res
def req.request_time; Time.now; end
def req.request_uri; '/digest_auth'; end
def req.request_method; 'GET'; end
begin
@@authenticator.authenticate req, res
res.body = 'You are authenticated'
rescue WEBrick::HTTPStatus::Unauthorized
res.status = 401
end
end
alias :do_POST :do_GET
end
| 22.294118 | 63 | 0.654354 |
08bb29ec9a2efb303a9f56f91568605a2221512f | 4,256 | # frozen_string_literal: true
class Fisk
module Instructions
# Instruction CMOVP: Move if parity (PF == 1)
CMOVP = Instruction.new("CMOVP", [
# cmovp: r16, r16
Form.new([
OPERAND_TYPES[7],
OPERAND_TYPES[8],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
add_prefix(buffer, operands, 0x66, false) +
add_rex(buffer, operands,
false,
0,
operands[0].rex_value,
0,
operands[1].rex_value) +
add_opcode(buffer, 0x0F, 0) +
add_opcode(buffer, 0x4A, 0) +
add_modrm_reg_reg(buffer,
3,
operands[0].op_value,
operands[1].op_value, operands) +
0
end
}.new.freeze,
].freeze).freeze,
# cmovp: r16, m16
Form.new([
OPERAND_TYPES[7],
OPERAND_TYPES[9],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
add_prefix(buffer, operands, 0x66, false) +
add_rex(buffer, operands,
false,
0,
operands[0].rex_value,
operands[1].rex_value,
operands[1].rex_value) +
add_opcode(buffer, 0x0F, 0) +
add_opcode(buffer, 0x4A, 0) +
add_modrm_reg_mem(buffer,
0,
operands[0].op_value,
operands[1].op_value, operands) +
0
end
}.new.freeze,
].freeze).freeze,
# cmovp: r32, r32
Form.new([
OPERAND_TYPES[12],
OPERAND_TYPES[13],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
add_rex(buffer, operands,
false,
0,
operands[0].rex_value,
0,
operands[1].rex_value) +
add_opcode(buffer, 0x0F, 0) +
add_opcode(buffer, 0x4A, 0) +
add_modrm_reg_reg(buffer,
3,
operands[0].op_value,
operands[1].op_value, operands) +
0
end
}.new.freeze,
].freeze).freeze,
# cmovp: r32, m32
Form.new([
OPERAND_TYPES[12],
OPERAND_TYPES[14],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
add_rex(buffer, operands,
false,
0,
operands[0].rex_value,
operands[1].rex_value,
operands[1].rex_value) +
add_opcode(buffer, 0x0F, 0) +
add_opcode(buffer, 0x4A, 0) +
add_modrm_reg_mem(buffer,
0,
operands[0].op_value,
operands[1].op_value, operands) +
0
end
}.new.freeze,
].freeze).freeze,
# cmovp: r64, r64
Form.new([
OPERAND_TYPES[16],
OPERAND_TYPES[17],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
add_rex(buffer, operands,
true,
1,
operands[0].rex_value,
0,
operands[1].rex_value) +
add_opcode(buffer, 0x0F, 0) +
add_opcode(buffer, 0x4A, 0) +
add_modrm_reg_reg(buffer,
3,
operands[0].op_value,
operands[1].op_value, operands) +
0
end
}.new.freeze,
].freeze).freeze,
# cmovp: r64, m64
Form.new([
OPERAND_TYPES[16],
OPERAND_TYPES[18],
].freeze, [
Class.new(Fisk::Encoding) {
def encode buffer, operands
add_rex(buffer, operands,
true,
1,
operands[0].rex_value,
operands[1].rex_value,
operands[1].rex_value) +
add_opcode(buffer, 0x0F, 0) +
add_opcode(buffer, 0x4A, 0) +
add_modrm_reg_mem(buffer,
0,
operands[0].op_value,
operands[1].op_value, operands) +
0
end
}.new.freeze,
].freeze).freeze,
].freeze).freeze
end
end
| 28.373333 | 55 | 0.469925 |
ed0ba2d82580fa5c9ecb5b77d5c2ca02a5231c71 | 1,457 | # encoding: ascii-8bit
# frozen_string_literal: true
require 'heapinfo/cache'
describe HeapInfo::Cache do
before(:all) do
@prefix = 'testcx1dd/'
end
after(:each) do
FileUtils.rm_rf File.join(HeapInfo::Cache::CACHE_DIR, @prefix)
end
it 'handle unwritable' do
org = HeapInfo::Cache::CACHE_DIR
HeapInfo::Cache.send :remove_const, :CACHE_DIR
no = '/tmp/no_permission'
FileUtils.mkdir_p no
File.chmod 0o444, no # no write permission
HeapInfo::Cache.const_set :CACHE_DIR, no + '/.cache'
HeapInfo::Cache.send :init
expect(HeapInfo::Cache::CACHE_DIR).to eq HeapInfo::TMP_DIR + '/.cache/heapinfo'
HeapInfo::Cache.send :remove_const, :CACHE_DIR
HeapInfo::Cache.const_set :CACHE_DIR, org
FileUtils.rm_rf no
end
it 'write' do
expect(HeapInfo::Cache.write(@prefix + '123', a: 1)).to be true
end
it 'read' do
expect(HeapInfo::Cache.read(@prefix + 'z/zzz')).to be nil
end
it 'write and read' do
key = @prefix + 'fefw/z/zz/xdddd'
object = { a: { b: 'string', array: [3, '1', 2] }, 'd' => 3 }
expect(HeapInfo::Cache.read(key)).to be nil
expect(HeapInfo::Cache.write(key, object)).to be true
expect(HeapInfo::Cache.read(key)).to eq object
end
it 'file corrupted' do
key = @prefix + 'corrupted'
HeapInfo::Cache.write(key, 'ok')
IO.binwrite(File.join(HeapInfo::Cache::CACHE_DIR, key), 'not ok')
expect(HeapInfo::Cache.read(key)).to be nil
end
end
| 29.14 | 83 | 0.66232 |
39c6b6e3f983cd3d62aaa7935a2f617bbde9ef72 | 2,647 | module SuperDiff
module RSpec
module OperationalSequencers
class CollectionContainingExactly < SuperDiff::OperationalSequencers::Base
def self.applies_to?(expected, actual)
SuperDiff::RSpec.collection_containing_exactly?(expected) &&
actual.is_a?(::Array)
end
def initialize(actual:, **rest)
super
populate_pairings_maximizer_in_expected_with(actual)
end
protected
def unary_operations
operations = []
(0...actual.length).each do |index|
add_noop_to(operations, index)
end
indexes_in_expected_but_not_in_actual.each do |index|
add_delete_to(operations, index)
end
operations
end
def build_operation_sequencer
OperationSequences::Array.new([])
end
private
def populate_pairings_maximizer_in_expected_with(actual)
expected.matches?(actual)
end
def add_noop_to(operations, index)
value = actual[index]
operations << ::SuperDiff::Operations::UnaryOperation.new(
name: :noop,
collection: collection,
key: index,
value: value,
index: index,
index_in_collection: collection.index(value),
)
end
def add_delete_to(operations, index)
value = expected.expected[index]
operations << ::SuperDiff::Operations::UnaryOperation.new(
name: :delete,
collection: collection,
key: index,
value: value,
index: index,
index_in_collection: collection.index(value),
)
end
def add_insert_to(operations, index)
value = actual[index]
operations << ::SuperDiff::Operations::UnaryOperation.new(
name: :insert,
collection: collection,
key: index,
value: value,
index: index,
index_in_collection: collection.index(value),
)
end
def collection
actual + values_in_expected_but_not_in_actual
end
def values_in_expected_but_not_in_actual
indexes_in_expected_but_not_in_actual.map do |index|
expected.expected[index]
end
end
def indexes_in_expected_but_not_in_actual
pairings_maximizer_best_solution.unmatched_expected_indexes
end
def pairings_maximizer_best_solution
expected.__send__(:best_solution)
end
end
end
end
end
| 27.010204 | 80 | 0.589346 |
0864f4bb4be2349731f8d53a3bb6a1861e5a5d72 | 34,406 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 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.
#++
require File.expand_path('../../../../spec_helper', __FILE__)
describe Api::V2::PlanningElementsController, type: :controller do
# ===========================================================
# Helpers
def self.become_admin
let(:current_user) { FactoryGirl.create(:admin) }
end
def self.become_non_member(&block)
let(:current_user) { FactoryGirl.create(:user) }
before do
projects = block ? instance_eval(&block) : [project]
projects.each do |p|
current_user.memberships.select { |m| m.project_id == p.id }.each(&:destroy)
end
end
end
def self.become_member_with_view_planning_element_permissions(&block)
let(:current_user) { FactoryGirl.create(:user) }
before do
role = FactoryGirl.create(:role, permissions: [:view_work_packages])
projects = block ? instance_eval(&block) : [project]
projects.each do |p|
member = FactoryGirl.build(:member, user: current_user, project: p)
member.roles = [role]
member.save!
end
end
end
def self.become_member_with_edit_planning_element_permissions(&block)
let(:current_user) { FactoryGirl.create(:user) }
before do
role = FactoryGirl.create(:role, permissions: [:edit_work_packages])
projects = block ? instance_eval(&block) : [project]
projects.each do |p|
member = FactoryGirl.build(:member, user: current_user, project: p)
member.roles = [role]
member.save!
end
end
end
def self.become_member_with_delete_planning_element_permissions(&block)
let(:current_user) { FactoryGirl.create(:user) }
before do
role = FactoryGirl.create(:role, permissions: [:delete_work_packages])
projects = block ? instance_eval(&block) : [project]
projects.each do |_p|
member = FactoryGirl.build(:member, user: current_user, project: project)
member.roles = [role]
member.save!
end
end
end
def work_packages_to_structs(work_packages)
work_packages.map do |model|
Struct::WorkPackage.new.tap do |s|
model.attributes.each do |attribute, value|
s.send(:"#{attribute}=", value)
end
s.child_ids = []
s.custom_values = []
end
end
end
before do
allow(User).to receive(:current).and_return current_user
FactoryGirl.create :priority, is_default: true
FactoryGirl.create :default_status
end
# ===========================================================
# API tests
describe 'index.xml' do
become_admin
describe 'w/ list of ids' do
describe 'w/ an unknown work package id' do
it 'renders an empty list' do
get 'index', ids: '4711', format: 'xml'
expect(assigns(:planning_elements)).to eq([])
end
end
describe 'w/ known work package ids in one project' do
let(:project) { FactoryGirl.create(:project, identifier: 'test_project') }
let(:work_package) { FactoryGirl.create(:work_package, project_id: project.id) }
describe 'w/o being a member or administrator' do
become_non_member
it 'renders an empty list' do
get 'index', ids: work_package.id.to_s, format: 'xml'
expect(assigns(:planning_elements)).to eq([])
end
end
describe 'w/ the current user being a member with view_work_packages permissions' do
become_member_with_view_planning_element_permissions
before do
get 'index', ids: '', format: 'xml'
end
describe 'w/o any planning elements within the project' do
it 'assigns an empty planning_elements array' do
expect(assigns(:planning_elements)).to eq([])
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
describe 'w/ 3 planning elements within the project' do
before do
@created_planning_elements = [
FactoryGirl.create(:work_package, project_id: project.id),
FactoryGirl.create(:work_package, project_id: project.id),
FactoryGirl.create(:work_package, project_id: project.id)
]
get 'index', ids: @created_planning_elements.map(&:id).join(','), format: 'xml'
end
it 'assigns a planning_elements array containing all three elements' do
expect(assigns(:planning_elements)).to match_array(@created_planning_elements)
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
describe 'w/ 2 planning elements within a specific project and one PE requested' do
context 'with rewire_parents=false' do
let!(:wp_parent) { FactoryGirl.create(:work_package, project_id: project.id) }
let!(:wp_child) {
FactoryGirl.create(:work_package, project_id: project.id,
parent_id: wp_parent.id)
}
context 'with rewire_parents=false' do
before do
get 'index', project_id: project.id,
ids: wp_child.id.to_s,
rewire_parents: 'false',
format: 'xml'
end
it "includes the child's parent_id" do
expect(assigns(:planning_elements)[0].parent_id).to eq wp_parent.id
end
end
context 'without rewire_parents' do
# This is unbelievably inconsistent. When requesting this without a project_id,
# the rewiring is not done at all, so the parent_id can be seen with and
# without rewiring disabled.
# Passing a project_id here, so we can test this with rewiring enabled.
before do
get 'index', project_id: project.id,
ids: wp_child.id.to_s,
format: 'xml'
end
it "doesn't include child's parent_id" do
expect(assigns(:planning_elements)[0].parent_id).to eq nil
end
end
end
end
end
end
describe 'w/ known work package ids in multiple projects' do
let(:project_a) { FactoryGirl.create(:project, identifier: 'project_a') }
let(:project_b) { FactoryGirl.create(:project, identifier: 'project_b') }
let(:project_c) { FactoryGirl.create(:project, identifier: 'project_c') }
before do
@project_a_wps = [
FactoryGirl.create(:work_package, project_id: project_a.id),
FactoryGirl.create(:work_package, project_id: project_a.id),
]
@project_b_wps = [
FactoryGirl.create(:work_package, project_id: project_b.id),
FactoryGirl.create(:work_package, project_id: project_b.id),
]
@project_c_wps = [
FactoryGirl.create(:work_package, project_id: project_c.id),
FactoryGirl.create(:work_package, project_id: project_c.id)
]
end
describe 'w/ an unknown pe in the list' do
become_admin { [project_a, project_b] }
it 'renders only existing work packages' do
get 'index', ids: [@project_a_wps[0].id, @project_b_wps[0].id, '4171', '5555'].join(','), format: 'xml'
expect(assigns(:planning_elements)).to match_array([@project_a_wps[0], @project_b_wps[0]])
end
end
describe 'w/ an inaccessible pe in the list' do
become_member_with_view_planning_element_permissions { [project_a, project_b] }
become_non_member { [project_c] }
it 'renders only accessable work packages' do
get 'index', ids: [@project_a_wps[0].id, @project_b_wps[0].id, @project_c_wps[0].id, @project_c_wps[1].id].join(','), format: 'xml'
expect(assigns(:planning_elements)).to match_array([@project_a_wps[0], @project_b_wps[0]])
end
it 'renders only accessable work packages' do
get 'index', ids: [@project_c_wps[0].id, @project_c_wps[1].id].join(','), format: 'xml'
expect(assigns(:planning_elements)).to match_array([])
end
end
describe 'w/ multiple work packages in multiple projects' do
become_member_with_view_planning_element_permissions { [project_a, project_b, project_c] }
it 'renders all work packages' do
get 'index', ids: (@project_a_wps + @project_b_wps + @project_c_wps).map(&:id).join(','), format: 'xml'
expect(assigns(:planning_elements)).to match_array(@project_a_wps + @project_b_wps + @project_c_wps)
end
end
end
describe 'w/ cross-project relations' do
before do
allow(Setting).to receive(:cross_project_work_package_relations?).and_return(true)
end
let!(:project1) { FactoryGirl.create(:project, identifier: 'project-1') }
let!(:project2) { FactoryGirl.create(:project, identifier: 'project-2') }
let!(:ticket_a) { FactoryGirl.create(:work_package, project_id: project1.id) }
let!(:ticket_b) { FactoryGirl.create(:work_package, project_id: project1.id, parent_id: ticket_a.id) }
let!(:ticket_c) { FactoryGirl.create(:work_package, project_id: project1.id, parent_id: ticket_b.id) }
let!(:ticket_d) { FactoryGirl.create(:work_package, project_id: project1.id) }
let!(:ticket_e) { FactoryGirl.create(:work_package, project_id: project2.id, parent_id: ticket_d.id) }
let!(:ticket_f) { FactoryGirl.create(:work_package, project_id: project1.id, parent_id: ticket_e.id) }
become_admin { [project1, project2] }
context 'without rewire_parents' do # equivalent to rewire_parents=true
it 'rewires ancestors correctly' do
get 'index', project_id: project1.id, format: 'xml'
# the controller returns structs. We therefore have to filter for those
ticket_f_struct = assigns(:planning_elements).detect { |pe| pe.id == ticket_f.id }
expect(ticket_f_struct.parent_id).to eq(ticket_d.id)
end
end
context 'with rewire_parents=false' do
before do
get 'index', project_id: project1.id, format: 'xml', rewire_parents: 'false'
end
it "doesn't rewire ancestors" do
# the controller returns structs. We therefore have to filter for those
ticket_f_struct = assigns(:planning_elements).detect { |pe| pe.id == ticket_f.id }
expect(ticket_f_struct.parent_id).to eq(ticket_e.id)
end
it 'filters out invisible work packages' do
expect(assigns(:planning_elements).map(&:id)).not_to include(ticket_e.id)
end
end
end
describe 'changed since' do
let!(:work_package) do
work_package = Timecop.travel(5.hours.ago) do
wp = FactoryGirl.create(:work_package)
wp.save!
wp
end
work_package.subject = 'Changed now!'
work_package.save!
work_package
end
become_admin { [work_package.project] }
shared_context 'get work packages changed since' do
before { get 'index', project_id: work_package.project_id, changed_since: timestamp, format: 'xml' }
end
describe 'valid timestamp' do
shared_examples_for 'valid timestamp' do
let(:timestamp) { (work_package.updated_at - 5.seconds).to_i }
include_context 'get work packages changed since'
it { expect(assigns(:planning_elements).map(&:id)).to match_array([work_package.id]) }
end
shared_examples_for 'valid but early timestamp' do
let(:timestamp) { (work_package.updated_at + 5.seconds).to_i }
include_context 'get work packages changed since'
it { expect(assigns(:planning_elements)).to be_empty }
end
it_behaves_like 'valid timestamp'
it_behaves_like 'valid but early timestamp'
end
describe 'invalid timestamp' do
let(:timestamp) { 'eeek' }
include_context 'get work packages changed since'
it { expect(response.status).to eq(400) }
end
end
end
describe 'ids' do
let(:project_a) { FactoryGirl.create(:project) }
let(:project_b) { FactoryGirl.create(:project) }
let(:project_c) { FactoryGirl.create(:project) }
let!(:work_package_a) {
FactoryGirl.create(:work_package,
project: project_a)
}
let!(:work_package_b) {
FactoryGirl.create(:work_package,
project: project_b)
}
let!(:work_package_c) {
FactoryGirl.create(:work_package,
project: project_c)
}
let(:project_ids) { [project_a, project_b, project_c].map(&:id).join(',') }
let(:wp_ids) { [work_package_a, work_package_b].map(&:id) }
become_admin { [project_a, project_b, work_package_c.project] }
describe 'empty ids' do
before { get 'index', project_id: project_ids, ids: '', format: 'xml' }
it { expect(assigns(:planning_elements)).to be_empty }
end
shared_examples_for 'valid ids request' do
before { get 'index', project_id: project_ids, ids: wp_ids.join(','), format: 'xml' }
subject { assigns(:planning_elements).map(&:id) }
it { expect(subject).to include(*wp_ids) }
it { expect(subject).not_to include(*invalid_wp_ids) }
end
describe 'known ids' do
context 'single id' do
it_behaves_like 'valid ids request' do
let(:wp_ids) { [work_package_a.id] }
let(:invalid_wp_ids) { [work_package_b.id, work_package_c.id] }
end
end
context 'multiple ids' do
it_behaves_like 'valid ids request' do
let(:wp_ids) { [work_package_a.id, work_package_b.id] }
let(:invalid_wp_ids) { [work_package_c.id] }
end
end
end
end
describe 'w/ list of projects' do
describe 'w/ an unknown project' do
it 'renders a 404 Not Found page' do
get 'index', project_id: 'project_x,project_b', format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ a known project' do
let(:project) { FactoryGirl.create(:project, identifier: 'test_project') }
describe 'w/o being a member or administrator' do
become_non_member
it 'renders a 403 Forbidden page' do
get 'index', project_id: project.identifier, format: 'xml'
expect(response.response_code).to eq(403)
end
end
describe 'w/ the current user being a member with view_work_packages permissions' do
become_member_with_view_planning_element_permissions
before do
get 'index', project_id: project.id, format: 'xml'
end
describe 'w/o any planning elements within the project' do
it 'assigns an empty planning_elements array' do
expect(assigns(:planning_elements)).to eq([])
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
describe 'w/ 3 planning elements within the project' do
before do
created_planning_elements = [
FactoryGirl.create(:work_package, project_id: project.id),
FactoryGirl.create(:work_package, project_id: project.id),
FactoryGirl.create(:work_package, project_id: project.id)
]
@created_planning_elements = work_packages_to_structs(created_planning_elements)
get 'index', project_id: project.id, format: 'xml'
end
it 'assigns a planning_elements array containing all three elements' do
expect(assigns(:planning_elements)).to match_array(@created_planning_elements)
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
end
end
describe 'w/ multiple known projects' do
let(:project_a) { FactoryGirl.create(:project, identifier: 'project_a') }
let(:project_b) { FactoryGirl.create(:project, identifier: 'project_b') }
let(:project_c) { FactoryGirl.create(:project, identifier: 'project_c') }
describe 'w/ an unknown project in the list' do
become_admin { [project_a, project_b] }
it 'renders a 404 Not Found page' do
get 'index', project_id: 'project_x,project_b', format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ a project in the list, the current user may not access' do
before { project_a; project_b }
become_non_member { [project_b] }
before do
get 'index', project_id: 'project_a,project_b', format: 'xml'
end
it 'assigns an empty planning_elements array' do
expect(assigns(:planning_elements)).to eq([])
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
describe 'w/ the current user being a member with view_work_packages permission' do
become_member_with_view_planning_element_permissions { [project_a, project_b] }
before do
get 'index', project_id: 'project_a,project_b', format: 'xml'
end
describe 'w/o any planning elements within the project' do
it 'assigns an empty planning_elements array' do
expect(assigns(:planning_elements)).to eq([])
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
describe 'w/ 1 planning element in project_a and 2 in project_b' do
before do
created_planning_elements = [
FactoryGirl.create(:work_package, project_id: project_a.id),
FactoryGirl.create(:work_package, project_id: project_b.id),
FactoryGirl.create(:work_package, project_id: project_b.id)
]
@created_planning_elements = work_packages_to_structs(created_planning_elements)
# adding another planning element, just to make sure, that the
# result set is properly filtered
FactoryGirl.create(:work_package, project_id: project_c.id)
get 'index', project_id: 'project_a,project_b', format: 'xml'
end
it 'assigns a planning_elements array containing all three elements' do
expect(assigns(:planning_elements)).to match_array(@created_planning_elements)
end
it 'renders the index builder template' do
expect(response).to render_template('planning_elements/index')
end
end
end
end
end
end
describe 'create.xml' do
let(:project) { FactoryGirl.create(:project_with_types, is_public: false) }
let(:author) { FactoryGirl.create(:user) }
become_admin
describe 'permissions' do
let(:planning_element) do
FactoryGirl.build(:work_package, author: author, project_id: project.id)
end
def fetch
post 'create', project_id: project.identifier,
format: 'xml',
planning_element: planning_element.attributes
end
def expect_redirect_to
Regexp.new(api_v2_project_planning_elements_path(project))
end
let(:permission) { :edit_work_packages }
it_should_behave_like 'a controller action which needs project permissions'
end
describe 'with custom fields' do
let(:type) { ::Type.find_by(name: 'None') || FactoryGirl.create(:type_standard) }
let(:custom_field) do
FactoryGirl.create :issue_custom_field,
name: 'Verse',
field_format: 'text',
projects: [project],
types: [type]
end
let(:planning_element) do
FactoryGirl.build(
:work_package,
author: author,
type: type,
project: project)
end
it 'creates a new planning element with the given custom field value' do
post 'create',
project_id: project.identifier,
format: 'xml',
planning_element: planning_element.attributes.merge(custom_fields: [
{ id: custom_field.id, value: 'Wurst' }])
expect(response.response_code).to eq(303)
id = response.headers['Location'].scan(/\d+/).last.to_i
wp = WorkPackage.find_by id: id
expect(wp).not_to be_nil
custom_value = wp.custom_values.find do |value|
value.custom_field.name == custom_field.name
end
expect(custom_value).not_to be_nil
expect(custom_value.value).to eq('Wurst')
end
end
end
describe 'show.xml' do
become_admin
describe 'w/o a valid planning element id' do
describe 'w/o a given project' do
it 'renders a 404 Not Found page' do
get 'show', id: '4711', format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ an unknown project' do
it 'renders a 404 Not Found page' do
get 'show', project_id: '4711', id: '1337', format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ a known project' do
let(:project) { FactoryGirl.create(:project, identifier: 'test_project') }
describe 'w/o being a member or administrator' do
become_non_member
it 'renders a 403 Forbidden page' do
get 'show', project_id: project.id, id: '1337', format: 'xml'
expect(response.response_code).to be === 403
end
end
describe 'w/ the current user being a member' do
become_member_with_view_planning_element_permissions
it 'raises ActiveRecord::RecordNotFound errors' do
expect {
get 'show', project_id: project.id, id: '1337', format: 'xml'
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
end
describe 'w/ a valid planning element id' do
become_admin
let(:project) { FactoryGirl.create(:project, identifier: 'test_project') }
let(:planning_element) { FactoryGirl.create(:work_package, project_id: project.id) }
describe 'w/o a given project' do
it 'renders a 404 Not Found page' do
get 'show', id: planning_element.id, format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ a known project' do
describe 'w/o being a member or administrator' do
become_non_member
it 'renders a 403 Forbidden page' do
get 'show', project_id: project.id, id: planning_element.id, format: 'xml'
expect(response.response_code).to eq(403)
end
end
describe 'w/ the current user being a member' do
become_member_with_view_planning_element_permissions
it 'assigns the planning_element' do
get 'show', project_id: project.id, id: planning_element.id, format: 'xml'
expect(assigns(:planning_element)).to eq(planning_element)
end
it 'renders the show builder template' do
get 'show', project_id: project.id, id: planning_element.id, format: 'xml'
expect(response).to render_template('planning_elements/show')
end
end
end
end
describe 'with custom fields' do
render_views
let(:project) { FactoryGirl.create(:project) }
let(:type) { ::Type.find_by(name: 'None') || FactoryGirl.create(:type_standard) }
let(:custom_field) do
FactoryGirl.create :text_issue_custom_field,
projects: [project],
types: [type]
end
let(:planning_element) do
FactoryGirl.create :work_package,
type: type,
project: project,
custom_values: [
CustomValue.new(custom_field: custom_field, value: 'Mett')]
end
it 'should render the custom field values' do
get 'show', project_id: project.identifier, id: planning_element.id, format: 'json'
expect(response).to be_success
expect(response.header['Content-Type']).to include 'application/json'
expect(response.body).to include 'Mett'
end
end
end
describe 'update.xml' do
let(:project) { FactoryGirl.create(:project, is_public: false) }
let(:work_package) { FactoryGirl.create(:work_package) }
become_admin
describe 'permissions' do
let(:planning_element) {
FactoryGirl.create(:work_package,
project_id: project.id)
}
def fetch
post 'update', project_id: project.identifier,
id: planning_element.id,
planning_element: { name: 'blubs' },
format: 'xml'
end
def expect_no_content
true
end
let(:permission) { :edit_work_packages }
it_should_behave_like 'a controller action which needs project permissions'
end
describe 'empty' do
before do
put :update,
project_id: work_package.project_id,
id: work_package.id,
format: :xml
end
it { expect(response.status).to eq(400) }
end
describe 'notes' do
let(:note) { 'A note set by API' }
before do
put :update,
project_id: work_package.project_id,
id: work_package.id,
planning_element: { note: note },
format: :xml
end
it { expect(response.status).to eq(204) }
describe 'journals' do
subject { work_package.reload.journals }
it { expect(subject.count).to eq(2) }
it { expect(subject.last.notes).to eq(note) }
it { expect(subject.last.user).to eq(User.current) }
end
end
describe 'with custom fields' do
let(:type) { ::Type.find_by(name: 'None') || FactoryGirl.create(:type_standard) }
let(:custom_field) do
FactoryGirl.create :text_issue_custom_field,
projects: [project],
types: [type]
end
let(:planning_element) do
FactoryGirl.create :work_package,
type: type,
project: project,
custom_values: [
CustomValue.new(custom_field: custom_field, value: 'Mett')]
end
it 'updates the custom field value' do
put 'update',
project_id: project.identifier,
format: 'xml',
id: planning_element.id,
planning_element: {
custom_fields: [
{ id: custom_field.id, value: 'Wurst' }
]
}
expect(response.response_code).to eq(204)
wp = WorkPackage.find planning_element.id
custom_value = wp.custom_values.find do |value|
value.custom_field.name == custom_field.name
end
expect(custom_value).not_to be_nil
expect(custom_value.value).not_to eq('Mett')
expect(custom_value.value).to eq('Wurst')
end
end
##
# It should be possible to update a planning element's status by transmitting the
# field 'status_id'. The test tries to change a planning element's status from
# status A to B.
describe 'status' do
let(:status_a) { FactoryGirl.create :status }
let(:status_b) { FactoryGirl.create :status }
let(:planning_element) { FactoryGirl.create :work_package, status: status_a }
shared_examples_for 'work package status change' do
before do
put 'update',
project_id: project.identifier,
format: 'xml',
id: planning_element.id,
planning_element: { status_id: status_b.id }
end
it { expect(response.response_code).to eq(expected_response_code) }
it { expect(WorkPackage.find(planning_element.id).status).to eq(expected_work_package_status) }
end
context 'valid workflow exists' do
let!(:workflow) {
FactoryGirl.create(:workflow,
old_status: status_a,
new_status: status_b,
type_id: planning_element.type_id)
}
before { planning_element.project.add_member!(current_user, workflow.role) }
it_behaves_like 'work package status change' do
let(:expected_response_code) { 204 }
let(:expected_work_package_status) { status_b }
end
end
context 'no valid workflow exists' do
it_behaves_like 'work package status change' do
let(:expected_response_code) { 422 }
let(:expected_work_package_status) { status_a }
end
end
end
end
describe 'destroy.xml' do
become_admin
describe 'w/o a valid planning element id' do
describe 'w/o a given project' do
it 'renders a 404 Not Found page' do
get 'destroy', id: '4711', format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ an unknown project' do
it 'renders a 404 Not Found page' do
get 'destroy', project_id: '4711', id: '1337', format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ a known project' do
let(:project) { FactoryGirl.create(:project, identifier: 'test_project') }
describe 'w/o being a member or administrator' do
become_non_member
it 'renders a 403 Forbidden page' do
get 'destroy', project_id: project.id, id: '1337', format: 'xml'
expect(response.response_code).to eq(403)
end
end
describe 'w/ the current user being a member' do
become_member_with_delete_planning_element_permissions
it 'raises ActiveRecord::RecordNotFound errors' do
expect {
get 'destroy', project_id: project.id, id: '1337', format: 'xml'
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
end
describe 'w/ a valid planning element id' do
let(:project) { FactoryGirl.create(:project, identifier: 'test_project') }
let(:planning_element) { FactoryGirl.create(:work_package, project_id: project.id) }
describe 'w/o a given project' do
it 'renders a 404 Not Found page' do
get 'destroy', id: planning_element.id, format: 'xml'
expect(response.response_code).to eq(404)
end
end
describe 'w/ a known project' do
describe 'w/o being a member or administrator' do
become_non_member
it 'renders a 403 Forbidden page' do
get 'destroy', project_id: project.id, id: planning_element.id, format: 'xml'
expect(response.response_code).to eq(403)
end
end
describe 'w/ the current user being a member' do
become_member_with_delete_planning_element_permissions
it 'assigns the planning_element' do
get 'destroy', project_id: project.id, id: planning_element.id, format: 'xml'
expect(assigns(:planning_element)).to eq(planning_element)
end
it 'renders the destroy builder template' do
get 'destroy', project_id: project.id, id: planning_element.id, format: 'xml'
expect(response).to render_template('planning_elements/destroy')
end
it 'deletes the record' do
get 'destroy', project_id: project.id, id: planning_element.id, format: 'xml'
expect {
planning_element.reload
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
end
end
end
| 34.578894 | 143 | 0.602046 |
03311883d12ecb42f970c2aa382e36b526ce0987 | 1,002 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'kaba/version'
Gem::Specification.new do |spec|
spec.name = 'kaba'
spec.version = Kaba::VERSION
spec.authors = ['Genki Sugawara']
spec.email = ['[email protected]']
spec.summary = %q{Kaba is a tool to manage AWS ALB.}
spec.description = %q{Kaba is a tool to manage AWS ALB.}
spec.homepage = 'https://github.com/winebarrel/monosasi'
spec.license = 'MIT'
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.add_dependency 'aws-sdk'
spec.add_dependency 'parallel'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.0'
end
| 33.4 | 74 | 0.647705 |
f8314a869352c239f45b9393e7e376f38bea9d9c | 368 | # frozen_string_literal: true
# A curator is allowed to create and edit common resources
class CuratorPolicy < ApplicationPolicy
def create?
user&.curator?
end
def destroy?
user.curator?
end
def edit?
user.curator?
end
def update?
user.curator?
end
# class Scope < Scope
# def resolve
# scope.all
# end
# end
end
| 13.62963 | 58 | 0.652174 |
e28c5a23cbc756bb6364c7b576e979a33396e5a9 | 142 | # frozen_string_literal: true
FactoryBot.define do
factory :user do
email { "#{Faker::Internet.unique.user_name}@mail.com" }
end
end
| 17.75 | 60 | 0.71831 |
e83165e5a0aad756978d166bf728f61a7cf46a98 | 155,195 | # 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::LexModelsV2
# @api private
module ClientApi
include Seahorse::Model
AmazonResourceName = Shapes::StringShape.new(name: 'AmazonResourceName')
AttachmentTitle = Shapes::StringShape.new(name: 'AttachmentTitle')
AttachmentUrl = Shapes::StringShape.new(name: 'AttachmentUrl')
AudioLogDestination = Shapes::StructureShape.new(name: 'AudioLogDestination')
AudioLogSetting = Shapes::StructureShape.new(name: 'AudioLogSetting')
AudioLogSettingsList = Shapes::ListShape.new(name: 'AudioLogSettingsList')
Boolean = Shapes::BooleanShape.new(name: 'Boolean')
BotAliasHistoryEvent = Shapes::StructureShape.new(name: 'BotAliasHistoryEvent')
BotAliasHistoryEventsList = Shapes::ListShape.new(name: 'BotAliasHistoryEventsList')
BotAliasId = Shapes::StringShape.new(name: 'BotAliasId')
BotAliasLocaleSettings = Shapes::StructureShape.new(name: 'BotAliasLocaleSettings')
BotAliasLocaleSettingsMap = Shapes::MapShape.new(name: 'BotAliasLocaleSettingsMap')
BotAliasStatus = Shapes::StringShape.new(name: 'BotAliasStatus')
BotAliasSummary = Shapes::StructureShape.new(name: 'BotAliasSummary')
BotAliasSummaryList = Shapes::ListShape.new(name: 'BotAliasSummaryList')
BotFilter = Shapes::StructureShape.new(name: 'BotFilter')
BotFilterName = Shapes::StringShape.new(name: 'BotFilterName')
BotFilterOperator = Shapes::StringShape.new(name: 'BotFilterOperator')
BotFilters = Shapes::ListShape.new(name: 'BotFilters')
BotLocaleFilter = Shapes::StructureShape.new(name: 'BotLocaleFilter')
BotLocaleFilterName = Shapes::StringShape.new(name: 'BotLocaleFilterName')
BotLocaleFilterOperator = Shapes::StringShape.new(name: 'BotLocaleFilterOperator')
BotLocaleFilters = Shapes::ListShape.new(name: 'BotLocaleFilters')
BotLocaleHistoryEvent = Shapes::StructureShape.new(name: 'BotLocaleHistoryEvent')
BotLocaleHistoryEventDescription = Shapes::StringShape.new(name: 'BotLocaleHistoryEventDescription')
BotLocaleHistoryEventsList = Shapes::ListShape.new(name: 'BotLocaleHistoryEventsList')
BotLocaleSortAttribute = Shapes::StringShape.new(name: 'BotLocaleSortAttribute')
BotLocaleSortBy = Shapes::StructureShape.new(name: 'BotLocaleSortBy')
BotLocaleStatus = Shapes::StringShape.new(name: 'BotLocaleStatus')
BotLocaleSummary = Shapes::StructureShape.new(name: 'BotLocaleSummary')
BotLocaleSummaryList = Shapes::ListShape.new(name: 'BotLocaleSummaryList')
BotSortAttribute = Shapes::StringShape.new(name: 'BotSortAttribute')
BotSortBy = Shapes::StructureShape.new(name: 'BotSortBy')
BotStatus = Shapes::StringShape.new(name: 'BotStatus')
BotSummary = Shapes::StructureShape.new(name: 'BotSummary')
BotSummaryList = Shapes::ListShape.new(name: 'BotSummaryList')
BotVersion = Shapes::StringShape.new(name: 'BotVersion')
BotVersionLocaleDetails = Shapes::StructureShape.new(name: 'BotVersionLocaleDetails')
BotVersionLocaleSpecification = Shapes::MapShape.new(name: 'BotVersionLocaleSpecification')
BotVersionSortAttribute = Shapes::StringShape.new(name: 'BotVersionSortAttribute')
BotVersionSortBy = Shapes::StructureShape.new(name: 'BotVersionSortBy')
BotVersionSummary = Shapes::StructureShape.new(name: 'BotVersionSummary')
BotVersionSummaryList = Shapes::ListShape.new(name: 'BotVersionSummaryList')
BoxedBoolean = Shapes::BooleanShape.new(name: 'BoxedBoolean')
BuildBotLocaleRequest = Shapes::StructureShape.new(name: 'BuildBotLocaleRequest')
BuildBotLocaleResponse = Shapes::StructureShape.new(name: 'BuildBotLocaleResponse')
BuiltInIntentSortAttribute = Shapes::StringShape.new(name: 'BuiltInIntentSortAttribute')
BuiltInIntentSortBy = Shapes::StructureShape.new(name: 'BuiltInIntentSortBy')
BuiltInIntentSummary = Shapes::StructureShape.new(name: 'BuiltInIntentSummary')
BuiltInIntentSummaryList = Shapes::ListShape.new(name: 'BuiltInIntentSummaryList')
BuiltInOrCustomSlotTypeId = Shapes::StringShape.new(name: 'BuiltInOrCustomSlotTypeId')
BuiltInSlotTypeSortAttribute = Shapes::StringShape.new(name: 'BuiltInSlotTypeSortAttribute')
BuiltInSlotTypeSortBy = Shapes::StructureShape.new(name: 'BuiltInSlotTypeSortBy')
BuiltInSlotTypeSummary = Shapes::StructureShape.new(name: 'BuiltInSlotTypeSummary')
BuiltInSlotTypeSummaryList = Shapes::ListShape.new(name: 'BuiltInSlotTypeSummaryList')
BuiltInsMaxResults = Shapes::IntegerShape.new(name: 'BuiltInsMaxResults')
Button = Shapes::StructureShape.new(name: 'Button')
ButtonText = Shapes::StringShape.new(name: 'ButtonText')
ButtonValue = Shapes::StringShape.new(name: 'ButtonValue')
ButtonsList = Shapes::ListShape.new(name: 'ButtonsList')
ChildDirected = Shapes::BooleanShape.new(name: 'ChildDirected')
CloudWatchLogGroupArn = Shapes::StringShape.new(name: 'CloudWatchLogGroupArn')
CloudWatchLogGroupLogDestination = Shapes::StructureShape.new(name: 'CloudWatchLogGroupLogDestination')
CodeHookInterfaceVersion = Shapes::StringShape.new(name: 'CodeHookInterfaceVersion')
CodeHookSpecification = Shapes::StructureShape.new(name: 'CodeHookSpecification')
ConfidenceThreshold = Shapes::FloatShape.new(name: 'ConfidenceThreshold')
ConflictException = Shapes::StructureShape.new(name: 'ConflictException')
ContextTimeToLiveInSeconds = Shapes::IntegerShape.new(name: 'ContextTimeToLiveInSeconds')
ContextTurnsToLive = Shapes::IntegerShape.new(name: 'ContextTurnsToLive')
ConversationLogSettings = Shapes::StructureShape.new(name: 'ConversationLogSettings')
CreateBotAliasRequest = Shapes::StructureShape.new(name: 'CreateBotAliasRequest')
CreateBotAliasResponse = Shapes::StructureShape.new(name: 'CreateBotAliasResponse')
CreateBotLocaleRequest = Shapes::StructureShape.new(name: 'CreateBotLocaleRequest')
CreateBotLocaleResponse = Shapes::StructureShape.new(name: 'CreateBotLocaleResponse')
CreateBotRequest = Shapes::StructureShape.new(name: 'CreateBotRequest')
CreateBotResponse = Shapes::StructureShape.new(name: 'CreateBotResponse')
CreateBotVersionRequest = Shapes::StructureShape.new(name: 'CreateBotVersionRequest')
CreateBotVersionResponse = Shapes::StructureShape.new(name: 'CreateBotVersionResponse')
CreateIntentRequest = Shapes::StructureShape.new(name: 'CreateIntentRequest')
CreateIntentResponse = Shapes::StructureShape.new(name: 'CreateIntentResponse')
CreateSlotRequest = Shapes::StructureShape.new(name: 'CreateSlotRequest')
CreateSlotResponse = Shapes::StructureShape.new(name: 'CreateSlotResponse')
CreateSlotTypeRequest = Shapes::StructureShape.new(name: 'CreateSlotTypeRequest')
CreateSlotTypeResponse = Shapes::StructureShape.new(name: 'CreateSlotTypeResponse')
CustomPayload = Shapes::StructureShape.new(name: 'CustomPayload')
CustomPayloadValue = Shapes::StringShape.new(name: 'CustomPayloadValue')
DataPrivacy = Shapes::StructureShape.new(name: 'DataPrivacy')
DeleteBotAliasRequest = Shapes::StructureShape.new(name: 'DeleteBotAliasRequest')
DeleteBotAliasResponse = Shapes::StructureShape.new(name: 'DeleteBotAliasResponse')
DeleteBotLocaleRequest = Shapes::StructureShape.new(name: 'DeleteBotLocaleRequest')
DeleteBotLocaleResponse = Shapes::StructureShape.new(name: 'DeleteBotLocaleResponse')
DeleteBotRequest = Shapes::StructureShape.new(name: 'DeleteBotRequest')
DeleteBotResponse = Shapes::StructureShape.new(name: 'DeleteBotResponse')
DeleteBotVersionRequest = Shapes::StructureShape.new(name: 'DeleteBotVersionRequest')
DeleteBotVersionResponse = Shapes::StructureShape.new(name: 'DeleteBotVersionResponse')
DeleteIntentRequest = Shapes::StructureShape.new(name: 'DeleteIntentRequest')
DeleteSlotRequest = Shapes::StructureShape.new(name: 'DeleteSlotRequest')
DeleteSlotTypeRequest = Shapes::StructureShape.new(name: 'DeleteSlotTypeRequest')
DescribeBotAliasRequest = Shapes::StructureShape.new(name: 'DescribeBotAliasRequest')
DescribeBotAliasResponse = Shapes::StructureShape.new(name: 'DescribeBotAliasResponse')
DescribeBotLocaleRequest = Shapes::StructureShape.new(name: 'DescribeBotLocaleRequest')
DescribeBotLocaleResponse = Shapes::StructureShape.new(name: 'DescribeBotLocaleResponse')
DescribeBotRequest = Shapes::StructureShape.new(name: 'DescribeBotRequest')
DescribeBotResponse = Shapes::StructureShape.new(name: 'DescribeBotResponse')
DescribeBotVersionRequest = Shapes::StructureShape.new(name: 'DescribeBotVersionRequest')
DescribeBotVersionResponse = Shapes::StructureShape.new(name: 'DescribeBotVersionResponse')
DescribeIntentRequest = Shapes::StructureShape.new(name: 'DescribeIntentRequest')
DescribeIntentResponse = Shapes::StructureShape.new(name: 'DescribeIntentResponse')
DescribeSlotRequest = Shapes::StructureShape.new(name: 'DescribeSlotRequest')
DescribeSlotResponse = Shapes::StructureShape.new(name: 'DescribeSlotResponse')
DescribeSlotTypeRequest = Shapes::StructureShape.new(name: 'DescribeSlotTypeRequest')
DescribeSlotTypeResponse = Shapes::StructureShape.new(name: 'DescribeSlotTypeResponse')
Description = Shapes::StringShape.new(name: 'Description')
DialogCodeHookSettings = Shapes::StructureShape.new(name: 'DialogCodeHookSettings')
DraftBotVersion = Shapes::StringShape.new(name: 'DraftBotVersion')
ExceptionMessage = Shapes::StringShape.new(name: 'ExceptionMessage')
FailureReason = Shapes::StringShape.new(name: 'FailureReason')
FailureReasons = Shapes::ListShape.new(name: 'FailureReasons')
FilterValue = Shapes::StringShape.new(name: 'FilterValue')
FilterValues = Shapes::ListShape.new(name: 'FilterValues')
FulfillmentCodeHookSettings = Shapes::StructureShape.new(name: 'FulfillmentCodeHookSettings')
Id = Shapes::StringShape.new(name: 'Id')
ImageResponseCard = Shapes::StructureShape.new(name: 'ImageResponseCard')
InputContext = Shapes::StructureShape.new(name: 'InputContext')
InputContextsList = Shapes::ListShape.new(name: 'InputContextsList')
IntentClosingSetting = Shapes::StructureShape.new(name: 'IntentClosingSetting')
IntentConfirmationSetting = Shapes::StructureShape.new(name: 'IntentConfirmationSetting')
IntentFilter = Shapes::StructureShape.new(name: 'IntentFilter')
IntentFilterName = Shapes::StringShape.new(name: 'IntentFilterName')
IntentFilterOperator = Shapes::StringShape.new(name: 'IntentFilterOperator')
IntentFilters = Shapes::ListShape.new(name: 'IntentFilters')
IntentSignature = Shapes::StringShape.new(name: 'IntentSignature')
IntentSortAttribute = Shapes::StringShape.new(name: 'IntentSortAttribute')
IntentSortBy = Shapes::StructureShape.new(name: 'IntentSortBy')
IntentSummary = Shapes::StructureShape.new(name: 'IntentSummary')
IntentSummaryList = Shapes::ListShape.new(name: 'IntentSummaryList')
InternalServerException = Shapes::StructureShape.new(name: 'InternalServerException')
KendraConfiguration = Shapes::StructureShape.new(name: 'KendraConfiguration')
KendraIndexArn = Shapes::StringShape.new(name: 'KendraIndexArn')
KmsKeyArn = Shapes::StringShape.new(name: 'KmsKeyArn')
LambdaARN = Shapes::StringShape.new(name: 'LambdaARN')
LambdaCodeHook = Shapes::StructureShape.new(name: 'LambdaCodeHook')
ListBotAliasesRequest = Shapes::StructureShape.new(name: 'ListBotAliasesRequest')
ListBotAliasesResponse = Shapes::StructureShape.new(name: 'ListBotAliasesResponse')
ListBotLocalesRequest = Shapes::StructureShape.new(name: 'ListBotLocalesRequest')
ListBotLocalesResponse = Shapes::StructureShape.new(name: 'ListBotLocalesResponse')
ListBotVersionsRequest = Shapes::StructureShape.new(name: 'ListBotVersionsRequest')
ListBotVersionsResponse = Shapes::StructureShape.new(name: 'ListBotVersionsResponse')
ListBotsRequest = Shapes::StructureShape.new(name: 'ListBotsRequest')
ListBotsResponse = Shapes::StructureShape.new(name: 'ListBotsResponse')
ListBuiltInIntentsRequest = Shapes::StructureShape.new(name: 'ListBuiltInIntentsRequest')
ListBuiltInIntentsResponse = Shapes::StructureShape.new(name: 'ListBuiltInIntentsResponse')
ListBuiltInSlotTypesRequest = Shapes::StructureShape.new(name: 'ListBuiltInSlotTypesRequest')
ListBuiltInSlotTypesResponse = Shapes::StructureShape.new(name: 'ListBuiltInSlotTypesResponse')
ListIntentsRequest = Shapes::StructureShape.new(name: 'ListIntentsRequest')
ListIntentsResponse = Shapes::StructureShape.new(name: 'ListIntentsResponse')
ListSlotTypesRequest = Shapes::StructureShape.new(name: 'ListSlotTypesRequest')
ListSlotTypesResponse = Shapes::StructureShape.new(name: 'ListSlotTypesResponse')
ListSlotsRequest = Shapes::StructureShape.new(name: 'ListSlotsRequest')
ListSlotsResponse = Shapes::StructureShape.new(name: 'ListSlotsResponse')
ListTagsForResourceRequest = Shapes::StructureShape.new(name: 'ListTagsForResourceRequest')
ListTagsForResourceResponse = Shapes::StructureShape.new(name: 'ListTagsForResourceResponse')
LocaleId = Shapes::StringShape.new(name: 'LocaleId')
LocaleName = Shapes::StringShape.new(name: 'LocaleName')
LogPrefix = Shapes::StringShape.new(name: 'LogPrefix')
MaxResults = Shapes::IntegerShape.new(name: 'MaxResults')
Message = Shapes::StructureShape.new(name: 'Message')
MessageGroup = Shapes::StructureShape.new(name: 'MessageGroup')
MessageGroupsList = Shapes::ListShape.new(name: 'MessageGroupsList')
MessageVariationsList = Shapes::ListShape.new(name: 'MessageVariationsList')
Name = Shapes::StringShape.new(name: 'Name')
NextToken = Shapes::StringShape.new(name: 'NextToken')
NumericalBotVersion = Shapes::StringShape.new(name: 'NumericalBotVersion')
ObfuscationSetting = Shapes::StructureShape.new(name: 'ObfuscationSetting')
ObfuscationSettingType = Shapes::StringShape.new(name: 'ObfuscationSettingType')
OutputContext = Shapes::StructureShape.new(name: 'OutputContext')
OutputContextsList = Shapes::ListShape.new(name: 'OutputContextsList')
PlainTextMessage = Shapes::StructureShape.new(name: 'PlainTextMessage')
PlainTextMessageValue = Shapes::StringShape.new(name: 'PlainTextMessageValue')
PreconditionFailedException = Shapes::StructureShape.new(name: 'PreconditionFailedException')
PriorityValue = Shapes::IntegerShape.new(name: 'PriorityValue')
PromptMaxRetries = Shapes::IntegerShape.new(name: 'PromptMaxRetries')
PromptSpecification = Shapes::StructureShape.new(name: 'PromptSpecification')
QueryFilterString = Shapes::StringShape.new(name: 'QueryFilterString')
RegexPattern = Shapes::StringShape.new(name: 'RegexPattern')
ResourceCount = Shapes::IntegerShape.new(name: 'ResourceCount')
ResourceNotFoundException = Shapes::StructureShape.new(name: 'ResourceNotFoundException')
ResponseSpecification = Shapes::StructureShape.new(name: 'ResponseSpecification')
RetryAfterSeconds = Shapes::IntegerShape.new(name: 'RetryAfterSeconds')
RoleArn = Shapes::StringShape.new(name: 'RoleArn')
S3BucketArn = Shapes::StringShape.new(name: 'S3BucketArn')
S3BucketLogDestination = Shapes::StructureShape.new(name: 'S3BucketLogDestination')
SSMLMessage = Shapes::StructureShape.new(name: 'SSMLMessage')
SSMLMessageValue = Shapes::StringShape.new(name: 'SSMLMessageValue')
SampleUtterance = Shapes::StructureShape.new(name: 'SampleUtterance')
SampleUtterancesList = Shapes::ListShape.new(name: 'SampleUtterancesList')
SampleValue = Shapes::StructureShape.new(name: 'SampleValue')
SentimentAnalysisSettings = Shapes::StructureShape.new(name: 'SentimentAnalysisSettings')
ServiceQuotaExceededException = Shapes::StructureShape.new(name: 'ServiceQuotaExceededException')
SessionTTL = Shapes::IntegerShape.new(name: 'SessionTTL')
SkipResourceInUseCheck = Shapes::BooleanShape.new(name: 'SkipResourceInUseCheck')
SlotConstraint = Shapes::StringShape.new(name: 'SlotConstraint')
SlotDefaultValue = Shapes::StructureShape.new(name: 'SlotDefaultValue')
SlotDefaultValueList = Shapes::ListShape.new(name: 'SlotDefaultValueList')
SlotDefaultValueSpecification = Shapes::StructureShape.new(name: 'SlotDefaultValueSpecification')
SlotDefaultValueString = Shapes::StringShape.new(name: 'SlotDefaultValueString')
SlotFilter = Shapes::StructureShape.new(name: 'SlotFilter')
SlotFilterName = Shapes::StringShape.new(name: 'SlotFilterName')
SlotFilterOperator = Shapes::StringShape.new(name: 'SlotFilterOperator')
SlotFilters = Shapes::ListShape.new(name: 'SlotFilters')
SlotPrioritiesList = Shapes::ListShape.new(name: 'SlotPrioritiesList')
SlotPriority = Shapes::StructureShape.new(name: 'SlotPriority')
SlotSortAttribute = Shapes::StringShape.new(name: 'SlotSortAttribute')
SlotSortBy = Shapes::StructureShape.new(name: 'SlotSortBy')
SlotSummary = Shapes::StructureShape.new(name: 'SlotSummary')
SlotSummaryList = Shapes::ListShape.new(name: 'SlotSummaryList')
SlotTypeFilter = Shapes::StructureShape.new(name: 'SlotTypeFilter')
SlotTypeFilterName = Shapes::StringShape.new(name: 'SlotTypeFilterName')
SlotTypeFilterOperator = Shapes::StringShape.new(name: 'SlotTypeFilterOperator')
SlotTypeFilters = Shapes::ListShape.new(name: 'SlotTypeFilters')
SlotTypeSignature = Shapes::StringShape.new(name: 'SlotTypeSignature')
SlotTypeSortAttribute = Shapes::StringShape.new(name: 'SlotTypeSortAttribute')
SlotTypeSortBy = Shapes::StructureShape.new(name: 'SlotTypeSortBy')
SlotTypeSummary = Shapes::StructureShape.new(name: 'SlotTypeSummary')
SlotTypeSummaryList = Shapes::ListShape.new(name: 'SlotTypeSummaryList')
SlotTypeValue = Shapes::StructureShape.new(name: 'SlotTypeValue')
SlotTypeValues = Shapes::ListShape.new(name: 'SlotTypeValues')
SlotValueElicitationSetting = Shapes::StructureShape.new(name: 'SlotValueElicitationSetting')
SlotValueRegexFilter = Shapes::StructureShape.new(name: 'SlotValueRegexFilter')
SlotValueResolutionStrategy = Shapes::StringShape.new(name: 'SlotValueResolutionStrategy')
SlotValueSelectionSetting = Shapes::StructureShape.new(name: 'SlotValueSelectionSetting')
SortOrder = Shapes::StringShape.new(name: 'SortOrder')
StillWaitingResponseFrequency = Shapes::IntegerShape.new(name: 'StillWaitingResponseFrequency')
StillWaitingResponseSpecification = Shapes::StructureShape.new(name: 'StillWaitingResponseSpecification')
StillWaitingResponseTimeout = Shapes::IntegerShape.new(name: 'StillWaitingResponseTimeout')
SynonymList = Shapes::ListShape.new(name: 'SynonymList')
TagKey = Shapes::StringShape.new(name: 'TagKey')
TagKeyList = Shapes::ListShape.new(name: 'TagKeyList')
TagMap = Shapes::MapShape.new(name: 'TagMap')
TagResourceRequest = Shapes::StructureShape.new(name: 'TagResourceRequest')
TagResourceResponse = Shapes::StructureShape.new(name: 'TagResourceResponse')
TagValue = Shapes::StringShape.new(name: 'TagValue')
TextLogDestination = Shapes::StructureShape.new(name: 'TextLogDestination')
TextLogSetting = Shapes::StructureShape.new(name: 'TextLogSetting')
TextLogSettingsList = Shapes::ListShape.new(name: 'TextLogSettingsList')
ThrottlingException = Shapes::StructureShape.new(name: 'ThrottlingException')
Timestamp = Shapes::TimestampShape.new(name: 'Timestamp')
UntagResourceRequest = Shapes::StructureShape.new(name: 'UntagResourceRequest')
UntagResourceResponse = Shapes::StructureShape.new(name: 'UntagResourceResponse')
UpdateBotAliasRequest = Shapes::StructureShape.new(name: 'UpdateBotAliasRequest')
UpdateBotAliasResponse = Shapes::StructureShape.new(name: 'UpdateBotAliasResponse')
UpdateBotLocaleRequest = Shapes::StructureShape.new(name: 'UpdateBotLocaleRequest')
UpdateBotLocaleResponse = Shapes::StructureShape.new(name: 'UpdateBotLocaleResponse')
UpdateBotRequest = Shapes::StructureShape.new(name: 'UpdateBotRequest')
UpdateBotResponse = Shapes::StructureShape.new(name: 'UpdateBotResponse')
UpdateIntentRequest = Shapes::StructureShape.new(name: 'UpdateIntentRequest')
UpdateIntentResponse = Shapes::StructureShape.new(name: 'UpdateIntentResponse')
UpdateSlotRequest = Shapes::StructureShape.new(name: 'UpdateSlotRequest')
UpdateSlotResponse = Shapes::StructureShape.new(name: 'UpdateSlotResponse')
UpdateSlotTypeRequest = Shapes::StructureShape.new(name: 'UpdateSlotTypeRequest')
UpdateSlotTypeResponse = Shapes::StructureShape.new(name: 'UpdateSlotTypeResponse')
Utterance = Shapes::StringShape.new(name: 'Utterance')
ValidationException = Shapes::StructureShape.new(name: 'ValidationException')
Value = Shapes::StringShape.new(name: 'Value')
VoiceId = Shapes::StringShape.new(name: 'VoiceId')
VoiceSettings = Shapes::StructureShape.new(name: 'VoiceSettings')
WaitAndContinueSpecification = Shapes::StructureShape.new(name: 'WaitAndContinueSpecification')
AudioLogDestination.add_member(:s3_bucket, Shapes::ShapeRef.new(shape: S3BucketLogDestination, required: true, location_name: "s3Bucket"))
AudioLogDestination.struct_class = Types::AudioLogDestination
AudioLogSetting.add_member(:enabled, Shapes::ShapeRef.new(shape: Boolean, required: true, location_name: "enabled"))
AudioLogSetting.add_member(:destination, Shapes::ShapeRef.new(shape: AudioLogDestination, required: true, location_name: "destination"))
AudioLogSetting.struct_class = Types::AudioLogSetting
AudioLogSettingsList.member = Shapes::ShapeRef.new(shape: AudioLogSetting)
BotAliasHistoryEvent.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
BotAliasHistoryEvent.add_member(:start_date, Shapes::ShapeRef.new(shape: Timestamp, location_name: "startDate"))
BotAliasHistoryEvent.add_member(:end_date, Shapes::ShapeRef.new(shape: Timestamp, location_name: "endDate"))
BotAliasHistoryEvent.struct_class = Types::BotAliasHistoryEvent
BotAliasHistoryEventsList.member = Shapes::ShapeRef.new(shape: BotAliasHistoryEvent)
BotAliasLocaleSettings.add_member(:enabled, Shapes::ShapeRef.new(shape: Boolean, required: true, location_name: "enabled"))
BotAliasLocaleSettings.add_member(:code_hook_specification, Shapes::ShapeRef.new(shape: CodeHookSpecification, location_name: "codeHookSpecification"))
BotAliasLocaleSettings.struct_class = Types::BotAliasLocaleSettings
BotAliasLocaleSettingsMap.key = Shapes::ShapeRef.new(shape: LocaleId)
BotAliasLocaleSettingsMap.value = Shapes::ShapeRef.new(shape: BotAliasLocaleSettings)
BotAliasSummary.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, location_name: "botAliasId"))
BotAliasSummary.add_member(:bot_alias_name, Shapes::ShapeRef.new(shape: Name, location_name: "botAliasName"))
BotAliasSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
BotAliasSummary.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
BotAliasSummary.add_member(:bot_alias_status, Shapes::ShapeRef.new(shape: BotAliasStatus, location_name: "botAliasStatus"))
BotAliasSummary.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
BotAliasSummary.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
BotAliasSummary.struct_class = Types::BotAliasSummary
BotAliasSummaryList.member = Shapes::ShapeRef.new(shape: BotAliasSummary)
BotFilter.add_member(:name, Shapes::ShapeRef.new(shape: BotFilterName, required: true, location_name: "name"))
BotFilter.add_member(:values, Shapes::ShapeRef.new(shape: FilterValues, required: true, location_name: "values"))
BotFilter.add_member(:operator, Shapes::ShapeRef.new(shape: BotFilterOperator, required: true, location_name: "operator"))
BotFilter.struct_class = Types::BotFilter
BotFilters.member = Shapes::ShapeRef.new(shape: BotFilter)
BotLocaleFilter.add_member(:name, Shapes::ShapeRef.new(shape: BotLocaleFilterName, required: true, location_name: "name"))
BotLocaleFilter.add_member(:values, Shapes::ShapeRef.new(shape: FilterValues, required: true, location_name: "values"))
BotLocaleFilter.add_member(:operator, Shapes::ShapeRef.new(shape: BotLocaleFilterOperator, required: true, location_name: "operator"))
BotLocaleFilter.struct_class = Types::BotLocaleFilter
BotLocaleFilters.member = Shapes::ShapeRef.new(shape: BotLocaleFilter)
BotLocaleHistoryEvent.add_member(:event, Shapes::ShapeRef.new(shape: BotLocaleHistoryEventDescription, required: true, location_name: "event"))
BotLocaleHistoryEvent.add_member(:event_date, Shapes::ShapeRef.new(shape: Timestamp, required: true, location_name: "eventDate"))
BotLocaleHistoryEvent.struct_class = Types::BotLocaleHistoryEvent
BotLocaleHistoryEventsList.member = Shapes::ShapeRef.new(shape: BotLocaleHistoryEvent)
BotLocaleSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: BotLocaleSortAttribute, required: true, location_name: "attribute"))
BotLocaleSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
BotLocaleSortBy.struct_class = Types::BotLocaleSortBy
BotLocaleSummary.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
BotLocaleSummary.add_member(:locale_name, Shapes::ShapeRef.new(shape: LocaleName, location_name: "localeName"))
BotLocaleSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
BotLocaleSummary.add_member(:bot_locale_status, Shapes::ShapeRef.new(shape: BotLocaleStatus, location_name: "botLocaleStatus"))
BotLocaleSummary.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
BotLocaleSummary.add_member(:last_build_submitted_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastBuildSubmittedDateTime"))
BotLocaleSummary.struct_class = Types::BotLocaleSummary
BotLocaleSummaryList.member = Shapes::ShapeRef.new(shape: BotLocaleSummary)
BotSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: BotSortAttribute, required: true, location_name: "attribute"))
BotSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
BotSortBy.struct_class = Types::BotSortBy
BotSummary.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
BotSummary.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, location_name: "botName"))
BotSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
BotSummary.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
BotSummary.add_member(:latest_bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, location_name: "latestBotVersion"))
BotSummary.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
BotSummary.struct_class = Types::BotSummary
BotSummaryList.member = Shapes::ShapeRef.new(shape: BotSummary)
BotVersionLocaleDetails.add_member(:source_bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location_name: "sourceBotVersion"))
BotVersionLocaleDetails.struct_class = Types::BotVersionLocaleDetails
BotVersionLocaleSpecification.key = Shapes::ShapeRef.new(shape: LocaleId)
BotVersionLocaleSpecification.value = Shapes::ShapeRef.new(shape: BotVersionLocaleDetails)
BotVersionSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: BotVersionSortAttribute, required: true, location_name: "attribute"))
BotVersionSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
BotVersionSortBy.struct_class = Types::BotVersionSortBy
BotVersionSummary.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, location_name: "botName"))
BotVersionSummary.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
BotVersionSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
BotVersionSummary.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
BotVersionSummary.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
BotVersionSummary.struct_class = Types::BotVersionSummary
BotVersionSummaryList.member = Shapes::ShapeRef.new(shape: BotVersionSummary)
BuildBotLocaleRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
BuildBotLocaleRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
BuildBotLocaleRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
BuildBotLocaleRequest.struct_class = Types::BuildBotLocaleRequest
BuildBotLocaleResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
BuildBotLocaleResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
BuildBotLocaleResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
BuildBotLocaleResponse.add_member(:bot_locale_status, Shapes::ShapeRef.new(shape: BotLocaleStatus, location_name: "botLocaleStatus"))
BuildBotLocaleResponse.add_member(:last_build_submitted_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastBuildSubmittedDateTime"))
BuildBotLocaleResponse.struct_class = Types::BuildBotLocaleResponse
BuiltInIntentSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: BuiltInIntentSortAttribute, required: true, location_name: "attribute"))
BuiltInIntentSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
BuiltInIntentSortBy.struct_class = Types::BuiltInIntentSortBy
BuiltInIntentSummary.add_member(:intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "intentSignature"))
BuiltInIntentSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
BuiltInIntentSummary.struct_class = Types::BuiltInIntentSummary
BuiltInIntentSummaryList.member = Shapes::ShapeRef.new(shape: BuiltInIntentSummary)
BuiltInSlotTypeSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: BuiltInSlotTypeSortAttribute, required: true, location_name: "attribute"))
BuiltInSlotTypeSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
BuiltInSlotTypeSortBy.struct_class = Types::BuiltInSlotTypeSortBy
BuiltInSlotTypeSummary.add_member(:slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "slotTypeSignature"))
BuiltInSlotTypeSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
BuiltInSlotTypeSummary.struct_class = Types::BuiltInSlotTypeSummary
BuiltInSlotTypeSummaryList.member = Shapes::ShapeRef.new(shape: BuiltInSlotTypeSummary)
Button.add_member(:text, Shapes::ShapeRef.new(shape: ButtonText, required: true, location_name: "text"))
Button.add_member(:value, Shapes::ShapeRef.new(shape: ButtonValue, required: true, location_name: "value"))
Button.struct_class = Types::Button
ButtonsList.member = Shapes::ShapeRef.new(shape: Button)
CloudWatchLogGroupLogDestination.add_member(:cloud_watch_log_group_arn, Shapes::ShapeRef.new(shape: CloudWatchLogGroupArn, required: true, location_name: "cloudWatchLogGroupArn"))
CloudWatchLogGroupLogDestination.add_member(:log_prefix, Shapes::ShapeRef.new(shape: LogPrefix, required: true, location_name: "logPrefix"))
CloudWatchLogGroupLogDestination.struct_class = Types::CloudWatchLogGroupLogDestination
CodeHookSpecification.add_member(:lambda_code_hook, Shapes::ShapeRef.new(shape: LambdaCodeHook, required: true, location_name: "lambdaCodeHook"))
CodeHookSpecification.struct_class = Types::CodeHookSpecification
ConflictException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
ConflictException.struct_class = Types::ConflictException
ConversationLogSettings.add_member(:text_log_settings, Shapes::ShapeRef.new(shape: TextLogSettingsList, location_name: "textLogSettings"))
ConversationLogSettings.add_member(:audio_log_settings, Shapes::ShapeRef.new(shape: AudioLogSettingsList, location_name: "audioLogSettings"))
ConversationLogSettings.struct_class = Types::ConversationLogSettings
CreateBotAliasRequest.add_member(:bot_alias_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "botAliasName"))
CreateBotAliasRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotAliasRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, location_name: "botVersion"))
CreateBotAliasRequest.add_member(:bot_alias_locale_settings, Shapes::ShapeRef.new(shape: BotAliasLocaleSettingsMap, location_name: "botAliasLocaleSettings"))
CreateBotAliasRequest.add_member(:conversation_log_settings, Shapes::ShapeRef.new(shape: ConversationLogSettings, location_name: "conversationLogSettings"))
CreateBotAliasRequest.add_member(:sentiment_analysis_settings, Shapes::ShapeRef.new(shape: SentimentAnalysisSettings, location_name: "sentimentAnalysisSettings"))
CreateBotAliasRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
CreateBotAliasRequest.add_member(:tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "tags"))
CreateBotAliasRequest.struct_class = Types::CreateBotAliasRequest
CreateBotAliasResponse.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, location_name: "botAliasId"))
CreateBotAliasResponse.add_member(:bot_alias_name, Shapes::ShapeRef.new(shape: Name, location_name: "botAliasName"))
CreateBotAliasResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotAliasResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, location_name: "botVersion"))
CreateBotAliasResponse.add_member(:bot_alias_locale_settings, Shapes::ShapeRef.new(shape: BotAliasLocaleSettingsMap, location_name: "botAliasLocaleSettings"))
CreateBotAliasResponse.add_member(:conversation_log_settings, Shapes::ShapeRef.new(shape: ConversationLogSettings, location_name: "conversationLogSettings"))
CreateBotAliasResponse.add_member(:sentiment_analysis_settings, Shapes::ShapeRef.new(shape: SentimentAnalysisSettings, location_name: "sentimentAnalysisSettings"))
CreateBotAliasResponse.add_member(:bot_alias_status, Shapes::ShapeRef.new(shape: BotAliasStatus, location_name: "botAliasStatus"))
CreateBotAliasResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateBotAliasResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateBotAliasResponse.add_member(:tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "tags"))
CreateBotAliasResponse.struct_class = Types::CreateBotAliasResponse
CreateBotLocaleRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
CreateBotLocaleRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
CreateBotLocaleRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location_name: "localeId"))
CreateBotLocaleRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotLocaleRequest.add_member(:nlu_intent_confidence_threshold, Shapes::ShapeRef.new(shape: ConfidenceThreshold, required: true, location_name: "nluIntentConfidenceThreshold"))
CreateBotLocaleRequest.add_member(:voice_settings, Shapes::ShapeRef.new(shape: VoiceSettings, location_name: "voiceSettings"))
CreateBotLocaleRequest.struct_class = Types::CreateBotLocaleRequest
CreateBotLocaleResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateBotLocaleResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
CreateBotLocaleResponse.add_member(:locale_name, Shapes::ShapeRef.new(shape: LocaleName, location_name: "localeName"))
CreateBotLocaleResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
CreateBotLocaleResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotLocaleResponse.add_member(:nlu_intent_confidence_threshold, Shapes::ShapeRef.new(shape: ConfidenceThreshold, location_name: "nluIntentConfidenceThreshold"))
CreateBotLocaleResponse.add_member(:voice_settings, Shapes::ShapeRef.new(shape: VoiceSettings, location_name: "voiceSettings"))
CreateBotLocaleResponse.add_member(:bot_locale_status, Shapes::ShapeRef.new(shape: BotLocaleStatus, location_name: "botLocaleStatus"))
CreateBotLocaleResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateBotLocaleResponse.struct_class = Types::CreateBotLocaleResponse
CreateBotRequest.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "botName"))
CreateBotRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotRequest.add_member(:role_arn, Shapes::ShapeRef.new(shape: RoleArn, required: true, location_name: "roleArn"))
CreateBotRequest.add_member(:data_privacy, Shapes::ShapeRef.new(shape: DataPrivacy, required: true, location_name: "dataPrivacy"))
CreateBotRequest.add_member(:idle_session_ttl_in_seconds, Shapes::ShapeRef.new(shape: SessionTTL, required: true, location_name: "idleSessionTTLInSeconds"))
CreateBotRequest.add_member(:bot_tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "botTags"))
CreateBotRequest.add_member(:test_bot_alias_tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "testBotAliasTags"))
CreateBotRequest.struct_class = Types::CreateBotRequest
CreateBotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateBotResponse.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, location_name: "botName"))
CreateBotResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotResponse.add_member(:role_arn, Shapes::ShapeRef.new(shape: RoleArn, location_name: "roleArn"))
CreateBotResponse.add_member(:data_privacy, Shapes::ShapeRef.new(shape: DataPrivacy, location_name: "dataPrivacy"))
CreateBotResponse.add_member(:idle_session_ttl_in_seconds, Shapes::ShapeRef.new(shape: SessionTTL, location_name: "idleSessionTTLInSeconds"))
CreateBotResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
CreateBotResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateBotResponse.add_member(:bot_tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "botTags"))
CreateBotResponse.add_member(:test_bot_alias_tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "testBotAliasTags"))
CreateBotResponse.struct_class = Types::CreateBotResponse
CreateBotVersionRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
CreateBotVersionRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotVersionRequest.add_member(:bot_version_locale_specification, Shapes::ShapeRef.new(shape: BotVersionLocaleSpecification, required: true, location_name: "botVersionLocaleSpecification"))
CreateBotVersionRequest.struct_class = Types::CreateBotVersionRequest
CreateBotVersionResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateBotVersionResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateBotVersionResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, location_name: "botVersion"))
CreateBotVersionResponse.add_member(:bot_version_locale_specification, Shapes::ShapeRef.new(shape: BotVersionLocaleSpecification, location_name: "botVersionLocaleSpecification"))
CreateBotVersionResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
CreateBotVersionResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateBotVersionResponse.struct_class = Types::CreateBotVersionResponse
CreateIntentRequest.add_member(:intent_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "intentName"))
CreateIntentRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateIntentRequest.add_member(:parent_intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "parentIntentSignature"))
CreateIntentRequest.add_member(:sample_utterances, Shapes::ShapeRef.new(shape: SampleUtterancesList, location_name: "sampleUtterances"))
CreateIntentRequest.add_member(:dialog_code_hook, Shapes::ShapeRef.new(shape: DialogCodeHookSettings, location_name: "dialogCodeHook"))
CreateIntentRequest.add_member(:fulfillment_code_hook, Shapes::ShapeRef.new(shape: FulfillmentCodeHookSettings, location_name: "fulfillmentCodeHook"))
CreateIntentRequest.add_member(:intent_confirmation_setting, Shapes::ShapeRef.new(shape: IntentConfirmationSetting, location_name: "intentConfirmationSetting"))
CreateIntentRequest.add_member(:intent_closing_setting, Shapes::ShapeRef.new(shape: IntentClosingSetting, location_name: "intentClosingSetting"))
CreateIntentRequest.add_member(:input_contexts, Shapes::ShapeRef.new(shape: InputContextsList, location_name: "inputContexts"))
CreateIntentRequest.add_member(:output_contexts, Shapes::ShapeRef.new(shape: OutputContextsList, location_name: "outputContexts"))
CreateIntentRequest.add_member(:kendra_configuration, Shapes::ShapeRef.new(shape: KendraConfiguration, location_name: "kendraConfiguration"))
CreateIntentRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
CreateIntentRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
CreateIntentRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
CreateIntentRequest.struct_class = Types::CreateIntentRequest
CreateIntentResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
CreateIntentResponse.add_member(:intent_name, Shapes::ShapeRef.new(shape: Name, location_name: "intentName"))
CreateIntentResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateIntentResponse.add_member(:parent_intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "parentIntentSignature"))
CreateIntentResponse.add_member(:sample_utterances, Shapes::ShapeRef.new(shape: SampleUtterancesList, location_name: "sampleUtterances"))
CreateIntentResponse.add_member(:dialog_code_hook, Shapes::ShapeRef.new(shape: DialogCodeHookSettings, location_name: "dialogCodeHook"))
CreateIntentResponse.add_member(:fulfillment_code_hook, Shapes::ShapeRef.new(shape: FulfillmentCodeHookSettings, location_name: "fulfillmentCodeHook"))
CreateIntentResponse.add_member(:intent_confirmation_setting, Shapes::ShapeRef.new(shape: IntentConfirmationSetting, location_name: "intentConfirmationSetting"))
CreateIntentResponse.add_member(:intent_closing_setting, Shapes::ShapeRef.new(shape: IntentClosingSetting, location_name: "intentClosingSetting"))
CreateIntentResponse.add_member(:input_contexts, Shapes::ShapeRef.new(shape: InputContextsList, location_name: "inputContexts"))
CreateIntentResponse.add_member(:output_contexts, Shapes::ShapeRef.new(shape: OutputContextsList, location_name: "outputContexts"))
CreateIntentResponse.add_member(:kendra_configuration, Shapes::ShapeRef.new(shape: KendraConfiguration, location_name: "kendraConfiguration"))
CreateIntentResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateIntentResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
CreateIntentResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
CreateIntentResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateIntentResponse.struct_class = Types::CreateIntentResponse
CreateSlotRequest.add_member(:slot_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "slotName"))
CreateSlotRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateSlotRequest.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: BuiltInOrCustomSlotTypeId, required: true, location_name: "slotTypeId"))
CreateSlotRequest.add_member(:value_elicitation_setting, Shapes::ShapeRef.new(shape: SlotValueElicitationSetting, required: true, location_name: "valueElicitationSetting"))
CreateSlotRequest.add_member(:obfuscation_setting, Shapes::ShapeRef.new(shape: ObfuscationSetting, location_name: "obfuscationSetting"))
CreateSlotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
CreateSlotRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
CreateSlotRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
CreateSlotRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
CreateSlotRequest.struct_class = Types::CreateSlotRequest
CreateSlotResponse.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotId"))
CreateSlotResponse.add_member(:slot_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotName"))
CreateSlotResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateSlotResponse.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: BuiltInOrCustomSlotTypeId, location_name: "slotTypeId"))
CreateSlotResponse.add_member(:value_elicitation_setting, Shapes::ShapeRef.new(shape: SlotValueElicitationSetting, location_name: "valueElicitationSetting"))
CreateSlotResponse.add_member(:obfuscation_setting, Shapes::ShapeRef.new(shape: ObfuscationSetting, location_name: "obfuscationSetting"))
CreateSlotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateSlotResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
CreateSlotResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
CreateSlotResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
CreateSlotResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateSlotResponse.struct_class = Types::CreateSlotResponse
CreateSlotTypeRequest.add_member(:slot_type_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "slotTypeName"))
CreateSlotTypeRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateSlotTypeRequest.add_member(:slot_type_values, Shapes::ShapeRef.new(shape: SlotTypeValues, location_name: "slotTypeValues"))
CreateSlotTypeRequest.add_member(:value_selection_setting, Shapes::ShapeRef.new(shape: SlotValueSelectionSetting, required: true, location_name: "valueSelectionSetting"))
CreateSlotTypeRequest.add_member(:parent_slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "parentSlotTypeSignature"))
CreateSlotTypeRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
CreateSlotTypeRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
CreateSlotTypeRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
CreateSlotTypeRequest.struct_class = Types::CreateSlotTypeRequest
CreateSlotTypeResponse.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotTypeId"))
CreateSlotTypeResponse.add_member(:slot_type_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotTypeName"))
CreateSlotTypeResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
CreateSlotTypeResponse.add_member(:slot_type_values, Shapes::ShapeRef.new(shape: SlotTypeValues, location_name: "slotTypeValues"))
CreateSlotTypeResponse.add_member(:value_selection_setting, Shapes::ShapeRef.new(shape: SlotValueSelectionSetting, location_name: "valueSelectionSetting"))
CreateSlotTypeResponse.add_member(:parent_slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "parentSlotTypeSignature"))
CreateSlotTypeResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
CreateSlotTypeResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
CreateSlotTypeResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
CreateSlotTypeResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
CreateSlotTypeResponse.struct_class = Types::CreateSlotTypeResponse
CustomPayload.add_member(:value, Shapes::ShapeRef.new(shape: CustomPayloadValue, required: true, location_name: "value"))
CustomPayload.struct_class = Types::CustomPayload
DataPrivacy.add_member(:child_directed, Shapes::ShapeRef.new(shape: ChildDirected, required: true, location_name: "childDirected"))
DataPrivacy.struct_class = Types::DataPrivacy
DeleteBotAliasRequest.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, required: true, location: "uri", location_name: "botAliasId"))
DeleteBotAliasRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteBotAliasRequest.add_member(:skip_resource_in_use_check, Shapes::ShapeRef.new(shape: SkipResourceInUseCheck, location: "querystring", location_name: "skipResourceInUseCheck"))
DeleteBotAliasRequest.struct_class = Types::DeleteBotAliasRequest
DeleteBotAliasResponse.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, location_name: "botAliasId"))
DeleteBotAliasResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DeleteBotAliasResponse.add_member(:bot_alias_status, Shapes::ShapeRef.new(shape: BotAliasStatus, location_name: "botAliasStatus"))
DeleteBotAliasResponse.struct_class = Types::DeleteBotAliasResponse
DeleteBotLocaleRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteBotLocaleRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
DeleteBotLocaleRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DeleteBotLocaleRequest.struct_class = Types::DeleteBotLocaleRequest
DeleteBotLocaleResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DeleteBotLocaleResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
DeleteBotLocaleResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
DeleteBotLocaleResponse.add_member(:bot_locale_status, Shapes::ShapeRef.new(shape: BotLocaleStatus, location_name: "botLocaleStatus"))
DeleteBotLocaleResponse.struct_class = Types::DeleteBotLocaleResponse
DeleteBotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteBotRequest.add_member(:skip_resource_in_use_check, Shapes::ShapeRef.new(shape: SkipResourceInUseCheck, location: "querystring", location_name: "skipResourceInUseCheck"))
DeleteBotRequest.struct_class = Types::DeleteBotRequest
DeleteBotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DeleteBotResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
DeleteBotResponse.struct_class = Types::DeleteBotResponse
DeleteBotVersionRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteBotVersionRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, required: true, location: "uri", location_name: "botVersion"))
DeleteBotVersionRequest.add_member(:skip_resource_in_use_check, Shapes::ShapeRef.new(shape: SkipResourceInUseCheck, location: "querystring", location_name: "skipResourceInUseCheck"))
DeleteBotVersionRequest.struct_class = Types::DeleteBotVersionRequest
DeleteBotVersionResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DeleteBotVersionResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, location_name: "botVersion"))
DeleteBotVersionResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
DeleteBotVersionResponse.struct_class = Types::DeleteBotVersionResponse
DeleteIntentRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
DeleteIntentRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteIntentRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
DeleteIntentRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DeleteIntentRequest.struct_class = Types::DeleteIntentRequest
DeleteSlotRequest.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "slotId"))
DeleteSlotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteSlotRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
DeleteSlotRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DeleteSlotRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
DeleteSlotRequest.struct_class = Types::DeleteSlotRequest
DeleteSlotTypeRequest.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "slotTypeId"))
DeleteSlotTypeRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DeleteSlotTypeRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
DeleteSlotTypeRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DeleteSlotTypeRequest.add_member(:skip_resource_in_use_check, Shapes::ShapeRef.new(shape: SkipResourceInUseCheck, location: "querystring", location_name: "skipResourceInUseCheck"))
DeleteSlotTypeRequest.struct_class = Types::DeleteSlotTypeRequest
DescribeBotAliasRequest.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, required: true, location: "uri", location_name: "botAliasId"))
DescribeBotAliasRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeBotAliasRequest.struct_class = Types::DescribeBotAliasRequest
DescribeBotAliasResponse.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, location_name: "botAliasId"))
DescribeBotAliasResponse.add_member(:bot_alias_name, Shapes::ShapeRef.new(shape: Name, location_name: "botAliasName"))
DescribeBotAliasResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeBotAliasResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
DescribeBotAliasResponse.add_member(:bot_alias_locale_settings, Shapes::ShapeRef.new(shape: BotAliasLocaleSettingsMap, location_name: "botAliasLocaleSettings"))
DescribeBotAliasResponse.add_member(:conversation_log_settings, Shapes::ShapeRef.new(shape: ConversationLogSettings, location_name: "conversationLogSettings"))
DescribeBotAliasResponse.add_member(:sentiment_analysis_settings, Shapes::ShapeRef.new(shape: SentimentAnalysisSettings, location_name: "sentimentAnalysisSettings"))
DescribeBotAliasResponse.add_member(:bot_alias_history_events, Shapes::ShapeRef.new(shape: BotAliasHistoryEventsList, location_name: "botAliasHistoryEvents"))
DescribeBotAliasResponse.add_member(:bot_alias_status, Shapes::ShapeRef.new(shape: BotAliasStatus, location_name: "botAliasStatus"))
DescribeBotAliasResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeBotAliasResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeBotAliasResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
DescribeBotAliasResponse.struct_class = Types::DescribeBotAliasResponse
DescribeBotLocaleRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeBotLocaleRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
DescribeBotLocaleRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DescribeBotLocaleRequest.struct_class = Types::DescribeBotLocaleRequest
DescribeBotLocaleResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeBotLocaleResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
DescribeBotLocaleResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
DescribeBotLocaleResponse.add_member(:locale_name, Shapes::ShapeRef.new(shape: LocaleName, location_name: "localeName"))
DescribeBotLocaleResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeBotLocaleResponse.add_member(:nlu_intent_confidence_threshold, Shapes::ShapeRef.new(shape: ConfidenceThreshold, location_name: "nluIntentConfidenceThreshold"))
DescribeBotLocaleResponse.add_member(:voice_settings, Shapes::ShapeRef.new(shape: VoiceSettings, location_name: "voiceSettings"))
DescribeBotLocaleResponse.add_member(:intents_count, Shapes::ShapeRef.new(shape: ResourceCount, location_name: "intentsCount"))
DescribeBotLocaleResponse.add_member(:slot_types_count, Shapes::ShapeRef.new(shape: ResourceCount, location_name: "slotTypesCount"))
DescribeBotLocaleResponse.add_member(:bot_locale_status, Shapes::ShapeRef.new(shape: BotLocaleStatus, location_name: "botLocaleStatus"))
DescribeBotLocaleResponse.add_member(:failure_reasons, Shapes::ShapeRef.new(shape: FailureReasons, location_name: "failureReasons"))
DescribeBotLocaleResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeBotLocaleResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
DescribeBotLocaleResponse.add_member(:last_build_submitted_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastBuildSubmittedDateTime"))
DescribeBotLocaleResponse.add_member(:bot_locale_history_events, Shapes::ShapeRef.new(shape: BotLocaleHistoryEventsList, location_name: "botLocaleHistoryEvents"))
DescribeBotLocaleResponse.struct_class = Types::DescribeBotLocaleResponse
DescribeBotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeBotRequest.struct_class = Types::DescribeBotRequest
DescribeBotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeBotResponse.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, location_name: "botName"))
DescribeBotResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeBotResponse.add_member(:role_arn, Shapes::ShapeRef.new(shape: RoleArn, location_name: "roleArn"))
DescribeBotResponse.add_member(:data_privacy, Shapes::ShapeRef.new(shape: DataPrivacy, location_name: "dataPrivacy"))
DescribeBotResponse.add_member(:idle_session_ttl_in_seconds, Shapes::ShapeRef.new(shape: SessionTTL, location_name: "idleSessionTTLInSeconds"))
DescribeBotResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
DescribeBotResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeBotResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
DescribeBotResponse.struct_class = Types::DescribeBotResponse
DescribeBotVersionRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeBotVersionRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, required: true, location: "uri", location_name: "botVersion"))
DescribeBotVersionRequest.struct_class = Types::DescribeBotVersionRequest
DescribeBotVersionResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeBotVersionResponse.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, location_name: "botName"))
DescribeBotVersionResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: NumericalBotVersion, location_name: "botVersion"))
DescribeBotVersionResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeBotVersionResponse.add_member(:role_arn, Shapes::ShapeRef.new(shape: RoleArn, location_name: "roleArn"))
DescribeBotVersionResponse.add_member(:data_privacy, Shapes::ShapeRef.new(shape: DataPrivacy, location_name: "dataPrivacy"))
DescribeBotVersionResponse.add_member(:idle_session_ttl_in_seconds, Shapes::ShapeRef.new(shape: SessionTTL, location_name: "idleSessionTTLInSeconds"))
DescribeBotVersionResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
DescribeBotVersionResponse.add_member(:failure_reasons, Shapes::ShapeRef.new(shape: FailureReasons, location_name: "failureReasons"))
DescribeBotVersionResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeBotVersionResponse.struct_class = Types::DescribeBotVersionResponse
DescribeIntentRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
DescribeIntentRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeIntentRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
DescribeIntentRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DescribeIntentRequest.struct_class = Types::DescribeIntentRequest
DescribeIntentResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
DescribeIntentResponse.add_member(:intent_name, Shapes::ShapeRef.new(shape: Name, location_name: "intentName"))
DescribeIntentResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeIntentResponse.add_member(:parent_intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "parentIntentSignature"))
DescribeIntentResponse.add_member(:sample_utterances, Shapes::ShapeRef.new(shape: SampleUtterancesList, location_name: "sampleUtterances"))
DescribeIntentResponse.add_member(:dialog_code_hook, Shapes::ShapeRef.new(shape: DialogCodeHookSettings, location_name: "dialogCodeHook"))
DescribeIntentResponse.add_member(:fulfillment_code_hook, Shapes::ShapeRef.new(shape: FulfillmentCodeHookSettings, location_name: "fulfillmentCodeHook"))
DescribeIntentResponse.add_member(:slot_priorities, Shapes::ShapeRef.new(shape: SlotPrioritiesList, location_name: "slotPriorities"))
DescribeIntentResponse.add_member(:intent_confirmation_setting, Shapes::ShapeRef.new(shape: IntentConfirmationSetting, location_name: "intentConfirmationSetting"))
DescribeIntentResponse.add_member(:intent_closing_setting, Shapes::ShapeRef.new(shape: IntentClosingSetting, location_name: "intentClosingSetting"))
DescribeIntentResponse.add_member(:input_contexts, Shapes::ShapeRef.new(shape: InputContextsList, location_name: "inputContexts"))
DescribeIntentResponse.add_member(:output_contexts, Shapes::ShapeRef.new(shape: OutputContextsList, location_name: "outputContexts"))
DescribeIntentResponse.add_member(:kendra_configuration, Shapes::ShapeRef.new(shape: KendraConfiguration, location_name: "kendraConfiguration"))
DescribeIntentResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeIntentResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
DescribeIntentResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
DescribeIntentResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeIntentResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
DescribeIntentResponse.struct_class = Types::DescribeIntentResponse
DescribeSlotRequest.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "slotId"))
DescribeSlotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeSlotRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
DescribeSlotRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DescribeSlotRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
DescribeSlotRequest.struct_class = Types::DescribeSlotRequest
DescribeSlotResponse.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotId"))
DescribeSlotResponse.add_member(:slot_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotName"))
DescribeSlotResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeSlotResponse.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: BuiltInOrCustomSlotTypeId, location_name: "slotTypeId"))
DescribeSlotResponse.add_member(:value_elicitation_setting, Shapes::ShapeRef.new(shape: SlotValueElicitationSetting, location_name: "valueElicitationSetting"))
DescribeSlotResponse.add_member(:obfuscation_setting, Shapes::ShapeRef.new(shape: ObfuscationSetting, location_name: "obfuscationSetting"))
DescribeSlotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeSlotResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
DescribeSlotResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
DescribeSlotResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
DescribeSlotResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeSlotResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
DescribeSlotResponse.struct_class = Types::DescribeSlotResponse
DescribeSlotTypeRequest.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "slotTypeId"))
DescribeSlotTypeRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
DescribeSlotTypeRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
DescribeSlotTypeRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
DescribeSlotTypeRequest.struct_class = Types::DescribeSlotTypeRequest
DescribeSlotTypeResponse.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotTypeId"))
DescribeSlotTypeResponse.add_member(:slot_type_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotTypeName"))
DescribeSlotTypeResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
DescribeSlotTypeResponse.add_member(:slot_type_values, Shapes::ShapeRef.new(shape: SlotTypeValues, location_name: "slotTypeValues"))
DescribeSlotTypeResponse.add_member(:value_selection_setting, Shapes::ShapeRef.new(shape: SlotValueSelectionSetting, location_name: "valueSelectionSetting"))
DescribeSlotTypeResponse.add_member(:parent_slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "parentSlotTypeSignature"))
DescribeSlotTypeResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
DescribeSlotTypeResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
DescribeSlotTypeResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
DescribeSlotTypeResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
DescribeSlotTypeResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
DescribeSlotTypeResponse.struct_class = Types::DescribeSlotTypeResponse
DialogCodeHookSettings.add_member(:enabled, Shapes::ShapeRef.new(shape: Boolean, required: true, location_name: "enabled"))
DialogCodeHookSettings.struct_class = Types::DialogCodeHookSettings
FailureReasons.member = Shapes::ShapeRef.new(shape: FailureReason)
FilterValues.member = Shapes::ShapeRef.new(shape: FilterValue)
FulfillmentCodeHookSettings.add_member(:enabled, Shapes::ShapeRef.new(shape: Boolean, required: true, location_name: "enabled"))
FulfillmentCodeHookSettings.struct_class = Types::FulfillmentCodeHookSettings
ImageResponseCard.add_member(:title, Shapes::ShapeRef.new(shape: AttachmentTitle, required: true, location_name: "title"))
ImageResponseCard.add_member(:subtitle, Shapes::ShapeRef.new(shape: AttachmentTitle, location_name: "subtitle"))
ImageResponseCard.add_member(:image_url, Shapes::ShapeRef.new(shape: AttachmentUrl, location_name: "imageUrl"))
ImageResponseCard.add_member(:buttons, Shapes::ShapeRef.new(shape: ButtonsList, location_name: "buttons"))
ImageResponseCard.struct_class = Types::ImageResponseCard
InputContext.add_member(:name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "name"))
InputContext.struct_class = Types::InputContext
InputContextsList.member = Shapes::ShapeRef.new(shape: InputContext)
IntentClosingSetting.add_member(:closing_response, Shapes::ShapeRef.new(shape: ResponseSpecification, required: true, location_name: "closingResponse"))
IntentClosingSetting.struct_class = Types::IntentClosingSetting
IntentConfirmationSetting.add_member(:prompt_specification, Shapes::ShapeRef.new(shape: PromptSpecification, required: true, location_name: "promptSpecification"))
IntentConfirmationSetting.add_member(:declination_response, Shapes::ShapeRef.new(shape: ResponseSpecification, required: true, location_name: "declinationResponse"))
IntentConfirmationSetting.struct_class = Types::IntentConfirmationSetting
IntentFilter.add_member(:name, Shapes::ShapeRef.new(shape: IntentFilterName, required: true, location_name: "name"))
IntentFilter.add_member(:values, Shapes::ShapeRef.new(shape: FilterValues, required: true, location_name: "values"))
IntentFilter.add_member(:operator, Shapes::ShapeRef.new(shape: IntentFilterOperator, required: true, location_name: "operator"))
IntentFilter.struct_class = Types::IntentFilter
IntentFilters.member = Shapes::ShapeRef.new(shape: IntentFilter)
IntentSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: IntentSortAttribute, required: true, location_name: "attribute"))
IntentSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
IntentSortBy.struct_class = Types::IntentSortBy
IntentSummary.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
IntentSummary.add_member(:intent_name, Shapes::ShapeRef.new(shape: Name, location_name: "intentName"))
IntentSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
IntentSummary.add_member(:parent_intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "parentIntentSignature"))
IntentSummary.add_member(:input_contexts, Shapes::ShapeRef.new(shape: InputContextsList, location_name: "inputContexts"))
IntentSummary.add_member(:output_contexts, Shapes::ShapeRef.new(shape: OutputContextsList, location_name: "outputContexts"))
IntentSummary.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
IntentSummary.struct_class = Types::IntentSummary
IntentSummaryList.member = Shapes::ShapeRef.new(shape: IntentSummary)
InternalServerException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
InternalServerException.struct_class = Types::InternalServerException
KendraConfiguration.add_member(:kendra_index, Shapes::ShapeRef.new(shape: KendraIndexArn, required: true, location_name: "kendraIndex"))
KendraConfiguration.add_member(:query_filter_string_enabled, Shapes::ShapeRef.new(shape: Boolean, location_name: "queryFilterStringEnabled"))
KendraConfiguration.add_member(:query_filter_string, Shapes::ShapeRef.new(shape: QueryFilterString, location_name: "queryFilterString"))
KendraConfiguration.struct_class = Types::KendraConfiguration
LambdaCodeHook.add_member(:lambda_arn, Shapes::ShapeRef.new(shape: LambdaARN, required: true, location_name: "lambdaARN"))
LambdaCodeHook.add_member(:code_hook_interface_version, Shapes::ShapeRef.new(shape: CodeHookInterfaceVersion, required: true, location_name: "codeHookInterfaceVersion"))
LambdaCodeHook.struct_class = Types::LambdaCodeHook
ListBotAliasesRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
ListBotAliasesRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListBotAliasesRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotAliasesRequest.struct_class = Types::ListBotAliasesRequest
ListBotAliasesResponse.add_member(:bot_alias_summaries, Shapes::ShapeRef.new(shape: BotAliasSummaryList, location_name: "botAliasSummaries"))
ListBotAliasesResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotAliasesResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
ListBotAliasesResponse.struct_class = Types::ListBotAliasesResponse
ListBotLocalesRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
ListBotLocalesRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
ListBotLocalesRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: BotLocaleSortBy, location_name: "sortBy"))
ListBotLocalesRequest.add_member(:filters, Shapes::ShapeRef.new(shape: BotLocaleFilters, location_name: "filters"))
ListBotLocalesRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListBotLocalesRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotLocalesRequest.struct_class = Types::ListBotLocalesRequest
ListBotLocalesResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
ListBotLocalesResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
ListBotLocalesResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotLocalesResponse.add_member(:bot_locale_summaries, Shapes::ShapeRef.new(shape: BotLocaleSummaryList, location_name: "botLocaleSummaries"))
ListBotLocalesResponse.struct_class = Types::ListBotLocalesResponse
ListBotVersionsRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
ListBotVersionsRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: BotVersionSortBy, location_name: "sortBy"))
ListBotVersionsRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListBotVersionsRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotVersionsRequest.struct_class = Types::ListBotVersionsRequest
ListBotVersionsResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
ListBotVersionsResponse.add_member(:bot_version_summaries, Shapes::ShapeRef.new(shape: BotVersionSummaryList, location_name: "botVersionSummaries"))
ListBotVersionsResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotVersionsResponse.struct_class = Types::ListBotVersionsResponse
ListBotsRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: BotSortBy, location_name: "sortBy"))
ListBotsRequest.add_member(:filters, Shapes::ShapeRef.new(shape: BotFilters, location_name: "filters"))
ListBotsRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListBotsRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotsRequest.struct_class = Types::ListBotsRequest
ListBotsResponse.add_member(:bot_summaries, Shapes::ShapeRef.new(shape: BotSummaryList, location_name: "botSummaries"))
ListBotsResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBotsResponse.struct_class = Types::ListBotsResponse
ListBuiltInIntentsRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
ListBuiltInIntentsRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: BuiltInIntentSortBy, location_name: "sortBy"))
ListBuiltInIntentsRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: BuiltInsMaxResults, location_name: "maxResults"))
ListBuiltInIntentsRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBuiltInIntentsRequest.struct_class = Types::ListBuiltInIntentsRequest
ListBuiltInIntentsResponse.add_member(:built_in_intent_summaries, Shapes::ShapeRef.new(shape: BuiltInIntentSummaryList, location_name: "builtInIntentSummaries"))
ListBuiltInIntentsResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBuiltInIntentsResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
ListBuiltInIntentsResponse.struct_class = Types::ListBuiltInIntentsResponse
ListBuiltInSlotTypesRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
ListBuiltInSlotTypesRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: BuiltInSlotTypeSortBy, location_name: "sortBy"))
ListBuiltInSlotTypesRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: BuiltInsMaxResults, location_name: "maxResults"))
ListBuiltInSlotTypesRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBuiltInSlotTypesRequest.struct_class = Types::ListBuiltInSlotTypesRequest
ListBuiltInSlotTypesResponse.add_member(:built_in_slot_type_summaries, Shapes::ShapeRef.new(shape: BuiltInSlotTypeSummaryList, location_name: "builtInSlotTypeSummaries"))
ListBuiltInSlotTypesResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListBuiltInSlotTypesResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
ListBuiltInSlotTypesResponse.struct_class = Types::ListBuiltInSlotTypesResponse
ListIntentsRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
ListIntentsRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
ListIntentsRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
ListIntentsRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: IntentSortBy, location_name: "sortBy"))
ListIntentsRequest.add_member(:filters, Shapes::ShapeRef.new(shape: IntentFilters, location_name: "filters"))
ListIntentsRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListIntentsRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListIntentsRequest.struct_class = Types::ListIntentsRequest
ListIntentsResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
ListIntentsResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
ListIntentsResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
ListIntentsResponse.add_member(:intent_summaries, Shapes::ShapeRef.new(shape: IntentSummaryList, location_name: "intentSummaries"))
ListIntentsResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListIntentsResponse.struct_class = Types::ListIntentsResponse
ListSlotTypesRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
ListSlotTypesRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
ListSlotTypesRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
ListSlotTypesRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: SlotTypeSortBy, location_name: "sortBy"))
ListSlotTypesRequest.add_member(:filters, Shapes::ShapeRef.new(shape: SlotTypeFilters, location_name: "filters"))
ListSlotTypesRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListSlotTypesRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListSlotTypesRequest.struct_class = Types::ListSlotTypesRequest
ListSlotTypesResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
ListSlotTypesResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
ListSlotTypesResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
ListSlotTypesResponse.add_member(:slot_type_summaries, Shapes::ShapeRef.new(shape: SlotTypeSummaryList, location_name: "slotTypeSummaries"))
ListSlotTypesResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListSlotTypesResponse.struct_class = Types::ListSlotTypesResponse
ListSlotsRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
ListSlotsRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, required: true, location: "uri", location_name: "botVersion"))
ListSlotsRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
ListSlotsRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
ListSlotsRequest.add_member(:sort_by, Shapes::ShapeRef.new(shape: SlotSortBy, location_name: "sortBy"))
ListSlotsRequest.add_member(:filters, Shapes::ShapeRef.new(shape: SlotFilters, location_name: "filters"))
ListSlotsRequest.add_member(:max_results, Shapes::ShapeRef.new(shape: MaxResults, location_name: "maxResults"))
ListSlotsRequest.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListSlotsRequest.struct_class = Types::ListSlotsRequest
ListSlotsResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
ListSlotsResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
ListSlotsResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
ListSlotsResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
ListSlotsResponse.add_member(:slot_summaries, Shapes::ShapeRef.new(shape: SlotSummaryList, location_name: "slotSummaries"))
ListSlotsResponse.add_member(:next_token, Shapes::ShapeRef.new(shape: NextToken, location_name: "nextToken"))
ListSlotsResponse.struct_class = Types::ListSlotsResponse
ListTagsForResourceRequest.add_member(:resource_arn, Shapes::ShapeRef.new(shape: AmazonResourceName, required: true, location: "uri", location_name: "resourceARN"))
ListTagsForResourceRequest.struct_class = Types::ListTagsForResourceRequest
ListTagsForResourceResponse.add_member(:tags, Shapes::ShapeRef.new(shape: TagMap, location_name: "tags"))
ListTagsForResourceResponse.struct_class = Types::ListTagsForResourceResponse
Message.add_member(:plain_text_message, Shapes::ShapeRef.new(shape: PlainTextMessage, location_name: "plainTextMessage"))
Message.add_member(:custom_payload, Shapes::ShapeRef.new(shape: CustomPayload, location_name: "customPayload"))
Message.add_member(:ssml_message, Shapes::ShapeRef.new(shape: SSMLMessage, location_name: "ssmlMessage"))
Message.add_member(:image_response_card, Shapes::ShapeRef.new(shape: ImageResponseCard, location_name: "imageResponseCard"))
Message.struct_class = Types::Message
MessageGroup.add_member(:message, Shapes::ShapeRef.new(shape: Message, required: true, location_name: "message"))
MessageGroup.add_member(:variations, Shapes::ShapeRef.new(shape: MessageVariationsList, location_name: "variations"))
MessageGroup.struct_class = Types::MessageGroup
MessageGroupsList.member = Shapes::ShapeRef.new(shape: MessageGroup)
MessageVariationsList.member = Shapes::ShapeRef.new(shape: Message)
ObfuscationSetting.add_member(:obfuscation_setting_type, Shapes::ShapeRef.new(shape: ObfuscationSettingType, required: true, location_name: "obfuscationSettingType"))
ObfuscationSetting.struct_class = Types::ObfuscationSetting
OutputContext.add_member(:name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "name"))
OutputContext.add_member(:time_to_live_in_seconds, Shapes::ShapeRef.new(shape: ContextTimeToLiveInSeconds, required: true, location_name: "timeToLiveInSeconds"))
OutputContext.add_member(:turns_to_live, Shapes::ShapeRef.new(shape: ContextTurnsToLive, required: true, location_name: "turnsToLive"))
OutputContext.struct_class = Types::OutputContext
OutputContextsList.member = Shapes::ShapeRef.new(shape: OutputContext)
PlainTextMessage.add_member(:value, Shapes::ShapeRef.new(shape: PlainTextMessageValue, required: true, location_name: "value"))
PlainTextMessage.struct_class = Types::PlainTextMessage
PreconditionFailedException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
PreconditionFailedException.struct_class = Types::PreconditionFailedException
PromptSpecification.add_member(:message_groups, Shapes::ShapeRef.new(shape: MessageGroupsList, required: true, location_name: "messageGroups"))
PromptSpecification.add_member(:max_retries, Shapes::ShapeRef.new(shape: PromptMaxRetries, required: true, location_name: "maxRetries"))
PromptSpecification.add_member(:allow_interrupt, Shapes::ShapeRef.new(shape: BoxedBoolean, location_name: "allowInterrupt"))
PromptSpecification.struct_class = Types::PromptSpecification
ResourceNotFoundException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
ResourceNotFoundException.struct_class = Types::ResourceNotFoundException
ResponseSpecification.add_member(:message_groups, Shapes::ShapeRef.new(shape: MessageGroupsList, required: true, location_name: "messageGroups"))
ResponseSpecification.add_member(:allow_interrupt, Shapes::ShapeRef.new(shape: BoxedBoolean, location_name: "allowInterrupt"))
ResponseSpecification.struct_class = Types::ResponseSpecification
S3BucketLogDestination.add_member(:kms_key_arn, Shapes::ShapeRef.new(shape: KmsKeyArn, location_name: "kmsKeyArn"))
S3BucketLogDestination.add_member(:s3_bucket_arn, Shapes::ShapeRef.new(shape: S3BucketArn, required: true, location_name: "s3BucketArn"))
S3BucketLogDestination.add_member(:log_prefix, Shapes::ShapeRef.new(shape: LogPrefix, required: true, location_name: "logPrefix"))
S3BucketLogDestination.struct_class = Types::S3BucketLogDestination
SSMLMessage.add_member(:value, Shapes::ShapeRef.new(shape: SSMLMessageValue, required: true, location_name: "value"))
SSMLMessage.struct_class = Types::SSMLMessage
SampleUtterance.add_member(:utterance, Shapes::ShapeRef.new(shape: Utterance, required: true, location_name: "utterance"))
SampleUtterance.struct_class = Types::SampleUtterance
SampleUtterancesList.member = Shapes::ShapeRef.new(shape: SampleUtterance)
SampleValue.add_member(:value, Shapes::ShapeRef.new(shape: Value, required: true, location_name: "value"))
SampleValue.struct_class = Types::SampleValue
SentimentAnalysisSettings.add_member(:detect_sentiment, Shapes::ShapeRef.new(shape: Boolean, required: true, location_name: "detectSentiment"))
SentimentAnalysisSettings.struct_class = Types::SentimentAnalysisSettings
ServiceQuotaExceededException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
ServiceQuotaExceededException.struct_class = Types::ServiceQuotaExceededException
SlotDefaultValue.add_member(:default_value, Shapes::ShapeRef.new(shape: SlotDefaultValueString, required: true, location_name: "defaultValue"))
SlotDefaultValue.struct_class = Types::SlotDefaultValue
SlotDefaultValueList.member = Shapes::ShapeRef.new(shape: SlotDefaultValue)
SlotDefaultValueSpecification.add_member(:default_value_list, Shapes::ShapeRef.new(shape: SlotDefaultValueList, required: true, location_name: "defaultValueList"))
SlotDefaultValueSpecification.struct_class = Types::SlotDefaultValueSpecification
SlotFilter.add_member(:name, Shapes::ShapeRef.new(shape: SlotFilterName, required: true, location_name: "name"))
SlotFilter.add_member(:values, Shapes::ShapeRef.new(shape: FilterValues, required: true, location_name: "values"))
SlotFilter.add_member(:operator, Shapes::ShapeRef.new(shape: SlotFilterOperator, required: true, location_name: "operator"))
SlotFilter.struct_class = Types::SlotFilter
SlotFilters.member = Shapes::ShapeRef.new(shape: SlotFilter)
SlotPrioritiesList.member = Shapes::ShapeRef.new(shape: SlotPriority)
SlotPriority.add_member(:priority, Shapes::ShapeRef.new(shape: PriorityValue, required: true, location_name: "priority"))
SlotPriority.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, required: true, location_name: "slotId"))
SlotPriority.struct_class = Types::SlotPriority
SlotSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: SlotSortAttribute, required: true, location_name: "attribute"))
SlotSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
SlotSortBy.struct_class = Types::SlotSortBy
SlotSummary.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotId"))
SlotSummary.add_member(:slot_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotName"))
SlotSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
SlotSummary.add_member(:slot_constraint, Shapes::ShapeRef.new(shape: SlotConstraint, location_name: "slotConstraint"))
SlotSummary.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: BuiltInOrCustomSlotTypeId, location_name: "slotTypeId"))
SlotSummary.add_member(:value_elicitation_prompt_specification, Shapes::ShapeRef.new(shape: PromptSpecification, location_name: "valueElicitationPromptSpecification"))
SlotSummary.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
SlotSummary.struct_class = Types::SlotSummary
SlotSummaryList.member = Shapes::ShapeRef.new(shape: SlotSummary)
SlotTypeFilter.add_member(:name, Shapes::ShapeRef.new(shape: SlotTypeFilterName, required: true, location_name: "name"))
SlotTypeFilter.add_member(:values, Shapes::ShapeRef.new(shape: FilterValues, required: true, location_name: "values"))
SlotTypeFilter.add_member(:operator, Shapes::ShapeRef.new(shape: SlotTypeFilterOperator, required: true, location_name: "operator"))
SlotTypeFilter.struct_class = Types::SlotTypeFilter
SlotTypeFilters.member = Shapes::ShapeRef.new(shape: SlotTypeFilter)
SlotTypeSortBy.add_member(:attribute, Shapes::ShapeRef.new(shape: SlotTypeSortAttribute, required: true, location_name: "attribute"))
SlotTypeSortBy.add_member(:order, Shapes::ShapeRef.new(shape: SortOrder, required: true, location_name: "order"))
SlotTypeSortBy.struct_class = Types::SlotTypeSortBy
SlotTypeSummary.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotTypeId"))
SlotTypeSummary.add_member(:slot_type_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotTypeName"))
SlotTypeSummary.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
SlotTypeSummary.add_member(:parent_slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "parentSlotTypeSignature"))
SlotTypeSummary.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
SlotTypeSummary.struct_class = Types::SlotTypeSummary
SlotTypeSummaryList.member = Shapes::ShapeRef.new(shape: SlotTypeSummary)
SlotTypeValue.add_member(:sample_value, Shapes::ShapeRef.new(shape: SampleValue, location_name: "sampleValue"))
SlotTypeValue.add_member(:synonyms, Shapes::ShapeRef.new(shape: SynonymList, location_name: "synonyms"))
SlotTypeValue.struct_class = Types::SlotTypeValue
SlotTypeValues.member = Shapes::ShapeRef.new(shape: SlotTypeValue)
SlotValueElicitationSetting.add_member(:default_value_specification, Shapes::ShapeRef.new(shape: SlotDefaultValueSpecification, location_name: "defaultValueSpecification"))
SlotValueElicitationSetting.add_member(:slot_constraint, Shapes::ShapeRef.new(shape: SlotConstraint, required: true, location_name: "slotConstraint"))
SlotValueElicitationSetting.add_member(:prompt_specification, Shapes::ShapeRef.new(shape: PromptSpecification, location_name: "promptSpecification"))
SlotValueElicitationSetting.add_member(:sample_utterances, Shapes::ShapeRef.new(shape: SampleUtterancesList, location_name: "sampleUtterances"))
SlotValueElicitationSetting.add_member(:wait_and_continue_specification, Shapes::ShapeRef.new(shape: WaitAndContinueSpecification, location_name: "waitAndContinueSpecification"))
SlotValueElicitationSetting.struct_class = Types::SlotValueElicitationSetting
SlotValueRegexFilter.add_member(:pattern, Shapes::ShapeRef.new(shape: RegexPattern, required: true, location_name: "pattern"))
SlotValueRegexFilter.struct_class = Types::SlotValueRegexFilter
SlotValueSelectionSetting.add_member(:resolution_strategy, Shapes::ShapeRef.new(shape: SlotValueResolutionStrategy, required: true, location_name: "resolutionStrategy"))
SlotValueSelectionSetting.add_member(:regex_filter, Shapes::ShapeRef.new(shape: SlotValueRegexFilter, location_name: "regexFilter"))
SlotValueSelectionSetting.struct_class = Types::SlotValueSelectionSetting
StillWaitingResponseSpecification.add_member(:message_groups, Shapes::ShapeRef.new(shape: MessageGroupsList, required: true, location_name: "messageGroups"))
StillWaitingResponseSpecification.add_member(:frequency_in_seconds, Shapes::ShapeRef.new(shape: StillWaitingResponseFrequency, required: true, location_name: "frequencyInSeconds"))
StillWaitingResponseSpecification.add_member(:timeout_in_seconds, Shapes::ShapeRef.new(shape: StillWaitingResponseTimeout, required: true, location_name: "timeoutInSeconds"))
StillWaitingResponseSpecification.add_member(:allow_interrupt, Shapes::ShapeRef.new(shape: BoxedBoolean, location_name: "allowInterrupt"))
StillWaitingResponseSpecification.struct_class = Types::StillWaitingResponseSpecification
SynonymList.member = Shapes::ShapeRef.new(shape: SampleValue)
TagKeyList.member = Shapes::ShapeRef.new(shape: TagKey)
TagMap.key = Shapes::ShapeRef.new(shape: TagKey)
TagMap.value = Shapes::ShapeRef.new(shape: TagValue)
TagResourceRequest.add_member(:resource_arn, Shapes::ShapeRef.new(shape: AmazonResourceName, required: true, location: "uri", location_name: "resourceARN"))
TagResourceRequest.add_member(:tags, Shapes::ShapeRef.new(shape: TagMap, required: true, location_name: "tags"))
TagResourceRequest.struct_class = Types::TagResourceRequest
TagResourceResponse.struct_class = Types::TagResourceResponse
TextLogDestination.add_member(:cloud_watch, Shapes::ShapeRef.new(shape: CloudWatchLogGroupLogDestination, required: true, location_name: "cloudWatch"))
TextLogDestination.struct_class = Types::TextLogDestination
TextLogSetting.add_member(:enabled, Shapes::ShapeRef.new(shape: Boolean, required: true, location_name: "enabled"))
TextLogSetting.add_member(:destination, Shapes::ShapeRef.new(shape: TextLogDestination, required: true, location_name: "destination"))
TextLogSetting.struct_class = Types::TextLogSetting
TextLogSettingsList.member = Shapes::ShapeRef.new(shape: TextLogSetting)
ThrottlingException.add_member(:retry_after_seconds, Shapes::ShapeRef.new(shape: RetryAfterSeconds, location: "header", location_name: "Retry-After"))
ThrottlingException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
ThrottlingException.struct_class = Types::ThrottlingException
UntagResourceRequest.add_member(:resource_arn, Shapes::ShapeRef.new(shape: AmazonResourceName, required: true, location: "uri", location_name: "resourceARN"))
UntagResourceRequest.add_member(:tag_keys, Shapes::ShapeRef.new(shape: TagKeyList, required: true, location: "querystring", location_name: "tagKeys"))
UntagResourceRequest.struct_class = Types::UntagResourceRequest
UntagResourceResponse.struct_class = Types::UntagResourceResponse
UpdateBotAliasRequest.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, required: true, location: "uri", location_name: "botAliasId"))
UpdateBotAliasRequest.add_member(:bot_alias_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "botAliasName"))
UpdateBotAliasRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateBotAliasRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
UpdateBotAliasRequest.add_member(:bot_alias_locale_settings, Shapes::ShapeRef.new(shape: BotAliasLocaleSettingsMap, location_name: "botAliasLocaleSettings"))
UpdateBotAliasRequest.add_member(:conversation_log_settings, Shapes::ShapeRef.new(shape: ConversationLogSettings, location_name: "conversationLogSettings"))
UpdateBotAliasRequest.add_member(:sentiment_analysis_settings, Shapes::ShapeRef.new(shape: SentimentAnalysisSettings, location_name: "sentimentAnalysisSettings"))
UpdateBotAliasRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
UpdateBotAliasRequest.struct_class = Types::UpdateBotAliasRequest
UpdateBotAliasResponse.add_member(:bot_alias_id, Shapes::ShapeRef.new(shape: BotAliasId, location_name: "botAliasId"))
UpdateBotAliasResponse.add_member(:bot_alias_name, Shapes::ShapeRef.new(shape: Name, location_name: "botAliasName"))
UpdateBotAliasResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateBotAliasResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: BotVersion, location_name: "botVersion"))
UpdateBotAliasResponse.add_member(:bot_alias_locale_settings, Shapes::ShapeRef.new(shape: BotAliasLocaleSettingsMap, location_name: "botAliasLocaleSettings"))
UpdateBotAliasResponse.add_member(:conversation_log_settings, Shapes::ShapeRef.new(shape: ConversationLogSettings, location_name: "conversationLogSettings"))
UpdateBotAliasResponse.add_member(:sentiment_analysis_settings, Shapes::ShapeRef.new(shape: SentimentAnalysisSettings, location_name: "sentimentAnalysisSettings"))
UpdateBotAliasResponse.add_member(:bot_alias_status, Shapes::ShapeRef.new(shape: BotAliasStatus, location_name: "botAliasStatus"))
UpdateBotAliasResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
UpdateBotAliasResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
UpdateBotAliasResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
UpdateBotAliasResponse.struct_class = Types::UpdateBotAliasResponse
UpdateBotLocaleRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
UpdateBotLocaleRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
UpdateBotLocaleRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
UpdateBotLocaleRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateBotLocaleRequest.add_member(:nlu_intent_confidence_threshold, Shapes::ShapeRef.new(shape: ConfidenceThreshold, required: true, location_name: "nluIntentConfidenceThreshold"))
UpdateBotLocaleRequest.add_member(:voice_settings, Shapes::ShapeRef.new(shape: VoiceSettings, location_name: "voiceSettings"))
UpdateBotLocaleRequest.struct_class = Types::UpdateBotLocaleRequest
UpdateBotLocaleResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
UpdateBotLocaleResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
UpdateBotLocaleResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
UpdateBotLocaleResponse.add_member(:locale_name, Shapes::ShapeRef.new(shape: LocaleName, location_name: "localeName"))
UpdateBotLocaleResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateBotLocaleResponse.add_member(:nlu_intent_confidence_threshold, Shapes::ShapeRef.new(shape: ConfidenceThreshold, location_name: "nluIntentConfidenceThreshold"))
UpdateBotLocaleResponse.add_member(:voice_settings, Shapes::ShapeRef.new(shape: VoiceSettings, location_name: "voiceSettings"))
UpdateBotLocaleResponse.add_member(:bot_locale_status, Shapes::ShapeRef.new(shape: BotLocaleStatus, location_name: "botLocaleStatus"))
UpdateBotLocaleResponse.add_member(:failure_reasons, Shapes::ShapeRef.new(shape: FailureReasons, location_name: "failureReasons"))
UpdateBotLocaleResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
UpdateBotLocaleResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
UpdateBotLocaleResponse.struct_class = Types::UpdateBotLocaleResponse
UpdateBotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
UpdateBotRequest.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "botName"))
UpdateBotRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateBotRequest.add_member(:role_arn, Shapes::ShapeRef.new(shape: RoleArn, required: true, location_name: "roleArn"))
UpdateBotRequest.add_member(:data_privacy, Shapes::ShapeRef.new(shape: DataPrivacy, required: true, location_name: "dataPrivacy"))
UpdateBotRequest.add_member(:idle_session_ttl_in_seconds, Shapes::ShapeRef.new(shape: SessionTTL, required: true, location_name: "idleSessionTTLInSeconds"))
UpdateBotRequest.struct_class = Types::UpdateBotRequest
UpdateBotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
UpdateBotResponse.add_member(:bot_name, Shapes::ShapeRef.new(shape: Name, location_name: "botName"))
UpdateBotResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateBotResponse.add_member(:role_arn, Shapes::ShapeRef.new(shape: RoleArn, location_name: "roleArn"))
UpdateBotResponse.add_member(:data_privacy, Shapes::ShapeRef.new(shape: DataPrivacy, location_name: "dataPrivacy"))
UpdateBotResponse.add_member(:idle_session_ttl_in_seconds, Shapes::ShapeRef.new(shape: SessionTTL, location_name: "idleSessionTTLInSeconds"))
UpdateBotResponse.add_member(:bot_status, Shapes::ShapeRef.new(shape: BotStatus, location_name: "botStatus"))
UpdateBotResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
UpdateBotResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
UpdateBotResponse.struct_class = Types::UpdateBotResponse
UpdateIntentRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
UpdateIntentRequest.add_member(:intent_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "intentName"))
UpdateIntentRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateIntentRequest.add_member(:parent_intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "parentIntentSignature"))
UpdateIntentRequest.add_member(:sample_utterances, Shapes::ShapeRef.new(shape: SampleUtterancesList, location_name: "sampleUtterances"))
UpdateIntentRequest.add_member(:dialog_code_hook, Shapes::ShapeRef.new(shape: DialogCodeHookSettings, location_name: "dialogCodeHook"))
UpdateIntentRequest.add_member(:fulfillment_code_hook, Shapes::ShapeRef.new(shape: FulfillmentCodeHookSettings, location_name: "fulfillmentCodeHook"))
UpdateIntentRequest.add_member(:slot_priorities, Shapes::ShapeRef.new(shape: SlotPrioritiesList, location_name: "slotPriorities"))
UpdateIntentRequest.add_member(:intent_confirmation_setting, Shapes::ShapeRef.new(shape: IntentConfirmationSetting, location_name: "intentConfirmationSetting"))
UpdateIntentRequest.add_member(:intent_closing_setting, Shapes::ShapeRef.new(shape: IntentClosingSetting, location_name: "intentClosingSetting"))
UpdateIntentRequest.add_member(:input_contexts, Shapes::ShapeRef.new(shape: InputContextsList, location_name: "inputContexts"))
UpdateIntentRequest.add_member(:output_contexts, Shapes::ShapeRef.new(shape: OutputContextsList, location_name: "outputContexts"))
UpdateIntentRequest.add_member(:kendra_configuration, Shapes::ShapeRef.new(shape: KendraConfiguration, location_name: "kendraConfiguration"))
UpdateIntentRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
UpdateIntentRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
UpdateIntentRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
UpdateIntentRequest.struct_class = Types::UpdateIntentRequest
UpdateIntentResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
UpdateIntentResponse.add_member(:intent_name, Shapes::ShapeRef.new(shape: Name, location_name: "intentName"))
UpdateIntentResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateIntentResponse.add_member(:parent_intent_signature, Shapes::ShapeRef.new(shape: IntentSignature, location_name: "parentIntentSignature"))
UpdateIntentResponse.add_member(:sample_utterances, Shapes::ShapeRef.new(shape: SampleUtterancesList, location_name: "sampleUtterances"))
UpdateIntentResponse.add_member(:dialog_code_hook, Shapes::ShapeRef.new(shape: DialogCodeHookSettings, location_name: "dialogCodeHook"))
UpdateIntentResponse.add_member(:fulfillment_code_hook, Shapes::ShapeRef.new(shape: FulfillmentCodeHookSettings, location_name: "fulfillmentCodeHook"))
UpdateIntentResponse.add_member(:slot_priorities, Shapes::ShapeRef.new(shape: SlotPrioritiesList, location_name: "slotPriorities"))
UpdateIntentResponse.add_member(:intent_confirmation_setting, Shapes::ShapeRef.new(shape: IntentConfirmationSetting, location_name: "intentConfirmationSetting"))
UpdateIntentResponse.add_member(:intent_closing_setting, Shapes::ShapeRef.new(shape: IntentClosingSetting, location_name: "intentClosingSetting"))
UpdateIntentResponse.add_member(:input_contexts, Shapes::ShapeRef.new(shape: InputContextsList, location_name: "inputContexts"))
UpdateIntentResponse.add_member(:output_contexts, Shapes::ShapeRef.new(shape: OutputContextsList, location_name: "outputContexts"))
UpdateIntentResponse.add_member(:kendra_configuration, Shapes::ShapeRef.new(shape: KendraConfiguration, location_name: "kendraConfiguration"))
UpdateIntentResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
UpdateIntentResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
UpdateIntentResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
UpdateIntentResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
UpdateIntentResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
UpdateIntentResponse.struct_class = Types::UpdateIntentResponse
UpdateSlotRequest.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "slotId"))
UpdateSlotRequest.add_member(:slot_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "slotName"))
UpdateSlotRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateSlotRequest.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: BuiltInOrCustomSlotTypeId, required: true, location_name: "slotTypeId"))
UpdateSlotRequest.add_member(:value_elicitation_setting, Shapes::ShapeRef.new(shape: SlotValueElicitationSetting, required: true, location_name: "valueElicitationSetting"))
UpdateSlotRequest.add_member(:obfuscation_setting, Shapes::ShapeRef.new(shape: ObfuscationSetting, location_name: "obfuscationSetting"))
UpdateSlotRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
UpdateSlotRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
UpdateSlotRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
UpdateSlotRequest.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "intentId"))
UpdateSlotRequest.struct_class = Types::UpdateSlotRequest
UpdateSlotResponse.add_member(:slot_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotId"))
UpdateSlotResponse.add_member(:slot_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotName"))
UpdateSlotResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateSlotResponse.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: BuiltInOrCustomSlotTypeId, location_name: "slotTypeId"))
UpdateSlotResponse.add_member(:value_elicitation_setting, Shapes::ShapeRef.new(shape: SlotValueElicitationSetting, location_name: "valueElicitationSetting"))
UpdateSlotResponse.add_member(:obfuscation_setting, Shapes::ShapeRef.new(shape: ObfuscationSetting, location_name: "obfuscationSetting"))
UpdateSlotResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
UpdateSlotResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
UpdateSlotResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
UpdateSlotResponse.add_member(:intent_id, Shapes::ShapeRef.new(shape: Id, location_name: "intentId"))
UpdateSlotResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
UpdateSlotResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
UpdateSlotResponse.struct_class = Types::UpdateSlotResponse
UpdateSlotTypeRequest.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "slotTypeId"))
UpdateSlotTypeRequest.add_member(:slot_type_name, Shapes::ShapeRef.new(shape: Name, required: true, location_name: "slotTypeName"))
UpdateSlotTypeRequest.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateSlotTypeRequest.add_member(:slot_type_values, Shapes::ShapeRef.new(shape: SlotTypeValues, location_name: "slotTypeValues"))
UpdateSlotTypeRequest.add_member(:value_selection_setting, Shapes::ShapeRef.new(shape: SlotValueSelectionSetting, required: true, location_name: "valueSelectionSetting"))
UpdateSlotTypeRequest.add_member(:parent_slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "parentSlotTypeSignature"))
UpdateSlotTypeRequest.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, required: true, location: "uri", location_name: "botId"))
UpdateSlotTypeRequest.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, required: true, location: "uri", location_name: "botVersion"))
UpdateSlotTypeRequest.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, required: true, location: "uri", location_name: "localeId"))
UpdateSlotTypeRequest.struct_class = Types::UpdateSlotTypeRequest
UpdateSlotTypeResponse.add_member(:slot_type_id, Shapes::ShapeRef.new(shape: Id, location_name: "slotTypeId"))
UpdateSlotTypeResponse.add_member(:slot_type_name, Shapes::ShapeRef.new(shape: Name, location_name: "slotTypeName"))
UpdateSlotTypeResponse.add_member(:description, Shapes::ShapeRef.new(shape: Description, location_name: "description"))
UpdateSlotTypeResponse.add_member(:slot_type_values, Shapes::ShapeRef.new(shape: SlotTypeValues, location_name: "slotTypeValues"))
UpdateSlotTypeResponse.add_member(:value_selection_setting, Shapes::ShapeRef.new(shape: SlotValueSelectionSetting, location_name: "valueSelectionSetting"))
UpdateSlotTypeResponse.add_member(:parent_slot_type_signature, Shapes::ShapeRef.new(shape: SlotTypeSignature, location_name: "parentSlotTypeSignature"))
UpdateSlotTypeResponse.add_member(:bot_id, Shapes::ShapeRef.new(shape: Id, location_name: "botId"))
UpdateSlotTypeResponse.add_member(:bot_version, Shapes::ShapeRef.new(shape: DraftBotVersion, location_name: "botVersion"))
UpdateSlotTypeResponse.add_member(:locale_id, Shapes::ShapeRef.new(shape: LocaleId, location_name: "localeId"))
UpdateSlotTypeResponse.add_member(:creation_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "creationDateTime"))
UpdateSlotTypeResponse.add_member(:last_updated_date_time, Shapes::ShapeRef.new(shape: Timestamp, location_name: "lastUpdatedDateTime"))
UpdateSlotTypeResponse.struct_class = Types::UpdateSlotTypeResponse
ValidationException.add_member(:message, Shapes::ShapeRef.new(shape: ExceptionMessage, location_name: "message"))
ValidationException.struct_class = Types::ValidationException
VoiceSettings.add_member(:voice_id, Shapes::ShapeRef.new(shape: VoiceId, required: true, location_name: "voiceId"))
VoiceSettings.struct_class = Types::VoiceSettings
WaitAndContinueSpecification.add_member(:waiting_response, Shapes::ShapeRef.new(shape: ResponseSpecification, required: true, location_name: "waitingResponse"))
WaitAndContinueSpecification.add_member(:continue_response, Shapes::ShapeRef.new(shape: ResponseSpecification, required: true, location_name: "continueResponse"))
WaitAndContinueSpecification.add_member(:still_waiting_response, Shapes::ShapeRef.new(shape: StillWaitingResponseSpecification, location_name: "stillWaitingResponse"))
WaitAndContinueSpecification.struct_class = Types::WaitAndContinueSpecification
# @api private
API = Seahorse::Model::Api.new.tap do |api|
api.version = "2020-08-07"
api.metadata = {
"apiVersion" => "2020-08-07",
"endpointPrefix" => "models-v2-lex",
"jsonVersion" => "1.1",
"protocol" => "rest-json",
"serviceAbbreviation" => "Lex Models V2",
"serviceFullName" => "Amazon Lex Model Building V2",
"serviceId" => "Lex Models V2",
"signatureVersion" => "v4",
"signingName" => "lex",
"uid" => "models.lex.v2-2020-08-07",
}
api.add_operation(:build_bot_locale, Seahorse::Model::Operation.new.tap do |o|
o.name = "BuildBotLocale"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/"
o.input = Shapes::ShapeRef.new(shape: BuildBotLocaleRequest)
o.output = Shapes::ShapeRef.new(shape: BuildBotLocaleResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_bot, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateBot"
o.http_method = "PUT"
o.http_request_uri = "/bots/"
o.input = Shapes::ShapeRef.new(shape: CreateBotRequest)
o.output = Shapes::ShapeRef.new(shape: CreateBotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_bot_alias, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateBotAlias"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botaliases/"
o.input = Shapes::ShapeRef.new(shape: CreateBotAliasRequest)
o.output = Shapes::ShapeRef.new(shape: CreateBotAliasResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_bot_locale, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateBotLocale"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/"
o.input = Shapes::ShapeRef.new(shape: CreateBotLocaleRequest)
o.output = Shapes::ShapeRef.new(shape: CreateBotLocaleResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_bot_version, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateBotVersion"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/"
o.input = Shapes::ShapeRef.new(shape: CreateBotVersionRequest)
o.output = Shapes::ShapeRef.new(shape: CreateBotVersionResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_intent, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateIntent"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/"
o.input = Shapes::ShapeRef.new(shape: CreateIntentRequest)
o.output = Shapes::ShapeRef.new(shape: CreateIntentResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_slot, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateSlot"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/"
o.input = Shapes::ShapeRef.new(shape: CreateSlotRequest)
o.output = Shapes::ShapeRef.new(shape: CreateSlotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:create_slot_type, Seahorse::Model::Operation.new.tap do |o|
o.name = "CreateSlotType"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/"
o.input = Shapes::ShapeRef.new(shape: CreateSlotTypeRequest)
o.output = Shapes::ShapeRef.new(shape: CreateSlotTypeResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_bot, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBot"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/"
o.input = Shapes::ShapeRef.new(shape: DeleteBotRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteBotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_bot_alias, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBotAlias"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/botaliases/{botAliasId}/"
o.input = Shapes::ShapeRef.new(shape: DeleteBotAliasRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteBotAliasResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_bot_locale, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBotLocale"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/"
o.input = Shapes::ShapeRef.new(shape: DeleteBotLocaleRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteBotLocaleResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_bot_version, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteBotVersion"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/"
o.input = Shapes::ShapeRef.new(shape: DeleteBotVersionRequest)
o.output = Shapes::ShapeRef.new(shape: DeleteBotVersionResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_intent, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteIntent"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/"
o.input = Shapes::ShapeRef.new(shape: DeleteIntentRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_slot, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteSlot"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}/"
o.input = Shapes::ShapeRef.new(shape: DeleteSlotRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:delete_slot_type, Seahorse::Model::Operation.new.tap do |o|
o.name = "DeleteSlotType"
o.http_method = "DELETE"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}/"
o.input = Shapes::ShapeRef.new(shape: DeleteSlotTypeRequest)
o.output = Shapes::ShapeRef.new(shape: Shapes::StructureShape.new(struct_class: Aws::EmptyStructure))
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_bot, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeBot"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/"
o.input = Shapes::ShapeRef.new(shape: DescribeBotRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeBotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_bot_alias, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeBotAlias"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/botaliases/{botAliasId}/"
o.input = Shapes::ShapeRef.new(shape: DescribeBotAliasRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeBotAliasResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_bot_locale, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeBotLocale"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/"
o.input = Shapes::ShapeRef.new(shape: DescribeBotLocaleRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeBotLocaleResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_bot_version, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeBotVersion"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/"
o.input = Shapes::ShapeRef.new(shape: DescribeBotVersionRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeBotVersionResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_intent, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeIntent"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/"
o.input = Shapes::ShapeRef.new(shape: DescribeIntentRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeIntentResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_slot, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeSlot"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}/"
o.input = Shapes::ShapeRef.new(shape: DescribeSlotRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeSlotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:describe_slot_type, Seahorse::Model::Operation.new.tap do |o|
o.name = "DescribeSlotType"
o.http_method = "GET"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}/"
o.input = Shapes::ShapeRef.new(shape: DescribeSlotTypeRequest)
o.output = Shapes::ShapeRef.new(shape: DescribeSlotTypeResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:list_bot_aliases, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBotAliases"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botaliases/"
o.input = Shapes::ShapeRef.new(shape: ListBotAliasesRequest)
o.output = Shapes::ShapeRef.new(shape: ListBotAliasesResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_bot_locales, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBotLocales"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/"
o.input = Shapes::ShapeRef.new(shape: ListBotLocalesRequest)
o.output = Shapes::ShapeRef.new(shape: ListBotLocalesResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_bot_versions, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBotVersions"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botversions/"
o.input = Shapes::ShapeRef.new(shape: ListBotVersionsRequest)
o.output = Shapes::ShapeRef.new(shape: ListBotVersionsResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_bots, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBots"
o.http_method = "POST"
o.http_request_uri = "/bots/"
o.input = Shapes::ShapeRef.new(shape: ListBotsRequest)
o.output = Shapes::ShapeRef.new(shape: ListBotsResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_built_in_intents, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBuiltInIntents"
o.http_method = "POST"
o.http_request_uri = "/builtins/locales/{localeId}/intents/"
o.input = Shapes::ShapeRef.new(shape: ListBuiltInIntentsRequest)
o.output = Shapes::ShapeRef.new(shape: ListBuiltInIntentsResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_built_in_slot_types, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListBuiltInSlotTypes"
o.http_method = "POST"
o.http_request_uri = "/builtins/locales/{localeId}/slottypes/"
o.input = Shapes::ShapeRef.new(shape: ListBuiltInSlotTypesRequest)
o.output = Shapes::ShapeRef.new(shape: ListBuiltInSlotTypesResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_intents, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListIntents"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/"
o.input = Shapes::ShapeRef.new(shape: ListIntentsRequest)
o.output = Shapes::ShapeRef.new(shape: ListIntentsResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_slot_types, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListSlotTypes"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/"
o.input = Shapes::ShapeRef.new(shape: ListSlotTypesRequest)
o.output = Shapes::ShapeRef.new(shape: ListSlotTypesResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_slots, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListSlots"
o.http_method = "POST"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/"
o.input = Shapes::ShapeRef.new(shape: ListSlotsRequest)
o.output = Shapes::ShapeRef.new(shape: ListSlotsResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o[:pager] = Aws::Pager.new(
limit_key: "max_results",
tokens: {
"next_token" => "next_token"
}
)
end)
api.add_operation(:list_tags_for_resource, Seahorse::Model::Operation.new.tap do |o|
o.name = "ListTagsForResource"
o.http_method = "GET"
o.http_request_uri = "/tags/{resourceARN}"
o.input = Shapes::ShapeRef.new(shape: ListTagsForResourceRequest)
o.output = Shapes::ShapeRef.new(shape: ListTagsForResourceResponse)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
end)
api.add_operation(:tag_resource, Seahorse::Model::Operation.new.tap do |o|
o.name = "TagResource"
o.http_method = "POST"
o.http_request_uri = "/tags/{resourceARN}"
o.input = Shapes::ShapeRef.new(shape: TagResourceRequest)
o.output = Shapes::ShapeRef.new(shape: TagResourceResponse)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
end)
api.add_operation(:untag_resource, Seahorse::Model::Operation.new.tap do |o|
o.name = "UntagResource"
o.http_method = "DELETE"
o.http_request_uri = "/tags/{resourceARN}"
o.input = Shapes::ShapeRef.new(shape: UntagResourceRequest)
o.output = Shapes::ShapeRef.new(shape: UntagResourceResponse)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
end)
api.add_operation(:update_bot, Seahorse::Model::Operation.new.tap do |o|
o.name = "UpdateBot"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/"
o.input = Shapes::ShapeRef.new(shape: UpdateBotRequest)
o.output = Shapes::ShapeRef.new(shape: UpdateBotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:update_bot_alias, Seahorse::Model::Operation.new.tap do |o|
o.name = "UpdateBotAlias"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botaliases/{botAliasId}/"
o.input = Shapes::ShapeRef.new(shape: UpdateBotAliasRequest)
o.output = Shapes::ShapeRef.new(shape: UpdateBotAliasResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:update_bot_locale, Seahorse::Model::Operation.new.tap do |o|
o.name = "UpdateBotLocale"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/"
o.input = Shapes::ShapeRef.new(shape: UpdateBotLocaleRequest)
o.output = Shapes::ShapeRef.new(shape: UpdateBotLocaleResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:update_intent, Seahorse::Model::Operation.new.tap do |o|
o.name = "UpdateIntent"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/"
o.input = Shapes::ShapeRef.new(shape: UpdateIntentRequest)
o.output = Shapes::ShapeRef.new(shape: UpdateIntentResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:update_slot, Seahorse::Model::Operation.new.tap do |o|
o.name = "UpdateSlot"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/intents/{intentId}/slots/{slotId}/"
o.input = Shapes::ShapeRef.new(shape: UpdateSlotRequest)
o.output = Shapes::ShapeRef.new(shape: UpdateSlotResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
api.add_operation(:update_slot_type, Seahorse::Model::Operation.new.tap do |o|
o.name = "UpdateSlotType"
o.http_method = "PUT"
o.http_request_uri = "/bots/{botId}/botversions/{botVersion}/botlocales/{localeId}/slottypes/{slotTypeId}/"
o.input = Shapes::ShapeRef.new(shape: UpdateSlotTypeRequest)
o.output = Shapes::ShapeRef.new(shape: UpdateSlotTypeResponse)
o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
o.errors << Shapes::ShapeRef.new(shape: ValidationException)
o.errors << Shapes::ShapeRef.new(shape: PreconditionFailedException)
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
end)
end
end
end
| 80.662682 | 197 | 0.774187 |
1c9d1cd0eb72ac36c6ed34eac62e4a3103af87eb | 2,364 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190226025317) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "comments", force: :cascade do |t|
t.string "content"
t.integer "user_id"
t.integer "picture_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "picture_tags", force: :cascade do |t|
t.integer "picture_id"
t.integer "tag_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "pictures", force: :cascade do |t|
t.string "image_url"
t.string "title"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "relationships", force: :cascade do |t|
t.integer "follower_id"
t.integer "followed_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["followed_id"], name: "index_relationships_on_followed_id"
t.index ["follower_id", "followed_id"], name: "index_relationships_on_follower_id_and_followed_id", unique: true
t.index ["follower_id"], name: "index_relationships_on_follower_id"
end
create_table "tags", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "email"
t.string "username"
t.string "password_digest"
t.string "profile_pic"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
| 35.283582 | 116 | 0.725465 |
1d9fa06d32c297d0d5d35c5eb932bf05937c0a54 | 1,021 | module TestsHelper
def test_result_summary_rows(test_result)
rows = [
{
key: { text: "Date of test" },
value: { text: test_result.date.to_s(:govuk) }
},
{
key: { text: "Product tested" },
value: { html: link_to(test_result.product.name, product_path(test_result.product)) }
},
{
key: { text: "Legislation" },
value: { text: test_result.legislation }
},
{
key: { text: "Result" },
value: { text: test_result.result.upcase_first }
}
]
if test_result.details.present?
rows << {
key: { text: "Further details" },
value: { text: test_result.details }
}
end
test_result.documents.each do |document|
attachment_description = document.blob.metadata["description"]
next if attachment_description.blank?
rows << {
key: { text: "Attachment description" },
value: { text: attachment_description }
}
end
rows
end
end
| 23.744186 | 93 | 0.563173 |
5daae207d44d397e91ae22695bc44d1eba1089c7 | 1,142 | class Pmd < Formula
desc "Source code analyzer for Java, JavaScript, and more"
homepage "https://pmd.github.io"
url "https://github.com/pmd/pmd/releases/download/pmd_releases/6.46.0/pmd-bin-6.46.0.zip"
sha256 "04981da7163141300ec44a4dcc51dca205e7a83c0c39545a09a5d4724602e80a"
license "BSD-4-Clause"
bottle do
sha256 cellar: :any_skip_relocation, all: "e9052436c925b249355eb909c8e3169e9dadc9c2d9bc45b64e8ffd52d28d0c1b"
end
depends_on "openjdk"
def install
rm Dir["bin/*.bat"]
libexec.install Dir["*"]
(bin/"pmd").write_env_script libexec/"bin/run.sh", Language::Java.overridable_java_home_env
end
def caveats
<<~EOS
Run with `pmd` (instead of `run.sh` as described in the documentation).
EOS
end
test do
(testpath/"java/testClass.java").write <<~EOS
public class BrewTestClass {
// dummy constant
public String SOME_CONST = "foo";
public boolean doTest () {
return true;
}
}
EOS
system "#{bin}/pmd", "pmd", "-d", "#{testpath}/java", "-R",
"rulesets/java/basic.xml", "-f", "textcolor", "-l", "java"
end
end
| 27.190476 | 112 | 0.661996 |
382ac34e9e962f0e00aca428a760f1c2465a47df | 495 | # Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'
# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)
# Loop over addresses and print out a property for each one
@client.addresses.list(customer_name: 'Customer 123')
.each do |address|
puts address.friendly_name
end
| 30.9375 | 61 | 0.757576 |
1c93c04af628f41753948fc2025665ed1e66690f | 2,693 | =begin
namespace :slices do
namespace :sunflower_comments do
desc "Run slice specs within the host application context"
task :spec => [ "spec:explain", "spec:default" ]
namespace :spec do
slice_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
task :explain do
puts "\nNote: By running SunflowerComments specs inside the application context any\n" +
"overrides could break existing specs. This isn't always a problem,\n" +
"especially in the case of views. Use these spec tasks to check how\n" +
"well your application conforms to the original slice implementation."
end
Spec::Rake::SpecTask.new('default') do |t|
t.spec_opts = ["--format", "specdoc", "--colour"]
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
end
desc "Run all model specs, run a spec for a specific Model with MODEL=MyModel"
Spec::Rake::SpecTask.new('model') do |t|
t.spec_opts = ["--format", "specdoc", "--colour"]
if(ENV['MODEL'])
t.spec_files = Dir["#{slice_root}/spec/models/**/#{ENV['MODEL']}_spec.rb"].sort
else
t.spec_files = Dir["#{slice_root}/spec/models/**/*_spec.rb"].sort
end
end
desc "Run all controller specs, run a spec for a specific Controller with CONTROLLER=MyController"
Spec::Rake::SpecTask.new('controller') do |t|
t.spec_opts = ["--format", "specdoc", "--colour"]
if(ENV['CONTROLLER'])
t.spec_files = Dir["#{slice_root}/spec/controllers/**/#{ENV['CONTROLLER']}_spec.rb"].sort
else
t.spec_files = Dir["#{slice_root}/spec/controllers/**/*_spec.rb"].sort
end
end
desc "Run all view specs, run specs for a specific controller (and view) with CONTROLLER=MyController (VIEW=MyView)"
Spec::Rake::SpecTask.new('view') do |t|
t.spec_opts = ["--format", "specdoc", "--colour"]
if(ENV['CONTROLLER'] and ENV['VIEW'])
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/#{ENV['VIEW']}*_spec.rb"].sort
elsif(ENV['CONTROLLER'])
t.spec_files = Dir["#{slice_root}/spec/views/**/#{ENV['CONTROLLER']}/*_spec.rb"].sort
else
t.spec_files = Dir["#{slice_root}/spec/views/**/*_spec.rb"].sort
end
end
desc "Run all specs and output the result in html"
Spec::Rake::SpecTask.new('html') do |t|
t.spec_opts = ["--format", "html"]
t.libs = ['lib', 'server/lib' ]
t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
end
end
end
end
=end
| 39.602941 | 122 | 0.589306 |
6a8e49d7143b2f6796e6551cac363487369712ef | 3,001 | describe "ProMotion::TestMapScreen functionality" do
tests PM::TestMapScreen
# Override controller to properly instantiate
def controller
rotate_device to: :portrait, button: :bottom
@map ||= TestMapScreen.new(nav_bar: true)
@map.will_appear
@map.navigation_controller
end
after do
@map = nil
end
it "should have a navigation bar" do
@map.navigationController.should.be.kind_of(UINavigationController)
end
it "should have the map properly centered" do
center_coordinate = @map.center
center_coordinate.latitude.should.be.close 35.090648651123, 0.02
center_coordinate.longitude.should.be.close -82.965972900391, 0.02
end
it "should move the map center" do
@map.center = {latitude: 35.07496, longitude: -82.95916, animated: true}
wait 0.75 do
center_coordinate = @map.center
center_coordinate.latitude.should.be.close 35.07496, 0.001
center_coordinate.longitude.should.be.close -82.95916, 0.001
end
end
it "should select an annotation" do
@map.selected_annotations.should == nil
@map.select_annotation @map.annotations.first
wait 0.75 do
@map.selected_annotations.count.should == 1
end
end
it "should select an annotation by index" do
@map.selected_annotations.should == nil
@map.select_annotation_at 2
wait 0.75 do
@map.selected_annotations.count.should == 1
@map.selected_annotations[0].should == @map.promotion_annotation_data[2]
end
end
it "should select another annotation and check that the title is correct" do
@map.selected_annotations.should == nil
@map.select_annotation @map.annotations[1]
wait 0.75 do
@map.selected_annotations.count.should == 1
end
@map.selected_annotations.first.title.should == "Turtleback Falls"
@map.selected_annotations.first.subtitle.should == "Nantahala National Forest"
end
it "should deselect selected annotations" do
@map.select_annotation @map.annotations.last
wait 0.75 do
# @map.selected_annotations.count.should == 1
end
@map.deselect_annotations
wait 0.75 do
@map.selected_annotations.should == nil
end
end
it "should add an annotation and be able to zoom immediately" do
ann = {
longitude: -82.966093558105,
latitude: 35.092520895652,
title: "Something Else"
}
@map.annotations.count.should == 5
@map.add_annotation ann
@map.annotations.count.should == 6
@map.set_region @map.region(coordinate: @map.annotations.last.coordinate, span: [0.05, 0.05])
@map.select_annotation @map.annotations.last
end
it "should be able to overwrite all annotations" do
anns = [{
longitude: -122.029620,
latitude: 37.331789,
title: "My Cool Pin"
},{
longitude: -80.8498118 ,
latitude: 35.2187218,
title: "My Cool Pin"
}]
@map.annotations.count.should == 5
@map.add_annotations anns
@map.annotations.count.should == 2
end
end
| 28.311321 | 97 | 0.694768 |
08e1159b1b5683525dcbb701796366b424200959 | 689 | Pod::Spec.new do |s|
s.name = "RemoteImageServiceForMDCDemos"
s.version = "100.1.0"
s.summary = "A helper image class for the MDC demos."
s.description = "This spec is made for use in the MDC demos. It gets images via url."
s.homepage = "https://github.com/material-components/material-components-ios"
s.license = "Apache 2.0"
s.authors = { 'Apple platform engineering at Google' => '[email protected]' }
s.source = { :git => "https://github.com/material-components/material-components-ios.git", :tag => "v#{s.version}" }
s.source_files = "RemoteImageService/*.{h,m}"
s.public_header_files = "RemoteImageService/*.h"
end
| 53 | 124 | 0.661829 |
f8b463959413d3231724f77eb730d2a289c02e04 | 697 | # frozen_string_literal: true
class AddForeignKeyToCiPipelinesMergeRequests < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_pipelines, :merge_request_id, where: 'merge_request_id IS NOT NULL'
add_concurrent_foreign_key :ci_pipelines, :merge_requests, column: :merge_request_id, on_delete: :cascade
end
def down
if foreign_key_exists?(:ci_pipelines, :merge_requests, column: :merge_request_id)
remove_foreign_key :ci_pipelines, :merge_requests
end
remove_concurrent_index :ci_pipelines, :merge_request_id, where: 'merge_request_id IS NOT NULL'
end
end
| 30.304348 | 109 | 0.789096 |
62a72db579aca24173c40cd61e85d936ba1f67c4 | 74 | json.extract! @attempt, :id, :user_id, :quiz_id, :created_at, :updated_at
| 37 | 73 | 0.72973 |
039662ae40b1868d96a534c83dfc50260ab5ee39 | 648 | require 'test_helper'
require 'fixtures/sample_mail'
class ComplianceTest < ActiveSupport::TestCase
include ActiveModel::Lint::Tests
def setup
@model = SampleMail.new
end
test 'model_name exposes singular and human name' do
assert_equal 'sample_mail', @model.class.model_name.singular
assert_equal 'Sample mail', @model.class.model_name.human
end
test 'model_name.human uses I18n' do
begin
I18n.backend.store_translations :en,
activemodel: { models: { sample_mail: 'My Sample Mail' } }
assert_equal 'My Sample Mail', @model.class.model_name.human
ensure
I18n.reload!
end
end
end
| 24 | 66 | 0.714506 |
6a58c5244ebe1260bf9ed0cc2bbff5e272930cdb | 408 | class UserSessionsController < ApplicationController
def new
@user = User.new
end
def create
@user_session = UserSession.new params.require(:user)
.permit(:login, :password)
if @user_session.save
redirect_to root_path
else
redirect_to new_user_session_path
end
end
def destroy
current_user_session.destroy
redirect_to new_user_session_path
end
end
| 19.428571 | 57 | 0.720588 |
01e07d8b2cb0208954ef6804f6fd4fcb7ce4e14e | 469 | module ThreeScaleToolbox
module Commands
module PlansCommand
module Export
class ReadPlanLimitsStep
include Step
##
# Reads Application Plan limits
# add metric system_name out of metric_id
def call
result[:limits] = plan.limits.map do |limit|
limit.attrs.merge('metric' => metric_info(limit, 'Limit'))
end
end
end
end
end
end
end
| 23.45 | 72 | 0.560768 |
79181114adf5fdea5e04740e929c3f6cd304d47a | 2,799 | #! /usr/bin/ruby
require 'rubygems'
require 'treetop'
require 'liquid'
require 'optparse'
require_relative 'objc'
require_relative 'scribe'
require_relative 'AST/scribe'
parameters = { :source => [], :destination => Dir.pwd }
OptionParser.new do |opts|
opts.banner = "Usage: objctemplar [options]"
opts.on('-s [ARG]', '--source [ARG]', "Source files (could be multiple)") do |v|
parameters[:source] += [ v ]
end
opts.on('-d [ARG]', '--destination [ARG]', "Destination folder (default = working directory)") do |v|
parameters[:destination] = v
end
opts.on('--version', 'Display the version') do
puts "objctemplar version 0.1a"
exit
end
opts.on('-h', '--help', 'Display this help') do
puts opts
exit
end
end.parse!
def sanitize(input)
input.gsub!(/\/\/[^\n]*\n/, ' ')
input.gsub!(/\/\*.*?\*\//, ' ')
input
end
header_template = Liquid::Template.parse(IO.read 'src/objc_header.template')
source_template = Liquid::Template.parse(IO.read 'src/objc_source.template')
parser_class = Treetop.load 'src/objc_grammar'
parser = parser_class.new
results = parameters[:source].map do |s|
result = parser.parse(sanitize IO.read s)
abort "Error processing file #{s}: #{parser.failure_reason}" if result.nil?
result
end
if results.include? nil
abort parser.failure_reason
else
Scribe.default_interfaces = {
'foundation' => '<Foundation/Foundation.h>',
'tracking' => { 'protocol' => 'SCTrackChanges', 'in' => '"SCTrackChanges.h"' },
'tracker' => { 'class' => 'SCPropertyChangesTracker', 'protocol' => { 'ext' => 'SCTracker', 'int' => 'SCTracking' }, 'in' => '"SCPropertyChangesTracker.h"'},
'validator' => { 'protocol' => 'SCValidator', 'in' => '"SCValidator.h"'},
'immutable copy' => { 'protocol' => 'SCImmutableCopying', 'in' => '"SCImmutableCopying.h"', 'helper' => '"SCImmutableCopyingHelpers.h"' }
}
classes = Scribe.to_objc results
abort '[ERROR] Validation failed for class graph. Please check messages above and fix all problems' unless Scribe.validate_classes classes
for cls in classes
other_classes = classes.reject { |c| c == cls }
File.open("#{parameters[:destination]}/#{cls.name}.h", 'w') do |header|
header.write(header_template.render 'class' => cls,
'other_classes' => other_classes.map { |cls| cls.name },
'interfaces' => Scribe.default_interfaces )
end
File.open("#{parameters[:destination]}/#{cls.name}.m", 'w') do |source|
source.write(source_template.render 'class' => cls,
'other_classes' => other_classes.map { |cls| cls.name },
'interfaces' => Scribe.default_interfaces)
end
end
end | 37.32 | 163 | 0.624151 |
5ded765759a0e859d44f4ddf1e3253ccd04aa884 | 2,182 | require 'run_cl'
include RunCl::ActAsRun
module ApplicationHelper
def set_active(opt)
if controller_name == opt
return 'active'
end
end
def get_role_name(opt)
if opt == 'admin'
return 'Administrador'
elsif opt == 'provider'
return 'Proveedor'
elsif opt == 'owner'
return 'Tienda'
else
return 'Hacker'
end
end
# Flag de entrega con factor de verificacion (3= Orden entregada ,2= Orden en reparto ,1= Orden rechazada, 0= Solicitud de orden).
# enum order_status: [:pending, :rejected, :in_route, :deliver]
def order_status(order_status)
stat_name = ''
if order_status == 'deliver'
stat_name = 'Entregada'
elsif order_status == 'in_route'
stat_name = 'Reparto'
elsif order_status == 'rejected'
stat_name = 'Rechazada'
elsif order_status == 'pending'
stat_name = 'Pendiente'
elsif order_status.nil?
stat_name = 'No tiene estado'
end
stat_name
end
# def order_status(order_status)
# stat_name = ''
# if order_status == 3
# stat_name = 'Entregada'
# elsif order_status == 2
# stat_name = 'Reparto'
# elsif order_status == 1
# stat_name = 'Rechazada'
# elsif order_status == 0
# stat_name = 'Pendiente'
# elsif order_status.nil?
# stat_name = 'No tiene estado'
# end
# stat_name
# end
def payment_methods(paymentmethod_id)
pay_methods = ''
if paymentmethod_id == 1
pay_methods = 'Crédito'
elsif paymentmethod_id == 2
pay_methods = 'Débito'
elsif paymentmethod_id == 3
pay_methods = 'Efectivo'
elsif paymentmethod_id == 4
pay_methods = 'Efectivo y Crédito'
elsif paymentmethod_id == 5
pay_methods = 'Débito y Crédito'
elsif paymentmethod_id == 6
pay_methods = 'Efectivo y Débito'
elsif paymentmethod_id == 7
pay_methods = 'Efectivo, Débito y Crédito'
else
pay_methods = 'Desconocido'
end
pay_methods
end
def rut_formatter(rut)
Run.format(rut)
end
def price_format(price)
price = number_to_currency(price, unit: '$', separator: ',', delimiter: '.')
price
end
end
| 24.516854 | 132 | 0.636572 |
915ba6525a4933889069dc2b811a834f2c7a8010 | 4,121 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# Mail Setting
config.action_mailer.default_url_options = { host: ENV['ROOT_PATH'] }
Mail.register_interceptor RecipientInterceptor.new(Settings.email.sandbox, subject_prefix: '[STAGING]')
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = {
address: Settings.smtp.address,
port: Settings.smtp.port,
enable_starttls_auto: Settings.smtp.enable_starttls_auto,
user_name: Settings.smtp.user_name,
password: Settings.smtp.password,
authentication: Settings.smtp.authentication
}
config.middleware.use ExceptionNotification::Rack,
email: {
email_prefix: "[glass]",
sender_address: %{"Notifier" <[email protected]>},
exception_recipients: %w{[email protected]}
}
end
| 40.009709 | 105 | 0.760495 |
e2b09a880f47a024953a36e22621c72078dba4b9 | 3,525 | class ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource < ManageIQ::Providers::EmbeddedAutomationManager::ConfigurationScriptSource
FRIENDLY_NAME = "Ansible Automation Inside Project".freeze
REPO_DIR = Rails.root.join("tmp", "git_repos")
validates :name, :presence => true # TODO: unique within region?
validates :scm_type, :presence => true, :inclusion => { :in => %w[git] }
validates :scm_branch, :presence => true
default_value_for :scm_type, "git"
default_value_for :scm_branch, "master"
include ManageIQ::Providers::EmbeddedAnsible::CrudCommon
def self.display_name(number = 1)
n_('Repository (Embedded Ansible)', 'Repositories (Embedded Ansible)', number)
end
def self.notify_on_provider_interaction?
true
end
def self.raw_create_in_provider(manager, params)
params.delete(:scm_type) if params[:scm_type].blank?
params.delete(:scm_branch) if params[:scm_branch].blank?
transaction { create!(params.merge(:manager => manager)).tap(&:sync) }
end
def raw_update_in_provider(params)
transaction do
update_attributes!(params.except(:task_id, :miq_task_id))
sync
end
end
def raw_delete_in_provider
transaction do
destroy!
remove_clone
end
end
def sync
ensure_clone
sync_playbooks
end
def path_to_playbook(playbook_name)
repo_dir.join(playbook_name)
end
private
def git(*params, chdir: true)
args = {:params => params, :chdir => repo_dir}
args.delete(:chdir) unless chdir
AwesomeSpawn.run!("git", args).tap do |result|
_log.debug(result.output)
end
end
def ensure_clone
_log.info("Ensuring presence of git repo #{scm_url.inspect}...")
if !repo_dir.exist?
_log.info("Cloning git repo #{scm_url.inspect}...")
git("clone", scm_url, repo_dir, :chdir => false)
else
_log.info("Fetching latest from #{scm_url.inspect}...")
git("remote", "set-url", "origin", scm_url) # In case the url has changed
git("fetch")
end
_log.info("Checking out #{scm_branch.inspect}...")
git("checkout", scm_branch)
git("reset", :hard, "origin/#{scm_branch}")
_log.info("Ensuring presence of git repo #{scm_url.inspect}...Complete")
end
def remove_clone
return unless repo_dir.exist?
dir = repo_dir.to_s
_log.info("Ensuring removal of git repo located at #{dir.inspect}...")
raise ArgumentError, "invalid repo dir #{dir.inspect}" unless dir.start_with?(REPO_DIR.to_s)
FileUtils.rm_rf(dir)
_log.info("Ensuring removal of git repo located at #{dir.inspect}...Complete")
end
def sync_playbooks
transaction do
current = configuration_script_payloads.index_by(&:name)
playbooks_in_repo_dir.each do |e|
found = current.delete(e[:name]) || self.class.parent::Playbook.new(:configuration_script_source_id => id)
found.update_attributes!(e)
end
current.values.each(&:destroy)
configuration_script_payloads.reload
end
end
def playbooks_in_repo_dir
Dir.glob(repo_dir.join("*.y{a,}ml")).collect do |file|
name = File.basename(file)
description = begin
YAML.safe_load(File.read(file)).fetch_path(0, "name")
rescue StandardError
nil
end
{:name => name, :description => description, :manager_id => manager_id}
end
end
def repo_dir
@repo_dir ||= REPO_DIR.join(id.to_s)
end
end
| 28.658537 | 164 | 0.671206 |
1c59f45a614f1a6bdf823f48570e818b6e6933c2 | 1,523 | class AddStudentForm < Form
set_attributes_for :child, :first_name, :last_name, :dob_day, :dob_month, :dob_year, :school_type
validates_presence_of :first_name, message: proc { I18n.t('validations.first_name') }
validates_presence_of :last_name, message: proc { I18n.t('validations.last_name') }
validates :school_type, inclusion: { in: Child.school_types.keys, message: proc { I18n.t('validations.school_type') } }
validate :presence_of_dob_fields
validate :validity_of_date
def save
form_attributes = attributes_for(:child)
attributes = {
first_name: form_attributes[:first_name],
last_name: form_attributes[:last_name],
dob: [form_attributes[:dob_day], form_attributes[:dob_month], form_attributes[:dob_year]].join('/'),
school_type: form_attributes[:school_type],
suid: SuidGenerator.generate
}
household.children.create(attributes)
household.save
end
private
def date_in_future?(dob)
dob.present? && dob.future?
end
def validity_of_date
if @dob_day.present? && @dob_month.present? && @dob_year.present?
dob = Date.parse [@dob_day, @dob_month, @dob_year].join('/')
end
errors.add(:dob, proc { I18n.t('validations.dob') }) if date_in_future?(dob)
rescue ArgumentError
errors.add(:dob, proc { I18n.t('validations.dob') })
end
def presence_of_dob_fields
%i[dob_year dob_month dob_day].detect do |attr|
errors.add(:dob, proc { I18n.t('validations.dob') }) if public_send(attr).blank?
end
end
end
| 35.418605 | 121 | 0.709783 |
7a0d8c004a3b024b4db3bb10b695d0de32353e9b | 723 | class OpenStudio::Model::ThermalStorageChilledWaterStratified
def maxWaterFlowRate
if useSideDesignFlowRate.is_initialized
useSideDesignFlowRate
else
autosizedUseSideDesignFlowRate
end
end
def maxWaterFlowRateAutosized
if useSideDesignFlowRate.is_initialized
# Not autosized if hard size field value present
return OpenStudio::OptionalBool.new(false)
else
return OpenStudio::OptionalBool.new(true)
end
end
def performanceCharacteristics
effs = []
effs << [useSideHeatTransferEffectiveness, 'Use Side Heat Transfer Effectiveness']
effs << [sourceSideHeatTransferEffectiveness, 'Source Side Heat Transfer Effectiveness']
return effs
end
end
| 27.807692 | 92 | 0.759336 |
b9aba29e314c0d8ec057f5753b8b7ba43c1c7d7d | 10,942 | module Csvlint
module Csvw
class Table
include Csvlint::ErrorCollector
attr_reader :columns, :dialect, :table_direction, :foreign_keys, :foreign_key_references, :id, :notes, :primary_key, :row_title_columns, :schema, :suppress_output, :transformations, :url, :annotations
def initialize(url, columns: [], dialect: {}, table_direction: :auto, foreign_keys: [], id: nil, notes: [], primary_key: nil, row_title_columns: [], schema: nil, suppress_output: false, transformations: [], annotations: [], warnings: [])
@url = url
@columns = columns
@dialect = dialect
@table_direction = table_direction
@foreign_keys = foreign_keys
@foreign_key_values = {}
@foreign_key_references = []
@foreign_key_reference_values = {}
@id = id
@notes = notes
@primary_key = primary_key
@primary_key_values = {}
@row_title_columns = row_title_columns
@schema = schema
@suppress_output = suppress_output
@transformations = transformations
@annotations = annotations
reset
@warnings += warnings
@errors += columns.map{|c| c.errors}.flatten
@warnings += columns.map{|c| c.warnings}.flatten
end
def validate_header(headers, strict)
reset
headers.each_with_index do |header,i|
if columns[i]
columns[i].validate_header(header, strict)
@errors += columns[i].errors
@warnings += columns[i].warnings
elsif strict
build_errors(:malformed_header, :schema, 1, nil, header, nil)
else
build_warnings(:malformed_header, :schema, 1, nil, header, nil)
end
end # unless columns.empty?
return valid?
end
def validate_row(values, row=nil, validate=false)
reset
values.each_with_index do |value,i|
column = columns[i]
if column
v = column.validate(value, row)
values[i] = v
@errors += column.errors
@warnings += column.warnings
else
build_errors(:too_many_values, :schema, row, nil, value, nil)
end
end unless columns.empty?
if validate
unless @primary_key.nil?
key = @primary_key.map { |column| column.validate(values[column.number - 1], row) }
colnum = if primary_key.length == 1 then primary_key[0].number else nil end
build_errors(:duplicate_key, :schema, row, colnum, key, @primary_key_values[key]) if @primary_key_values.include?(key)
@primary_key_values[key] = row
end
# build a record of the unique values that are referenced by foreign keys from other tables
# so that later we can check whether those foreign keys reference these values
@foreign_key_references.each do |foreign_key|
referenced_columns = foreign_key["referenced_columns"]
key = referenced_columns.map{ |column| values[column.number - 1] }
known_values = @foreign_key_reference_values[foreign_key] ||= {}
(known_values[key] ||= []) << row
end
# build a record of the references from this row to other tables
# we can't check yet whether these exist in the other tables because
# we might not have parsed those other tables
@foreign_keys.each do |foreign_key|
referencing_columns = foreign_key["referencing_columns"]
key = referencing_columns.map{ |column| values[column.number - 1] }
known_values = @foreign_key_values[foreign_key] ||= {}
if referencing_columns.length == 1 && !referencing_columns[0].separator.nil?
# This case is for an array-valued column, where each value is a
# FK. The data will look like this:
# [ [ "5", "7", "9" ] ]
# We want it like this:
# [ ["5"], ["7"], ["9"] ]
if key[0] != nil
key[0].each do |subkey|
(known_values[ [subkey] ] ||= []) << row
end
end
else
(known_values[key] ||= []) << row
end
end
end
return valid?
end
def validate_foreign_keys
reset
@foreign_keys.each do |foreign_key|
local = @foreign_key_values[foreign_key]
next if local.nil?
remote_table = foreign_key["referenced_table"]
remote_table.validate_foreign_key_references(foreign_key, @url, local)
@errors += remote_table.errors unless remote_table == self
@warnings += remote_table.warnings unless remote_table == self
end
return valid?
end
def validate_foreign_key_references(foreign_key, remote_url, remote)
reset
local = @foreign_key_reference_values[foreign_key] || {}
context = {
"from" => { "url" => remote_url.to_s.split("/")[-1], "columns" => foreign_key["columnReference"] },
"to" => { "url" => @url.to_s.split("/")[-1], "columns" => foreign_key["reference"]["columnReference"] }
}
colnum = if foreign_key["referencing_columns"].length == 1 then foreign_key["referencing_columns"][0].number else nil end
remote.each do |key,rows|
if not local[key]
rows.each do |row|
build_errors(:unmatched_foreign_key_reference, :schema, row, colnum, key, context)
end
elsif local[key].length > 1
rows.each do |row|
build_errors(:multiple_matched_rows, :schema, row, colnum, key, context)
end
end
end
return valid?
end
def self.from_json(table_desc, base_url=nil, lang="und", common_properties={}, inherited_properties={})
annotations = {}
warnings = []
columns = []
table_properties = common_properties.clone
inherited_properties = inherited_properties.clone
table_desc.each do |property,value|
if property =="@type"
raise Csvlint::Csvw::MetadataError.new("$.tables[?(@.url = '#{table_desc["url"]}')].@type"), "@type of table is not 'Table'" unless value == 'Table'
else
v, warning, type = Csvw::PropertyChecker.check_property(property, value, base_url, lang)
warnings += Array(warning).map{ |w| Csvlint::ErrorMessage.new(w, :metadata, nil, nil, "#{property}: #{value}", nil) } unless warning.nil? || warning.empty?
if type == :annotation
annotations[property] = v
elsif type == :table || type == :common
table_properties[property] = v
elsif type == :column
warnings << Csvlint::ErrorMessage.new(:invalid_property, :metadata, nil, nil, "#{property}", nil)
else
inherited_properties[property] = v
end
end
end
table_schema = table_properties["tableSchema"] || inherited_properties["tableSchema"]
column_names = []
foreign_keys = []
primary_key = nil
if table_schema
unless table_schema["columns"].instance_of? Array
table_schema["columns"] = []
warnings << Csvlint::ErrorMessage.new(:invalid_value, :metadata, nil, nil, "columns", nil)
end
table_schema.each do |p,v|
unless ["columns", "primaryKey", "foreignKeys", "rowTitles"].include? p
inherited_properties[p] = v
end
end
virtual_columns = false
table_schema["columns"].each_with_index do |column_desc,i|
if column_desc.instance_of? Hash
column = Csvlint::Csvw::Column.from_json(i+1, column_desc, base_url, lang, inherited_properties)
raise Csvlint::Csvw::MetadataError.new("$.tables[?(@.url = '#{table_desc["url"]}')].tableSchema.columns[#{i}].virtual"), "virtual columns before non-virtual column #{column.name || i}" if virtual_columns && !column.virtual
virtual_columns = virtual_columns || column.virtual
raise Csvlint::Csvw::MetadataError.new("$.tables[?(@.url = '#{table_desc["url"]}')].tableSchema.columns"), "multiple columns named #{column.name}" if column_names.include? column.name
column_names << column.name unless column.name.nil?
columns << column
else
warnings << Csvlint::ErrorMessage.new(:invalid_column_description, :metadata, nil, nil, "#{column_desc}", nil)
end
end
primary_key = table_schema["primaryKey"]
primary_key_columns = []
primary_key_valid = true
primary_key.each do |reference|
i = column_names.index(reference)
if i
primary_key_columns << columns[i]
else
warnings << Csvlint::ErrorMessage.new(:invalid_column_reference, :metadata, nil, nil, "primaryKey: #{reference}", nil)
primary_key_valid = false
end
end if primary_key
foreign_keys = table_schema["foreignKeys"]
foreign_keys.each_with_index do |foreign_key, i|
foreign_key_columns = []
foreign_key["columnReference"].each do |reference|
i = column_names.index(reference)
raise Csvlint::Csvw::MetadataError.new("$.tables[?(@.url = '#{table_desc["url"]}')].tableSchema.foreignKeys[#{i}].columnReference"), "foreignKey references non-existant column" unless i
foreign_key_columns << columns[i]
end
foreign_key["referencing_columns"] = foreign_key_columns
end if foreign_keys
row_titles = table_schema["rowTitles"]
row_title_columns = []
row_titles.each_with_index do |row_title|
i = column_names.index(row_title)
raise Csvlint::Csvw::MetadataError.new("$.tables[?(@.url = '#{table_desc["url"]}')].tableSchema.rowTitles[#{i}]"), "rowTitles references non-existant column" unless i
row_title_columns << columns[i]
end if row_titles
end
return self.new(table_properties["url"],
id: table_properties["@id"],
columns: columns,
dialect: table_properties["dialect"],
foreign_keys: foreign_keys || [],
notes: table_properties["notes"] || [],
primary_key: primary_key_valid && !primary_key_columns.empty? ? primary_key_columns : nil,
row_title_columns: row_title_columns,
schema: table_schema ? table_schema["@id"] : nil,
suppress_output: table_properties["suppressOutput"] ? table_properties["suppressOutput"] : false,
annotations: annotations,
warnings: warnings
)
end
end
end
end
| 44.299595 | 243 | 0.595961 |
1c37317f37a5ddbbc898df71efd0089f44cc9d36 | 1,304 | require_relative "./fastlane_test_runner_helpers/fastlane_ci_output"
require_relative "./fastlane_test_runner_helpers/fastlane_output_to_html"
module FastlaneCI
# Represents the test runner responsible for loading and running
# fastlane Fastfile configurations
class FastlaneTestRunner < TestRunner
def run(platform: nil, lane: nil, parameters: nil)
require "fastlane"
ci_output = FastlaneCI::FastlaneCIOutput.new(
file_path: "fastlane.log",
block: proc do |row|
puts "Current output from fastlane: #{row}"
yield(row)
end
)
FastlaneCore::UI.ui_object = ci_output
# this only takes a few ms the first time being called
Fastlane.load_actions
# Load and parse the Fastfile
fast_file = Fastlane::FastFile.new(FastlaneCore::FastlaneFolder.fastfile_path)
begin
# Execute the Fastfile here
fast_file.runner.execute(lane, platform, parameters)
puts("Big success")
# TODO: success handling here
# this all will be implemented using a separate PR
# once we have the web socket streaming implemented
rescue StandardError => ex
# TODO: Exception handling here
require "pry"; binding.pry
puts(ex)
end
end
end
end
| 31.047619 | 84 | 0.680215 |
617621d8610b2627dbf191785507b0647855bd5a | 1,129 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `bin/rails
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_12_26_010126) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "converters", force: :cascade do |t|
t.string "bank"
t.binary "statement"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.integer "statement_year"
end
end
| 41.814815 | 86 | 0.76705 |
ed34794a91ccc59f9a968b0503819f221b042a55 | 44,401 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ApiManagement::Mgmt::V2018_01_01
#
# ApiManagement Client
#
class AuthorizationServer
include MsRestAzure
#
# Creates and initializes a new instance of the AuthorizationServer class.
# @param client service class for accessing basic functionality.
#
def initialize(client)
@client = client
end
# @return [ApiManagementClient] reference to the ApiManagementClient
attr_reader :client
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param filter [String] | Field | Supported operators | Supported functions
# |
# |-------|------------------------|---------------------------------------------|
# | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# @param top [Integer] Number of records to return.
# @param skip [Integer] Number of records to skip.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<AuthorizationServerContract>] operation results.
#
def list_by_service(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
first_page = list_by_service_as_lazy(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers)
first_page.get_all_items
end
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param filter [String] | Field | Supported operators | Supported functions
# |
# |-------|------------------------|---------------------------------------------|
# | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# @param top [Integer] Number of records to return.
# @param skip [Integer] Number of records to skip.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_by_service_with_http_info(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
list_by_service_async(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers).value!
end
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param filter [String] | Field | Supported operators | Supported functions
# |
# |-------|------------------------|---------------------------------------------|
# | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# @param top [Integer] Number of records to return.
# @param skip [Integer] Number of records to skip.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_by_service_async(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'subscriptionId' => @client.subscription_id},
query_params: {'$filter' => filter,'$top' => top,'$skip' => skip,'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerCollection.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets the entity state (Etag) version of the authorizationServer specified by
# its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def get_entity_tag(resource_group_name, service_name, authsid, custom_headers:nil)
response = get_entity_tag_async(resource_group_name, service_name, authsid, custom_headers:custom_headers).value!
nil
end
#
# Gets the entity state (Etag) version of the authorizationServer specified by
# its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_entity_tag_with_http_info(resource_group_name, service_name, authsid, custom_headers:nil)
get_entity_tag_async(resource_group_name, service_name, authsid, custom_headers:custom_headers).value!
end
#
# Gets the entity state (Etag) version of the authorizationServer specified by
# its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_entity_tag_async(resource_group_name, service_name, authsid, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
fail ArgumentError, 'authsid is nil' if authsid.nil?
fail ArgumentError, "'authsid' should satisfy the constraint - 'MaxLength': '80'" if !authsid.nil? && authsid.length > 80
fail ArgumentError, "'authsid' should satisfy the constraint - 'MinLength': '1'" if !authsid.nil? && authsid.length < 1
fail ArgumentError, "'authsid' should satisfy the constraint - 'Pattern': '(^[\w]+$)|(^[\w][\w\-]+[\w]$)'" if !authsid.nil? && authsid.match(Regexp.new('^(^[\w]+$)|(^[\w][\w\-]+[\w]$)$')).nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'authsid' => authsid,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:head, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
result
end
promise.execute
end
#
# Gets the details of the authorization server specified by its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [AuthorizationServerContract] operation results.
#
def get(resource_group_name, service_name, authsid, custom_headers:nil)
response = get_async(resource_group_name, service_name, authsid, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets the details of the authorization server specified by its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_with_http_info(resource_group_name, service_name, authsid, custom_headers:nil)
get_async(resource_group_name, service_name, authsid, custom_headers:custom_headers).value!
end
#
# Gets the details of the authorization server specified by its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_async(resource_group_name, service_name, authsid, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
fail ArgumentError, 'authsid is nil' if authsid.nil?
fail ArgumentError, "'authsid' should satisfy the constraint - 'MaxLength': '80'" if !authsid.nil? && authsid.length > 80
fail ArgumentError, "'authsid' should satisfy the constraint - 'MinLength': '1'" if !authsid.nil? && authsid.length < 1
fail ArgumentError, "'authsid' should satisfy the constraint - 'Pattern': '(^[\w]+$)|(^[\w][\w\-]+[\w]$)'" if !authsid.nil? && authsid.match(Regexp.new('^(^[\w]+$)|(^[\w][\w\-]+[\w]$)$')).nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'authsid' => authsid,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerContract.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Creates new authorization server or updates an existing authorization server.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param parameters [AuthorizationServerContract] Create or update parameters.
# @param if_match [String] ETag of the Entity. Not required when creating an
# entity, but required when updating an entity.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [AuthorizationServerContract] operation results.
#
def create_or_update(resource_group_name, service_name, authsid, parameters, if_match:nil, custom_headers:nil)
response = create_or_update_async(resource_group_name, service_name, authsid, parameters, if_match:if_match, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Creates new authorization server or updates an existing authorization server.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param parameters [AuthorizationServerContract] Create or update parameters.
# @param if_match [String] ETag of the Entity. Not required when creating an
# entity, but required when updating an entity.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def create_or_update_with_http_info(resource_group_name, service_name, authsid, parameters, if_match:nil, custom_headers:nil)
create_or_update_async(resource_group_name, service_name, authsid, parameters, if_match:if_match, custom_headers:custom_headers).value!
end
#
# Creates new authorization server or updates an existing authorization server.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param parameters [AuthorizationServerContract] Create or update parameters.
# @param if_match [String] ETag of the Entity. Not required when creating an
# entity, but required when updating an entity.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def create_or_update_async(resource_group_name, service_name, authsid, parameters, if_match:nil, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
fail ArgumentError, 'authsid is nil' if authsid.nil?
fail ArgumentError, "'authsid' should satisfy the constraint - 'MaxLength': '80'" if !authsid.nil? && authsid.length > 80
fail ArgumentError, "'authsid' should satisfy the constraint - 'MinLength': '1'" if !authsid.nil? && authsid.length < 1
fail ArgumentError, "'authsid' should satisfy the constraint - 'Pattern': '(^[\w]+$)|(^[\w][\w\-]+[\w]$)'" if !authsid.nil? && authsid.match(Regexp.new('^(^[\w]+$)|(^[\w][\w\-]+[\w]$)$')).nil?
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['If-Match'] = if_match unless if_match.nil?
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerContract.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'authsid' => authsid,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:put, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 201 || status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 201
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerContract.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerContract.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Updates the details of the authorization server specified by its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param parameters [AuthorizationServerUpdateContract] OAuth2 Server settings
# Update parameters.
# @param if_match [String] ETag of the Entity. ETag should match the current
# entity state from the header response of the GET request or it should be *
# for unconditional update.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def update(resource_group_name, service_name, authsid, parameters, if_match, custom_headers:nil)
response = update_async(resource_group_name, service_name, authsid, parameters, if_match, custom_headers:custom_headers).value!
nil
end
#
# Updates the details of the authorization server specified by its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param parameters [AuthorizationServerUpdateContract] OAuth2 Server settings
# Update parameters.
# @param if_match [String] ETag of the Entity. ETag should match the current
# entity state from the header response of the GET request or it should be *
# for unconditional update.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def update_with_http_info(resource_group_name, service_name, authsid, parameters, if_match, custom_headers:nil)
update_async(resource_group_name, service_name, authsid, parameters, if_match, custom_headers:custom_headers).value!
end
#
# Updates the details of the authorization server specified by its identifier.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param parameters [AuthorizationServerUpdateContract] OAuth2 Server settings
# Update parameters.
# @param if_match [String] ETag of the Entity. ETag should match the current
# entity state from the header response of the GET request or it should be *
# for unconditional update.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def update_async(resource_group_name, service_name, authsid, parameters, if_match, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
fail ArgumentError, 'authsid is nil' if authsid.nil?
fail ArgumentError, "'authsid' should satisfy the constraint - 'MaxLength': '80'" if !authsid.nil? && authsid.length > 80
fail ArgumentError, "'authsid' should satisfy the constraint - 'MinLength': '1'" if !authsid.nil? && authsid.length < 1
fail ArgumentError, "'authsid' should satisfy the constraint - 'Pattern': '(^[\w]+$)|(^[\w][\w\-]+[\w]$)'" if !authsid.nil? && authsid.match(Regexp.new('^(^[\w]+$)|(^[\w][\w\-]+[\w]$)$')).nil?
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, 'if_match is nil' if if_match.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['If-Match'] = if_match unless if_match.nil?
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerUpdateContract.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'authsid' => authsid,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:patch, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
result
end
promise.execute
end
#
# Deletes specific authorization server instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param if_match [String] ETag of the Entity. ETag should match the current
# entity state from the header response of the GET request or it should be *
# for unconditional update.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def delete(resource_group_name, service_name, authsid, if_match, custom_headers:nil)
response = delete_async(resource_group_name, service_name, authsid, if_match, custom_headers:custom_headers).value!
nil
end
#
# Deletes specific authorization server instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param if_match [String] ETag of the Entity. ETag should match the current
# entity state from the header response of the GET request or it should be *
# for unconditional update.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def delete_with_http_info(resource_group_name, service_name, authsid, if_match, custom_headers:nil)
delete_async(resource_group_name, service_name, authsid, if_match, custom_headers:custom_headers).value!
end
#
# Deletes specific authorization server instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param authsid [String] Identifier of the authorization server.
# @param if_match [String] ETag of the Entity. ETag should match the current
# entity state from the header response of the GET request or it should be *
# for unconditional update.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def delete_async(resource_group_name, service_name, authsid, if_match, custom_headers:nil)
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
fail ArgumentError, 'service_name is nil' if service_name.nil?
fail ArgumentError, "'service_name' should satisfy the constraint - 'MaxLength': '50'" if !service_name.nil? && service_name.length > 50
fail ArgumentError, "'service_name' should satisfy the constraint - 'MinLength': '1'" if !service_name.nil? && service_name.length < 1
fail ArgumentError, "'service_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$'" if !service_name.nil? && service_name.match(Regexp.new('^^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$$')).nil?
fail ArgumentError, 'authsid is nil' if authsid.nil?
fail ArgumentError, "'authsid' should satisfy the constraint - 'MaxLength': '80'" if !authsid.nil? && authsid.length > 80
fail ArgumentError, "'authsid' should satisfy the constraint - 'MinLength': '1'" if !authsid.nil? && authsid.length < 1
fail ArgumentError, "'authsid' should satisfy the constraint - 'Pattern': '(^[\w]+$)|(^[\w][\w\-]+[\w]$)'" if !authsid.nil? && authsid.match(Regexp.new('^(^[\w]+$)|(^[\w][\w\-]+[\w]$)$')).nil?
fail ArgumentError, 'if_match is nil' if if_match.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['If-Match'] = if_match unless if_match.nil?
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/authorizationServers/{authsid}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'resourceGroupName' => resource_group_name,'serviceName' => service_name,'authsid' => authsid,'subscriptionId' => @client.subscription_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:delete, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200 || status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
result
end
promise.execute
end
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [AuthorizationServerCollection] operation results.
#
def list_by_service_next(next_page_link, custom_headers:nil)
response = list_by_service_next_async(next_page_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_by_service_next_with_http_info(next_page_link, custom_headers:nil)
list_by_service_next_async(next_page_link, custom_headers:custom_headers).value!
end
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param next_page_link [String] The NextLink from the previous successful call
# to List operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_by_service_next_async(next_page_link, custom_headers:nil)
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{nextLink}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
skip_encoding_path_params: {'nextLink' => next_page_link},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::ApiManagement::Mgmt::V2018_01_01::Models::AuthorizationServerCollection.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Lists a collection of authorization servers defined within a service
# instance.
#
# @param resource_group_name [String] The name of the resource group.
# @param service_name [String] The name of the API Management service.
# @param filter [String] | Field | Supported operators | Supported functions
# |
# |-------|------------------------|---------------------------------------------|
# | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith,
# endswith |
# @param top [Integer] Number of records to return.
# @param skip [Integer] Number of records to skip.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [AuthorizationServerCollection] which provide lazy access to pages of
# the response.
#
def list_by_service_as_lazy(resource_group_name, service_name, filter:nil, top:nil, skip:nil, custom_headers:nil)
response = list_by_service_async(resource_group_name, service_name, filter:filter, top:top, skip:skip, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_page_link|
list_by_service_next_async(next_page_link, custom_headers:custom_headers)
end
page
end
end
end
end
| 53.302521 | 233 | 0.693025 |
f751643925f0915247a2e333f53b3aeb2446d907 | 570 | class CharCounter
# La interfaz que se pide del diccionario no me parece adecuada
# Se supone que es un diccionario que me dice cuántas veces apareció un char, con lo cual, si pregunto por un
# char que no estaba, debería devolver 0, que es exactamente la cantidad de veces que apareció, no nil!
# Porque nil ni siquiera es del mismo tipo!
def CharCounter.count(str)
hash = if str.nil?
Hash.new;
else
str.gsub(' ', '').split(//).inject(Hash.new(0)) { |acum, e| acum[e] += 1; acum }
end
hash.default = nil ; hash
end
end
| 33.529412 | 111 | 0.663158 |
393122a1d04ac977f291c4a35741aa23de04bac8 | 55 | Spree.user_class.class_eval do
has_many :invoice
end
| 13.75 | 30 | 0.818182 |
3397fe086b7571b9dbb742785cd3d12e20e3ca92 | 29 | require 'rblineprof/fluentd'
| 14.5 | 28 | 0.827586 |
282a1db4ff59bc02d7e066ff3f800508319142e9 | 1,186 | #
# Author:: John Keiser (<[email protected]>)
# Copyright:: Copyright 2013-2016, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# 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_relative "policy"
require_relative "directory"
require_relative "../../data_handler/policy_data_handler"
class Chef
module ChefFS
module FileSystem
module Repository
class PoliciesDir < Repository::Directory
def can_have_child?(name, is_dir)
!is_dir && name.include?("-")
end
protected
def make_child_entry(child_name)
Policy.new(child_name, self)
end
end
end
end
end
end
| 27.581395 | 74 | 0.693929 |
f7230fe7c55e9c2b64b1c1c4775f9dd1ab1a58b3 | 477 | class CreateSendgridEvents < ActiveRecord::Migration
def change
create_table :sendgrid_events do |t|
t.integer :notification_id, null: false, foreign_key: false
t.integer :notification_user, null: false
t.text :notification_type, null: false
t.text :template_name, null: false
t.text :event, null: false
t.text :email, null: false
t.text :useragent
t.json :sendgrid_data, null: false
t.timestamps
end
end
end
| 28.058824 | 65 | 0.679245 |
26c4c474c6b8152c437fc63786e6b66b976779b3 | 376 | class CreatePayments < ActiveRecord::Migration
def self.up
create_table :payments do |t|
t.column :order_id, :integer
t.column :amount, :float
t.column :method, :integer
t.column :created_by_id, :integer
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table :payments
end
end
| 22.117647 | 46 | 0.664894 |
1a8ff7b1c8b87fd0a16104e9546239cd789b1641 | 282 | require 'owmo'
api_key = ""
weather = OWMO::Weather.new api_key
# Kelvin
puts weather.get :current, city_name: "London,UK"
# Imperial
puts weather.get :current, city_name: "London,UK", units: :imperial
# Metric
puts weather.get :current, city_name: "London,UK", units: :metric
| 18.8 | 67 | 0.723404 |
1852d7ff1e083ac9a192ff7d6e27c94f8dea844f | 2,426 | # frozen_string_literal: true
require "spec_helper"
describe EveOnline::ESI::Models::Constellation do
it { should be_a(EveOnline::ESI::Models::Base) }
let(:options) { double }
subject { described_class.new(options) }
describe "#initialize" do
its(:options) { should eq(options) }
end
describe "#as_json" do
let(:constellation) { described_class.new(options) }
before { expect(constellation).to receive(:constellation_id).and_return(20_000_001) }
before { expect(constellation).to receive(:name).and_return("San Matar") }
before { expect(constellation).to receive(:region_id).and_return(10_000_001) }
subject { constellation.as_json }
its([:constellation_id]) { should eq(20_000_001) }
its([:name]) { should eq("San Matar") }
its([:region_id]) { should eq(10_000_001) }
end
describe "#constellation_id" do
before { expect(options).to receive(:[]).with("constellation_id") }
specify { expect { subject.constellation_id }.not_to raise_error }
end
describe "#name" do
before { expect(options).to receive(:[]).with("name") }
specify { expect { subject.name }.not_to raise_error }
end
describe "#region_id" do
before { expect(options).to receive(:[]).with("region_id") }
specify { expect { subject.region_id }.not_to raise_error }
end
describe "#system_ids" do
before { expect(options).to receive(:[]).with("systems") }
specify { expect { subject.system_ids }.not_to raise_error }
end
describe "#position" do
context "when @position set" do
let(:position) { double }
before { subject.instance_variable_set(:@position, position) }
specify { expect(subject.position).to eq(position) }
end
context "when @position not set" do
let(:position) { double }
let(:option) { double }
before do
#
# subject.options['position'] => option
#
expect(subject).to receive(:options) do
double.tap do |a|
expect(a).to receive(:[]).with("position").and_return(option)
end
end
end
before { expect(EveOnline::ESI::Models::Position).to receive(:new).with(option).and_return(position) }
specify { expect { subject.position }.not_to raise_error }
specify { expect { subject.position }.to change { subject.instance_variable_get(:@position) }.from(nil).to(position) }
end
end
end
| 26.659341 | 124 | 0.654163 |
793c4cf4b2e3c70ab723a2e80607645fa2e5783b | 1,672 | module Seek
module Creators
extend ActiveSupport::Concern
included do
has_many :assets_creators, dependent: :destroy, as: :asset, foreign_key: :asset_id
accepts_nested_attributes_for :assets_creators, allow_destroy: true
has_many :creators, class_name: 'Person', through: :assets_creators,
after_remove: %i[update_timestamp record_creators_changed],
after_add: %i[update_timestamp record_creators_changed]
has_filter :creator
end
def record_creators_changed(_assets_creator)
@creators_changed = true
end
def creators_changed?
@creators_changed
end
# API-friendly way of setting creators without doing it in the `accepts_nested_attributes_for`-way.
# Replaces all AssetsCreators with the given set, creating, updating and deleting records as necessary.
# It identifiers existing assets_creators by: creator_id, orcid, or identical name + affiliation.
def api_assets_creators= attrs
existing = assets_creators.to_a
retained_and_new = attrs.map do |attr|
ex = existing.detect do |ac|
attr[:creator_id].present? && (ac.creator_id == attr[:creator_id]) ||
attr[:orcid].present? && ac.orcid == attr[:orcid] ||
(ac.given_name == attr[:given_name] &&
ac.family_name == attr[:family_name] &&
ac.affiliation == attr[:affiliation])
end
if ex
ex.assign_attributes(attr)
ex
else
assets_creators.build(attr)
end
end.compact
(existing - retained_and_new).each(&:destroy)
retained_and_new
end
end
end | 33.44 | 107 | 0.662081 |
e943abc85df9ce531638cb8da655263279833c16 | 390 | cask "upm" do
version "1.15.1"
sha256 "eea01028ff6bf4bbcd857dcf9191905a59a6e7c9ea3914c35ca0275417724cef"
url "https://downloads.sourceforge.net/upm/upm-#{version}/upm-mac-#{version}.tar.gz",
verified: "downloads.sourceforge.net/upm/"
name "Universal Password Manager"
desc "Password manager"
homepage "https://upm.sourceforge.io/"
app "upm-mac-#{version}/UPM.app"
end
| 30 | 87 | 0.735897 |
bfd24b07cf45e5877f90b7543556a23cd665eb15 | 122 | class AddPaytmToPayments < ActiveRecord::Migration[5.1]
def change
add_column :payments, :paytm, :decimal
end
end
| 20.333333 | 55 | 0.745902 |
08d55375ac18abd4622edaed423dcf2f0577fd3c | 1,105 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'weasel/version'
Gem::Specification.new do |spec|
spec.name = 'weasel'
spec.version = Weasel::VERSION
spec.authors = ['Agustin Cavilliotti']
spec.email = ['[email protected]']
spec.summary = %q{Simple Audit gem}
spec.description = %q{Works as a weasel for your controllers}
spec.homepage = 'https://github.com/cavi21/weasel'
spec.license = 'MIT'
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.add_dependency 'activerecord', '>= 5', '< 7'
spec.add_dependency 'sidekiq', '>= 2', '< 7'
spec.add_dependency 'maxminddb', '~> 0.1'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'pry-nav'
spec.add_development_dependency 'rake', '~> 12.3'
spec.add_development_dependency 'minitest'
end
| 35.645161 | 104 | 0.647059 |
4a4d69490a32aa1e81045cbb58656868000484b4 | 3,417 | require "spec_helper"
describe Gitlab::Git::Tree, :seed_helper do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '', 'group/project') }
context :repo do
let(:tree) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID) }
it { expect(tree).to be_kind_of Array }
it { expect(tree.empty?).to be_falsey }
it { expect(tree.select(&:dir?).size).to eq(2) }
it { expect(tree.select(&:file?).size).to eq(10) }
it { expect(tree.select(&:submodule?).size).to eq(2) }
describe '#dir?' do
let(:dir) { tree.select(&:dir?).first }
it { expect(dir).to be_kind_of Gitlab::Git::Tree }
it { expect(dir.id).to eq('3c122d2b7830eca25235131070602575cf8b41a1') }
it { expect(dir.commit_id).to eq(SeedRepo::Commit::ID) }
it { expect(dir.name).to eq('encoding') }
it { expect(dir.path).to eq('encoding') }
it { expect(dir.flat_path).to eq('encoding') }
it { expect(dir.mode).to eq('40000') }
context :subdir do
let(:subdir) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files').first }
it { expect(subdir).to be_kind_of Gitlab::Git::Tree }
it { expect(subdir.id).to eq('a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba') }
it { expect(subdir.commit_id).to eq(SeedRepo::Commit::ID) }
it { expect(subdir.name).to eq('html') }
it { expect(subdir.path).to eq('files/html') }
it { expect(subdir.flat_path).to eq('files/html') }
end
context :subdir_file do
let(:subdir_file) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID, 'files/ruby').first }
it { expect(subdir_file).to be_kind_of Gitlab::Git::Tree }
it { expect(subdir_file.id).to eq('7e3e39ebb9b2bf433b4ad17313770fbe4051649c') }
it { expect(subdir_file.commit_id).to eq(SeedRepo::Commit::ID) }
it { expect(subdir_file.name).to eq('popen.rb') }
it { expect(subdir_file.path).to eq('files/ruby/popen.rb') }
it { expect(subdir_file.flat_path).to eq('files/ruby/popen.rb') }
end
end
describe '#file?' do
let(:file) { tree.select(&:file?).first }
it { expect(file).to be_kind_of Gitlab::Git::Tree }
it { expect(file.id).to eq('dfaa3f97ca337e20154a98ac9d0be76ddd1fcc82') }
it { expect(file.commit_id).to eq(SeedRepo::Commit::ID) }
it { expect(file.name).to eq('.gitignore') }
end
describe '#readme?' do
let(:file) { tree.select(&:readme?).first }
it { expect(file).to be_kind_of Gitlab::Git::Tree }
it { expect(file.name).to eq('README.md') }
end
describe '#contributing?' do
let(:file) { tree.select(&:contributing?).first }
it { expect(file).to be_kind_of Gitlab::Git::Tree }
it { expect(file.name).to eq('CONTRIBUTING.md') }
end
describe '#submodule?' do
let(:submodule) { tree.select(&:submodule?).first }
it { expect(submodule).to be_kind_of Gitlab::Git::Tree }
it { expect(submodule.id).to eq('79bceae69cb5750d6567b223597999bfa91cb3b9') }
it { expect(submodule.commit_id).to eq('570e7b2abdd848b95f2f578043fc23bd6f6fd24d') }
it { expect(submodule.name).to eq('gitlab-shell') }
end
end
describe '#where' do
it 'returns an empty array when called with an invalid ref' do
expect(described_class.where(repository, 'foobar-does-not-exist')).to eq([])
end
end
end
| 38.829545 | 107 | 0.634475 |
e27344c56bd588d6a397e04d5fe5a1db6c06b511 | 1,196 | require 'base/base'
class BaseTests
module Options
LOGGER = Logger.new(STDOUT)
NATS_URI = "nats://localhost:4222"
IP_ROUTE = "127.0.0.1"
NODE_TIMEOUT = 5
PLAN = "free"
CAPACITY = 200
def self.default(more=nil)
options = {
:logger => LOGGER,
:plan => PLAN,
:capacity => CAPACITY,
:ip_route => IP_ROUTE,
:mbus => NATS_URI,
:node_timeout => NODE_TIMEOUT
}
more.each { |k,v| options[k] = v } if more
options
end
end
def self.create_base
BaseTester.new(Options.default)
end
class BaseTester < VCAP::Services::Base::Base
attr_accessor :node_mbus_connected
attr_accessor :varz_invoked
attr_accessor :healthz_invoked
def initialize(options)
@node_mbus_connected = false
@varz_invoked = false
@healthz_invoked = false
super(options)
end
def flavor
"flavor"
end
def service_name
"service_name"
end
def on_connect_node
@node_mbus_connected = true
end
def varz_details
@varz_invoked = true
{}
end
def healthz_details
@healthz_invoked = true
{}
end
end
end
| 19.606557 | 48 | 0.605351 |
abc506c7af183244835fc74648617077e1195375 | 982 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::LambdaPreview
# This class provides a resource oriented interface for LambdaPreview.
# To create a resource object:
# resource = Aws::LambdaPreview::Resource.new(region: 'us-west-2')
# You can supply a client object with custom configuration that will be used for all resource operations.
# If you do not pass +:client+, a default client will be constructed.
# client = Aws::LambdaPreview::Client.new(region: 'us-west-2')
# resource = Aws::LambdaPreview::Resource.new(client: client)
class Resource
# @param options ({})
# @option options [Client] :client
def initialize(options = {})
@client = options[:client] || Client.new(options)
end
# @return [Client]
def client
@client
end
end
end
| 31.677419 | 107 | 0.697556 |
4a2ca452ff2028755570456645ade97ab6491b3b | 2,434 | ##
# $Id: ccproxy_telnet_ping.rb 9179 2010-04-30 08:40:19Z jduck $
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
'Name' => 'CCProxy <= v6.2 Telnet Proxy Ping Overflow',
'Description' => %q{
This module exploits the YoungZSoft CCProxy <= v6.2 suite
Telnet service. The stack is overwritten when sending an overly
long address to the 'ping' command.
},
'Author' => [ 'Patrick Webster <patrick[at]aushack.com>' ],
'Arch' => [ ARCH_X86 ],
'License' => MSF_LICENSE,
'Version' => '$Revision: 9179 $',
'References' =>
[
[ 'CVE', '2004-2416' ],
[ 'OSVDB', '11593' ],
[ 'BID', '11666 ' ],
[ 'URL', 'http://milw0rm.com/exploits/621' ],
],
'Privileged' => false,
'DefaultOptions' =>
{
'EXITFUNC' => 'thread',
},
'Payload' =>
{
'Space' => 1012,
'BadChars' => "\x00\x07\x08\x0a\x0d\x20",
},
'Platform' => ['win'],
'Targets' =>
[
# Patrick - Tested OK 2007/08/19. W2K SP0, W2KSP4, XP SP0, XP SP2 EN.
[ 'Windows 2000 Pro All - English', { 'Ret' => 0x75023411 } ], # call esi ws2help.dll
[ 'Windows 2000 Pro All - Italian', { 'Ret' => 0x74fd2b81 } ], # call esi ws2help.dll
[ 'Windows 2000 Pro All - French', { 'Ret' => 0x74fa2b22 } ], # call esi ws2help.dll
[ 'Windows XP SP0/1 - English', { 'Ret' => 0x71aa1a97 } ], # call esi ws2help.dll
[ 'Windows XP SP2 - English', { 'Ret' => 0x71aa1b22 } ], # call esi ws2help.dll
],
'DisclosureDate' => 'Nov 11 2004'))
register_options(
[
Opt::RPORT(23),
], self.class)
end
def check
connect
banner = sock.get_once(-1,3)
disconnect
if (banner =~ /CCProxy Telnet Service Ready/)
return Exploit::CheckCode::Appears
end
return Exploit::CheckCode::Safe
end
def exploit
connect
sploit = "p " + payload.encoded + [target['Ret']].pack('V') + make_nops(7)
sock.put(sploit + "\r\n")
handler
disconnect
end
end | 27.977011 | 91 | 0.580937 |
08ea814d89b3dbe7211d179db7cb4c8c88a70057 | 908 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative 'shared/push'
describe "Array#<<" do
it "pushes the object onto the end of the array" do
([ 1, 2 ] << "c" << "d" << [ 3, 4 ]).should == [1, 2, "c", "d", [3, 4]]
end
it "returns self to allow chaining" do
a = []
b = a
(a << 1).should equal(b)
(a << 2 << 3).should equal(b)
end
it "correctly resizes the Array" do
a = []
a.size.should == 0
a << :foo
a.size.should == 1
a << :bar << :baz
a.size.should == 3
a = [1, 2, 3]
a.shift
a.shift
a.shift
a << :foo
a.should == [:foo]
end
it "raises a #{frozen_error_class} on a frozen array" do
lambda { ArraySpecs.frozen_array << 5 }.should raise_error(frozen_error_class)
end
end
ruby_version_is "2.5" do
describe "Array#append" do
it_behaves_like :array_push, :append
end
end
| 21.116279 | 82 | 0.582599 |
d58df4e3123246af329bc34f0fae394dcae29b7b | 2,463 | module Jaspion
module Kilza
# Represents a single Class property
class Property
# Normalized property name
# Starts with _ or alphanumeric character
# and doesn't contain any special character
attr_accessor :name
# Original JSON property name
attr_accessor :original_name
# Ruby string type
# Can be object, fixnum, float, falseclass, trueclass and nilclass
attr_accessor :original_type
# Property type name
attr_accessor :type
# Indicates if the property represents an array of objects
attr_accessor :array
alias_method :array?, :array
# Indicates if the property should be used for comparing purposes
# Used to compare if one object is equal to another one
attr_accessor :key
alias_method :key?, :key
def initialize(name, type, array, key = '')
@name = Jaspion::Kilza::Property.normalize(name)
@original_name = name
@type = type
@array = array
@key = key
@original_type = type
end
def object?
@original_type == 'hash'
end
def fixnum?
@original_type == 'fixnum'
end
def boolean?
@original_type == 'trueclass' || @original_type == 'falseclass'
end
def float?
@original_type == 'float'
end
def null?
@original_type == 'nilclass'
end
def ==(pr)
@name == pr.name
end
# If this Property represents a new Class,
# it returns the formatted class name
def class_name
Jaspion::Kilza::Class.normalize(@original_name)
end
def to_s
{
name: @name,
original_name: @original_name,
type: @type,
array?: @array
}.to_s
end
# Removes everything except numbers and letters.
#
# @param str [String] string to be cleaned
#
# @return [String] cleaned string
def self.clean(str)
return if str.nil?
str.gsub(/[^a-zA-Z0-9]/, '')
end
# Cleans the string and make it lowercase.
#
# @param str [String] string to be cleaned
#
# @return [String] cleaned string
def self.normalize(str)
return if str.nil?
str = str.gsub(/[^a-zA-Z0-9]/, '_')
str = '_' if str.length == 0
str = '_' + str if str[0].number?
str.downcase
end
end
end
end
| 24.147059 | 72 | 0.574097 |
ac0a105d0fe1ef4aa5159dc6398663f21c18342c | 484 | class AccountActivationsController < ApplicationController
def edit
user = User.find_by(email: params[:email])
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.activate
# user.update_attribute(:activated, true)
# user.update_attribute(:activated_at, Time.zone.now)
log_in user
flash[:success] = "Account activated!"
redirect_to user
else
flash[:danger] = "Invalid activation link"
redirect_to root_path
end
end
end
| 25.473684 | 78 | 0.727273 |
61cbcaff27991f3922777c3794d5eea8675ce65c | 8,590 | # frozen_string_literal: true
require "active_support/xml_mini"
require "active_support/time"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/object/to_param"
require "active_support/core_ext/object/to_query"
require "active_support/core_ext/array/wrap"
require "active_support/core_ext/hash/reverse_merge"
require "active_support/core_ext/string/inflections"
class Hash
# Returns a string containing an XML representation of its receiver:
#
# { foo: 1, bar: 2 }.to_xml
# # =>
# # <?xml version="1.0" encoding="UTF-8"?>
# # <hash>
# # <foo type="integer">1</foo>
# # <bar type="integer">2</bar>
# # </hash>
#
# To do so, the method loops over the pairs and builds nodes that depend on
# the _values_. Given a pair +key+, +value+:
#
# * If +value+ is a hash there's a recursive call with +key+ as <tt>:root</tt>.
#
# * If +value+ is an array there's a recursive call with +key+ as <tt>:root</tt>,
# and +key+ singularized as <tt>:children</tt>.
#
# * If +value+ is a callable object it must expect one or two arguments. Depending
# on the arity, the callable is invoked with the +options+ hash as first argument
# with +key+ as <tt>:root</tt>, and +key+ singularized as second argument. The
# callable can add nodes by using <tt>options[:builder]</tt>.
#
# {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml
# # => "<b>foo</b>"
#
# * If +value+ responds to +to_xml+ the method is invoked with +key+ as <tt>:root</tt>.
#
# class Foo
# def to_xml(options)
# options[:builder].bar 'fooing!'
# end
# end
#
# { foo: Foo.new }.to_xml(skip_instruct: true)
# # =>
# # <hash>
# # <bar>fooing!</bar>
# # </hash>
#
# * Otherwise, a node with +key+ as tag is created with a string representation of
# +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added.
# Unless the option <tt>:skip_types</tt> exists and is true, an attribute "type" is
# added as well according to the following mapping:
#
# XML_TYPE_NAMES = {
# "Symbol" => "symbol",
# "Integer" => "integer",
# "BigDecimal" => "decimal",
# "Float" => "float",
# "TrueClass" => "boolean",
# "FalseClass" => "boolean",
# "Date" => "date",
# "DateTime" => "dateTime",
# "Time" => "dateTime"
# }
#
# By default the root node is "hash", but that's configurable via the <tt>:root</tt> option.
#
# The default XML builder is a fresh instance of <tt>Builder::XmlMarkup</tt>. You can
# configure your own builder with the <tt>:builder</tt> option. The method also accepts
# options like <tt>:dasherize</tt> and friends, they are forwarded to the builder.
def to_xml(options = {})
require "active_support/builder" unless defined?(Builder::XmlMarkup)
options = options.dup
options[:indent] ||= 2
options[:root] ||= "hash"
options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent])
builder = options[:builder]
builder.instruct! unless options.delete(:skip_instruct)
root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options)
builder.tag!(root) do
each { |key, value| ActiveSupport::XmlMini.to_tag(key, value, options) }
yield builder if block_given?
end
end
class << self
# Returns a Hash containing a collection of pairs when the key is the node name and the value is
# its content
#
# xml = <<-XML
# <?xml version="1.0" encoding="UTF-8"?>
# <hash>
# <foo type="integer">1</foo>
# <bar type="integer">2</bar>
# </hash>
# XML
#
# hash = Hash.from_xml(xml)
# # => {"hash"=>{"foo"=>1, "bar"=>2}}
#
# +DisallowedType+ is raised if the XML contains attributes with <tt>type="yaml"</tt> or
# <tt>type="symbol"</tt>. Use <tt>Hash.from_trusted_xml</tt> to
# parse this XML.
#
# Custom +disallowed_types+ can also be passed in the form of an
# array.
#
# xml = <<-XML
# <?xml version="1.0" encoding="UTF-8"?>
# <hash>
# <foo type="integer">1</foo>
# <bar type="string">"David"</bar>
# </hash>
# XML
#
# hash = Hash.from_xml(xml, ['integer'])
# # => ActiveSupport::XMLConverter::DisallowedType: Disallowed type attribute: "integer"
#
# Note that passing custom disallowed types will override the default types,
# which are Symbol and YAML.
def from_xml(xml, disallowed_types = nil)
ActiveSupport::XMLConverter.new(xml, disallowed_types).to_h
end
# Builds a Hash from XML just like <tt>Hash.from_xml</tt>, but also allows Symbol and YAML.
def from_trusted_xml(xml)
from_xml xml, []
end
end
end
module ActiveSupport
class XMLConverter # :nodoc:
# Raised if the XML contains attributes with type="yaml" or
# type="symbol". Read Hash#from_xml for more details.
class DisallowedType < StandardError
def initialize(type)
super "Disallowed type attribute: #{type.inspect}"
end
end
DISALLOWED_TYPES = %w(symbol yaml)
def initialize(xml, disallowed_types = nil)
@xml = normalize_keys(XmlMini.parse(xml))
@disallowed_types = disallowed_types || DISALLOWED_TYPES
end
def to_h
deep_to_h(@xml)
end
private
def normalize_keys(params)
case params
when Hash
Hash[params.map { |k, v| [k.to_s.tr("-", "_"), normalize_keys(v)] } ]
when Array
params.map { |v| normalize_keys(v) }
else
params
end
end
def deep_to_h(value)
case value
when Hash
process_hash(value)
when Array
process_array(value)
when String
value
else
raise "can't typecast #{value.class.name} - #{value.inspect}"
end
end
def process_hash(value)
if value.include?("type") && !value["type"].is_a?(Hash) && @disallowed_types.include?(value["type"])
raise DisallowedType, value["type"]
end
if become_array?(value)
_, entries = Array.wrap(value.detect { |k, v| not v.is_a?(String) })
if entries.nil? || value["__content__"].try(:empty?)
[]
else
case entries
when Array
entries.collect { |v| deep_to_h(v) }
when Hash
[deep_to_h(entries)]
else
raise "can't typecast #{entries.inspect}"
end
end
elsif become_content?(value)
process_content(value)
elsif become_empty_string?(value)
""
elsif become_hash?(value)
xml_value = Hash[value.map { |k, v| [k, deep_to_h(v)] }]
# Turn { files: { file: #<StringIO> } } into { files: #<StringIO> } so it is compatible with
# how multipart uploaded files from HTML appear
xml_value["file"].is_a?(StringIO) ? xml_value["file"] : xml_value
end
end
def become_content?(value)
value["type"] == "file" || (value["__content__"] && (value.keys.size == 1 || value["__content__"].present?))
end
def become_array?(value)
value["type"] == "array"
end
def become_empty_string?(value)
# { "string" => true }
# No tests fail when the second term is removed.
value["type"] == "string" && value["nil"] != "true"
end
def become_hash?(value)
!nothing?(value) && !garbage?(value)
end
def nothing?(value)
# blank or nil parsed values are represented by nil
value.blank? || value["nil"] == "true"
end
def garbage?(value)
# If the type is the only element which makes it then
# this still makes the value nil, except if type is
# an XML node(where type['value'] is a Hash)
value["type"] && !value["type"].is_a?(::Hash) && value.size == 1
end
def process_content(value)
content = value["__content__"]
if parser = ActiveSupport::XmlMini::PARSING[value["type"]]
parser.arity == 1 ? parser.call(content) : parser.call(content, value)
else
content
end
end
def process_array(value)
value.map! { |i| deep_to_h(i) }
value.length > 1 ? value : value.first
end
end
end
| 32.537879 | 116 | 0.584517 |
28286e5d9b1565a436e312d83e64adc069b0e783 | 2,057 | require "test_helper"
class ApiKeyTest < ActiveSupport::TestCase
should belong_to :user
should validate_presence_of(:name)
should validate_presence_of(:user)
should validate_presence_of(:hashed_key)
should "be valid with factory" do
assert build(:api_key).valid?
end
should "be invalid when name is empty string" do
api_key = build(:api_key, name: "")
refute api_key.valid?
assert_contains api_key.errors[:name], "can't be blank"
end
should "be invalid when name is longer than Gemcutter::MAX_FIELD_LENGTH" do
api_key = build(:api_key, name: "aa" * Gemcutter::MAX_FIELD_LENGTH)
refute api_key.valid?
assert_contains api_key.errors[:name], "is too long (maximum is 255 characters)"
end
context "#scope" do
setup do
@api_key = create(:api_key, index_rubygems: true, push_rubygem: true)
end
should "return enabled scopes" do
assert_equal %i[index_rubygems push_rubygem], @api_key.enabled_scopes
end
end
context "show_dashboard scope" do
should "be valid when enabled exclusively" do
assert build(:api_key, show_dashboard: true).valid?
end
should "be invalid when enabled with any other scope" do
refute build(:api_key, show_dashboard: true, push_rubygem: true).valid?
end
end
context "#mfa_enabled?" do
setup do
@api_key = create(:api_key, index_rubygems: true)
end
should "return false with MFA disabled user" do
refute @api_key.mfa_enabled?
@api_key.update(mfa: true)
refute @api_key.mfa_enabled?
end
should "return mfa with MFA UI enabled user" do
@api_key.user.enable_mfa!(ROTP::Base32.random_base32, :ui_only)
refute @api_key.mfa_enabled?
@api_key.update(mfa: true)
assert @api_key.mfa_enabled?
end
should "return true with MFA UI and API enabled user" do
@api_key.user.enable_mfa!(ROTP::Base32.random_base32, :ui_and_api)
assert @api_key.mfa_enabled?
@api_key.update(mfa: true)
assert @api_key.mfa_enabled?
end
end
end
| 27.797297 | 84 | 0.700535 |
084b103ee3bc3a85aaa6e7d70c7bcedbae90b258 | 4,016 | # frozen_string_literal: true
module Admin
class PropagateIntegrationService
BATCH_SIZE = 100
delegate :data_fields_present?, to: :integration
def self.propagate(integration:, overwrite:)
new(integration, overwrite).propagate
end
def initialize(integration, overwrite)
@integration = integration
@overwrite = overwrite
end
def propagate
if overwrite
update_integration_for_all_projects
else
update_integration_for_inherited_projects
end
create_integration_for_projects_without_integration
end
private
attr_reader :integration, :overwrite
# rubocop: disable Cop/InBatches
# rubocop: disable CodeReuse/ActiveRecord
def update_integration_for_inherited_projects
Service.where(type: integration.type, inherit_from_id: integration.id).in_batches(of: BATCH_SIZE) do |batch|
bulk_update_from_integration(batch)
end
end
def update_integration_for_all_projects
Service.where(type: integration.type).in_batches(of: BATCH_SIZE) do |batch|
bulk_update_from_integration(batch)
end
end
# rubocop: enable Cop/InBatches
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def bulk_update_from_integration(batch)
# Retrieving the IDs instantiates the ActiveRecord relation (batch)
# into concrete models, otherwise update_all will clear the relation.
# https://stackoverflow.com/q/34811646/462015
batch_ids = batch.pluck(:id)
Service.transaction do
batch.update_all(service_hash)
if data_fields_present?
integration.data_fields.class.where(service_id: batch_ids).update_all(data_fields_hash)
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
def create_integration_for_projects_without_integration
loop do
batch = Project.uncached { project_ids_without_integration }
bulk_create_from_integration(batch) unless batch.empty?
break if batch.size < BATCH_SIZE
end
end
def bulk_create_from_integration(batch)
service_list = ServiceList.new(batch, service_hash, { 'inherit_from_id' => integration.id }).to_array
Project.transaction do
results = bulk_insert(*service_list)
if data_fields_present?
data_list = DataList.new(results, data_fields_hash, integration.data_fields.class).to_array
bulk_insert(*data_list)
end
run_callbacks(batch)
end
end
def bulk_insert(klass, columns, values_array)
items_to_insert = values_array.map { |array| Hash[columns.zip(array)] }
klass.insert_all(items_to_insert, returning: [:id])
end
# rubocop: disable CodeReuse/ActiveRecord
def run_callbacks(batch)
if active_external_issue_tracker?
Project.where(id: batch).update_all(has_external_issue_tracker: true)
end
if active_external_wiki?
Project.where(id: batch).update_all(has_external_wiki: true)
end
end
# rubocop: enable CodeReuse/ActiveRecord
def active_external_issue_tracker?
integration.issue_tracker? && !integration.default
end
def active_external_wiki?
integration.type == 'ExternalWikiService'
end
# rubocop: disable CodeReuse/ActiveRecord
def project_ids_without_integration
services = Service
.select('1')
.where('services.project_id = projects.id')
.where(type: integration.type)
Project
.where('NOT EXISTS (?)', services)
.where(pending_delete: false)
.where(archived: false)
.limit(BATCH_SIZE)
.pluck(:id)
end
# rubocop: enable CodeReuse/ActiveRecord
def service_hash
@service_hash ||= integration.to_service_hash
.tap { |json| json['inherit_from_id'] = integration.id }
end
def data_fields_hash
@data_fields_hash ||= integration.to_data_fields_hash
end
end
end
| 28.083916 | 114 | 0.698954 |
1c81a5b71bcbba59ab7dea9bc66d17fc44eac360 | 3,466 | require 'set'
module ActiveRecord
module AttributeMethods
module PrimaryKey
extend ActiveSupport::Concern
# Returns this record's primary key value wrapped in an Array if one is
# available.
def to_key
sync_with_transaction_state
key = self.id
[key] if key
end
# Returns the primary key value.
def id
if pk = self.class.primary_key
sync_with_transaction_state
read_attribute(pk)
end
end
# Sets the primary key value.
def id=(value)
sync_with_transaction_state
write_attribute(self.class.primary_key, value) if self.class.primary_key
end
# Queries the primary key value.
def id?
sync_with_transaction_state
query_attribute(self.class.primary_key)
end
# Returns the primary key value before type cast.
def id_before_type_cast
sync_with_transaction_state
read_attribute_before_type_cast(self.class.primary_key)
end
protected
def attribute_method?(attr_name)
attr_name == 'id' || super
end
module ClassMethods
def define_method_attribute(attr_name)
super
if attr_name == primary_key && attr_name != 'id'
generated_attribute_methods.send(:alias_method, :id, primary_key)
end
end
ID_ATTRIBUTE_METHODS = %w(id id= id? id_before_type_cast).to_set
def dangerous_attribute_method?(method_name)
super && !ID_ATTRIBUTE_METHODS.include?(method_name)
end
# Defines the primary key field -- can be overridden in subclasses.
# Overwriting will negate any effect of the +primary_key_prefix_type+
# setting, though.
def primary_key
@primary_key = reset_primary_key unless defined? @primary_key
@primary_key
end
# Returns a quoted version of the primary key name, used to construct
# SQL statements.
def quoted_primary_key
@quoted_primary_key ||= connection.quote_column_name(primary_key)
end
def reset_primary_key #:nodoc:
if self == base_class
self.primary_key = get_primary_key(base_class.name)
else
self.primary_key = base_class.primary_key
end
end
def get_primary_key(base_name) #:nodoc:
return 'id' if base_name.blank?
case primary_key_prefix_type
when :table_name
base_name.foreign_key(false)
when :table_name_with_underscore
base_name.foreign_key
else
if ActiveRecord::Base != self && table_exists?
connection.schema_cache.primary_keys(table_name)
else
'id'
end
end
end
# Sets the name of the primary key column.
#
# class Project < ActiveRecord::Base
# self.primary_key = 'sysid'
# end
#
# You can also define the +primary_key+ method yourself:
#
# class Project < ActiveRecord::Base
# def self.primary_key
# 'foo_' + super
# end
# end
#
# Project.primary_key # => "foo_id"
def primary_key=(value)
@primary_key = value && value.to_s
@quoted_primary_key = nil
end
end
end
end
end
| 27.728 | 80 | 0.596365 |
331bddecbf7f482913e1d143387c90eefd86011e | 1,006 | require "rdcl/apps/crouton/framework/plugin_base.rb"
require "rdcl/apps/crouton/framework/sidebar_icon.rb"
module RDCL
class InfoPlugin < PluginBase
attr_accessor :icon
attr_accessor :text
attr_accessor :app
def initialize(parent, workarea, id, app)
super(parent, workarea, app)
@icon = SidebarIcon.new(self, parent, id, File.join(File.dirname(__FILE__), "inspector.png"), "Info")
@text = Wx::TextCtrl.new(workarea, -1, 'Device Information', Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::TE_MULTILINE | Wx::TE_READONLY)
@text.show(false)
end
def activate
super()
@text.change_value(@app.model.newton_info.to_s)
@text.show
# size = @workarea.get_size
# @text.set_client_size(size.get_width, size.get_height)
end
def deactivate
super()
@text.show(false)
end
def on_size(event)
@text.set_client_size(event.get_size.get_width, event.get_size.get_height)
end
end
end | 26.473684 | 142 | 0.668986 |
6160dafb177e5d740bb52d417ffaaf865600a1e0 | 1,662 | # frozen_string_literal: true
class Projects::CycleAnalyticsController < Projects::ApplicationController
include ActionView::Helpers::DateHelper
include ActionView::Helpers::TextHelper
include CycleAnalyticsParams
include GracefulTimeoutHandling
include RedisTracking
extend ::Gitlab::Utils::Override
before_action :authorize_read_cycle_analytics!
before_action :load_value_stream, only: :show
track_redis_hll_event :show, name: 'p_analytics_valuestream'
feature_category :planning_analytics
urgency :low
before_action do
push_licensed_feature(:cycle_analytics_for_groups) if project.licensed_feature_available?(:cycle_analytics_for_groups)
end
def show
@cycle_analytics = Analytics::CycleAnalytics::ProjectLevel.new(project: @project, options: options(cycle_analytics_project_params))
@request_params ||= ::Gitlab::Analytics::CycleAnalytics::RequestParams.new(all_cycle_analytics_params)
respond_to do |format|
format.html do
Gitlab::UsageDataCounters::CycleAnalyticsCounter.count(:views)
render :show
end
format.json do
render json: cycle_analytics_json
end
end
end
private
override :all_cycle_analytics_params
def all_cycle_analytics_params
super.merge({ project: @project, value_stream: @value_stream })
end
def load_value_stream
@value_stream = Analytics::CycleAnalytics::ProjectValueStream.build_default_value_stream(@project)
end
def cycle_analytics_json
{
summary: @cycle_analytics.summary,
stats: @cycle_analytics.stats,
permissions: @cycle_analytics.permissions(user: current_user)
}
end
end
| 28.655172 | 135 | 0.770758 |
394b2b9772a9abbd55d3309c3d30cad806df6f4e | 1,524 | # encoding: utf-8
require File.expand_path('../lib/rails_admin/version', __FILE__)
Gem::Specification.new do |spec|
# If you add a dependency, please maintain alphabetical order
spec.add_dependency 'nested_form', '~> 0.2'
spec.add_dependency 'sass-rails', '~> 3.1'
spec.add_dependency 'bootstrap-sass', '~> 2.1'
spec.add_dependency 'font-awesome-sass-rails', '>= 3.0.0.1'
spec.add_dependency 'jquery-ui-rails', '~> 2.0'
spec.add_dependency 'builder', '~> 3.0.4'
spec.add_dependency 'coffee-rails', '~> 3.1'
spec.add_dependency 'haml', '~> 3.1'
spec.add_dependency 'jquery-rails', '~> 2.1'
spec.add_dependency 'kaminari', '~> 0.14'
spec.add_dependency 'rack-pjax', '~> 0.6'
spec.add_dependency 'rails', '~> 3.1'
spec.add_dependency 'remotipart', '~> 1.0'
spec.authors = ["Erik Michaels-Ober", "Bogdan Gaza", "Petteri Kaapa", "Benoit Benezech"]
spec.description = %q{RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data.}
spec.email = ['[email protected]', '[email protected]', '[email protected]']
spec.files = Dir['Gemfile', 'LICENSE.md', 'README.md', 'Rakefile', 'app/**/*', 'config/**/*', 'lib/**/*', 'public/**/*']
spec.licenses = ['MIT']
spec.homepage = 'https://github.com/sferik/rails_admin'
spec.name = 'rails_admin'
spec.require_paths = ['lib']
spec.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
spec.summary = %q{Admin for Rails}
spec.test_files = Dir['spec/**/*']
spec.version = RailsAdmin::Version
end
| 47.625 | 122 | 0.675197 |
1c8096bdface76efbed29aa43b2c83241a41b2ad | 100,871 | # 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 '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 MonitoringV3
# Stackdriver Monitoring API
#
# Manages your Stackdriver Monitoring data and configurations. Most projects
# must be associated with a Stackdriver account, with a few exceptions as noted
# on the individual method pages. The table entries below are presented in
# alphabetical order, not in order of common use. For explanations of the
# concepts found in the table entries, read the Stackdriver Monitoring
# documentation.
#
# @example
# require 'google/apis/monitoring_v3'
#
# Monitoring = Google::Apis::MonitoringV3 # Alias the module
# service = Monitoring::MonitoringService.new
#
# @see https://cloud.google.com/monitoring/api/
class MonitoringService < Google::Apis::Core::BaseService
# @return [String]
# API key. Your API key identifies your project and provides you with API access,
# quota, and reports. Required unless you provide an OAuth 2.0 token.
attr_accessor :key
# @return [String]
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
attr_accessor :quota_user
def initialize
super('https://monitoring.googleapis.com/', '')
@batch_path = 'batch'
end
# Creates a new alerting policy.
# @param [String] name
# The project in which to create the alerting policy. The format is projects/[
# PROJECT_ID].Note that this field names the parent container in which the
# alerting policy will be written, not the name of the created policy. The
# alerting policy that is returned will have a name that contains a normalized
# representation of this name as a prefix but adds a suffix of the form /
# alertPolicies/[POLICY_ID], identifying the policy in the container.
# @param [Google::Apis::MonitoringV3::AlertPolicy] alert_policy_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::AlertPolicy] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::AlertPolicy]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_alert_policy(name, alert_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}/alertPolicies', options)
command.request_representation = Google::Apis::MonitoringV3::AlertPolicy::Representation
command.request_object = alert_policy_object
command.response_representation = Google::Apis::MonitoringV3::AlertPolicy::Representation
command.response_class = Google::Apis::MonitoringV3::AlertPolicy
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes an alerting policy.
# @param [String] name
# The alerting policy to delete. The format is:
# projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
# For more information, see AlertPolicy.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_alert_policy(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single alerting policy.
# @param [String] name
# The alerting policy to retrieve. The format is
# projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::AlertPolicy] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::AlertPolicy]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_alert_policy(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::AlertPolicy::Representation
command.response_class = Google::Apis::MonitoringV3::AlertPolicy
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists the existing alerting policies for the project.
# @param [String] name
# The project whose alert policies are to be listed. The format is
# projects/[PROJECT_ID]
# Note that this field names the parent container in which the alerting policies
# to be listed are stored. To retrieve a single alerting policy by name, use the
# GetAlertPolicy operation, instead.
# @param [String] filter
# If provided, this field specifies the criteria that must be met by alert
# policies to be included in the response.For more details, see sorting and
# filtering.
# @param [String] order_by
# A comma-separated list of fields by which to sort the result. Supports the
# same set of field references as the filter field. Entries can be prefixed with
# a minus sign to sort by the field in descending order.For more details, see
# sorting and filtering.
# @param [Fixnum] page_size
# The maximum number of results to return in a single response.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return more results from the previous method call.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListAlertPoliciesResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListAlertPoliciesResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_alert_policies(name, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/alertPolicies', options)
command.response_representation = Google::Apis::MonitoringV3::ListAlertPoliciesResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListAlertPoliciesResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['orderBy'] = order_by unless order_by.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Updates an alerting policy. You can either replace the entire policy with a
# new one or replace only certain fields in the current alerting policy by
# specifying the fields to be updated via updateMask. Returns the updated
# alerting policy.
# @param [String] name
# Required if the policy exists. The resource name for this policy. The syntax
# is:
# projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
# [ALERT_POLICY_ID] is assigned by Stackdriver Monitoring when the policy is
# created. When calling the alertPolicies.create method, do not include the name
# field in the alerting policy passed as part of the request.
# @param [Google::Apis::MonitoringV3::AlertPolicy] alert_policy_object
# @param [String] update_mask
# Optional. A list of alerting policy field names. If this field is not empty,
# each listed field in the existing alerting policy is set to the value of the
# corresponding field in the supplied policy (alert_policy), or to the field's
# default value if the field is not in the supplied alerting policy. Fields not
# listed retain their previous value.Examples of valid field masks include
# display_name, documentation, documentation.content, documentation.mime_type,
# user_labels, user_label.nameofkey, enabled, conditions, combiner, etc.If this
# field is empty, then the supplied alerting policy replaces the existing policy.
# It is the same as deleting the existing policy and adding the supplied policy,
# except for the following:
# The new policy will have the same [ALERT_POLICY_ID] as the former policy. This
# gives you continuity with the former policy in your notifications and
# incidents.
# Conditions in the new policy will keep their former [CONDITION_ID] if the
# supplied condition includes the name field with that [CONDITION_ID]. If the
# supplied condition omits the name field, then a new [CONDITION_ID] is created.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::AlertPolicy] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::AlertPolicy]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def patch_project_alert_policy(name, alert_policy_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:patch, 'v3/{+name}', options)
command.request_representation = Google::Apis::MonitoringV3::AlertPolicy::Representation
command.request_object = alert_policy_object
command.response_representation = Google::Apis::MonitoringV3::AlertPolicy::Representation
command.response_class = Google::Apis::MonitoringV3::AlertPolicy
command.params['name'] = name unless name.nil?
command.query['updateMask'] = update_mask unless update_mask.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Stackdriver Monitoring Agent only: Creates a new time series.<aside class="
# caution">This method is only for use by the Stackdriver Monitoring Agent. Use
# projects.timeSeries.create instead.</aside>
# @param [String] name
# The project in which to create the time series. The format is "projects/
# PROJECT_ID_OR_NUMBER".
# @param [Google::Apis::MonitoringV3::CreateCollectdTimeSeriesRequest] create_collectd_time_series_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::CreateCollectdTimeSeriesResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::CreateCollectdTimeSeriesResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_collectd_time_series(name, create_collectd_time_series_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}/collectdTimeSeries', options)
command.request_representation = Google::Apis::MonitoringV3::CreateCollectdTimeSeriesRequest::Representation
command.request_object = create_collectd_time_series_request_object
command.response_representation = Google::Apis::MonitoringV3::CreateCollectdTimeSeriesResponse::Representation
command.response_class = Google::Apis::MonitoringV3::CreateCollectdTimeSeriesResponse
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Creates a new group.
# @param [String] name
# The project in which to create the group. The format is "projects/`
# project_id_or_number`".
# @param [Google::Apis::MonitoringV3::Group] group_object
# @param [Boolean] validate_only
# If true, validate this request but do not create the group.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Group] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Group]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_group(name, group_object = nil, validate_only: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}/groups', options)
command.request_representation = Google::Apis::MonitoringV3::Group::Representation
command.request_object = group_object
command.response_representation = Google::Apis::MonitoringV3::Group::Representation
command.response_class = Google::Apis::MonitoringV3::Group
command.params['name'] = name unless name.nil?
command.query['validateOnly'] = validate_only unless validate_only.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes an existing group.
# @param [String] name
# The group to delete. The format is "projects/`project_id_or_number`/groups/`
# group_id`".
# @param [Boolean] recursive
# If this field is true, then the request means to delete a group with all its
# descendants. Otherwise, the request means to delete a group only when it has
# no descendants. The default value is false.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_group(name, recursive: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['recursive'] = recursive unless recursive.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single group.
# @param [String] name
# The group to retrieve. The format is "projects/`project_id_or_number`/groups/`
# group_id`".
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Group] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Group]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_group(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::Group::Representation
command.response_class = Google::Apis::MonitoringV3::Group
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists the existing groups.
# @param [String] name
# The project whose groups are to be listed. The format is "projects/`
# project_id_or_number`".
# @param [String] ancestors_of_group
# A group name: "projects/`project_id_or_number`/groups/`group_id`". Returns
# groups that are ancestors of the specified group. The groups are returned in
# order, starting with the immediate parent and ending with the most distant
# ancestor. If the specified group has no immediate parent, the results are
# empty.
# @param [String] children_of_group
# A group name: "projects/`project_id_or_number`/groups/`group_id`". Returns
# groups whose parentName field contains the group name. If no groups have this
# parent, the results are empty.
# @param [String] descendants_of_group
# A group name: "projects/`project_id_or_number`/groups/`group_id`". Returns the
# descendants of the specified group. This is a superset of the results returned
# by the childrenOfGroup filter, and includes children-of-children, and so forth.
# @param [Fixnum] page_size
# A positive number that is the maximum number of results to return.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return additional results from the previous method call.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListGroupsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListGroupsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_groups(name, ancestors_of_group: nil, children_of_group: nil, descendants_of_group: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/groups', options)
command.response_representation = Google::Apis::MonitoringV3::ListGroupsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListGroupsResponse
command.params['name'] = name unless name.nil?
command.query['ancestorsOfGroup'] = ancestors_of_group unless ancestors_of_group.nil?
command.query['childrenOfGroup'] = children_of_group unless children_of_group.nil?
command.query['descendantsOfGroup'] = descendants_of_group unless descendants_of_group.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Updates an existing group. You can change any group attributes except name.
# @param [String] name
# Output only. The name of this group. The format is "projects/`
# project_id_or_number`/groups/`group_id`". When creating a group, this field is
# ignored and a new name is created consisting of the project specified in the
# call to CreateGroup and a unique `group_id` that is generated automatically.
# @param [Google::Apis::MonitoringV3::Group] group_object
# @param [Boolean] validate_only
# If true, validate this request but do not update the existing group.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Group] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Group]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def update_project_group(name, group_object = nil, validate_only: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:put, 'v3/{+name}', options)
command.request_representation = Google::Apis::MonitoringV3::Group::Representation
command.request_object = group_object
command.response_representation = Google::Apis::MonitoringV3::Group::Representation
command.response_class = Google::Apis::MonitoringV3::Group
command.params['name'] = name unless name.nil?
command.query['validateOnly'] = validate_only unless validate_only.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists the monitored resources that are members of a group.
# @param [String] name
# The group whose members are listed. The format is "projects/`
# project_id_or_number`/groups/`group_id`".
# @param [String] filter
# An optional list filter describing the members to be returned. The filter may
# reference the type, labels, and metadata of monitored resources that comprise
# the group. For example, to return only resources representing Compute Engine
# VM instances, use this filter:
# resource.type = "gce_instance"
# @param [String] interval_end_time
# Required. The end of the time interval.
# @param [String] interval_start_time
# Optional. The beginning of the time interval. The default value for the start
# time is the end time. The start time must not be later than the end time.
# @param [Fixnum] page_size
# A positive number that is the maximum number of results to return.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return additional results from the previous method call.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListGroupMembersResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListGroupMembersResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_group_members(name, filter: nil, interval_end_time: nil, interval_start_time: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/members', options)
command.response_representation = Google::Apis::MonitoringV3::ListGroupMembersResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListGroupMembersResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['interval.endTime'] = interval_end_time unless interval_end_time.nil?
command.query['interval.startTime'] = interval_start_time unless interval_start_time.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Creates a new metric descriptor. User-created metric descriptors define custom
# metrics.
# @param [String] name
# The project on which to execute the request. The format is "projects/`
# project_id_or_number`".
# @param [Google::Apis::MonitoringV3::MetricDescriptor] metric_descriptor_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::MetricDescriptor] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::MetricDescriptor]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_metric_descriptor(name, metric_descriptor_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}/metricDescriptors', options)
command.request_representation = Google::Apis::MonitoringV3::MetricDescriptor::Representation
command.request_object = metric_descriptor_object
command.response_representation = Google::Apis::MonitoringV3::MetricDescriptor::Representation
command.response_class = Google::Apis::MonitoringV3::MetricDescriptor
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes a metric descriptor. Only user-created custom metrics can be deleted.
# @param [String] name
# The metric descriptor on which to execute the request. The format is "projects/
# `project_id_or_number`/metricDescriptors/`metric_id`". An example of `
# metric_id` is: "custom.googleapis.com/my_test_metric".
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_metric_descriptor(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single metric descriptor. This method does not require a Stackdriver
# account.
# @param [String] name
# The metric descriptor on which to execute the request. The format is "projects/
# `project_id_or_number`/metricDescriptors/`metric_id`". An example value of `
# metric_id` is "compute.googleapis.com/instance/disk/read_bytes_count".
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::MetricDescriptor] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::MetricDescriptor]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_metric_descriptor(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::MetricDescriptor::Representation
command.response_class = Google::Apis::MonitoringV3::MetricDescriptor
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists metric descriptors that match a filter. This method does not require a
# Stackdriver account.
# @param [String] name
# The project on which to execute the request. The format is "projects/`
# project_id_or_number`".
# @param [String] filter
# If this field is empty, all custom and system-defined metric descriptors are
# returned. Otherwise, the filter specifies which metric descriptors are to be
# returned. For example, the following filter matches all custom metrics:
# metric.type = starts_with("custom.googleapis.com/")
# @param [Fixnum] page_size
# A positive number that is the maximum number of results to return.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return additional results from the previous method call.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListMetricDescriptorsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListMetricDescriptorsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_metric_descriptors(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/metricDescriptors', options)
command.response_representation = Google::Apis::MonitoringV3::ListMetricDescriptorsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListMetricDescriptorsResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single monitored resource descriptor. This method does not require a
# Stackdriver account.
# @param [String] name
# The monitored resource descriptor to get. The format is "projects/`
# project_id_or_number`/monitoredResourceDescriptors/`resource_type`". The `
# resource_type` is a predefined type, such as cloudsql_database.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::MonitoredResourceDescriptor] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::MonitoredResourceDescriptor]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_monitored_resource_descriptor(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::MonitoredResourceDescriptor::Representation
command.response_class = Google::Apis::MonitoringV3::MonitoredResourceDescriptor
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists monitored resource descriptors that match a filter. This method does not
# require a Stackdriver account.
# @param [String] name
# The project on which to execute the request. The format is "projects/`
# project_id_or_number`".
# @param [String] filter
# An optional filter describing the descriptors to be returned. The filter can
# reference the descriptor's type and labels. For example, the following filter
# returns only Google Compute Engine descriptors that have an id label:
# resource.type = starts_with("gce_") AND resource.label:id
# @param [Fixnum] page_size
# A positive number that is the maximum number of results to return.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return additional results from the previous method call.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListMonitoredResourceDescriptorsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListMonitoredResourceDescriptorsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_monitored_resource_descriptors(name, filter: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/monitoredResourceDescriptors', options)
command.response_representation = Google::Apis::MonitoringV3::ListMonitoredResourceDescriptorsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListMonitoredResourceDescriptorsResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single channel descriptor. The descriptor indicates which fields are
# expected / permitted for a notification channel of the given type.
# @param [String] name
# The channel type for which to execute the request. The format is projects/[
# PROJECT_ID]/notificationChannelDescriptors/`channel_type`.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::NotificationChannelDescriptor] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::NotificationChannelDescriptor]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_notification_channel_descriptor(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::NotificationChannelDescriptor::Representation
command.response_class = Google::Apis::MonitoringV3::NotificationChannelDescriptor
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists the descriptors for supported channel types. The use of descriptors
# makes it possible for new channel types to be dynamically added.
# @param [String] name
# The REST resource name of the parent from which to retrieve the notification
# channel descriptors. The expected syntax is:
# projects/[PROJECT_ID]
# Note that this names the parent container in which to look for the descriptors;
# to retrieve a single descriptor by name, use the
# GetNotificationChannelDescriptor operation, instead.
# @param [Fixnum] page_size
# The maximum number of results to return in a single response. If not set to a
# positive number, a reasonable value will be chosen by the service.
# @param [String] page_token
# If non-empty, page_token must contain a value returned as the next_page_token
# in a previous response to request the next set of results.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListNotificationChannelDescriptorsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListNotificationChannelDescriptorsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_notification_channel_descriptors(name, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/notificationChannelDescriptors', options)
command.response_representation = Google::Apis::MonitoringV3::ListNotificationChannelDescriptorsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListNotificationChannelDescriptorsResponse
command.params['name'] = name unless name.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Creates a new notification channel, representing a single notification
# endpoint such as an email address, SMS number, or PagerDuty service.
# @param [String] name
# The project on which to execute the request. The format is:
# projects/[PROJECT_ID]
# Note that this names the container into which the channel will be written.
# This does not name the newly created channel. The resulting channel's name
# will have a normalized version of this field as a prefix, but will add /
# notificationChannels/[CHANNEL_ID] to identify the channel.
# @param [Google::Apis::MonitoringV3::NotificationChannel] notification_channel_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::NotificationChannel] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::NotificationChannel]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_notification_channel(name, notification_channel_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}/notificationChannels', options)
command.request_representation = Google::Apis::MonitoringV3::NotificationChannel::Representation
command.request_object = notification_channel_object
command.response_representation = Google::Apis::MonitoringV3::NotificationChannel::Representation
command.response_class = Google::Apis::MonitoringV3::NotificationChannel
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes a notification channel.
# @param [String] name
# The channel for which to execute the request. The format is projects/[
# PROJECT_ID]/notificationChannels/[CHANNEL_ID].
# @param [Boolean] force
# If true, the notification channel will be deleted regardless of its use in
# alert policies (the policies will be updated to remove the channel). If false,
# channels that are still referenced by an existing alerting policy will fail to
# be deleted in a delete operation.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_notification_channel(name, force: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['force'] = force unless force.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single notification channel. The channel includes the relevant
# configuration details with which the channel was created. However, the
# response may truncate or omit passwords, API keys, or other private key matter
# and thus the response may not be 100% identical to the information that was
# supplied in the call to the create method.
# @param [String] name
# The channel for which to execute the request. The format is projects/[
# PROJECT_ID]/notificationChannels/[CHANNEL_ID].
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::NotificationChannel] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::NotificationChannel]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_notification_channel(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::NotificationChannel::Representation
command.response_class = Google::Apis::MonitoringV3::NotificationChannel
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Requests a verification code for an already verified channel that can then be
# used in a call to VerifyNotificationChannel() on a different channel with an
# equivalent identity in the same or in a different project. This makes it
# possible to copy a channel between projects without requiring manual
# reverification of the channel. If the channel is not in the verified state,
# this method will fail (in other words, this may only be used if the
# SendNotificationChannelVerificationCode and VerifyNotificationChannel paths
# have already been used to put the given channel into the verified state).There
# is no guarantee that the verification codes returned by this method will be of
# a similar structure or form as the ones that are delivered to the channel via
# SendNotificationChannelVerificationCode; while VerifyNotificationChannel()
# will recognize both the codes delivered via
# SendNotificationChannelVerificationCode() and returned from
# GetNotificationChannelVerificationCode(), it is typically the case that the
# verification codes delivered via SendNotificationChannelVerificationCode()
# will be shorter and also have a shorter expiration (e.g. codes such as "G-
# 123456") whereas GetVerificationCode() will typically return a much longer,
# websafe base 64 encoded string that has a longer expiration time.
# @param [String] name
# The notification channel for which a verification code is to be generated and
# retrieved. This must name a channel that is already verified; if the specified
# channel is not verified, the request will fail.
# @param [Google::Apis::MonitoringV3::GetNotificationChannelVerificationCodeRequest] get_notification_channel_verification_code_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::GetNotificationChannelVerificationCodeResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::GetNotificationChannelVerificationCodeResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_notification_channel_verification_code(name, get_notification_channel_verification_code_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}:getVerificationCode', options)
command.request_representation = Google::Apis::MonitoringV3::GetNotificationChannelVerificationCodeRequest::Representation
command.request_object = get_notification_channel_verification_code_request_object
command.response_representation = Google::Apis::MonitoringV3::GetNotificationChannelVerificationCodeResponse::Representation
command.response_class = Google::Apis::MonitoringV3::GetNotificationChannelVerificationCodeResponse
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists the notification channels that have been created for the project.
# @param [String] name
# The project on which to execute the request. The format is projects/[
# PROJECT_ID]. That is, this names the container in which to look for the
# notification channels; it does not name a specific channel. To query a
# specific channel by REST resource name, use the GetNotificationChannel
# operation.
# @param [String] filter
# If provided, this field specifies the criteria that must be met by
# notification channels to be included in the response.For more details, see
# sorting and filtering.
# @param [String] order_by
# A comma-separated list of fields by which to sort the result. Supports the
# same set of fields as in filter. Entries can be prefixed with a minus sign to
# sort in descending rather than ascending order.For more details, see sorting
# and filtering.
# @param [Fixnum] page_size
# The maximum number of results to return in a single response. If not set to a
# positive number, a reasonable value will be chosen by the service.
# @param [String] page_token
# If non-empty, page_token must contain a value returned as the next_page_token
# in a previous response to request the next set of results.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListNotificationChannelsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListNotificationChannelsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_notification_channels(name, filter: nil, order_by: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/notificationChannels', options)
command.response_representation = Google::Apis::MonitoringV3::ListNotificationChannelsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListNotificationChannelsResponse
command.params['name'] = name unless name.nil?
command.query['filter'] = filter unless filter.nil?
command.query['orderBy'] = order_by unless order_by.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Updates a notification channel. Fields not specified in the field mask remain
# unchanged.
# @param [String] name
# The full REST resource name for this channel. The syntax is:
# projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
# The [CHANNEL_ID] is automatically assigned by the server on creation.
# @param [Google::Apis::MonitoringV3::NotificationChannel] notification_channel_object
# @param [String] update_mask
# The fields to update.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::NotificationChannel] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::NotificationChannel]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def patch_project_notification_channel(name, notification_channel_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:patch, 'v3/{+name}', options)
command.request_representation = Google::Apis::MonitoringV3::NotificationChannel::Representation
command.request_object = notification_channel_object
command.response_representation = Google::Apis::MonitoringV3::NotificationChannel::Representation
command.response_class = Google::Apis::MonitoringV3::NotificationChannel
command.params['name'] = name unless name.nil?
command.query['updateMask'] = update_mask unless update_mask.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Causes a verification code to be delivered to the channel. The code can then
# be supplied in VerifyNotificationChannel to verify the channel.
# @param [String] name
# The notification channel to which to send a verification code.
# @param [Google::Apis::MonitoringV3::SendNotificationChannelVerificationCodeRequest] send_notification_channel_verification_code_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def send_project_notification_channel_verification_code(name, send_notification_channel_verification_code_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}:sendVerificationCode', options)
command.request_representation = Google::Apis::MonitoringV3::SendNotificationChannelVerificationCodeRequest::Representation
command.request_object = send_notification_channel_verification_code_request_object
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Verifies a NotificationChannel by proving receipt of the code delivered to the
# channel as a result of calling SendNotificationChannelVerificationCode.
# @param [String] name
# The notification channel to verify.
# @param [Google::Apis::MonitoringV3::VerifyNotificationChannelRequest] verify_notification_channel_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::NotificationChannel] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::NotificationChannel]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def verify_notification_channel(name, verify_notification_channel_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}:verify', options)
command.request_representation = Google::Apis::MonitoringV3::VerifyNotificationChannelRequest::Representation
command.request_object = verify_notification_channel_request_object
command.response_representation = Google::Apis::MonitoringV3::NotificationChannel::Representation
command.response_class = Google::Apis::MonitoringV3::NotificationChannel
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Creates or adds data to one or more time series. The response is empty if all
# time series in the request were written. If any time series could not be
# written, a corresponding failure message is included in the error response.
# @param [String] name
# The project on which to execute the request. The format is "projects/`
# project_id_or_number`".
# @param [Google::Apis::MonitoringV3::CreateTimeSeriesRequest] create_time_series_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_time_series(name, create_time_series_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+name}/timeSeries', options)
command.request_representation = Google::Apis::MonitoringV3::CreateTimeSeriesRequest::Representation
command.request_object = create_time_series_request_object
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists time series that match a filter. This method does not require a
# Stackdriver account.
# @param [String] name
# The project on which to execute the request. The format is "projects/`
# project_id_or_number`".
# @param [String] aggregation_alignment_period
# The alignment period for per-time series alignment. If present,
# alignmentPeriod must be at least 60 seconds. After per-time series alignment,
# each time series will contain data points only on the period boundaries. If
# perSeriesAligner is not specified or equals ALIGN_NONE, then this field is
# ignored. If perSeriesAligner is specified and does not equal ALIGN_NONE, then
# this field must be defined; otherwise an error is returned.
# @param [String] aggregation_cross_series_reducer
# The approach to be used to combine time series. Not all reducer functions may
# be applied to all time series, depending on the metric type and the value type
# of the original time series. Reduction may change the metric type of value
# type of the time series.Time series data must be aligned in order to perform
# cross-time series reduction. If crossSeriesReducer is specified, then
# perSeriesAligner must be specified and not equal ALIGN_NONE and
# alignmentPeriod must be specified; otherwise, an error is returned.
# @param [Array<String>, String] aggregation_group_by_fields
# The set of fields to preserve when crossSeriesReducer is specified. The
# groupByFields determine how the time series are partitioned into subsets prior
# to applying the aggregation function. Each subset contains time series that
# have the same value for each of the grouping fields. Each individual time
# series is a member of exactly one subset. The crossSeriesReducer is applied to
# each subset of time series. It is not possible to reduce across different
# resource types, so this field implicitly contains resource.type. Fields not
# specified in groupByFields are aggregated away. If groupByFields is not
# specified and all the time series have the same resource type, then the time
# series are aggregated into a single output time series. If crossSeriesReducer
# is not defined, this field is ignored.
# @param [String] aggregation_per_series_aligner
# The approach to be used to align individual time series. Not all alignment
# functions may be applied to all time series, depending on the metric type and
# value type of the original time series. Alignment may change the metric type
# or the value type of the time series.Time series data must be aligned in order
# to perform cross-time series reduction. If crossSeriesReducer is specified,
# then perSeriesAligner must be specified and not equal ALIGN_NONE and
# alignmentPeriod must be specified; otherwise, an error is returned.
# @param [String] filter
# A monitoring filter that specifies which time series should be returned. The
# filter must specify a single metric type, and can additionally specify metric
# labels and other information. For example:
# metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
# metric.labels.instance_name = "my-instance-name"
# @param [String] interval_end_time
# Required. The end of the time interval.
# @param [String] interval_start_time
# Optional. The beginning of the time interval. The default value for the start
# time is the end time. The start time must not be later than the end time.
# @param [String] order_by
# Unsupported: must be left blank. The points in each time series are returned
# in reverse time order.
# @param [Fixnum] page_size
# A positive number that is the maximum number of results to return. If
# page_size is empty or more than 100,000 results, the effective page_size is
# 100,000 results. If view is set to FULL, this is the maximum number of Points
# returned. If view is set to HEADERS, this is the maximum number of TimeSeries
# returned.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return additional results from the previous method call.
# @param [String] view
# Specifies which information is returned about the time series.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListTimeSeriesResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListTimeSeriesResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_time_series(name, aggregation_alignment_period: nil, aggregation_cross_series_reducer: nil, aggregation_group_by_fields: nil, aggregation_per_series_aligner: nil, filter: nil, interval_end_time: nil, interval_start_time: nil, order_by: nil, page_size: nil, page_token: nil, view: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}/timeSeries', options)
command.response_representation = Google::Apis::MonitoringV3::ListTimeSeriesResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListTimeSeriesResponse
command.params['name'] = name unless name.nil?
command.query['aggregation.alignmentPeriod'] = aggregation_alignment_period unless aggregation_alignment_period.nil?
command.query['aggregation.crossSeriesReducer'] = aggregation_cross_series_reducer unless aggregation_cross_series_reducer.nil?
command.query['aggregation.groupByFields'] = aggregation_group_by_fields unless aggregation_group_by_fields.nil?
command.query['aggregation.perSeriesAligner'] = aggregation_per_series_aligner unless aggregation_per_series_aligner.nil?
command.query['filter'] = filter unless filter.nil?
command.query['interval.endTime'] = interval_end_time unless interval_end_time.nil?
command.query['interval.startTime'] = interval_start_time unless interval_start_time.nil?
command.query['orderBy'] = order_by unless order_by.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['view'] = view unless view.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Creates a new uptime check configuration.
# @param [String] parent
# The project in which to create the uptime check. The format is projects/[
# PROJECT_ID].
# @param [Google::Apis::MonitoringV3::UptimeCheckConfig] uptime_check_config_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::UptimeCheckConfig] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::UptimeCheckConfig]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def create_project_uptime_check_config(parent, uptime_check_config_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v3/{+parent}/uptimeCheckConfigs', options)
command.request_representation = Google::Apis::MonitoringV3::UptimeCheckConfig::Representation
command.request_object = uptime_check_config_object
command.response_representation = Google::Apis::MonitoringV3::UptimeCheckConfig::Representation
command.response_class = Google::Apis::MonitoringV3::UptimeCheckConfig
command.params['parent'] = parent unless parent.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes an uptime check configuration. Note that this method will fail if the
# uptime check configuration is referenced by an alert policy or other dependent
# configs that would be rendered invalid by the deletion.
# @param [String] name
# The uptime check configuration to delete. The format is projects/[PROJECT_ID]/
# uptimeCheckConfigs/[UPTIME_CHECK_ID].
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_project_uptime_check_config(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::Empty::Representation
command.response_class = Google::Apis::MonitoringV3::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets a single uptime check configuration.
# @param [String] name
# The uptime check configuration to retrieve. The format is projects/[
# PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::UptimeCheckConfig] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::UptimeCheckConfig]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_project_uptime_check_config(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+name}', options)
command.response_representation = Google::Apis::MonitoringV3::UptimeCheckConfig::Representation
command.response_class = Google::Apis::MonitoringV3::UptimeCheckConfig
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists the existing valid uptime check configurations for the project, leaving
# out any invalid configurations.
# @param [String] parent
# The project whose uptime check configurations are listed. The format is
# projects/[PROJECT_ID].
# @param [Fixnum] page_size
# The maximum number of results to return in a single response. The server may
# further constrain the maximum number of results returned in a single page. If
# the page_size is <=0, the server will decide the number of results to be
# returned.
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return more results from the previous method call.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListUptimeCheckConfigsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListUptimeCheckConfigsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_project_uptime_check_configs(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/{+parent}/uptimeCheckConfigs', options)
command.response_representation = Google::Apis::MonitoringV3::ListUptimeCheckConfigsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListUptimeCheckConfigsResponse
command.params['parent'] = parent unless parent.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Updates an uptime check configuration. You can either replace the entire
# configuration with a new one or replace only certain fields in the current
# configuration by specifying the fields to be updated via "updateMask". Returns
# the updated configuration.
# @param [String] name
# A unique resource name for this UptimeCheckConfig. The format is:projects/[
# PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID].This field should be omitted
# when creating the uptime check configuration; on create, the resource name is
# assigned by the server and included in the response.
# @param [Google::Apis::MonitoringV3::UptimeCheckConfig] uptime_check_config_object
# @param [String] update_mask
# Optional. If present, only the listed fields in the current uptime check
# configuration are updated with values from the new configuration. If this
# field is empty, then the current configuration is completely replaced with the
# new configuration.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::UptimeCheckConfig] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::UptimeCheckConfig]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def patch_project_uptime_check_config(name, uptime_check_config_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:patch, 'v3/{+name}', options)
command.request_representation = Google::Apis::MonitoringV3::UptimeCheckConfig::Representation
command.request_object = uptime_check_config_object
command.response_representation = Google::Apis::MonitoringV3::UptimeCheckConfig::Representation
command.response_class = Google::Apis::MonitoringV3::UptimeCheckConfig
command.params['name'] = name unless name.nil?
command.query['updateMask'] = update_mask unless update_mask.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Returns the list of IPs that checkers run from
# @param [Fixnum] page_size
# The maximum number of results to return in a single response. The server may
# further constrain the maximum number of results returned in a single page. If
# the page_size is <=0, the server will decide the number of results to be
# returned. NOTE: this field is not yet implemented
# @param [String] page_token
# If this field is not empty then it must contain the nextPageToken value
# returned by a previous call to this method. Using this field causes the method
# to return more results from the previous method call. NOTE: this field is not
# yet implemented
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::MonitoringV3::ListUptimeCheckIpsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::MonitoringV3::ListUptimeCheckIpsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_uptime_check_ips(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v3/uptimeCheckIps', options)
command.response_representation = Google::Apis::MonitoringV3::ListUptimeCheckIpsResponse::Representation
command.response_class = Google::Apis::MonitoringV3::ListUptimeCheckIpsResponse
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
protected
def apply_command_defaults(command)
command.query['key'] = key unless key.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
end
end
end
end
end
| 64.86881 | 361 | 0.682912 |
1c55f187fa9a3375ac9d2e0ed156cc66a58aa684 | 44 | module ZipGenerator
VERSION = "0.0.1"
end
| 11 | 19 | 0.704545 |
6a07b9470d9b7df6993806fd18eaed3b71e60bc2 | 139 | class AddSingletonToIntroduction < ActiveRecord::Migration[5.1]
def change
add_column :introductions, :singleton, :decimal
end
end
| 23.166667 | 63 | 0.776978 |
e9d3575c365568545e8362b4de64859f3b943853 | 972 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_08_24_202516) do
create_table "articles", force: :cascade do |t|
t.string "title"
t.text "text"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end
end
| 42.26087 | 86 | 0.765432 |
623e600ddd465cc8792a58b3f12fe608bf1922b2 | 1,389 | #
# Copyright:: Chef Software Inc.
# License:: Apache License, Version 2.0
#
# 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_relative "exceptions"
require "chef/cookbook/metadata"
module ChefCLI
# Subclass of Chef's Cookbook::Metadata class that provides the API expected
# by CookbookOmnifetch
class CookbookMetadata < Chef::Cookbook::Metadata
def self.from_path(path)
metadata_json_path = File.join(path, "metadata.json")
metadata_rb_path = File.join(path, "metadata.rb")
if File.exist?(metadata_json_path)
new.tap { |m| m.from_json(File.read(metadata_json_path)) }
elsif File.exist?(metadata_rb_path)
new.tap { |m| m.from_file(metadata_rb_path) }
else
raise MalformedCookbook, "Cookbook at #{path} has neither metadata.json or metadata.rb"
end
end
def cookbook_name
name
end
end
end
| 30.195652 | 95 | 0.720662 |
e9afd35c91b822de01f5703f95c366b266498e0a | 1,695 | cask "corsair-icue" do
version "3.35.152"
sha256 "1df9913bd1391766840d71ae399dc59e681c02d58fe5021a0b09bb0a305b5171"
url "https://downloads.corsair.com/Files/CUE/iCUE-#{version}-release.dmg"
appcast "https://www.corsair.com/us/en/downloads/search?searchCategory=Cor_Products_iCue_Compatibility"
name "Corsair iCUE"
desc "Software for Corsair components and devices"
homepage "https://www.corsair.com/us/en/icue"
depends_on macos: ">= :high_sierra"
pkg "iCUE.pkg"
uninstall launchctl: [
"com.corsair.AudioConfigService.System",
"com.corsair.cue.#{version.major}.launchHelper",
],
quit: [
"com.corsair.cue.*",
"org.qt-project.*",
],
script: {
executable: "/usr/bin/osascript",
args: ["#{appdir}/Corsair/iCUEUninstaller.app/Contents/Scripts/uninstall.scpt"],
sudo: true,
},
pkgutil: [
"com.corsair.CorsairAudio",
"com.corsair.cue.*",
],
delete: [
"/Library/Audio/Plug-Ins/HAL/CorsairAudio.plugin",
"/Library/LaunchAgents/iCUELaunchAgent.plist",
],
rmdir: "/Applications/Corsair"
zap trash: [
"~/.config/com.corsair",
"~/Library/Application Support/Corsair",
"~/Library/Caches/Corsair",
"~/Library/Caches/iCUEUninstaller",
"~/Library/Preferences/com.corsair.cue.#{version.major}.plist",
"~/Library/Saved Application State/com.corsair.cue.#{version.major}.cue_unistaller.savedState",
"~/Library/Saved Application State/com.corsair.cue.#{version.major}.savedState",
]
end
| 35.3125 | 105 | 0.612389 |
61ffdf9f0157fd07e73cbb6eb45f747dd02edb50 | 241 | class SubmissionsAddSubmissionVersionUsed < ActiveRecord::Migration[4.2]
def self.up
add_column :submissions, :submission_version_used, :boolean
end
def self.down
remove_column :submissions, :submission_version_used
end
end
| 24.1 | 72 | 0.788382 |
d580a5ff87a6ab34bc25c6b3fe2da181f8a182dd | 1,046 | require 'helper'
class TestZoneFactory < Test::Unit::TestCase
context "ZoneFactory" do
setup do
@dynect = Dynectastic.session(DYNECT_CUST_NAME, DYNECT_USER_NAME, DYNECT_USER_PASS)
@factory = @dynect.zones
@zone = @factory.build(
:name => "dynectastictests.com",
:contact => "[email protected]",
:ttl => 1800
)
@zone.save
end
teardown do
@zone.destroy
end
should "build new zone" do
zone = @factory.build(:name => "new_zone.name", :contact => "[email protected]", :ttl => 1800)
assert_equal "[email protected]", zone.contact
assert_equal 1800, zone.ttl
assert_equal "new_zone.name", zone.name
end
should "find zone by name" do
zone = @factory.find_by_name("dynectastictests.com")
assert_equal "dynectastictests.com", zone.name
end
should "find all existing zones" do
zones = @factory.find_all
assert zones.find{|z| z.name == 'dynectastictests.com'}
end
end
end | 25.512195 | 99 | 0.617591 |
b949a80b0b4e028f741cef6c11aecbf92b8187df | 678 | Pod::Spec.new do |spec|
spec.name = 'GradientView'
spec.version = '2.3.4'
spec.authors = {'Sam Soffes' => '[email protected]'}
spec.homepage = 'https://github.com/soffes/GradientView'
spec.summary = 'Easily use gradients in UIKit.'
spec.description = 'Gradient View is a simple UIView wrapper around CGGradient.'
spec.source = {:git => 'https://github.com/soffes/GradientView.git', :tag => "v#{spec.version}"}
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.swift_versions = ['5.0', '5.2']
spec.ios.deployment_target = '8.0'
spec.tvos.deployment_target = '9.0'
spec.frameworks = 'UIKit'
spec.source_files = 'Sources/GradientView/**/*.swift'
end
| 37.666667 | 98 | 0.668142 |
38f0cfbb317d44cb6500e599a2f9e4eca7de0d11 | 1,183 | module Noir::Base
class Command
class << self # class methods
def description
if @description.nil?
raise "Undefined description : " + self.to_s
else
puts self.to_s.split(':').last.downcase.ljust(15) + " : " + @description
end
end
def execute *args
if self == Noir::Base::Command
raise 'called raw Noir::Base::Command.execute. please call it in extended class.'
end
# check invalid command
check_command_not_found(*args)
# default execute is show description with sub commands.
description
puts '-- sub commands --'
sub_commands.map{|c|eval(self.to_s + '::' + c.to_s)}.each{|c| c.description}
end
def sub_commands
consts = constants - superclass.constants
consts = consts.select do |const|
const_get(const).class == Class &&
const_get(const).ancestors.include?(Noir::Base::Command)
end
consts.sort
end
def check_command_not_found command=nil, *args
return if command.nil?
raise 'command not found : ' + command
end
end
end
end
| 25.717391 | 91 | 0.587489 |
bffcddef1706cbd916894a9594da9ef718bf9d7e | 5,460 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "railsTest_#{Rails.env}"
config.action_mailer.delivery_method = :deliver
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = {host: 'eventsurfer.online'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: '[email protected]',
password: '***REMOVED***',
authentication: 'plain',
enable_starttls_auto: true}
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end
| 44.390244 | 114 | 0.759524 |
4a31c812f619f3f1625d1cdc836859c72b788f68 | 116 | require 'rails_helper'
module OurnaropaPlanner
RSpec.describe CoursesController, type: :controller do
end
end
| 14.5 | 56 | 0.801724 |
5d43017958d7045176bfd8a3d1e05b8619837bf9 | 523 | cask 'fredm-fuse' do
version '1.3.7'
sha256 'c86c2820ca65af064bb9971cfb7cdff81f2f974c3492ea10d7cc7d0c82493a08'
url "https://downloads.sourceforge.net/fuse-for-macosx/fuse-for-macosx/#{version}/FuseForMacOS-#{version}.zip"
appcast 'https://sourceforge.net/projects/fuse-for-macosx/rss?path=/fuse-for-macosx',
checkpoint: '9b4362ea3a1b8e0eae268315258065061af8bd4f0a58f4e3cb7684e51c9de025'
name 'Fuse for Mac OS X'
homepage 'http://fuse-for-macosx.sourceforge.net/'
app 'Fuse for MacOS/Fuse.app'
end
| 40.230769 | 112 | 0.770554 |
0837dd7ffcf9c8591773bfb2d02da1c3af4cb937 | 1,725 | class NewrelicCli < Formula
desc "Command-line interface for New Relic"
homepage "https://github.com/newrelic/newrelic-cli"
url "https://github.com/newrelic/newrelic-cli/archive/v0.36.8.tar.gz"
sha256 "a8fb1a60e39fc46e8bd97465b2d5287a462dd9506b5b15bd8011055525252638"
license "Apache-2.0"
head "https://github.com/newrelic/newrelic-cli.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "b59546476f35e6964d8699b94dc8e14c5909cc2081f422117632704ffc39962c"
sha256 cellar: :any_skip_relocation, big_sur: "daa60e98859c418ff8bd82c3512a4512e2dd125be1bc6ee932c31b6afcb54a3a"
sha256 cellar: :any_skip_relocation, catalina: "7dbd69fc51656485efb7dc0533ed2fc87e5a636335e042bc098ae28d0a5bda56"
sha256 cellar: :any_skip_relocation, mojave: "929e1616331eb5661903256509a77560a86f465ecb19867ccc190fb4164b9d5d"
sha256 cellar: :any_skip_relocation, x86_64_linux: "84286eea7c5204dfd4e720eecdb06727a783741dc5e43ddf5ba52cbeedd62ad4"
end
depends_on "go" => :build
def install
ENV["PROJECT_VER"] = version
system "make", "compile-only"
if OS.mac?
bin.install "bin/darwin/newrelic"
else
bin.install "bin/linux/newrelic"
end
output = Utils.safe_popen_read("#{bin}/newrelic", "completion", "--shell", "bash")
(bash_completion/"newrelic").write output
output = Utils.safe_popen_read("#{bin}/newrelic", "completion", "--shell", "zsh")
(zsh_completion/"_newrelic").write output
end
test do
output = shell_output("#{bin}/newrelic config list")
assert_match "loglevel", output
assert_match "plugindir", output
assert_match version.to_s, shell_output("#{bin}/newrelic version 2>&1")
end
end
| 41.071429 | 122 | 0.751304 |
62a0763f6859db5258dfe62fd8829d3d0f574d91 | 913 | require "language/node"
class AngularCli < Formula
desc "CLI tool for Angular"
homepage "https://cli.angular.io/"
url "https://registry.npmjs.org/@angular/cli/-/cli-6.1.2.tgz"
sha256 "72be54e8777b1d9328164fa8274c979bff8e2c37b25e8b53c6d1c419f3a52e37"
bottle do
sha256 "55ddb4c10b8aaba9781cc6993cfaabca8c6a1dba39807d30e919c441778bd7fd" => :high_sierra
sha256 "d99ec499b120bd19ff7dc12674e676a4872d94c845887ee80b79f3a96e2d1968" => :sierra
sha256 "4fffeaf28e2ddd868389f75b30523750ba07e1d3eb632dbc8128f9dd25e350af" => :el_capitan
end
depends_on "node"
def install
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
system bin/"ng", "new", "angular-homebrew-test", "--skip-install"
assert_predicate testpath/"angular-homebrew-test/package.json", :exist?, "Project was not created"
end
end
| 33.814815 | 102 | 0.762322 |
1d7f1fbdc88ffa042d4b8b9f35a3c8a2ab92bf86 | 176 | class CreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
t.string :name
t.string :surname
t.timestamps
end
end
end
| 16 | 48 | 0.642045 |
334e9c0de60c7620fb1e5a87a22118a74d7c834a | 525 | Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root to: "users#welcome"
resources :notes
resources :courses do
resources :notes, only: [:index, :new, :create]
end
get "/login", to: "sessions#new"
post "/login", to: "sessions#create"
delete "/logout", to: "sessions#destroy"
get "/signup", to: "users#new"
post "/signup", to: "users#create"
get "/auth/:provider/callback", to: "sessions#omniauth"
end
| 21 | 102 | 0.674286 |
7a9fc304c16e1df5e0970bf9dcb867e6491fb9ea | 3,753 | module ActiveRecord
module ConnectionAdapters
class JdbcConnection
module ConfigHelper
attr_reader :config
def config=(config)
@config = config.symbolize_keys!
end
def configure_connection
config[:retry_count] ||= 5
config[:connection_alive_sql] ||= "select 1"
@jndi_connection = false
@connection = nil
if config[:jndi]
begin
configure_jndi
rescue => e
warn "JNDI data source unavailable: #{e.message}; trying straight JDBC"
configure_jdbc
end
else
configure_jdbc
end
end
def configure_jndi
jndi = config[:jndi].to_s
ctx = javax.naming.InitialContext.new
ds = ctx.lookup(jndi)
@connection_factory = JdbcConnectionFactory.impl do
ds.connection
end
unless config[:driver]
config[:driver] = connection.meta_data.connection.java_class.name
end
@jndi_connection = true
end
def configure_url
url = config[:url].to_s
if Hash === config[:options]
options = ''
config[:options].each do |k,v|
options << '&' unless options.empty?
options << "#{k}=#{v}"
end
url = url['?'] ? "#{url}&#{options}" : "#{url}?#{options}" unless options.empty?
config[:url] = url
config[:options] = nil
end
url
end
def configure_jdbc
driver = config[:driver].to_s
user = config[:username].to_s
pass = config[:password].to_s
url = configure_url
unless driver && url
raise ::ActiveRecord::ConnectionFailed, "jdbc adapter requires driver class and url"
end
jdbc_driver = JdbcDriver.new(driver)
jdbc_driver.load
@connection_factory = JdbcConnectionFactory.impl do
jdbc_driver.connection(url, user, pass)
end
end
end
attr_reader :adapter, :connection_factory
# @native_database_types - setup properly by adapter= versus set_native_database_types.
# This contains type information for the adapter. Individual adapters can make tweaks
# by defined modify_types
#
# @native_types - This is the default type settings sans any modifications by the
# individual adapter. My guess is that if we loaded two adapters of different types
# then this is used as a base to be tweaked by each adapter to create @native_database_types
def initialize(config)
self.config = config
configure_connection
connection # force the connection to load
set_native_database_types
@stmts = {}
rescue Exception => e
raise "The driver encountered an error: #{e}"
end
def adapter=(adapter)
@adapter = adapter
@native_database_types = dup_native_types
@adapter.modify_types(@native_database_types)
end
# Duplicate all native types into new hash structure so it can be modified
# without destroying original structure.
def dup_native_types
types = {}
@native_types.each_pair do |k, v|
types[k] = v.inject({}) do |memo, kv|
memo[kv.first] = begin kv.last.dup rescue kv.last end
memo
end
end
types
end
private :dup_native_types
def jndi_connection?
@jndi_connection
end
def active?
@connection
end
private
include ConfigHelper
end
end
end
| 29.551181 | 98 | 0.576072 |
bbca083abf65ef93cb51f3e55a86efef3091553c | 802 | # frozen_string_literal: true
require 'spec_helper'
if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
describe 'Stdlib::IP::Address::V6::Nosubnet::Compressed' do
describe 'accepts ipv6 addresses in compressed format without subnets' do
[
'1080::8:800:200C:417A',
'FF01::101',
'::1',
'::',
].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
end
end
describe 'rejects other values' do
[
'1080::8:800:200C:417A/60',
'nope',
'127.0.0.1',
'FEDC::BA98:7654:3210::3210',
].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
end
end
end
end
| 23.588235 | 77 | 0.563591 |
aca6d9d95d5045479064d274b1be6a791ba4c174 | 20,813 | =begin
#DocuSign REST API
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module DocuSign_eSign
class Title
# When set to **true**, the anchor string does not consider case when matching strings in the document. The default value is **true**.
attr_accessor :anchor_case_sensitive
# Specifies the alignment of anchor tabs with anchor strings. Possible values are **left** or **right**. The default value is **left**.
attr_accessor :anchor_horizontal_alignment
# When set to **true**, this tab is ignored if anchorString is not found in the document.
attr_accessor :anchor_ignore_if_not_present
# When set to **true**, the anchor string in this tab matches whole words only (strings embedded in other strings are ignored.) The default value is **true**.
attr_accessor :anchor_match_whole_word
# Anchor text information for a radio button.
attr_accessor :anchor_string
# Specifies units of the X and Y offset. Units could be pixels, millimeters, centimeters, or inches.
attr_accessor :anchor_units
# Specifies the X axis location of the tab, in achorUnits, relative to the anchorString.
attr_accessor :anchor_x_offset
# Specifies the Y axis location of the tab, in achorUnits, relative to the anchorString.
attr_accessor :anchor_y_offset
# When set to **true**, the information in the tab is bold.
attr_accessor :bold
# When set to **true**, the field appears normally while the recipient is adding or modifying the information in the field, but the data is not visible (the characters are hidden by asterisks) to any other signer or the sender. When an envelope is completed the information is available to the sender through the Form Data link in the DocuSign Console. This setting applies only to text boxes and does not affect list boxes, radio buttons, or check boxes.
attr_accessor :conceal_value_on_document
# For conditional fields this is the TabLabel of the parent tab that controls this tab's visibility.
attr_accessor :conditional_parent_label
# For conditional fields, this is the value of the parent tab that controls the tab's visibility. If the parent tab is a Checkbox, Radio button, Optional Signature, or Optional Initial use \"on\" as the value to show that the parent tab is active.
attr_accessor :conditional_parent_value
# The DocuSign generated custom tab ID for the custom tab to be applied. This can only be used when adding new tabs for a recipient. When used, the new tab inherits all the custom tab properties.
attr_accessor :custom_tab_id
# When set to **true**, disables the auto sizing of single line text boxes in the signing screen when the signer enters data. If disabled users will only be able enter as much data as the text box can hold. By default this is false. This property only affects single line text boxes.
attr_accessor :disable_auto_size
# Specifies the document ID number that the tab is placed on. This must refer to an existing Document's ID attribute.
attr_accessor :document_id
attr_accessor :error_details
# The font to be used for the tab value. Supported Fonts: Arial, Arial, ArialNarrow, Calibri, CourierNew, Garamond, Georgia, Helvetica, LucidaConsole, Tahoma, TimesNewRoman, Trebuchet, Verdana, MSGothic, MSMincho, Default.
attr_accessor :font
# The font color used for the information in the tab. Possible values are: Black, BrightBlue, BrightRed, DarkGreen, DarkRed, Gold, Green, NavyBlue, Purple, or White.
attr_accessor :font_color
# The font size used for the information in the tab. Possible values are: Size7, Size8, Size9, Size10, Size11, Size12, Size14, Size16, Size18, Size20, Size22, Size24, Size26, Size28, Size36, Size48, or Size72.
attr_accessor :font_size
# When set to **true**, the information in the tab is italic.
attr_accessor :italic
# When set to **true**, the signer cannot change the data of the custom tab.
attr_accessor :locked
# An optional value that describes the maximum length of the property when the property is a string.
attr_accessor :max_length
attr_accessor :merge_field
#
attr_accessor :name
# The initial value of the tab when it was sent to the recipient.
attr_accessor :original_value
# Specifies the page number on which the tab is located.
attr_accessor :page_number
# Unique for the recipient. It is used by the tab element to indicate which recipient is to sign the Document.
attr_accessor :recipient_id
# When set to **true**, the signer is required to fill out this tab
attr_accessor :required
# Indicates the envelope status. Valid values are: * sent - The envelope is sent to the recipients. * created - The envelope is saved as a draft and can be modified and sent later.
attr_accessor :status
# The unique identifier for the tab. The tabid can be retrieved with the [ML:GET call].
attr_accessor :tab_id
# The label string associated with the tab.
attr_accessor :tab_label
#
attr_accessor :tab_order
# When set to **true**, the sender cannot change any attributes of the recipient. Used only when working with template recipients.
attr_accessor :template_locked
# When set to **true**, the sender may not remove the recipient. Used only when working with template recipients.
attr_accessor :template_required
# When set to **true**, the information in the tab is underlined.
attr_accessor :underline
# Specifies the value of the tab.
attr_accessor :value
# Width of the tab in pixels.
attr_accessor :width
# This indicates the horizontal offset of the object on the page. DocuSign uses 72 DPI when determining position.
attr_accessor :x_position
# This indicates the vertical offset of the object on the page. DocuSign uses 72 DPI when determining position.
attr_accessor :y_position
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'anchor_case_sensitive' => :'anchorCaseSensitive',
:'anchor_horizontal_alignment' => :'anchorHorizontalAlignment',
:'anchor_ignore_if_not_present' => :'anchorIgnoreIfNotPresent',
:'anchor_match_whole_word' => :'anchorMatchWholeWord',
:'anchor_string' => :'anchorString',
:'anchor_units' => :'anchorUnits',
:'anchor_x_offset' => :'anchorXOffset',
:'anchor_y_offset' => :'anchorYOffset',
:'bold' => :'bold',
:'conceal_value_on_document' => :'concealValueOnDocument',
:'conditional_parent_label' => :'conditionalParentLabel',
:'conditional_parent_value' => :'conditionalParentValue',
:'custom_tab_id' => :'customTabId',
:'disable_auto_size' => :'disableAutoSize',
:'document_id' => :'documentId',
:'error_details' => :'errorDetails',
:'font' => :'font',
:'font_color' => :'fontColor',
:'font_size' => :'fontSize',
:'italic' => :'italic',
:'locked' => :'locked',
:'max_length' => :'maxLength',
:'merge_field' => :'mergeField',
:'name' => :'name',
:'original_value' => :'originalValue',
:'page_number' => :'pageNumber',
:'recipient_id' => :'recipientId',
:'required' => :'required',
:'status' => :'status',
:'tab_id' => :'tabId',
:'tab_label' => :'tabLabel',
:'tab_order' => :'tabOrder',
:'template_locked' => :'templateLocked',
:'template_required' => :'templateRequired',
:'underline' => :'underline',
:'value' => :'value',
:'width' => :'width',
:'x_position' => :'xPosition',
:'y_position' => :'yPosition'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'anchor_case_sensitive' => :'String',
:'anchor_horizontal_alignment' => :'String',
:'anchor_ignore_if_not_present' => :'String',
:'anchor_match_whole_word' => :'String',
:'anchor_string' => :'String',
:'anchor_units' => :'String',
:'anchor_x_offset' => :'String',
:'anchor_y_offset' => :'String',
:'bold' => :'String',
:'conceal_value_on_document' => :'String',
:'conditional_parent_label' => :'String',
:'conditional_parent_value' => :'String',
:'custom_tab_id' => :'String',
:'disable_auto_size' => :'String',
:'document_id' => :'String',
:'error_details' => :'ErrorDetails',
:'font' => :'String',
:'font_color' => :'String',
:'font_size' => :'String',
:'italic' => :'String',
:'locked' => :'String',
:'max_length' => :'Integer',
:'merge_field' => :'MergeField',
:'name' => :'String',
:'original_value' => :'String',
:'page_number' => :'String',
:'recipient_id' => :'String',
:'required' => :'String',
:'status' => :'String',
:'tab_id' => :'String',
:'tab_label' => :'String',
:'tab_order' => :'String',
:'template_locked' => :'String',
:'template_required' => :'String',
:'underline' => :'String',
:'value' => :'String',
:'width' => :'Integer',
:'x_position' => :'String',
:'y_position' => :'String'
}
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?(:'anchorCaseSensitive')
self.anchor_case_sensitive = attributes[:'anchorCaseSensitive']
end
if attributes.has_key?(:'anchorHorizontalAlignment')
self.anchor_horizontal_alignment = attributes[:'anchorHorizontalAlignment']
end
if attributes.has_key?(:'anchorIgnoreIfNotPresent')
self.anchor_ignore_if_not_present = attributes[:'anchorIgnoreIfNotPresent']
end
if attributes.has_key?(:'anchorMatchWholeWord')
self.anchor_match_whole_word = attributes[:'anchorMatchWholeWord']
end
if attributes.has_key?(:'anchorString')
self.anchor_string = attributes[:'anchorString']
end
if attributes.has_key?(:'anchorUnits')
self.anchor_units = attributes[:'anchorUnits']
end
if attributes.has_key?(:'anchorXOffset')
self.anchor_x_offset = attributes[:'anchorXOffset']
end
if attributes.has_key?(:'anchorYOffset')
self.anchor_y_offset = attributes[:'anchorYOffset']
end
if attributes.has_key?(:'bold')
self.bold = attributes[:'bold']
end
if attributes.has_key?(:'concealValueOnDocument')
self.conceal_value_on_document = attributes[:'concealValueOnDocument']
end
if attributes.has_key?(:'conditionalParentLabel')
self.conditional_parent_label = attributes[:'conditionalParentLabel']
end
if attributes.has_key?(:'conditionalParentValue')
self.conditional_parent_value = attributes[:'conditionalParentValue']
end
if attributes.has_key?(:'customTabId')
self.custom_tab_id = attributes[:'customTabId']
end
if attributes.has_key?(:'disableAutoSize')
self.disable_auto_size = attributes[:'disableAutoSize']
end
if attributes.has_key?(:'documentId')
self.document_id = attributes[:'documentId']
end
if attributes.has_key?(:'errorDetails')
self.error_details = attributes[:'errorDetails']
end
if attributes.has_key?(:'font')
self.font = attributes[:'font']
end
if attributes.has_key?(:'fontColor')
self.font_color = attributes[:'fontColor']
end
if attributes.has_key?(:'fontSize')
self.font_size = attributes[:'fontSize']
end
if attributes.has_key?(:'italic')
self.italic = attributes[:'italic']
end
if attributes.has_key?(:'locked')
self.locked = attributes[:'locked']
end
if attributes.has_key?(:'maxLength')
self.max_length = attributes[:'maxLength']
end
if attributes.has_key?(:'mergeField')
self.merge_field = attributes[:'mergeField']
end
if attributes.has_key?(:'name')
self.name = attributes[:'name']
end
if attributes.has_key?(:'originalValue')
self.original_value = attributes[:'originalValue']
end
if attributes.has_key?(:'pageNumber')
self.page_number = attributes[:'pageNumber']
end
if attributes.has_key?(:'recipientId')
self.recipient_id = attributes[:'recipientId']
end
if attributes.has_key?(:'required')
self.required = attributes[:'required']
end
if attributes.has_key?(:'status')
self.status = attributes[:'status']
end
if attributes.has_key?(:'tabId')
self.tab_id = attributes[:'tabId']
end
if attributes.has_key?(:'tabLabel')
self.tab_label = attributes[:'tabLabel']
end
if attributes.has_key?(:'tabOrder')
self.tab_order = attributes[:'tabOrder']
end
if attributes.has_key?(:'templateLocked')
self.template_locked = attributes[:'templateLocked']
end
if attributes.has_key?(:'templateRequired')
self.template_required = attributes[:'templateRequired']
end
if attributes.has_key?(:'underline')
self.underline = attributes[:'underline']
end
if attributes.has_key?(:'value')
self.value = attributes[:'value']
end
if attributes.has_key?(:'width')
self.width = attributes[:'width']
end
if attributes.has_key?(:'xPosition')
self.x_position = attributes[:'xPosition']
end
if attributes.has_key?(:'yPosition')
self.y_position = attributes[:'yPosition']
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 &&
anchor_case_sensitive == o.anchor_case_sensitive &&
anchor_horizontal_alignment == o.anchor_horizontal_alignment &&
anchor_ignore_if_not_present == o.anchor_ignore_if_not_present &&
anchor_match_whole_word == o.anchor_match_whole_word &&
anchor_string == o.anchor_string &&
anchor_units == o.anchor_units &&
anchor_x_offset == o.anchor_x_offset &&
anchor_y_offset == o.anchor_y_offset &&
bold == o.bold &&
conceal_value_on_document == o.conceal_value_on_document &&
conditional_parent_label == o.conditional_parent_label &&
conditional_parent_value == o.conditional_parent_value &&
custom_tab_id == o.custom_tab_id &&
disable_auto_size == o.disable_auto_size &&
document_id == o.document_id &&
error_details == o.error_details &&
font == o.font &&
font_color == o.font_color &&
font_size == o.font_size &&
italic == o.italic &&
locked == o.locked &&
max_length == o.max_length &&
merge_field == o.merge_field &&
name == o.name &&
original_value == o.original_value &&
page_number == o.page_number &&
recipient_id == o.recipient_id &&
required == o.required &&
status == o.status &&
tab_id == o.tab_id &&
tab_label == o.tab_label &&
tab_order == o.tab_order &&
template_locked == o.template_locked &&
template_required == o.template_required &&
underline == o.underline &&
value == o.value &&
width == o.width &&
x_position == o.x_position &&
y_position == o.y_position
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
[anchor_case_sensitive, anchor_horizontal_alignment, anchor_ignore_if_not_present, anchor_match_whole_word, anchor_string, anchor_units, anchor_x_offset, anchor_y_offset, bold, conceal_value_on_document, conditional_parent_label, conditional_parent_value, custom_tab_id, disable_auto_size, document_id, error_details, font, font_color, font_size, italic, locked, max_length, merge_field, name, original_value, page_number, recipient_id, required, status, tab_id, tab_label, tab_order, template_locked, template_required, underline, value, width, x_position, y_position].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 = DocuSign_eSign.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
| 36.707231 | 580 | 0.646567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.