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
ab6ed36649ff299df6fbf2892450db95472ec558
237
require 'serverspec' require 'ansible_spec' set :backend, :exec # # Set ansible variables to serverspec property # group_idx = ENV['TARGET_GROUP_INDEX'].to_i vars = AnsibleSpec.get_variables('localhost', group_idx) set_property vars
16.928571
56
0.780591
edd0de99836e66f92526459b62d0ced6f32bd741
5,339
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. module Elasticsearch module API # Handles specific exceptional parameters and code snippets that need to be # included in the generated code. This module is included in SourceGenerator # so its methods can be used from the ERB template (method.erb). This will # potentially be refactored into different templates. module EndpointSpecifics # Endpoints that need Utils.__rescue_from_not_found IGNORE_404 = %w[ exists indices.exists indices.exists_alias indices.exists_template indices.exists_type ].freeze # Endpoints that need Utils.__rescue_from_not_found if the ignore # parameter is included COMPLEX_IGNORE_404 = %w[ delete get indices.flush_synced indices.delete_template indices.delete security.get_role security.get_user snapshot.status snapshot.get snapshot.get_repository snapshot.delete_repository snapshot.delete update watcher.delete_watch ].freeze # Endpoints that need params[:h] listified H_PARAMS = %w[aliases allocation count health indices nodes pending_tasks recovery shards thread_pool].freeze # Function that adds the listified h param code def specific_params(namespace) params = [] if H_PARAMS.include?(@method_name) && namespace == 'cat' if @method_name == 'nodes' params << 'params[:h] = Utils.__listify(params[:h], escape: false) if params[:h]' else params << 'params[:h] = Utils.__listify(params[:h]) if params[:h]' end end params end def needs_ignore_404?(endpoint) IGNORE_404.include? endpoint end def needs_complex_ignore_404?(endpoint) COMPLEX_IGNORE_404.include? endpoint end def module_name_helper(name) return name.upcase if %w[sql ssl].include? name name.split("_").map(&:capitalize).join end def ping_perform_request <<~SRC begin perform_request(method, path, params, body, headers).status == 200 ? true : false rescue Exception => e if e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not\s*Found|404|ConnectionFailed/i false else raise e end end SRC end def indices_stats_params_registry <<~SRC ParamsRegistry.register(:stats_params, [ #{@spec['params'].keys.map { |k| ":#{k}" }.join(",\n")} ].freeze) ParamsRegistry.register(:stats_parts, [ #{@parts['metric']['options'].push('metric').map { |k| ":#{k}" }.join(",\n")} ].freeze) SRC end def msearch_body_helper <<~SRC case when body.is_a?(Array) && body.any? { |d| d.has_key? :search } payload = body. inject([]) do |sum, item| meta = item data = meta.delete(:search) sum << meta sum << data sum end. map { |item| Elasticsearch::API.serializer.dump(item) } payload << "" unless payload.empty? payload = payload.join("\n") when body.is_a?(Array) payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) } payload << "" unless payload.empty? payload = payload.join("\n") else payload = body end SRC end def msearch_template_body_helper <<~SRC case when body.is_a?(Array) payload = body.map { |d| d.is_a?(String) ? d : Elasticsearch::API.serializer.dump(d) } payload << "" unless payload.empty? payload = payload.join("\n") else payload = body end SRC end def bulk_body_helper <<~SRC if body.is_a? Array payload = Elasticsearch::API::Utils.__bulkify(body) else payload = body end SRC end def bulk_doc_helper(info) <<~SRC # @option arguments [String|Array] :body #{info}. Array of Strings, Header/Data pairs, # or the conveniency "combined" format can be passed, refer to Elasticsearch::API::Utils.__bulkify documentation. SRC end end end end
31.779762
123
0.589811
283bcaea97b97b930c0cf3d8badd86d0a5be2b92
232
# # # Cookbook Name:: qs-stp # Recipe:: xfce4 # # Copyright 2014, cybuhh # [ "xfce4", "xfce4-session", "xfce4-settings", "xfwm4" ].each do |packageName| package packageName do action :install end end
12.888889
26
0.594828
bb7d664ac46fb67b1fb049615646ca178a4ae5df
380
require 'puppet_x/puppetlabs/meep/config' # Return a list of all mco broker hosts. # # The data is obtained from the MEEP pe.conf configuration. Puppet::Functions.create_function(:pe_list_mco_broker_nodes) do # @return [Array<String>] def pe_list_mco_broker_nodes config = PuppetX::Puppetlabs::Meep::Config.new(closure_scope) config.list_nodes(:mco_broker) end end
29.230769
65
0.771053
01b63f3572f6b4162634cbf01387feeac6f66ad7
1,104
require_relative "lib/rich_text_field/version" Gem::Specification.new do |spec| spec.name = "rich_text_field" spec.version = RichTextField::VERSION spec.authors = ["Benny Heller"] spec.email = ["benny@10fdesign.io"] spec.homepage = "https://10fdesign.io" spec.summary = "Add RichTextField to administrate." spec.description = "Add RichTextField to administrate." spec.license = "MIT" spec.add_dependency "administrate" # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' # to allow pushing to a single host or delete this section to allow pushing to any host. spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" spec.metadata["homepage_uri"] = spec.homepage # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] spec.add_dependency "rails", "~> 6.0.3", ">= 6.0.3.5" end
40.888889
96
0.692029
ab9ed9caf4f57d04dda252a80cc7a5670b4df59a
118
class NullAcademic def id -1 end def admin_role? false end def approver_role? false end end
8.428571
20
0.627119
e24c2588abb5282828a4878b4e43bc05cabd51f7
419
class ApplicationController < ActionController::Base rescue_from ApiExceptions::BaseException, with: :render_error_response protect_from_forgery with: :null_session include DeviseTokenAuth::Concerns::SetUserByToken before_action :set_format def render_error_response(error) render json: error, serializer: ApiExceptionSerializer, status: 200 end def set_format request.format = 'json' end end
27.933333
72
0.799523
7964e79ea6afce5b30b6f9b1e89a87aa4ae7cb3d
363
class String def to_state to_s == 'open' ? :open : :closed end def to_status to_s == 'open' ? :open : :completed end end class Things::Todo def number name.scan(/\[\#([0-9]+)\]/).first end end class APICache class << self def store # :nodoc: @store ||= begin APICache::MemoryStore.new end end end end
14.52
39
0.567493
39b1cbdfdac1a13323d63d9e1372f8d36a73544c
203
module MailOptOut class List < ApplicationRecord validates :name, presence: true validates_uniqueness_of :name, case_sensitive: false scope :active, -> { where(published: true) } end end
25.375
56
0.729064
87b84f9442335ac59a7fa7df8869308a98b7ec83
5,762
module SugarCRM # Associations are middlemen between the object that holds the association, known as the @owner, # and the actual associated object, known as the @target. Methods are added to the @owner that # allow access to the association collection, and are held in @proxy_methods. The cardinality # of the association is available in @cardinality, and the actual relationship details are held # in @relationship. class Association attr_accessor :owner, :target, :link_field, :relationship, :attributes, :proxy_methods, :cardinality # Creates a new instance of an Association def initialize(owner,link_field,opts={}) @options = { :define_methods? => true }.merge! opts @owner = owner check_valid_owner @link_field = link_field @attributes = owner.link_fields[link_field] @relationship = relationship_for(@attributes["relationship"]) @target = resolve_target @proxy_methods = define_methods if @options[:define_methods?] @cardinality = resolve_cardinality self end # Returns true if the association includes an attribute that matches # the provided string def include?(attribute) return true if attribute.class == @target return true if attribute == link_field return true if methods.include? attribute false end def ==(comparison_object) comparison_object.instance_of?(self.class) && @target.class == comparison_object.class && @link_field == comparison_object.link_field end alias :eql? :== def hash "#{@target.class}##{@link_field}".hash end def inspect self end def to_s "#<#{@owner.class.session.namespace_const}::Association @proxy_methods=[#{@proxy_methods.join(", ")}], " + "@link_field=\"#{@link_field}\", @target=#{@target}, @owner=#{@owner.class}, " + "@cardinality=:#{@cardinality}>" end def pretty_print(pp) pp.text self.inspect, 0 end protected def check_valid_owner valid = @owner.class.ancestors.include? SugarCRM::Base raise InvalidModule, "#{@owner} is not registered, or is not a descendant of SugarCRM::Base" unless valid end # Attempts to determine the class of the target in the association def resolve_target # Use the link_field name first klass = @link_field.singularize.camelize namespace = @owner.class.session.namespace_const return namespace.const_get(klass) if namespace.const_defined? klass # Use the link_field attribute "module" if @attributes["module"].length > 0 module_name = SugarCRM::Module.find(@attributes["module"], @owner.class.session) return namespace.const_get(module_name.klass) if module_name && namespace.const_defined?(module_name.klass) end # Use the "relationship" target if @attributes["relationship"].length > 0 klass = @relationship[:target][:name].singularize.camelize return namespace.const_get(klass) if namespace.const_defined? klass end false end # Defines methods for accessing the association target on the owner class. # If the link_field name includes the owner class name, it is stripped before # creating the method. If this occurs, we also create an alias to the stripped # method using the full link_field name. def define_methods methods = [] pretty_name = @relationship[:target][:name] methods << define_method(@link_field) methods << define_alias(pretty_name, @link_field) if pretty_name != @link_field methods end # Generates the association proxy method for related module def define_method(link_field) raise ArgumentError, "argument cannot be nil" if link_field.nil? if (@owner.respond_to? link_field.to_sym) && @owner.debug warn "Warning: Overriding method: #{@owner.class}##{link_field}" end @owner.class.module_eval %Q? def #{link_field} query_association :#{link_field} end ? link_field end # Defines a method alias. Checks to see if a method is already defined. def define_alias(alias_name, method_name) @owner.class.module_eval %Q? alias :#{alias_name} :#{method_name} ? alias_name end # This method breaks the relationship into parts and returns them def relationship_for(relationship) # We need to run both regexes, because the plurality of the @owner module name is # important plural_regex = /((.*)_)?(#{Regexp.quote(@owner.class._module.name.downcase)})(_(.*))?/ singular_regex = /((.*)_)?(#{Regexp.quote(@owner.class._module.name.downcase.singularize)})(_(.*))?/ # Break the loop if we match [plural_regex, singular_regex].each {|r| break if relationship.match(r)} # Assign sane values to things if we didnt match o = $3 o = @owner.class._module.name.downcase if o.nil? || o.empty? t = [$2, $5].compact.join('_') t = @link_field if t.nil? || t.empty? # Look up the cardinality o_c, t_c = cardinality_for(o,t) {:owner => {:name => o, :cardinality => o_c}, :target => {:name => t, :cardinality => t_c}} end # Determines if the provided string is plural or singular # Plurality == Cardinality def cardinality_for(*args) args.inject([]) {|results,arg| result = :many result = :one if arg.singularize == arg results << result } end def resolve_cardinality "#{@relationship[:owner][:cardinality]}_to_#{@relationship[:target][:cardinality]}".to_sym end end end
37.415584
115
0.654807
e8775e681f7ad7e5267b8af90cf61992a5a9ab91
5,448
## # This module requires Metasploit: http://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Auxiliary # Exploit mixins should be called first include Msf::Exploit::Remote::SMB::Client include Msf::Exploit::Remote::SMB::Client::Authenticated include Msf::Exploit::Remote::DCERPC # Scanner mixin should be near last include Msf::Auxiliary::Scanner include Msf::Auxiliary::Report def initialize super( 'Name' => 'SMB Domain User Enumeration', 'Description' => 'Determine what domain users are logged into a remote system via a DCERPC to NetWkstaUserEnum.', 'Author' => [ 'natron', # original module 'Joshua D. Abraham <jabra[at]praetorian.com>', # database storage ], 'References' => [ [ 'URL', 'http://msdn.microsoft.com/en-us/library/aa370669%28VS.85%29.aspx' ] ], 'License' => MSF_LICENSE ) deregister_options('RPORT', 'RHOST') end def parse_value(resp, idx) #val_length = resp[idx,4].unpack("V")[0] idx += 4 #val_offset = resp[idx,4].unpack("V")[0] idx += 4 val_actual = resp[idx,4].unpack("V")[0] idx += 4 value = resp[idx,val_actual*2] idx += val_actual * 2 idx += val_actual % 2 * 2 # alignment return value,idx end def parse_net_wksta_enum_users_info(resp) accounts = [ Hash.new() ] idx = 20 count = resp[idx,4].unpack("V")[0] # wkssvc_NetWkstaEnumUsersInfo -> Info -> PtrCt0 -> User() -> Ptr -> Max Count idx += 4 1.upto(count) do # wkssvc_NetWkstaEnumUsersInfo -> Info -> PtrCt0 -> User() -> Ptr -> Ref ID idx += 4 # ref id name idx += 4 # ref id logon domain idx += 4 # ref id other domains idx += 4 # ref id logon server end 1.upto(count) do # wkssvc_NetWkstaEnumUsersInfo -> Info -> PtrCt0 -> User() -> Ptr -> ID1 max count account_name,idx = parse_value(resp, idx) logon_domain,idx = parse_value(resp, idx) other_domains,idx = parse_value(resp, idx) logon_server,idx = parse_value(resp, idx) accounts << { :account_name => account_name, :logon_domain => logon_domain, :other_domains => other_domains, :logon_server => logon_server } end accounts end def rport @rport || datastore['RPORT'] end def smb_direct @smbdirect || datastore['SMBDirect'] end def store_username(username, res, ip, rport) service_data = { address: ip, port: rport, service_name: 'smb', protocol: 'tcp', workspace_id: myworkspace_id, proof: res } credential_data = { origin_type: :service, module_fullname: fullname, username: username } credential_data.merge!(service_data) credential_core = create_credential(credential_data) login_data = { core: credential_core, status: Metasploit::Model::Login::Status::UNTRIED } login_data.merge!(service_data) create_credential_login(login_data) end def run_host(ip) [[139, false], [445, true]].each do |info| @rport = info[0] @smbdirect = info[1] begin connect() smb_login() uuid = [ '6bffd098-a112-3610-9833-46c3f87e345a', '1.0' ] handle = dcerpc_handle( uuid[0], uuid[1], 'ncacn_np', ["\\wkssvc"] ) begin dcerpc_bind(handle) stub = NDR.uwstring("\\\\" + ip) + # Server Name NDR.long(1) + # Level NDR.long(1) + # Ctr NDR.long(rand(0xffffffff)) + # ref id NDR.long(0) + # entries read NDR.long(0) + # null ptr to user0 NDR.long(0xffffffff) + # Prefmaxlen NDR.long(rand(0xffffffff)) + # ref id NDR.long(0) # null ptr to resume handle dcerpc.call(2,stub) resp = dcerpc.last_response ? dcerpc.last_response.stub_data : nil accounts = parse_net_wksta_enum_users_info(resp) accounts.shift if datastore['VERBOSE'] accounts.each do |x| print_status ip + " : " + x[:logon_domain] + "\\" + x[:account_name] + "\t(logon_server: #{x[:logon_server]}, other_domains: #{x[:other_domains]})" end else print_status "#{ip} : #{accounts.collect{|x| x[:logon_domain] + "\\" + x[:account_name]}.join(", ")}" end found_accounts = [] accounts.each do |x| comp_user = x[:logon_domain] + "\\" + x[:account_name] found_accounts.push(comp_user.scan(/[[:print:]]/).join) unless found_accounts.include?(comp_user.scan(/[[:print:]]/).join) end found_accounts.each do |comp_user| if comp_user.to_s =~ /\$$/ next end print_good("#{ip} - Found user: #{comp_user}") store_username(comp_user, resp, ip, rport) end rescue ::Rex::Proto::SMB::Exceptions::ErrorCode => e print_line("UUID #{uuid[0]} #{uuid[1]} ERROR 0x%.8x" % e.error_code) #puts e #return rescue ::Exception => e print_line("UUID #{uuid[0]} #{uuid[1]} ERROR #{$!}") #puts e #return end disconnect() return rescue ::Exception print_line($!.to_s) end end end end
26.318841
132
0.576542
bb7262850371f4a78969291d02f03aaf0cf08fd7
1,362
# -*- encoding: utf-8 -*- # stub: em-websocket 0.5.2 ruby lib Gem::Specification.new do |s| s.name = "em-websocket".freeze s.version = "0.5.2" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Ilya Grigorik".freeze, "Martyn Loughran".freeze] s.date = "2020-09-23" s.description = "EventMachine based WebSocket server".freeze s.email = ["ilya@igvita.com".freeze, "me@mloughran.com".freeze] s.homepage = "http://github.com/igrigorik/em-websocket".freeze s.licenses = ["MIT".freeze] s.rubygems_version = "3.0.6".freeze s.summary = "EventMachine based WebSocket server".freeze s.installed_by_version = "3.0.6" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<eventmachine>.freeze, [">= 0.12.9"]) s.add_runtime_dependency(%q<http_parser.rb>.freeze, ["~> 0.6.0"]) else s.add_dependency(%q<eventmachine>.freeze, [">= 0.12.9"]) s.add_dependency(%q<http_parser.rb>.freeze, ["~> 0.6.0"]) end else s.add_dependency(%q<eventmachine>.freeze, [">= 0.12.9"]) s.add_dependency(%q<http_parser.rb>.freeze, ["~> 0.6.0"]) end end
37.833333
112
0.674743
bfae5d84c02cd462ce32c86f9539f10de9eba102
2,176
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{inflectious} s.version = "0.2.4" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Matt Atkins"] s.date = %q{2010-12-20} s.description = %q{Extends ActiveSupport::Inflector to include grammatical inflections such as adjectivize, gerundize and superlativize etc.} s.email = %q{developers@yoomee.com} s.extra_rdoc_files = [ "LICENSE.txt", "README.rdoc" ] s.files = [ ".document", "Gemfile", "Gemfile.lock", "LICENSE.txt", "README.rdoc", "Rakefile", "VERSION", "inflectious.gemspec", "init.rb", "lib/inflections.rb", "lib/inflectious.rb", "lib/inflectious/inflector.rb", "lib/inflectious/string.rb", "test/helper.rb", "test/test_inflectious.rb" ] s.homepage = %q{http://github.com/Yoomee/inflectious} s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.7} s.summary = %q{Extends Rails ActiveSupport::Inflector to include more grammatical inflections.} s.test_files = [ "test/helper.rb", "test/test_inflectious.rb" ] if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q<shoulda>, [">= 0"]) s.add_development_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"]) s.add_development_dependency(%q<rcov>, [">= 0"]) else s.add_dependency(%q<shoulda>, [">= 0"]) s.add_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_dependency(%q<jeweler>, ["~> 1.5.1"]) s.add_dependency(%q<rcov>, [">= 0"]) end else s.add_dependency(%q<shoulda>, [">= 0"]) s.add_dependency(%q<bundler>, ["~> 1.0.0"]) s.add_dependency(%q<jeweler>, ["~> 1.5.1"]) s.add_dependency(%q<rcov>, [">= 0"]) end end
31.536232
143
0.638327
039aff850420093212acc8ee323d0976939244b3
4,615
module Pantry # The Pantry Server. class Server include Celluloid finalizer :shutdown attr_accessor :identity attr_reader :client_registry def initialize(network_stack_class = Communication::Server) @commands = CommandHandler.new(self, Pantry.server_commands) @identity = current_hostname @clients = [] @client_registry = ClientRegistry.new @networking = network_stack_class.new_link(self) end # Start up the networking stack and start the server def run Pantry.set_proc_title("pantry server #{Pantry::VERSION}") @networking.run Pantry.logger.info("[#{@identity}] Server running") end # Close down networking and clean up resources def shutdown Pantry.logger.info("[#{@identity}] Server Shutting Down") end # Mark an authenticated client as checked-in def register_client(client) Pantry.logger.info("[#{@identity}] Received client registration :: #{client.identity}") @client_registry.check_in(client) end # Generate new authentication credentials for a client. # Returns a Hash containing the credentials required for the client to # connect and authenticate with this Server def create_client @networking.create_client end # Return ClientInfo on which Client sent the given Message def client_who_sent(message) @client_registry.find(message.from) end # Broadcast a +message+ to all clients who match the given +filter+. # By default all clients will be notified. def publish_message(message, filter = Communication::ClientFilter.new) Pantry.logger.debug("[#{@identity}] Publishing #{message.inspect} to #{filter.stream.inspect}") message.to = filter.stream @networking.publish_message(message) end # Callback from the network when a message is received unsolicited from a client. # If the message received is unhandleable by this Server, the message is forwarded # on down to the clients who match the message's +to+. def receive_message(message) Pantry.logger.debug("[#{@identity}] Received message #{message.inspect}") if @commands.can_handle?(message) results = @commands.process(message) if message.requires_response? Pantry.logger.debug("[#{@identity}] Returning results #{results.inspect}") send_results_back_to_requester(message, results) end else matched_clients = @client_registry.all_matching(message.to).map(&:identity) Pantry.logger.debug("[#{@identity}] Forwarding message on. Expect response from #{matched_clients.inspect}") send_results_back_to_requester(message, matched_clients, true) forward_message(message) end end # Send a Pantry::Message but mark it as requiring a response. # This will set up and return a Celluloid::Future that will contain the # response once it is available. def send_request(client, message) message.requires_response! message.to = client.identity Pantry.logger.debug("[#{@identity}] Sending request #{message.inspect}") @networking.send_request(message) end # Start a FileService::SendFile worker to upload the contents of the # file at +file_path+ to the equivalent ReceiveFile at +receiver_uuid+. # Using this method requires asking the receiving end (Server or Client) to receive # a file first, which will return the +receiver_uuid+ and +file_uuid+ to use here. def send_file(file_path, receiver_uuid, file_uuid) @networking.send_file(file_path, receiver_uuid, file_uuid) end # Set up a FileService::ReceiveFile worker to begin receiving a file with # the given size and checksum. This returns an informational object with # the new receiver's identity and the file UUID so a SendFile worker knows who # to send the file contents to. def receive_file(file_size, file_checksum) @networking.receive_file(file_size, file_checksum) end protected def current_hostname Socket.gethostname end def send_results_back_to_requester(message, results, client_response_list = false) response_message = message.build_response response_message.from = Pantry::SERVER_IDENTITY response_message[:client_response_list] = client_response_list [results].flatten(1).each do |entry| response_message << entry end @networking.publish_message(response_message) end def forward_message(message) @networking.forward_message(message) end end end
34.699248
116
0.709209
7afe176fca2aa120cadf1d9f5e3e9e46cea1ea0d
4,446
# encoding: utf-8 module I18n module Tests module Localization module Time def setup super setup_time_translations @time = ::Time.utc(2008, 3, 1, 6, 0) @other_time = ::Time.utc(2008, 3, 1, 18, 0) end test "localize Time: given the short format it uses it" do assert_equal '01. Mär 06:00', I18n.l(@time, :format => :short, :locale => :de) end test "localize Time: given the long format it uses it" do assert_equal '01. März 2008 06:00', I18n.l(@time, :format => :long, :locale => :de) end # TODO Seems to break on Windows because ENV['TZ'] is ignored. What's a better way to do this? # def test_localize_given_the_default_format_it_uses_it # assert_equal 'Sa, 01. Mar 2008 06:00:00 +0000', I18n.l(@time, :format => :default, :locale => :de) # end test "localize Time: given a day name format it returns the correct day name" do assert_equal 'Samstag', I18n.l(@time, :format => '%A', :locale => :de) end test "localize Time: given a uppercased day name format it returns the correct day name in upcase" do assert_equal 'samstag'.upcase, I18n.l(@time, :format => '%^A', :locale => :de) end test "localize Time: given an abbreviated day name format it returns the correct abbreviated day name" do assert_equal 'Sa', I18n.l(@time, :format => '%a', :locale => :de) end test "localize Time: given an abbreviated and uppercased day name format it returns the correct abbreviated day name in upcase" do assert_equal 'sa'.upcase, I18n.l(@time, :format => '%^a', :locale => :de) end test "localize Time: given a month name format it returns the correct month name" do assert_equal 'März', I18n.l(@time, :format => '%B', :locale => :de) end test "localize Time: given a uppercased month name format it returns the correct month name in upcase" do assert_equal 'märz'.upcase, I18n.l(@time, :format => '%^B', :locale => :de) end test "localize Time: given an abbreviated month name format it returns the correct abbreviated month name" do assert_equal 'Mär', I18n.l(@time, :format => '%b', :locale => :de) end test "localize Time: given an abbreviated and uppercased month name format it returns the correct abbreviated month name in upcase" do assert_equal 'mär'.upcase, I18n.l(@time, :format => '%^b', :locale => :de) end test "localize Time: given a date format with the month name upcased it returns the correct value" do assert_equal '1. FEBRUAR 2008', I18n.l(::Time.utc(2008, 2, 1, 6, 0), :format => "%-d. %^B %Y", :locale => :de) end test "localize Time: given missing translations it returns the correct error message" do assert_equal 'translation missing: fr.date.abbr_month_names', I18n.l(@time, :format => '%b', :locale => :fr) end test "localize Time: given a meridian indicator format it returns the correct meridian indicator" do assert_equal 'AM', I18n.l(@time, :format => '%p', :locale => :de) assert_equal 'PM', I18n.l(@other_time, :format => '%p', :locale => :de) end test "localize Time: given a meridian indicator format it returns the correct meridian indicator in upcase" do assert_equal 'am', I18n.l(@time, :format => '%P', :locale => :de) assert_equal 'pm', I18n.l(@other_time, :format => '%P', :locale => :de) end test "localize Time: given an unknown format it does not fail" do assert_nothing_raised { I18n.l(@time, :format => '%x') } end test "localize Time: given a format is missing it raises I18n::MissingTranslationData" do assert_raises(I18n::MissingTranslationData) { I18n.l(@time, :format => :missing) } end protected def setup_time_translations I18n.backend.store_translations :de, { :time => { :formats => { :default => "%a, %d. %b %Y %H:%M:%S %z", :short => "%d. %b %H:%M", :long => "%d. %B %Y %H:%M", }, :am => 'am', :pm => 'pm' } } end end end end end
42.75
142
0.582321
e99873066eb66a01bf432d8a05bc307107a5250b
956
describe :hash_iteration_no_block, :shared => true do before(:each) do @hsh = new_hash(1 => 2, 3 => 4, 5 => 6) @empty = new_hash ruby_version_is "" ... "1.8.7", -> it "raises a LocalJumpError when called on a non-empty hash without a block", -> lambda { @hsh.send(@method) }.should raise_error(LocalJumpError) it "does not raise a LocalJumpError when called on an empty hash without a block", -> @empty.send(@method).should == @empty ruby_version_is "1.8.7", -> it "returns an Enumerator if called on a non-empty hash without a block", -> @hsh.send(@method).should be_an_instance_of(enumerator_class) it "returns an Enumerator if called on an empty hash without a block", -> @empty.send(@method).should be_an_instance_of(enumerator_class) it "returns an Enumerator if called on a frozen instance", -> @hsh.freeze @hsh.send(@method).should be_an_instance_of(enumerator_class) end
39.833333
89
0.680962
3381c815dea90aa1c01d680e5c4b655d2da571e5
227
require 'auto_build/builder' require 'auto_build/has_one_hook' require 'auto_build/has_many_hook' require 'auto_build/association' require 'auto_build/version' module AutoBuild class AutoBuildError < StandardError; end end
20.636364
43
0.828194
38a11617050c4480bf4764517198c6d9269ffbad
524
# frozen_string_literal: true module Hyrax module Ability module CollectionTypeAbility def collection_type_abilities if admin? can :manage, CollectionType can :create_collection_type, CollectionType else can :create_collection_of_type, CollectionType do |collection_type| Hyrax::CollectionTypes::PermissionsService.can_create_collection_of_type?(user: current_user, collection_type: collection_type) end end end end end end
29.111111
139
0.700382
01cea935a23926705b55d26af6b30ea3337e6bfd
138
# -*- coding: binary -*- # Post-exploitation clients require 'rex/post/meterpreter' module Rex::Post end include Rex::Post::Permission
13.8
30
0.724638
284935cfec87e3650eb00bb02670ac0f8d30ab6f
3,827
class Metricbeat < Formula desc "Collect metrics from your systems and services" homepage "https://www.elastic.co/products/beats/metricbeat" url "https://github.com/elastic/beats.git", :tag => "v6.8.1", :revision => "6e16f47450373f04d6a60db1d23c5b13b37f7431" head "https://github.com/elastic/beats.git" bottle do cellar :any_skip_relocation sha256 "3cebb937a1a651b2720da38866310417153f2523b37b8bc1883c7666b0aad803" => :mojave sha256 "bbee3c9ab34a7c4edfa1b9334eb824030166cf5198046b2b826438e0efcc7de8" => :high_sierra sha256 "48ce2f9f54a3c5e57a7b3ba13b10866f6e766b46f3ad014b596ef06e0ebc5cd4" => :sierra sha256 "b8e51d1806a23bf0922f172ebf98ef477401e6f5c33f293f77554ac30b1446fe" => :x86_64_linux end depends_on "go" => :build depends_on "python@2" => :build resource "virtualenv" do url "https://files.pythonhosted.org/packages/8b/f4/360aa656ddb0f4168aeaa1057d8784b95d1ce12f34332c1cf52420b6db4e/virtualenv-16.3.0.tar.gz" sha256 "729f0bcab430e4ef137646805b5b1d8efbb43fe53d4a0f33328624a84a5121f7" end def install # remove non open source files rm_rf "x-pack" ENV["GOPATH"] = buildpath (buildpath/"src/github.com/elastic/beats").install buildpath.children ENV.prepend_create_path "PYTHONPATH", buildpath/"vendor/lib/python2.7/site-packages" resource("virtualenv").stage do system "python", *Language::Python.setup_install_args(buildpath/"vendor") end ENV.prepend_path "PATH", buildpath/"vendor/bin" # for virtualenv ENV.prepend_path "PATH", buildpath/"bin" # for mage (build tool) cd "src/github.com/elastic/beats/metricbeat" do # don't build docs because it would fail creating the combined OSS/x-pack # docs and we aren't installing them anyway inreplace "Makefile", "collect: assets collect-docs configs kibana imports", "collect: assets configs kibana imports" system "make", "mage" # prevent downloading binary wheels during python setup system "make", "PIP_INSTALL_COMMANDS=--no-binary :all", "python-env" system "mage", "-v", "build" system "mage", "-v", "update" (etc/"metricbeat").install Dir["metricbeat.*", "fields.yml", "modules.d"] (libexec/"bin").install "metricbeat" prefix.install "_meta/kibana.generated" end prefix.install_metafiles buildpath/"src/github.com/elastic/beats" (bin/"metricbeat").write <<~EOS #!/bin/sh exec #{libexec}/bin/metricbeat \ --path.config #{etc}/metricbeat \ --path.data #{var}/lib/metricbeat \ --path.home #{prefix} \ --path.logs #{var}/log/metricbeat \ "$@" EOS end plist_options :manual => "metricbeat" def plist; <<~EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>#{plist_name}</string> <key>Program</key> <string>#{opt_bin}/metricbeat</string> <key>RunAtLoad</key> <true/> </dict> </plist> EOS end test do (testpath/"config/metricbeat.yml").write <<~EOS metricbeat.modules: - module: system metricsets: ["load"] period: 1s output.file: enabled: true path: #{testpath}/data filename: metricbeat EOS (testpath/"logs").mkpath (testpath/"data").mkpath pid = fork do exec bin/"metricbeat", "-path.config", testpath/"config", "-path.data", testpath/"data" end begin sleep 30 assert_predicate testpath/"data/metricbeat", :exist? ensure Process.kill "SIGINT", pid Process.wait pid end end end
32.159664
141
0.658479
62f4b92b55b8ea434d4a4bcee2fca6cb2788685e
6,483
class Pipenv < Formula include Language::Python::Virtualenv desc "Python dependency management tool" homepage "https://docs.pipenv.org/" url "https://files.pythonhosted.org/packages/b5/3f/80a09ea5f279e90122600d24cfa25d698008dc7e5b261cb582de8966bbe2/pipenv-8.3.2.tar.gz" sha256 "20be245ad2a7908a04b302e9568ee26e57f8dacc558468d2a84e699b2622e9af" bottle do cellar :any_skip_relocation sha256 "cd0db2d9ebad34eef07f82d8a9f3e15cfa164f3cbb0f214a50b3b9576d83d35e" => :high_sierra sha256 "0211f0741f33ad5760b5889c73289119cf5970f5627b300bd36de2fefb0e518e" => :sierra sha256 "f5d2047ef26f423331d2274122d63925ea2a1f05b1490a1367d4ff0be9fb27bd" => :el_capitan end depends_on :python if MacOS.version <= :snow_leopard resource "backports.shutil_get_terminal_size" do url "https://files.pythonhosted.org/packages/ec/9c/368086faa9c016efce5da3e0e13ba392c9db79e3ab740b763fe28620b18b/backports.shutil_get_terminal_size-1.0.0.tar.gz" sha256 "713e7a8228ae80341c70586d1cc0a8caa5207346927e23d09dcbcaf18eadec80" end resource "certifi" do url "https://files.pythonhosted.org/packages/23/3f/8be01c50ed24a4bd6b8da799839066ce0288f66f5e11f0367323467f0cbc/certifi-2017.11.5.tar.gz" sha256 "5ec74291ca1136b40f0379e1128ff80e866597e4e2c1e755739a913bbc3613c0" end resource "chardet" do url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz" sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" end resource "configparser" do url "https://files.pythonhosted.org/packages/7c/69/c2ce7e91c89dc073eb1aa74c0621c3eefbffe8216b3f9af9d3885265c01c/configparser-3.5.0.tar.gz" sha256 "5308b47021bc2340965c371f0f058cc6971a04502638d4244225c49d80db273a" end resource "enum34" do url "https://files.pythonhosted.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz" sha256 "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1" end resource "flake8" do url "https://files.pythonhosted.org/packages/1e/ab/7730f6d6cdf73a3b7f98a2fe3b2cdf68e9e760a4a133e083607497d4c3a6/flake8-3.5.0.tar.gz" sha256 "7253265f7abd8b313e3892944044a365e3f4ac3fcdcfb4298f55ee9ddf188ba0" end resource "idna" do url "https://files.pythonhosted.org/packages/f4/bd/0467d62790828c23c47fc1dfa1b1f052b24efdf5290f071c7a91d0d82fd3/idna-2.6.tar.gz" sha256 "2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f" end resource "mccabe" do url "https://files.pythonhosted.org/packages/06/18/fa675aa501e11d6d6ca0ae73a101b2f3571a565e0f7d38e062eec18a91ee/mccabe-0.6.1.tar.gz" sha256 "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" end resource "pathlib" do url "https://files.pythonhosted.org/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz" sha256 "6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f" end resource "pew" do url "https://files.pythonhosted.org/packages/a4/be/efe77f7dcb088f263bfc5eac09121b2f9a6e59c3bdfdff7a801d2253f2ac/pew-1.1.0.tar.gz" sha256 "d0f9d127cf321c959bb857e59080f7eaa59c8bbeb2d53aa07d3350aae50e1f2d" end resource "pycodestyle" do url "https://files.pythonhosted.org/packages/e1/88/0e2cbf412bd849ea6f1af1f97882add46a374f4ba1d2aea39353609150ad/pycodestyle-2.3.1.tar.gz" sha256 "682256a5b318149ca0d2a9185d365d8864a768a28db66a84a2ea946bcc426766" end resource "pyflakes" do url "https://files.pythonhosted.org/packages/26/85/f6a315cd3c1aa597fb3a04cc7d7dbea5b3cc66ea6bd13dfa0478bf4876e6/pyflakes-1.6.0.tar.gz" sha256 "8d616a382f243dbf19b54743f280b80198be0bca3a5396f1d2e1fca6223e8805" end resource "requests" do url "https://files.pythonhosted.org/packages/b0/e1/eab4fc3752e3d240468a8c0b284607899d2fbfb236a56b7377a329aa8d09/requests-2.18.4.tar.gz" sha256 "9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" end resource "shutilwhich" do url "https://files.pythonhosted.org/packages/66/be/783f181594bb8bcfde174d6cd1e41956b986d0d8d337d535eb2555b92f8d/shutilwhich-1.1.0.tar.gz" sha256 "db1f39c6461e42f630fa617bb8c79090f7711c9ca493e615e43d0610ecb64dc6" end resource "urllib3" do url "https://files.pythonhosted.org/packages/ee/11/7c59620aceedcc1ef65e156cc5ce5a24ef87be4107c2b74458464e437a5d/urllib3-1.22.tar.gz" sha256 "cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" end resource "virtualenv" do url "https://files.pythonhosted.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz" sha256 "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a" end resource "virtualenv-clone" do url "https://files.pythonhosted.org/packages/36/66/d95f83255138ded1aec242de5ee51536226fa7b2582a7ce0863fea5dc4f2/virtualenv-clone-0.2.6.tar.gz" sha256 "6b3be5cab59e455f08c9eda573d23006b7d6fb41fae974ddaa2b275c93cc4405" end def install # Using the virtualenv DSL here because the alternative of using # write_env_script to set a PYTHONPATH breaks things. # https://github.com/Homebrew/homebrew-core/pull/19060#issuecomment-338397417 venv = virtualenv_create(libexec) venv.pip_install resources venv.pip_install buildpath # `pipenv` needs to be able to find `virtualenv` and `pew` on PATH. Rather # than installing symlinks for those scripts into `#{bin}` we leave them in # `#{libexec}/bin` and create a wrapper script for `pipenv` which adds # `#{libexec}/bin` to PATH. env = { :PATH => "#{libexec}/bin:$PATH", } (bin/"pipenv").write_env_script(libexec/"bin/pipenv", env) # `#{libexec}/bin` - which we've just added to PATH - contains symlinks # linking python2 and python2.7 to ./python. We remove those symlinks so # that pipenv options that search for a python version, like `pipenv --two` # and `pipenv --python=2.7`, respect the user's unmodified PATH rather than # finding the copy of system python that we have just prepended to it. rm libexec/"bin/python2" rm libexec/"bin/python2.7" end test do assert_match "Commands", shell_output("#{bin}/pipenv") system "#{bin}/pipenv", "install", "requests" assert_predicate testpath/"Pipfile", :exist? assert_predicate testpath/"Pipfile.lock", :exist? assert_match "requests", (testpath/"Pipfile").read end end
47.321168
164
0.799784
ff0116b5dbc0956c9f9f926de176caf35716f089
3,613
class Icecream < Formula desc "Distributed compiler with a central scheduler to share build load" homepage "https://en.opensuse.org/Icecream" url "https://github.com/icecc/icecream/archive/1.3.1.tar.gz" sha256 "9f45510fb2251d818baebcff19051c1cf059e48c6b830fb064a8379480159b9d" license "GPL-2.0" bottle do sha256 "666f827a6a686e6d2e81dc1d0eb5aae8374f01d7d1524ef6c695e3bf207c4af5" => :catalina sha256 "fb94b2d8e763469a2b0112523f89496f4a81e22ed9b7290f4280178f726853da" => :mojave sha256 "6cc11bcddd969e9aeb7e83692e9714d5891f0530bacbc1c52b019b298bce3d24" => :high_sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "docbook2x" => :build depends_on "libtool" => :build depends_on "libarchive" depends_on "lzo" depends_on "zstd" def install args = %W[ --disable-dependency-tracking --disable-silent-rules --prefix=#{prefix} --enable-clang-wrappers ] system "./autogen.sh" system "./configure", *args system "make", "install" # Manually install scheduler property list (prefix/"#{plist_name}-scheduler.plist").write scheduler_plist end def caveats <<~EOS To override the toolset with icecc, add to your path: #{opt_libexec}/icecc/bin EOS end plist_options manual: "iceccd" def plist <<~EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>#{plist_name}</string> <key>ProgramArguments</key> <array> <string>#{sbin}/iceccd</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> EOS end def scheduler_plist <<~EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>#{plist_name}-scheduler</string> <key>ProgramArguments</key> <array> <string>#{sbin}/icecc-scheduler</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> EOS end test do (testpath/"hello-c.c").write <<~EOS #include <stdio.h> int main() { puts("Hello, world!"); return 0; } EOS system opt_libexec/"icecc/bin/gcc", "-o", "hello-c", "hello-c.c" assert_equal "Hello, world!\n", shell_output("./hello-c") (testpath/"hello-cc.cc").write <<~EOS #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; } EOS system opt_libexec/"icecc/bin/g++", "-o", "hello-cc", "hello-cc.cc" assert_equal "Hello, world!\n", shell_output("./hello-cc") (testpath/"hello-clang.c").write <<~EOS #include <stdio.h> int main() { puts("Hello, world!"); return 0; } EOS system opt_libexec/"icecc/bin/clang", "-o", "hello-clang", "hello-clang.c" assert_equal "Hello, world!\n", shell_output("./hello-clang") (testpath/"hello-cclang.cc").write <<~EOS #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; } EOS system opt_libexec/"icecc/bin/clang++", "-o", "hello-cclang", "hello-cclang.cc" assert_equal "Hello, world!\n", shell_output("./hello-cclang") end end
27.580153
108
0.597564
f789359d74fb6e47b53dc460bd8f8be619888cb5
689
cask 'font-sarasa-gothic' do version '0.10.0' sha256 '5f101908073e5f19ef95d5216f4dfd71e7adbb8e206260dbc4b5a4a041adc12c' url "https://github.com/be5invis/Sarasa-Gothic/releases/download/v#{version}/sarasa-gothic-ttc-#{version}.7z" appcast 'https://github.com/be5invis/Sarasa-Gothic/releases.atom' name 'Sarasa Gothic' homepage 'https://github.com/be5invis/Sarasa-Gothic' font 'sarasa-bold.ttc' font 'sarasa-bolditalic.ttc' font 'sarasa-extralight.ttc' font 'sarasa-extralightitalic.ttc' font 'sarasa-italic.ttc' font 'sarasa-light.ttc' font 'sarasa-lightitalic.ttc' font 'sarasa-regular.ttc' font 'sarasa-semibold.ttc' font 'sarasa-semibolditalic.ttc' end
32.809524
111
0.759071
4a5802303707dabbaf228fe389381997273b0bce
1,139
# 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 Gem::Specification.new do |spec| spec.name = 'aws-sdk-codebuild' spec.version = File.read(File.expand_path('../VERSION', __FILE__)).strip spec.summary = 'AWS SDK for Ruby - AWS CodeBuild' spec.description = 'Official AWS Ruby gem for AWS CodeBuild. This gem is part of the AWS SDK for Ruby.' spec.author = 'Amazon Web Services' spec.homepage = 'https://github.com/aws/aws-sdk-ruby' spec.license = 'Apache-2.0' spec.email = ['trevrowe@amazon.com'] spec.require_paths = ['lib'] spec.files = Dir['lib/**/*.rb'] spec.metadata = { 'source_code_uri' => 'https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-codebuild', 'changelog_uri' => 'https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-codebuild/CHANGELOG.md' } spec.add_dependency('aws-sdk-core', '~> 3', '>= 3.71.0') spec.add_dependency('aws-sigv4', '~> 1.1') end
37.966667
110
0.661106
61fe81ee544b4d2a7059807682cfd3cde1c6c39f
146
# frozen_string_literal: true class AddPeopleNumberOfLegs < ActiveRecord::Migration::Current add_column :people, :number_of_legs, :integer end
24.333333
62
0.815068
91defe6d64295c65b4847c9fa4f95d62e02137c3
658
# # Copyright 2017 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. # class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end
32.9
74
0.761398
28068700ba2cfa56e4b70547cb784de1b4f908bc
1,282
{ matrix_id: '1748', name: 'p05', group: 'Meszaros', description: 'linear programming problem, C. Meszaros test set', author: '', editor: 'C. Meszaros', date: '2004', kind: 'linear programming problem', problem_2D_or_3D: '0', num_rows: '5090', num_cols: '9590', nonzeros: '59045', num_explicit_zeros: '0', num_strongly_connected_components: '10', num_dmperm_blocks: '15', structural_full_rank: 'true', structural_rank: '5090', pattern_symmetry: '0.000', numeric_symmetry: '0.000', rb_type: 'real', structure: 'rectangular', cholesky_candidate: 'no', positive_definite: 'no', notes: 'http://www.sztaki.hu/~meszaros/public_ftp/lptestset Converted to standard form via Resende and Veiga\'s mpsrd: minimize c\'*x, subject to A*x=b and lo <= x <= hi ', b_field: 'full 5090-by-1 ', aux_fields: 'c: full 9590-by-1 lo: full 9590-by-1 hi: full 9590-by-1 z0: full 1-by-1 ', norm: '1.277310e+01', min_singular_value: '1.496247e-01', condition_number: '8.536762e+01', svd_rank: '5090', sprank_minus_rank: '0', null_space_dimension: '0', full_numerical_rank: 'yes', image_files: 'p05.png,p05_dmperm.png,p05_scc.png,p05_svd.png,p05_graph.gif,', }
29.136364
81
0.642746
3830443d4c5e00e9af22b3d58e5f2033a1183b0c
4,817
# # Copyright (c) 2015, Arista Networks, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # Neither the name of Arista Networks nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Work around due to autoloader issues: https://projects.puppetlabs.com/issues/4248 require File.dirname(__FILE__) + '/../../puppet_x/eos/utils/helpers' Puppet::Type.newtype(:eos_routemap) do @doc = <<-EOS Manage route-maps on Arista EOS. Examples: eos_routemap { 'my_routemap:10': description => 'test 10', action => permit, match => 'ip address prefix-list 8to24', } eos_routemap { 'bgp_map:10': action => permit, match => 'as 10', set => 'local-preference 100', continue => 20, } eos_routemap { 'bgp_map:20': action => permit, match => [' metric-type type-1', 'as 100'], } EOS ensurable # Parameters newparam(:name, namevar: true) do desc <<-EOS The name of the routemap namevar composite name:seqno. EOS validate do |value| unless value.is_a? String fail "value #{value.inspect} is invalid, must be a String." end seqno = value.partition(':').last if value.include?(':') if seqno unless seqno.to_i.is_a? Integer fail "value #{seqno} must be an integer." end unless seqno.to_i.between?(1, 65_535) fail "value #{seqno} is invalid, / must be an integer from 1-65535." end else fail "value #{value.inspect} must be a composite name:seqno" end end end # Properties (state management) newproperty(:description) do desc <<-EOS A description for the route-map. EOS validate do |value| unless value.is_a? String fail "value #{value.inspect} is invalid, must be a String." end end end newproperty(:action) do desc <<-EOS A description for the route-map. EOS validate do |value| unless value.is_a? String fail "value #{value.inspect} is invalid, must be a String." end unless value == 'permit' || value == 'deny' fail "value #{value.inspect} can only be deny or permit" end end end newproperty(:match, array_matching: :all) do desc <<-EOS Route map match rule. EOS # Sort the arrays before comparing def insync?(current) current.sort == should.sort end validate do |value| unless value.is_a? String fail "value #{value.inspect} is invalid, must be a String." end end end newproperty(:set, array_matching: :all) do desc <<-EOS Set route attribute. EOS # Sort the arrays before comparing def insync?(current) current.sort == should.sort end validate do |value| unless value.is_a? String fail "value #{value.inspect} is invalid, must be a String." end end end newproperty(:continue) do desc <<-EOS A route-map sequence number to continue on. EOS munge { |value| Integer(value) } validate do |value| unless value.to_i.is_a? Integer fail "value #{value.inspect} is invalid, must be an Integer." end unless value.to_i.between?(1, 16_777_215) fail "value #{value.inspect} is invalid, / must be an integer from 1-16777215." end end end end
28.335294
83
0.647706
1cb3066700ff388007aad601cb8f430f343859a8
968
module Mutations class SignInUser < BaseMutation null true argument :email, Types::AuthProviderEmailInput, required: false field :token, String, null: true field :user, Types::UserType, null: true def resolve(email: nil) # basic validation return unless email user = User.find_by email: email[:email] # ensures we have the correct user return unless user return unless user.authenticate(email[:password]) # use Ruby on Rails - ActiveSupport::MessageEncryptor, to build a token # For Ruby on Rails >=5.2.x use: # crypt = ActiveSupport::MessageEncryptor.new(Rails.application.credentials.secret_key_base.byteslice(0..31)) crypt = ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base.byteslice(0..31)) token = crypt.encrypt_and_sign("user-id:#{ user.id }") context[:session][:token] = token { user: user, token: token } end end end
30.25
115
0.68595
1cc75bc08db50b45cf8a3838fe74b517ab47b7e0
1,118
class Libstxxl < Formula desc "C++ implementation of STL for extra large data sets" homepage "https://stxxl.sourceforge.io/" url "https://downloads.sourceforge.net/project/stxxl/stxxl/1.4.1/stxxl-1.4.1.tar.gz" sha256 "92789d60cd6eca5c37536235eefae06ad3714781ab5e7eec7794b1c10ace67ac" bottle do rebuild 1 sha256 cellar: :any_skip_relocation, arm64_big_sur: "8454123ffed231405d684ed18c2ef1a0ab1bd118d74614748a5b5df23d8bb5fe" sha256 cellar: :any_skip_relocation, big_sur: "c3f8dceb4e0a1716a2c193daf4b5eeb4ae3e8e96224bdc78ae8f74c2a3059152" sha256 cellar: :any_skip_relocation, catalina: "b4d5ef6b70735617973eb1f45214b11e3e6baec242bc6aa5ba9ed4da1834f6ad" sha256 cellar: :any_skip_relocation, mojave: "9b179722c61ea55b352c9196ae38d6915a3625096117088d43f854bee4eb6a39" sha256 cellar: :any_skip_relocation, x86_64_linux: "da132bcfb67ff680d1b5bf353627227b4956892c1cbe58df5037863d722dccf7" # linuxbrew-core end depends_on "cmake" => :build def install mkdir "build" do system "cmake", "..", *std_cmake_args system "make", "install" end end end
44.72
139
0.783542
91c7a7301d19911022770b0b4a7c9adf6aa331c0
2,002
module Codesake module Dawn module Kb class CVE_2013_1655_a include DependencyCheck def initialize message = "CVE-2013-1655: puppet versions 2.7.21 and 3.1.1 are vulnerable" super({ :name=>"CVE-2013-1655_a", :kind=>Codesake::Dawn::KnowledgeBase::DEPENDENCY_CHECK, }) self.safe_dependencies = [{:name=>"puppet", :version=>['2.7.21', '3.1.1']}] end end class CVE_2013_1655_b include RubyVersionCheck def initialize message = "CVE-2013-1655: puppet versions 2.7.21 and 3.1.1 are vulnerable only when running ruby 1.9.3 and 2.0.2" super({ :name=>"CVE-2013-1655_b", :kind=>Codesake::Dawn::KnowledgeBase::RUBY_VERSION_CHECK, }) self.safe_rubies = [ {:engine=>"ruby", :version=>"1.8.7", :patchlevel=>"p357"}, {:engine=>"ruby", :version=>"1.9.4", :patchlevel=>"p0"}, {:engine=>"ruby", :version=>"2.0.1", :patchlevel=>"p0"}] end end class CVE_2013_1655 include ComboCheck def initialize message = "Puppet 2.7.x before 2.7.21 and 3.1.x before 3.1.1, when running Ruby 1.9.3 or later, allows remote attackers to execute arbitrary code via vectors related to \"serialized attributes.\"" super({ :name=>"CVE-2013-1655", :cvss=>"AV:N/AC:L/Au:N/C:P/I:P/A:P", :release_date => Date.new(2013, 3, 20), :cwe=>"20", :owasp=>"A9", :applies=>["rails", "sinatra", "padrino"], :kind=>Codesake::Dawn::KnowledgeBase::COMBO_CHECK, :message=>message, :mitigation=>"Please upgrade puppet gem to a newer version", :aux_links=>["https://puppetlabs.com/security/cve/cve-2013-1655/"], :checks=>[CVE_2013_1655_a.new, CVE_2013_1655_b.new] }) end end end end end
29.441176
123
0.545954
acf6b2d45155ef1acae0020e8c9931a56eed8847
1,121
class RenderTarget attr_accessor :x, :y, :w, :h, :r, :g, :b, :a, :source_x, :source_y, :source_w, :source_h def initialize(name, size: nil, **values) @name = name @size = size @clear = true @queued_primitives = [] values.each do |attr, value| send("#{attr}=", value) end self.w ||= size.x self.h ||= size.y end def primitives @queued_primitives end def render(args) draw_to_render_target(args) if dirty? args.outputs.primitives << { x: @x, y: @y, w: @w, h: @h, path: @name, source_x: @source_x, source_y: @source_y, source_w: @source_w, source_h: @source_h, r: @r, g: @g, b: @b, a: @a }.sprite! end private def dirty? @queued_primitives.any? || @clear end def draw_to_render_target(args) target = get_target(args) target.primitives << @queued_primitives @queued_primitives = [] end def get_target(args) args.outputs[@name].tap { |render_target| render_target.width, render_target.height = @size if @size render_target.clear_before_render = @clear @clear = false } end end
22.877551
102
0.615522
9110121004228a74fc6760cedd2be21467812f5a
1,004
require_relative 'adapters/sequel' require_relative 'adapters/files' # require_relative 'adapters/puresql' # require_relative 'adapters/datamapper' module SeoApp # Storage interface class Storage class << self; attr_accessor :database end ## ## @brief Returns all report's name, date and key's to look for each ## ## @return { ## site_url: String, ## date: String ## key: String ## } ## def self.all_reports database.all_reports end ## ## @brief Retrieve report for key ## ## @param _key Key for retrieval ## ## @return html formatted report ## def self.report(_key) database.report(_key) end def self.save_report(_options) database.save_report(_options) end end # Base storage interface class AbstractStorage def all_reports; end def report(_key); end def save_report(_options); end end end
20.08
77
0.598606
61e95c5d3c5d5ed12c5bf1943f29c9c99357551b
941
require 'dm-core' require 'dm-transactions' require 'dm-validations' require 'friendly_id/datamapper_adapter/configuration' require 'friendly_id/datamapper_adapter/slug' require 'friendly_id/datamapper_adapter/simple_model' require 'friendly_id/datamapper_adapter/slugged_model' # require 'friendly_id/datamapper_adapter/tasks' require 'forwardable' module FriendlyId module DataMapperAdapter include FriendlyId::Base def has_friendly_id(method, options = {}) extend FriendlyId::DataMapperAdapter::ClassMethods @friendly_id_config = Configuration.new(self, method, options) if friendly_id_config.use_slug? include ::FriendlyId::DataMapperAdapter::SluggedModel else include ::FriendlyId::DataMapperAdapter::SimpleModel end end module ClassMethods attr_accessor :friendly_id_config end end end DataMapper::Model.append_extensions FriendlyId::DataMapperAdapter
26.885714
68
0.777896
7a1a09ae24b386373c52531dc2f0678bb12bae21
8,471
# # Author:: Lamont Granquist (<lamont@chef.io>) # Copyright:: Copyright 2014-2017, 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. # class Chef class NodeMap # # Set a key/value pair on the map with a filter. The filter must be true # when applied to the node in order to retrieve the value. # # @param key [Object] Key to store # @param value [Object] Value associated with the key # @param filters [Hash] Node filter options to apply to key retrieval # # @yield [node] Arbitrary node filter as a block which takes a node argument # # @return [NodeMap] Returns self for possible chaining # def set(key, value, platform: nil, platform_version: nil, platform_family: nil, os: nil, canonical: nil, override: nil, &block) filters = {} filters[:platform] = platform if platform filters[:platform_version] = platform_version if platform_version filters[:platform_family] = platform_family if platform_family filters[:os] = os if os new_matcher = { value: value, filters: filters } new_matcher[:block] = block if block new_matcher[:canonical] = canonical if canonical new_matcher[:override] = override if override # The map is sorted in order of preference already; we just need to find # our place in it (just before the first value with the same preference level). insert_at = nil map[key] ||= [] map[key].each_with_index do |matcher, index| cmp = compare_matchers(key, new_matcher, matcher) insert_at ||= index if cmp && cmp <= 0 end if insert_at map[key].insert(insert_at, new_matcher) else map[key] << new_matcher end map end # # Get a value from the NodeMap via applying the node to the filters that # were set on the key. # # @param node [Chef::Node] The Chef::Node object for the run, or `nil` to # ignore all filters. # @param key [Object] Key to look up # @param canonical [Boolean] `true` or `false` to match canonical or # non-canonical values only. `nil` to ignore canonicality. Default: `nil` # # @return [Object] Value # def get(node, key, canonical: nil) raise ArgumentError, "first argument must be a Chef::Node" unless node.is_a?(Chef::Node) || node.nil? list(node, key, canonical: canonical).first end # # List all matches for the given node and key from the NodeMap, from # most-recently added to oldest. # # @param node [Chef::Node] The Chef::Node object for the run, or `nil` to # ignore all filters. # @param key [Object] Key to look up # @param canonical [Boolean] `true` or `false` to match canonical or # non-canonical values only. `nil` to ignore canonicality. Default: `nil` # # @return [Object] Value # def list(node, key, canonical: nil) raise ArgumentError, "first argument must be a Chef::Node" unless node.is_a?(Chef::Node) || node.nil? return [] unless map.has_key?(key) map[key].select do |matcher| node_matches?(node, matcher) && canonical_matches?(canonical, matcher) end.map { |matcher| matcher[:value] } end # Seriously, don't use this, it's nearly certain to change on you # @return remaining # @api private def delete_canonical(key, value) remaining = map[key] if remaining remaining.delete_if { |matcher| matcher[:canonical] && Array(matcher[:value]) == Array(value) } if remaining.empty? map.delete(key) remaining = nil end end remaining end private # # Succeeds if: # - no negative matches (!value) # - at least one positive match (value or :all), or no positive filters # def matches_black_white_list?(node, filters, attribute) # It's super common for the filter to be nil. Catch that so we don't # spend any time here. return true if !filters[attribute] filter_values = Array(filters[attribute]) value = node[attribute] # Split the blacklist and whitelist blacklist, whitelist = filter_values.partition { |v| v.is_a?(String) && v.start_with?("!") } # If any blacklist value matches, we don't match return false if blacklist.any? { |v| v[1..-1] == value } # If the whitelist is empty, or anything matches, we match. whitelist.empty? || whitelist.any? { |v| v == :all || v == value } end def matches_version_list?(node, filters, attribute) # It's super common for the filter to be nil. Catch that so we don't # spend any time here. return true if !filters[attribute] filter_values = Array(filters[attribute]) value = node[attribute] filter_values.empty? || Array(filter_values).any? do |v| Chef::VersionConstraint::Platform.new(v).include?(value) end end def filters_match?(node, filters) matches_black_white_list?(node, filters, :os) && matches_black_white_list?(node, filters, :platform_family) && matches_black_white_list?(node, filters, :platform) && matches_version_list?(node, filters, :platform_version) end def block_matches?(node, block) return true if block.nil? block.call node end def node_matches?(node, matcher) return true if !node filters_match?(node, matcher[:filters]) && block_matches?(node, matcher[:block]) end def canonical_matches?(canonical, matcher) return true if canonical.nil? !!canonical == !!matcher[:canonical] end # @api private def dispatch_compare_matchers(key, new_matcher, matcher) cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:block] } return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:filters][:platform_version] } return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:filters][:platform] } return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:filters][:platform_family] } return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:filters][:os] } return cmp if cmp != 0 cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:override] } return cmp if cmp != 0 # If all things are identical, return 0 0 end # # "provides" lines with identical filters sort by class name (ascending). # def compare_matchers(key, new_matcher, matcher) cmp = dispatch_compare_matchers(key, new_matcher, matcher) if cmp == 0 # Sort by class name (ascending) as well, if all other properties # are exactly equal if new_matcher[:value].is_a?(Class) && !new_matcher[:override] cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:value].name } end end cmp end def compare_matcher_properties(new_matcher, matcher) a = yield(new_matcher) b = yield(matcher) # Check for blcacklists ('!windows'). Those always come *after* positive # whitelists. a_negated = Array(a).any? { |f| f.is_a?(String) && f.start_with?("!") } b_negated = Array(b).any? { |f| f.is_a?(String) && f.start_with?("!") } if a_negated != b_negated return 1 if a_negated return -1 if b_negated end # We treat false / true and nil / not-nil with the same comparison a = nil if a == false b = nil if b == false cmp = a <=> b # This is the case where one is non-nil, and one is nil. The one that is # nil is "greater" (i.e. it should come last). if cmp.nil? return 1 if a.nil? return -1 if b.nil? end cmp end def map @map ||= {} end end end
35.894068
131
0.641837
0871cafd5afc0b090877eb548cb54c7f7181adc7
322
json.array!(@wardrobes) do |wardrobe| json.extract! wardrobe, :id, :chosen, :recommended json.clothing do json.name wardrobe.clothe.name json.id wardrobe.clothe.id json.attrs do json.array!(wardrobe.clothe.attrs) do |attr| json.extract! attr, :name, :func, :value end end end end
24.769231
52
0.661491
39def5cff9c236ad17a094b73e4bf845987f43ca
2,179
require 'jquery-rails' require 'jquery-ui-rails' require 'kaminari' require 'nested_form' require 'rack-pjax' require 'rails' require 'rails_admin' require 'remotipart' module RailsAdmin class Engine < Rails::Engine isolate_namespace RailsAdmin config.action_dispatch.rescue_responses['RailsAdmin::ActionNotAllowed'] = :forbidden initializer 'RailsAdmin precompile hook', group: :all do |app| app.config.assets.precompile += %w( rails_admin/rails_admin.js rails_admin/rails_admin.css rails_admin/jquery.colorpicker.js rails_admin/jquery.colorpicker.css ) end initializer 'RailsAdmin setup middlewares' do |app| app.config.middleware.use Rack::Pjax end initializer 'RailsAdmin reload config in development' do if Rails.application.config.cache_classes if defined?(ActiveSupport::Reloader) ActiveSupport::Reloader.before_class_unload do RailsAdmin::Config.reset_all_models end # else # For Rails 4 not implemented end end end rake_tasks do Dir[File.join(File.dirname(__FILE__), '../tasks/*.rake')].each { |f| load f } end # Check for required middlewares, users may forget to use them in Rails API mode config.after_initialize do |app| has_session_store = app.config.middleware.to_a.any? do |m| m.klass.try(:<=, ActionDispatch::Session::AbstractStore) || m.klass.name =~ /^ActionDispatch::Session::/ end loaded = app.config.middleware.to_a.map(&:name) required = %w(ActionDispatch::Cookies ActionDispatch::Flash Rack::MethodOverride) missing = required - loaded unless missing.empty? && has_session_store configs = missing.map { |m| "config.middleware.use #{m}" } configs << "config.middleware.use #{app.config.session_store.try(:name) || 'ActionDispatch::Session::CookieStore'}, #{app.config.session_options}" unless has_session_store raise <<-EOM Required middlewares for RailsAdmin are not added To fix this, add #{configs.join("\n ")} to config/application.rb. EOM end end end end
31.57971
179
0.679211
e9fd7fc6ac4ceffb2dac8994f649c78b5a8cec45
326
$value_generators << ScriptedColumnValueGenerator.new("Family Count") do |nuix_case,query| modified_query = "(#{query}) AND has-exclusion:0" items = nuix_case.search(modified_query) family_items = $utilities.getItemUtility.findFamilies(items) family_items = family_items.reject{|i|i.isExcluded} next family_items.size end
46.571429
90
0.797546
1de7fbea82d1c9c7bacdd96c30c8930d6bedf5f3
273
TagTextType = GraphqlCrudOperations.define_default_type do name 'TagText' description 'Tag text type' interfaces [NodeIdentification.interface] field :dbid, types.Int field :text, types.String field :tags_count, types.Int field :teamwide, types.Boolean end
22.75
58
0.772894
ffa65fdc90eafee6940e7f80e590e10be8aa0398
36,742
require 'test_helper' class AuthorizeNetTest < Test::Unit::TestCase include CommStub def setup @gateway = AuthorizeNetGateway.new( login: 'X', password: 'Y' ) @amount = 100 @credit_card = credit_card @check = check @options = { order_id: '1', billing_address: address, description: 'Store Purchase' } end def test_add_swipe_data_with_bad_data @credit_card.track_data = '%B378282246310005LONGSONLONGBOB1705101130504392?' stub_comms do @gateway.purchase(@amount, @credit_card) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_nil doc.at_xpath('//track1') assert_nil doc.at_xpath('//track2') assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_purchase_response) end def test_add_swipe_data_with_track_1 @credit_card.track_data = '%B378282246310005^LONGSON/LONGBOB^1705101130504392?' stub_comms do @gateway.purchase(@amount, @credit_card) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_equal '%B378282246310005^LONGSON/LONGBOB^1705101130504392?', doc.at_xpath('//track1').content assert_nil doc.at_xpath('//track2') assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_purchase_response) end def test_add_swipe_data_with_track_2 @credit_card.track_data = ';4111111111111111=1803101000020000831?' stub_comms do @gateway.purchase(@amount, @credit_card) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_nil doc.at_xpath('//track1') assert_equal ';4111111111111111=1803101000020000831?', doc.at_xpath('//track2').content assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_purchase_response) end def test_successful_echeck_authorization response = stub_comms do @gateway.authorize(@amount, @check) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_not_nil doc.at_xpath("//payment/bankAccount") assert_equal "244183602", doc.at_xpath("//routingNumber").content assert_equal "15378535", doc.at_xpath("//accountNumber").content assert_equal "Bank of Elbonia", doc.at_xpath("//bankName").content assert_equal "Jim Smith", doc.at_xpath("//nameOnAccount").content assert_equal "WEB", doc.at_xpath("//echeckType").content assert_equal "1", doc.at_xpath("//checkNumber").content assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_authorize_response) assert response assert_instance_of Response, response assert_success response assert_equal '508141794', response.authorization.split('#')[0] end def test_successful_echeck_purchase response = stub_comms do @gateway.purchase(@amount, @check) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_not_nil doc.at_xpath("//payment/bankAccount") assert_equal "244183602", doc.at_xpath("//routingNumber").content assert_equal "15378535", doc.at_xpath("//accountNumber").content assert_equal "Bank of Elbonia", doc.at_xpath("//bankName").content assert_equal "Jim Smith", doc.at_xpath("//nameOnAccount").content assert_equal "WEB", doc.at_xpath("//echeckType").content assert_equal "1", doc.at_xpath("//checkNumber").content assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_purchase_response) assert response assert_instance_of Response, response assert_success response assert_equal '508141795', response.authorization.split('#')[0] end def test_echeck_passing_recurring_flag response = stub_comms do @gateway.purchase(@amount, @check, recurring: true) end.check_request do |endpoint, data, headers| assert_equal settings_from_doc(parse(data))["recurringBilling"], "true" end.respond_with(successful_purchase_response) assert_success response end def test_failed_echeck_authorization @gateway.expects(:ssl_post).returns(failed_authorize_response) response = @gateway.authorize(@amount, @check) assert_failure response end def test_successful_authorization @gateway.expects(:ssl_post).returns(successful_authorize_response) response = @gateway.authorize(@amount, @credit_card) assert_success response assert_equal 'M', response.cvv_result['code'] assert_equal 'CVV matches', response.cvv_result['message'] assert_equal '508141794', response.authorization.split('#')[0] assert response.test? end def test_successful_purchase @gateway.expects(:ssl_post).returns(successful_purchase_response) response = @gateway.purchase(@amount, @credit_card) assert_success response assert_equal '508141795', response.authorization.split('#')[0] assert response.test? assert_equal 'Y', response.avs_result['code'] assert response.avs_result['street_match'] assert response.avs_result['postal_match'] assert_equal 'Street address and 5-digit postal code match.', response.avs_result['message'] assert_equal 'P', response.cvv_result['code'] assert_equal 'CVV not processed', response.cvv_result['message'] end def test_failed_purchase @gateway.expects(:ssl_post).returns(failed_purchase_response) response = @gateway.purchase(@amount, @credit_card, @options) assert_failure response end def test_failed_authorize @gateway.expects(:ssl_post).returns(failed_authorize_response) response = @gateway.authorize(@amount, @credit_card, @options) assert_failure response end def test_successful_capture @gateway.expects(:ssl_post).returns(successful_capture_response) capture = @gateway.capture(@amount, '2214269051#XXXX1234', @options) assert_success capture end def test_failed_capture @gateway.expects(:ssl_post).returns(failed_capture_response) assert capture = @gateway.capture(@amount, '2214269051#XXXX1234') assert_failure capture end def test_failed_already_actioned_capture @gateway.expects(:ssl_post).returns(already_actioned_capture_response) response = @gateway.capture(50, '123456789') assert_instance_of Response, response assert_failure response end def test_successful_void @gateway.expects(:ssl_post).returns(successful_void_response) assert void = @gateway.void('') assert_success void end def test_failed_void @gateway.expects(:ssl_post).returns(failed_void_response) response = @gateway.void('') assert_failure response end def test_successful_verify response = stub_comms do @gateway.verify(@credit_card) end.respond_with(successful_authorize_response, successful_void_response) assert_success response end def test_successful_verify_failed_void response = stub_comms do @gateway.verify(@credit_card, @options) end.respond_with(successful_authorize_response, failed_void_response) assert_success response assert_match %r{This transaction has been approved}, response.message end def test_unsuccessful_verify response = stub_comms do @gateway.verify(@credit_card, @options) end.respond_with(failed_authorize_response, successful_void_response) assert_failure response assert_not_nil response.message end def test_address stub_comms do @gateway.authorize(@amount, @credit_card, billing_address: {address1: '164 Waverley Street', country: 'US', state: 'CO'}) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_equal "CO", doc.at_xpath("//billTo/state").content, data assert_equal "164 Waverley Street", doc.at_xpath("//billTo/address").content, data assert_equal "US", doc.at_xpath("//billTo/country").content, data end end.respond_with(successful_authorize_response) end def test_address_outsite_north_america stub_comms do @gateway.authorize(@amount, @credit_card, billing_address: {address1: '164 Waverley Street', country: 'DE', state: ''}) end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_equal "n/a", doc.at_xpath("//billTo/state").content, data assert_equal "164 Waverley Street", doc.at_xpath("//billTo/address").content, data assert_equal "DE", doc.at_xpath("//billTo/country").content, data end end.respond_with(successful_authorize_response) end def test_duplicate_window @gateway.class.duplicate_window = 0 stub_comms do @gateway.purchase(@amount, @credit_card) end.check_request do |endpoint, data, headers| assert_equal settings_from_doc(parse(data))["duplicateWindow"], "0" end.respond_with(successful_purchase_response) ensure @gateway.class.duplicate_window = nil end def test_add_cardholder_authentication_value stub_comms do @gateway.purchase(@amount, @credit_card, cardholder_authentication_value: 'E0Mvq8AAABEiMwARIjNEVWZ3iJk=', authentication_indicator: "2") end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_equal "E0Mvq8AAABEiMwARIjNEVWZ3iJk=", doc.at_xpath("//cardholderAuthentication/cardholderAuthenticationValue").content assert_equal "2", doc.at_xpath("//cardholderAuthentication/authenticationIndicator").content assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_purchase_response) end def test_capture_passing_extra_info response = stub_comms do @gateway.capture(50, '123456789', description: "Yo", order_id: "Sweetness") end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_not_nil doc.at_xpath("//order/description"), data assert_equal "Yo", doc.at_xpath("//order/description").content, data assert_equal "Sweetness", doc.at_xpath("//order/invoiceNumber").content, data assert_equal "0.50", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_capture_response) assert_success response end def test_successful_refund @gateway.expects(:ssl_post).returns(successful_refund_response) assert refund = @gateway.refund(36.40, '2214269051#XXXX1234') assert_success refund assert_equal 'This transaction has been approved', refund.message assert_equal '2214602071#2224', refund.authorization end def test_refund_passing_extra_info response = stub_comms do @gateway.refund(50, '123456789', card_number: @credit_card.number, first_name: "Bob", last_name: "Smith", zip: "12345") end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_equal "Bob", doc.at_xpath("//billTo/firstName").content, data assert_equal "Smith", doc.at_xpath("//billTo/lastName").content, data assert_equal "12345", doc.at_xpath("//billTo/zip").content, data assert_equal "0.50", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_purchase_response) assert_success response end def test_failed_refund @gateway.expects(:ssl_post).returns(failed_refund_response) refund = @gateway.refund(nil, '') assert_failure refund assert_equal 'The sum of credits against the referenced transaction would exceed original debit amount', refund.message assert_equal '0#2224', refund.authorization end def test_supported_countries assert_equal 4, (['US', 'CA', 'AU', 'VA'] & AuthorizeNetGateway.supported_countries).size end def test_supported_card_types assert_equal [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro], AuthorizeNetGateway.supported_cardtypes end def test_failure_without_response_reason_text response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(no_message_response) assert_equal "", response.message end def test_response_under_review_by_fraud_service @gateway.expects(:ssl_post).returns(fraud_review_response) response = @gateway.purchase(@amount, @credit_card) assert_failure response assert response.fraud_review? assert_equal "Thank you! For security reasons your order is currently being reviewed", response.message end def test_avs_result @gateway.expects(:ssl_post).returns(fraud_review_response) response = @gateway.purchase(@amount, @credit_card) assert_equal 'X', response.avs_result['code'] end def test_cvv_result @gateway.expects(:ssl_post).returns(fraud_review_response) response = @gateway.purchase(@amount, @credit_card) assert_equal 'M', response.cvv_result['code'] end def test_message response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(no_match_cvv_response) assert_equal "CVV does not match", response.message response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(no_match_avs_response) assert_equal "Street address matches, but 5-digit and 9-digit postal code do not match.", response.message response = stub_comms do @gateway.purchase(@amount, @credit_card) end.respond_with(failed_purchase_response) assert_equal "The credit card number is invalid", response.message end def test_solution_id_is_added_to_post_data_parameters @gateway.class.application_id = 'A1000000' stub_comms do @gateway.authorize(@amount, @credit_card) end.check_request do |endpoint, data, headers| doc = parse(data) assert_equal "A1000000", fields_from_doc(doc)["x_solution_id"], data assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end.respond_with(successful_authorize_response) ensure @gateway.class.application_id = nil end def test_alternate_currency @gateway.expects(:ssl_post).returns(successful_purchase_response) response = @gateway.purchase(@amount, @credit_card, currency: "GBP") assert_success response end def assert_no_has_customer_id(data) assert_no_match %r{x_cust_id}, data end def test_include_cust_id_for_numeric_values stub_comms do @gateway.purchase(@amount, @credit_card, customer: "123") end.check_request do |endpoint, data, headers| parse(data) do |doc| assert_not_nil doc.at_xpath("//customer/id"), data assert_equal "123", doc.at_xpath("//customer/id").content, data assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end end.respond_with(successful_authorize_response) end def test_dont_include_cust_id_for_non_numeric_values stub_comms do @gateway.purchase(@amount, @credit_card, customer: "bob@test.com") end.check_request do |endpoint, data, headers| doc = parse(data) assert !doc.at_xpath("//customer/id"), data assert_equal "1.00", doc.at_xpath("//transactionRequest/amount").content end.respond_with(successful_authorize_response) end def test_truncation card = credit_card('4242424242424242', first_name: "a" * 51, last_name: "a" * 51, ) options = { order_id: "a" * 21, description: "a" * 256, billing_address: address( company: "a" * 51, address1: "a" * 61, city: "a" * 41, state: "a" * 41, zip: "a" * 21, country: "a" * 61, ), shipping_address: address( company: "a" * 51, address1: "a" * 61, city: "a" * 41, state: "a" * 41, zip: "a" * 21, country: "a" * 61, ) } stub_comms do @gateway.purchase(@amount, card, options) end.check_request do |endpoint, data, headers| assert_truncated(data, 20, "//refId") assert_truncated(data, 255, "//description") assert_address_truncated(data, 50, "firstName") assert_address_truncated(data, 50, "lastName") assert_address_truncated(data, 50, "company") assert_address_truncated(data, 60, "address") assert_address_truncated(data, 40, "city") assert_address_truncated(data, 40, "state") assert_address_truncated(data, 20, "zip") assert_address_truncated(data, 60, "country") end.respond_with(successful_purchase_response) end private def parse(data) Nokogiri::XML(data).tap do |doc| doc.remove_namespaces! yield(doc) if block_given? end end def fields_from_doc(doc) assert_not_nil doc.at_xpath("//userFields/userField/name") doc.xpath("//userFields/userField").inject({}) do |hash, element| hash[element.at_xpath("name").content] = element.at_xpath("value").content hash end end def settings_from_doc(doc) assert_not_nil doc.at_xpath("//transactionSettings/setting/settingName") doc.xpath("//transactionSettings/setting").inject({}) do |hash, element| hash[element.at_xpath("settingName").content] = element.at_xpath("settingValue").content hash end end def assert_truncated(data, expected_size, field) assert_equal ("a" * expected_size), parse(data).at_xpath(field).text, data end def assert_address_truncated(data, expected_size, field) assert_truncated(data, expected_size, "//billTo/#{field}") assert_truncated(data, expected_size, "//shipTo/#{field}") end def successful_purchase_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>1</refId> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <transactionResponse> <responseCode>1</responseCode> <authCode>GSOFTZ</authCode> <avsResultCode>Y</avsResultCode> <cvvResultCode>P</cvvResultCode> <cavvResultCode>2</cavvResultCode> <transId>508141795</transId> <refTransID/> <transHash>655D049EE60E1766C9C28EB47CFAA389</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <messages> <message> <code>1</code> <description>This transaction has been approved.</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def fraud_review_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>1</refId> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <transactionResponse> <responseCode>4</responseCode> <authCode>GSOFTZ</authCode> <avsResultCode>X</avsResultCode> <cvvResultCode>M</cvvResultCode> <cavvResultCode>2</cavvResultCode> <transId>508141795</transId> <refTransID/> <transHash>655D049EE60E1766C9C28EB47CFAA389</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <messages> <message> <code>1</code> <description>Thank you! For security reasons your order is currently being reviewed</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def no_match_cvv_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>1</refId> <messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages> <transactionResponse> <responseCode>2</responseCode> <authCode>GSOFTZ</authCode> <avsResultCode>A</avsResultCode> <cvvResultCode>N</cvvResultCode> <cavvResultCode>2</cavvResultCode> <transId>508141795</transId> <refTransID/> <transHash>655D049EE60E1766C9C28EB47CFAA389</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <messages> <message> <code>1</code> <description>Thank you! For security reasons your order is currently being reviewed</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def no_match_avs_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>1</refId> <messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages> <transactionResponse> <responseCode>2</responseCode> <authCode>GSOFTZ</authCode> <avsResultCode>A</avsResultCode> <cvvResultCode>M</cvvResultCode> <cavvResultCode>2</cavvResultCode> <transId>508141795</transId> <refTransID/> <transHash>655D049EE60E1766C9C28EB47CFAA389</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <errors> <error> <errorCode>27</errorCode> <errorText>The transaction cannot be found.</errorText> </error> </errors> </transactionResponse> </createTransactionResponse> eos end def failed_purchase_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>1234567</refId> <messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages> <transactionResponse> <responseCode>3</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>0</transId> <refTransID/> <transHash>7F9A0CB845632DCA5833D2F30ED02677</transHash> <testRequest>0</testRequest> <accountNumber>XXXX0001</accountNumber> <accountType/> <errors> <error> <errorCode>6</errorCode> <errorText>The credit card number is invalid.</errorText> </error> </errors> <userFields> <userField> <name>MerchantDefinedFieldName1</name> <value>MerchantDefinedFieldValue1</value> </userField> <userField> <name>favorite_color</name> <value>blue</value> </userField> </userFields> </transactionResponse> </createTransactionResponse> eos end def no_message_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>1234567</refId> <messages> <resultCode>Error</resultCode> </messages> <transactionResponse> <responseCode>3</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>0</transId> <refTransID/> <transHash>7F9A0CB845632DCA5833D2F30ED02677</transHash> <testRequest>0</testRequest> <accountNumber>XXXX0001</accountNumber> <accountType/> <userFields> <userField> <name>MerchantDefinedFieldName1</name> <value>MerchantDefinedFieldValue1</value> </userField> <userField> <name>favorite_color</name> <value>blue</value> </userField> </userFields> </transactionResponse> </createTransactionResponse> eos end def successful_authorize_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>123456</refId> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <transactionResponse> <responseCode>1</responseCode> <authCode>A88MS0</authCode> <avsResultCode>Y</avsResultCode> <cvvResultCode>M</cvvResultCode> <cavvResultCode>2</cavvResultCode> <transId>508141794</transId> <refTransID/> <transHash>D0EFF3F32E5ABD14A7CE6ADF32736D57</transHash> <testRequest>0</testRequest> <accountNumber>XXXX0015</accountNumber> <accountType>MasterCard</accountType> <messages> <message> <code>1</code> <description>This transaction has been approved.</description> </message> </messages> <userFields> <userField> <name>MerchantDefinedFieldName1</name> <value>MerchantDefinedFieldValue1</value> </userField> <userField> <name>favorite_color</name> <value>blue</value> </userField> </userFields> </transactionResponse> </createTransactionResponse> eos end def failed_authorize_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId>123456</refId> <messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages> <transactionResponse> <responseCode>3</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>0</transId> <refTransID/> <transHash>DA56E64108957174C5AE9BE466914741</transHash> <testRequest>0</testRequest> <accountNumber>XXXX0001</accountNumber> <accountType/> <errors> <error> <errorCode>6</errorCode> <errorText>The credit card number is invalid.</errorText> </error> </errors> <userFields> <userField> <name>MerchantDefinedFieldName1</name> <value>MerchantDefinedFieldValue1</value> </userField> <userField> <name>favorite_color</name> <value>blue</value> </userField> </userFields> </transactionResponse> </createTransactionResponse> eos end def successful_capture_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema xmlns=AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId/> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <transactionResponse> <responseCode>1</responseCode> <authCode>UTDVHP</authCode> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>2214675515</transId> <refTransID>2214675515</refTransID> <transHash>6D739029E129D87F6CEFE3B3864F6D61</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <messages> <message> <code>1</code> <description>This transaction has been approved.</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def already_actioned_capture_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema xmlns=AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <refId/> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>This transaction has already been captured.</text> </message> </messages> <transactionResponse> <responseCode>1</responseCode> <authCode>UTDVHP</authCode> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>2214675515</transId> <refTransID>2214675515</refTransID> <transHash>6D739029E129D87F6CEFE3B3864F6D61</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <messages> <message> <code>311</code> <description>This transaction has already been captured.</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def failed_capture_response <<-eos <createTransactionResponse xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns=AnetApi/xml/v1/schema/AnetApiSchema.xsd><refId/><messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages><transactionResponse> <responseCode>3</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>0</transId> <refTransID>23124</refTransID> <transHash>D99CC43D1B34F0DAB7F430F8F8B3249A</transHash> <testRequest>0</testRequest> <accountNumber/> <accountType/> <errors> <error> <errorCode>16</errorCode> <errorText>The transaction cannot be found.</errorText> </error> </errors> <shipTo/> </transactionResponse> </createTransactionResponse> eos end def successful_refund_response <<-eos <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <transactionResponse> <responseCode>1</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>2214602071</transId> <refTransID>2214269051</refTransID> <transHash>A3E5982FB6789092985F2D618196A268</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <messages> <message> <code>1</code> <description>This transaction has been approved.</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def failed_refund_response <<-eos <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages> <transactionResponse> <responseCode>3</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>0</transId> <refTransID>2214269051</refTransID> <transHash>63E03F4968F0874E1B41FCD79DD54717</transHash> <testRequest>0</testRequest> <accountNumber>XXXX2224</accountNumber> <accountType>Visa</accountType> <errors> <error> <errorCode>55</errorCode> <errorText>The sum of credits against the referenced transaction would exceed original debit amount.</errorText> </error> </errors> </transactionResponse> </createTransactionResponse> eos end def successful_void_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <messages> <resultCode>Ok</resultCode> <message> <code>I00001</code> <text>Successful.</text> </message> </messages> <transactionResponse> <responseCode>1</responseCode> <authCode>GYEB3</authCode> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>2213755822</transId> <refTransID>2213755822</refTransID> <transHash>3383BBB85FF98057D61B2D9B9A2DA79F</transHash> <testRequest>0</testRequest> <accountNumber>XXXX0015</accountNumber> <accountType>MasterCard</accountType> <messages> <message> <code>1</code> <description>This transaction has been approved.</description> </message> </messages> </transactionResponse> </createTransactionResponse> eos end def failed_void_response <<-eos <?xml version="1.0" encoding="utf-8"?> <createTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <messages> <resultCode>Error</resultCode> <message> <code>E00027</code> <text>The transaction was unsuccessful.</text> </message> </messages> <transactionResponse> <responseCode>3</responseCode> <authCode/> <avsResultCode>P</avsResultCode> <cvvResultCode/> <cavvResultCode/> <transId>0</transId> <refTransID>2213755821</refTransID> <transHash>39DC95085A313FEF7278C40EA8A66B16</transHash> <testRequest>0</testRequest> <accountNumber/> <accountType/> <errors> <error> <errorCode>16</errorCode> <errorText>The transaction cannot be found.</errorText> </error> </errors> <shipTo/> </transactionResponse> </createTransactionResponse> eos end end
34.629595
182
0.656469
18664c32a749655417452daa432f72ec8532f86f
419,594
# 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/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE require 'seahorse/client/plugins/content_length.rb' require 'aws-sdk-core/plugins/credentials_configuration.rb' require 'aws-sdk-core/plugins/logging.rb' require 'aws-sdk-core/plugins/param_converter.rb' require 'aws-sdk-core/plugins/param_validator.rb' require 'aws-sdk-core/plugins/user_agent.rb' require 'aws-sdk-core/plugins/helpful_socket_errors.rb' require 'aws-sdk-core/plugins/retry_errors.rb' require 'aws-sdk-core/plugins/global_configuration.rb' require 'aws-sdk-core/plugins/regional_endpoint.rb' require 'aws-sdk-core/plugins/endpoint_discovery.rb' require 'aws-sdk-core/plugins/endpoint_pattern.rb' require 'aws-sdk-core/plugins/response_paging.rb' require 'aws-sdk-core/plugins/stub_responses.rb' require 'aws-sdk-core/plugins/idempotency_token.rb' require 'aws-sdk-core/plugins/jsonvalue_converter.rb' require 'aws-sdk-core/plugins/client_metrics_plugin.rb' require 'aws-sdk-core/plugins/client_metrics_send_plugin.rb' require 'aws-sdk-core/plugins/transfer_encoding.rb' require 'aws-sdk-core/plugins/http_checksum.rb' require 'aws-sdk-core/plugins/signature_v4.rb' require 'aws-sdk-core/plugins/protocols/rest_json.rb' Aws::Plugins::GlobalConfiguration.add_identifier(:iot) module Aws::IoT # An API client for IoT. To construct a client, you need to configure a `:region` and `:credentials`. # # client = Aws::IoT::Client.new( # region: region_name, # credentials: credentials, # # ... # ) # # For details on configuring region and credentials see # the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html). # # See {#initialize} for a full list of supported configuration options. class Client < Seahorse::Client::Base include Aws::ClientStubs @identifier = :iot set_api(ClientApi::API) add_plugin(Seahorse::Client::Plugins::ContentLength) add_plugin(Aws::Plugins::CredentialsConfiguration) add_plugin(Aws::Plugins::Logging) add_plugin(Aws::Plugins::ParamConverter) add_plugin(Aws::Plugins::ParamValidator) add_plugin(Aws::Plugins::UserAgent) add_plugin(Aws::Plugins::HelpfulSocketErrors) add_plugin(Aws::Plugins::RetryErrors) add_plugin(Aws::Plugins::GlobalConfiguration) add_plugin(Aws::Plugins::RegionalEndpoint) add_plugin(Aws::Plugins::EndpointDiscovery) add_plugin(Aws::Plugins::EndpointPattern) add_plugin(Aws::Plugins::ResponsePaging) add_plugin(Aws::Plugins::StubResponses) add_plugin(Aws::Plugins::IdempotencyToken) add_plugin(Aws::Plugins::JsonvalueConverter) add_plugin(Aws::Plugins::ClientMetricsPlugin) add_plugin(Aws::Plugins::ClientMetricsSendPlugin) add_plugin(Aws::Plugins::TransferEncoding) add_plugin(Aws::Plugins::HttpChecksum) add_plugin(Aws::Plugins::SignatureV4) add_plugin(Aws::Plugins::Protocols::RestJson) # @overload initialize(options) # @param [Hash] options # @option options [required, Aws::CredentialProvider] :credentials # Your AWS credentials. This can be an instance of any one of the # following classes: # # * `Aws::Credentials` - Used for configuring static, non-refreshing # credentials. # # * `Aws::InstanceProfileCredentials` - Used for loading credentials # from an EC2 IMDS on an EC2 instance. # # * `Aws::SharedCredentials` - Used for loading credentials from a # shared file, such as `~/.aws/config`. # # * `Aws::AssumeRoleCredentials` - Used when you need to assume a role. # # When `:credentials` are not configured directly, the following # locations will be searched for credentials: # # * `Aws.config[:credentials]` # * The `:access_key_id`, `:secret_access_key`, and `:session_token` options. # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'] # * `~/.aws/credentials` # * `~/.aws/config` # * EC2 IMDS instance profile - When used by default, the timeouts are # very aggressive. Construct and pass an instance of # `Aws::InstanceProfileCredentails` to enable retries and extended # timeouts. # # @option options [required, String] :region # The AWS region to connect to. The configured `:region` is # used to determine the service `:endpoint`. When not passed, # a default `:region` is searched for in the following locations: # # * `Aws.config[:region]` # * `ENV['AWS_REGION']` # * `ENV['AMAZON_REGION']` # * `ENV['AWS_DEFAULT_REGION']` # * `~/.aws/credentials` # * `~/.aws/config` # # @option options [String] :access_key_id # # @option options [Boolean] :active_endpoint_cache (false) # When set to `true`, a thread polling for endpoints will be running in # the background every 60 secs (default). Defaults to `false`. # # @option options [Boolean] :adaptive_retry_wait_to_fill (true) # Used only in `adaptive` retry mode. When true, the request will sleep # until there is sufficent client side capacity to retry the request. # When false, the request will raise a `RetryCapacityNotAvailableError` and will # not retry instead of sleeping. # # @option options [Boolean] :client_side_monitoring (false) # When `true`, client-side metrics will be collected for all API requests from # this client. # # @option options [String] :client_side_monitoring_client_id ("") # Allows you to provide an identifier for this client which will be attached to # all generated client side metrics. Defaults to an empty string. # # @option options [String] :client_side_monitoring_host ("127.0.0.1") # Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client # side monitoring agent is running on, where client metrics will be published via UDP. # # @option options [Integer] :client_side_monitoring_port (31000) # Required for publishing client metrics. The port that the client side monitoring # agent is running on, where client metrics will be published via UDP. # # @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher) # Allows you to provide a custom client-side monitoring publisher class. By default, # will use the Client Side Monitoring Agent Publisher. # # @option options [Boolean] :convert_params (true) # When `true`, an attempt is made to coerce request parameters into # the required types. # # @option options [Boolean] :correct_clock_skew (true) # Used only in `standard` and adaptive retry modes. Specifies whether to apply # a clock skew correction and retry requests with skewed client clocks. # # @option options [Boolean] :disable_host_prefix_injection (false) # Set to true to disable SDK automatically adding host prefix # to default service endpoint when available. # # @option options [String] :endpoint # The client endpoint is normally constructed from the `:region` # option. You should only configure an `:endpoint` when connecting # to test or custom endpoints. This should be a valid HTTP(S) URI. # # @option options [Integer] :endpoint_cache_max_entries (1000) # Used for the maximum size limit of the LRU cache storing endpoints data # for endpoint discovery enabled operations. Defaults to 1000. # # @option options [Integer] :endpoint_cache_max_threads (10) # Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. # # @option options [Integer] :endpoint_cache_poll_interval (60) # When :endpoint_discovery and :active_endpoint_cache is enabled, # Use this option to config the time interval in seconds for making # requests fetching endpoints information. Defaults to 60 sec. # # @option options [Boolean] :endpoint_discovery (false) # When set to `true`, endpoint discovery will be enabled for operations when available. # # @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default) # The log formatter. # # @option options [Symbol] :log_level (:info) # The log level to send messages to the `:logger` at. # # @option options [Logger] :logger # The Logger instance to send log messages to. If this option # is not set, logging will be disabled. # # @option options [Integer] :max_attempts (3) # An integer representing the maximum number attempts that will be made for # a single request, including the initial attempt. For example, # setting this value to 5 will result in a request being retried up to # 4 times. Used in `standard` and `adaptive` retry modes. # # @option options [String] :profile ("default") # Used when loading credentials from the shared credentials file # at HOME/.aws/credentials. When not specified, 'default' is used. # # @option options [Proc] :retry_backoff # A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay. # This option is only used in the `legacy` retry mode. # # @option options [Float] :retry_base_delay (0.3) # The base delay in seconds used by the default backoff function. This option # is only used in the `legacy` retry mode. # # @option options [Symbol] :retry_jitter (:none) # A delay randomiser function used by the default backoff function. # Some predefined functions can be referenced by name - :none, :equal, :full, # otherwise a Proc that takes and returns a number. This option is only used # in the `legacy` retry mode. # # @see https://www.awsarchitectureblog.com/2015/03/backoff.html # # @option options [Integer] :retry_limit (3) # The maximum number of times to retry failed requests. Only # ~ 500 level server errors and certain ~ 400 level client errors # are retried. Generally, these are throttling errors, data # checksum errors, networking errors, timeout errors, auth errors, # endpoint discovery, and errors from expired credentials. # This option is only used in the `legacy` retry mode. # # @option options [Integer] :retry_max_delay (0) # The maximum number of seconds to delay between retries (0 for no limit) # used by the default backoff function. This option is only used in the # `legacy` retry mode. # # @option options [String] :retry_mode ("legacy") # Specifies which retry algorithm to use. Values are: # # * `legacy` - The pre-existing retry behavior. This is default value if # no retry mode is provided. # # * `standard` - A standardized set of retry rules across the AWS SDKs. # This includes support for retry quotas, which limit the number of # unsuccessful retries a client can make. # # * `adaptive` - An experimental retry mode that includes all the # functionality of `standard` mode along with automatic client side # throttling. This is a provisional mode that may change behavior # in the future. # # # @option options [String] :secret_access_key # # @option options [String] :session_token # # @option options [Boolean] :stub_responses (false) # Causes the client to return stubbed responses. By default # fake responses are generated and returned. You can specify # the response data to return or errors to raise by calling # {ClientStubs#stub_responses}. See {ClientStubs} for more information. # # ** Please note ** When response stubbing is enabled, no HTTP # requests are made, and retries are disabled. # # @option options [Boolean] :validate_params (true) # When `true`, request parameters are validated before # sending the request. # # @option options [URI::HTTP,String] :http_proxy A proxy to send # requests through. Formatted like 'http://proxy.com:123'. # # @option options [Float] :http_open_timeout (15) The number of # seconds to wait when opening a HTTP session before raising a # `Timeout::Error`. # # @option options [Integer] :http_read_timeout (60) The default # number of seconds to wait for response data. This value can # safely be set per-request on the session. # # @option options [Float] :http_idle_timeout (5) The number of # seconds a connection is allowed to sit idle before it is # considered stale. Stale connections are closed and removed # from the pool before making a request. # # @option options [Float] :http_continue_timeout (1) The number of # seconds to wait for a 100-continue response before sending the # request body. This option has no effect unless the request has # "Expect" header set to "100-continue". Defaults to `nil` which # disables this behaviour. This value can safely be set per # request on the session. # # @option options [Boolean] :http_wire_trace (false) When `true`, # HTTP debug output will be sent to the `:logger`. # # @option options [Boolean] :ssl_verify_peer (true) When `true`, # SSL peer certificates are verified when establishing a # connection. # # @option options [String] :ssl_ca_bundle Full path to the SSL # certificate authority bundle file that should be used when # verifying peer certificates. If you do not pass # `:ssl_ca_bundle` or `:ssl_ca_directory` the the system default # will be used if available. # # @option options [String] :ssl_ca_directory Full path of the # directory that contains the unbundled SSL certificate # authority files for verifying peer certificates. If you do # not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the # system default will be used if available. # def initialize(*args) super end # @!group API Operations # Accepts a pending certificate transfer. The default state of the # certificate is INACTIVE. # # To check for pending certificate transfers, call ListCertificates to # enumerate your certificates. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @option params [Boolean] :set_as_active # Specifies whether the certificate is active. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.accept_certificate_transfer({ # certificate_id: "CertificateId", # required # set_as_active: false, # }) # # @overload accept_certificate_transfer(params = {}) # @param [Hash] params ({}) def accept_certificate_transfer(params = {}, options = {}) req = build_request(:accept_certificate_transfer, params) req.send_request(options) end # Adds a thing to a billing group. # # @option params [String] :billing_group_name # The name of the billing group. # # @option params [String] :billing_group_arn # The ARN of the billing group. # # @option params [String] :thing_name # The name of the thing to be added to the billing group. # # @option params [String] :thing_arn # The ARN of the thing to be added to the billing group. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.add_thing_to_billing_group({ # billing_group_name: "BillingGroupName", # billing_group_arn: "BillingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # }) # # @overload add_thing_to_billing_group(params = {}) # @param [Hash] params ({}) def add_thing_to_billing_group(params = {}, options = {}) req = build_request(:add_thing_to_billing_group, params) req.send_request(options) end # Adds a thing to a thing group. # # @option params [String] :thing_group_name # The name of the group to which you are adding a thing. # # @option params [String] :thing_group_arn # The ARN of the group to which you are adding a thing. # # @option params [String] :thing_name # The name of the thing to add to a group. # # @option params [String] :thing_arn # The ARN of the thing to add to a group. # # @option params [Boolean] :override_dynamic_groups # Override dynamic thing groups with static thing groups when 10-group # limit is reached. If a thing belongs to 10 thing groups, and one or # more of those groups are dynamic thing groups, adding a thing to a # static group removes the thing from the last dynamic group. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.add_thing_to_thing_group({ # thing_group_name: "ThingGroupName", # thing_group_arn: "ThingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # override_dynamic_groups: false, # }) # # @overload add_thing_to_thing_group(params = {}) # @param [Hash] params ({}) def add_thing_to_thing_group(params = {}, options = {}) req = build_request(:add_thing_to_thing_group, params) req.send_request(options) end # Associates a group with a continuous job. The following criteria must # be met: # # * The job must have been created with the `targetSelection` field set # to "CONTINUOUS". # # * The job status must currently be "IN\_PROGRESS". # # * The total number of targets associated with a job must not exceed # 100. # # @option params [required, Array<String>] :targets # A list of thing group ARNs that define the targets of the job. # # @option params [required, String] :job_id # The unique identifier you assigned to this job when it was created. # # @option params [String] :comment # An optional comment string describing why the job was associated with # the targets. # # @return [Types::AssociateTargetsWithJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::AssociateTargetsWithJobResponse#job_arn #job_arn} => String # * {Types::AssociateTargetsWithJobResponse#job_id #job_id} => String # * {Types::AssociateTargetsWithJobResponse#description #description} => String # # @example Request syntax with placeholder values # # resp = client.associate_targets_with_job({ # targets: ["TargetArn"], # required # job_id: "JobId", # required # comment: "Comment", # }) # # @example Response structure # # resp.job_arn #=> String # resp.job_id #=> String # resp.description #=> String # # @overload associate_targets_with_job(params = {}) # @param [Hash] params ({}) def associate_targets_with_job(params = {}, options = {}) req = build_request(:associate_targets_with_job, params) req.send_request(options) end # Attaches a policy to the specified target. # # @option params [required, String] :policy_name # The name of the policy to attach. # # @option params [required, String] :target # The [identity][1] to which the policy is attached. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/security-iam.html # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.attach_policy({ # policy_name: "PolicyName", # required # target: "PolicyTarget", # required # }) # # @overload attach_policy(params = {}) # @param [Hash] params ({}) def attach_policy(params = {}, options = {}) req = build_request(:attach_policy, params) req.send_request(options) end # Attaches the specified policy to the specified principal (certificate # or other credential). # # **Note:** This API is deprecated. Please use AttachPolicy instead. # # @option params [required, String] :policy_name # The policy name. # # @option params [required, String] :principal # The principal, which can be a certificate ARN (as returned from the # CreateCertificate operation) or an Amazon Cognito ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.attach_principal_policy({ # policy_name: "PolicyName", # required # principal: "Principal", # required # }) # # @overload attach_principal_policy(params = {}) # @param [Hash] params ({}) def attach_principal_policy(params = {}, options = {}) req = build_request(:attach_principal_policy, params) req.send_request(options) end # Associates a Device Defender security profile with a thing group or # this account. Each thing group or account can have up to five security # profiles associated with it. # # @option params [required, String] :security_profile_name # The security profile that is attached. # # @option params [required, String] :security_profile_target_arn # The ARN of the target (thing group) to which the security profile is # attached. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.attach_security_profile({ # security_profile_name: "SecurityProfileName", # required # security_profile_target_arn: "SecurityProfileTargetArn", # required # }) # # @overload attach_security_profile(params = {}) # @param [Hash] params ({}) def attach_security_profile(params = {}, options = {}) req = build_request(:attach_security_profile, params) req.send_request(options) end # Attaches the specified principal to the specified thing. A principal # can be X.509 certificates, IAM users, groups, and roles, Amazon # Cognito identities or federated identities. # # @option params [required, String] :thing_name # The name of the thing. # # @option params [required, String] :principal # The principal, which can be a certificate ARN (as returned from the # CreateCertificate operation) or an Amazon Cognito ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.attach_thing_principal({ # thing_name: "ThingName", # required # principal: "Principal", # required # }) # # @overload attach_thing_principal(params = {}) # @param [Hash] params ({}) def attach_thing_principal(params = {}, options = {}) req = build_request(:attach_thing_principal, params) req.send_request(options) end # Cancels a mitigation action task that is in progress. If the task is # not in progress, an InvalidRequestException occurs. # # @option params [required, String] :task_id # The unique identifier for the task that you want to cancel. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.cancel_audit_mitigation_actions_task({ # task_id: "AuditMitigationActionsTaskId", # required # }) # # @overload cancel_audit_mitigation_actions_task(params = {}) # @param [Hash] params ({}) def cancel_audit_mitigation_actions_task(params = {}, options = {}) req = build_request(:cancel_audit_mitigation_actions_task, params) req.send_request(options) end # Cancels an audit that is in progress. The audit can be either # scheduled or on-demand. If the audit is not in progress, an # "InvalidRequestException" occurs. # # @option params [required, String] :task_id # The ID of the audit you want to cancel. You can only cancel an audit # that is "IN\_PROGRESS". # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.cancel_audit_task({ # task_id: "AuditTaskId", # required # }) # # @overload cancel_audit_task(params = {}) # @param [Hash] params ({}) def cancel_audit_task(params = {}, options = {}) req = build_request(:cancel_audit_task, params) req.send_request(options) end # Cancels a pending transfer for the specified certificate. # # **Note** Only the transfer source account can use this operation to # cancel a transfer. (Transfer destinations can use # RejectCertificateTransfer instead.) After transfer, AWS IoT returns # the certificate to the source account in the INACTIVE state. After the # destination account has accepted the transfer, the transfer cannot be # cancelled. # # After a certificate transfer is cancelled, the status of the # certificate changes from PENDING\_TRANSFER to INACTIVE. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.cancel_certificate_transfer({ # certificate_id: "CertificateId", # required # }) # # @overload cancel_certificate_transfer(params = {}) # @param [Hash] params ({}) def cancel_certificate_transfer(params = {}, options = {}) req = build_request(:cancel_certificate_transfer, params) req.send_request(options) end # Cancels a job. # # @option params [required, String] :job_id # The unique identifier you assigned to this job when it was created. # # @option params [String] :reason_code # (Optional)A reason code string that explains why the job was canceled. # # @option params [String] :comment # An optional comment string describing why the job was canceled. # # @option params [Boolean] :force # (Optional) If `true` job executions with status "IN\_PROGRESS" and # "QUEUED" are canceled, otherwise only job executions with status # "QUEUED" are canceled. The default is `false`. # # Canceling a job which is "IN\_PROGRESS", will cause a device which # is executing the job to be unable to update the job execution status. # Use caution and ensure that each device executing a job which is # canceled is able to recover to a valid state. # # @return [Types::CancelJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CancelJobResponse#job_arn #job_arn} => String # * {Types::CancelJobResponse#job_id #job_id} => String # * {Types::CancelJobResponse#description #description} => String # # @example Request syntax with placeholder values # # resp = client.cancel_job({ # job_id: "JobId", # required # reason_code: "ReasonCode", # comment: "Comment", # force: false, # }) # # @example Response structure # # resp.job_arn #=> String # resp.job_id #=> String # resp.description #=> String # # @overload cancel_job(params = {}) # @param [Hash] params ({}) def cancel_job(params = {}, options = {}) req = build_request(:cancel_job, params) req.send_request(options) end # Cancels the execution of a job for a given thing. # # @option params [required, String] :job_id # The ID of the job to be canceled. # # @option params [required, String] :thing_name # The name of the thing whose execution of the job will be canceled. # # @option params [Boolean] :force # (Optional) If `true` the job execution will be canceled if it has # status IN\_PROGRESS or QUEUED, otherwise the job execution will be # canceled only if it has status QUEUED. If you attempt to cancel a job # execution that is IN\_PROGRESS, and you do not set `force` to `true`, # then an `InvalidStateTransitionException` will be thrown. The default # is `false`. # # Canceling a job execution which is "IN\_PROGRESS", will cause the # device to be unable to update the job execution status. Use caution # and ensure that the device is able to recover to a valid state. # # @option params [Integer] :expected_version # (Optional) The expected current version of the job execution. Each # time you update the job execution, its version is incremented. If the # version of the job execution stored in Jobs does not match, the update # is rejected with a VersionMismatch error, and an ErrorResponse that # contains the current job execution status data is returned. (This # makes it unnecessary to perform a separate DescribeJobExecution # request in order to obtain the job execution status data.) # # @option params [Hash<String,String>] :status_details # A collection of name/value pairs that describe the status of the job # execution. If not specified, the statusDetails are unchanged. You can # specify at most 10 name/value pairs. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.cancel_job_execution({ # job_id: "JobId", # required # thing_name: "ThingName", # required # force: false, # expected_version: 1, # status_details: { # "DetailsKey" => "DetailsValue", # }, # }) # # @overload cancel_job_execution(params = {}) # @param [Hash] params ({}) def cancel_job_execution(params = {}, options = {}) req = build_request(:cancel_job_execution, params) req.send_request(options) end # Clears the default authorizer. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @overload clear_default_authorizer(params = {}) # @param [Hash] params ({}) def clear_default_authorizer(params = {}, options = {}) req = build_request(:clear_default_authorizer, params) req.send_request(options) end # Confirms a topic rule destination. When you create a rule requiring a # destination, AWS IoT sends a confirmation message to the endpoint or # base address you specify. The message includes a token which you pass # back when calling `ConfirmTopicRuleDestination` to confirm that you # own or have access to the endpoint. # # @option params [required, String] :confirmation_token # The token used to confirm ownership or access to the topic rule # confirmation URL. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.confirm_topic_rule_destination({ # confirmation_token: "ConfirmationToken", # required # }) # # @overload confirm_topic_rule_destination(params = {}) # @param [Hash] params ({}) def confirm_topic_rule_destination(params = {}, options = {}) req = build_request(:confirm_topic_rule_destination, params) req.send_request(options) end # Creates an authorizer. # # @option params [required, String] :authorizer_name # The authorizer name. # # @option params [required, String] :authorizer_function_arn # The ARN of the authorizer's Lambda function. # # @option params [String] :token_key_name # The name of the token key used to extract the token from the HTTP # headers. # # @option params [Hash<String,String>] :token_signing_public_keys # The public keys used to verify the digital signature returned by your # custom authentication service. # # @option params [String] :status # The status of the create authorizer request. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the custom authorizer. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: &amp;&amp;tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @option params [Boolean] :signing_disabled # Specifies whether AWS IoT validates the token signature in an # authorization request. # # @return [Types::CreateAuthorizerResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateAuthorizerResponse#authorizer_name #authorizer_name} => String # * {Types::CreateAuthorizerResponse#authorizer_arn #authorizer_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_authorizer({ # authorizer_name: "AuthorizerName", # required # authorizer_function_arn: "AuthorizerFunctionArn", # required # token_key_name: "TokenKeyName", # token_signing_public_keys: { # "KeyName" => "KeyValue", # }, # status: "ACTIVE", # accepts ACTIVE, INACTIVE # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # signing_disabled: false, # }) # # @example Response structure # # resp.authorizer_name #=> String # resp.authorizer_arn #=> String # # @overload create_authorizer(params = {}) # @param [Hash] params ({}) def create_authorizer(params = {}, options = {}) req = build_request(:create_authorizer, params) req.send_request(options) end # Creates a billing group. # # @option params [required, String] :billing_group_name # The name you wish to give to the billing group. # # @option params [Types::BillingGroupProperties] :billing_group_properties # The properties of the billing group. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the billing group. # # @return [Types::CreateBillingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateBillingGroupResponse#billing_group_name #billing_group_name} => String # * {Types::CreateBillingGroupResponse#billing_group_arn #billing_group_arn} => String # * {Types::CreateBillingGroupResponse#billing_group_id #billing_group_id} => String # # @example Request syntax with placeholder values # # resp = client.create_billing_group({ # billing_group_name: "BillingGroupName", # required # billing_group_properties: { # billing_group_description: "BillingGroupDescription", # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.billing_group_name #=> String # resp.billing_group_arn #=> String # resp.billing_group_id #=> String # # @overload create_billing_group(params = {}) # @param [Hash] params ({}) def create_billing_group(params = {}, options = {}) req = build_request(:create_billing_group, params) req.send_request(options) end # Creates an X.509 certificate using the specified certificate signing # request. # # **Note:** The CSR must include a public key that is either an RSA key # with a length of at least 2048 bits or an ECC key from NIST P-256 or # NIST P-384 curves. # # **Note:** Reusing the same certificate signing request (CSR) results # in a distinct certificate. # # You can create multiple certificates in a batch by creating a # directory, copying multiple .csr files into that directory, and then # specifying that directory on the command line. The following commands # show how to create a batch of certificates given a batch of CSRs. # # Assuming a set of CSRs are located inside of the directory # my-csr-directory: # # On Linux and OS X, the command is: # # $ ls my-csr-directory/ \| xargs -I \\\{\\} aws iot # create-certificate-from-csr --certificate-signing-request # file://my-csr-directory/\\\{\\} # # This command lists all of the CSRs in my-csr-directory and pipes each # CSR file name to the aws iot create-certificate-from-csr AWS CLI # command to create a certificate for the corresponding CSR. # # The aws iot create-certificate-from-csr part of the command can also # be run in parallel to speed up the certificate creation process: # # $ ls my-csr-directory/ \| xargs -P 10 -I \\\{\\} aws iot # create-certificate-from-csr --certificate-signing-request # file://my-csr-directory/\\\{\\} # # On Windows PowerShell, the command to create certificates for all CSRs # in my-csr-directory is: # # &gt; ls -Name my-csr-directory \| %\\\{aws iot # create-certificate-from-csr --certificate-signing-request # file://my-csr-directory/$\_\\} # # On a Windows command prompt, the command to create certificates for # all CSRs in my-csr-directory is: # # &gt; forfiles /p my-csr-directory /c "cmd /c aws iot # create-certificate-from-csr --certificate-signing-request # file://@path" # # @option params [required, String] :certificate_signing_request # The certificate signing request (CSR). # # @option params [Boolean] :set_as_active # Specifies whether the certificate is active. # # @return [Types::CreateCertificateFromCsrResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateCertificateFromCsrResponse#certificate_arn #certificate_arn} => String # * {Types::CreateCertificateFromCsrResponse#certificate_id #certificate_id} => String # * {Types::CreateCertificateFromCsrResponse#certificate_pem #certificate_pem} => String # # @example Request syntax with placeholder values # # resp = client.create_certificate_from_csr({ # certificate_signing_request: "CertificateSigningRequest", # required # set_as_active: false, # }) # # @example Response structure # # resp.certificate_arn #=> String # resp.certificate_id #=> String # resp.certificate_pem #=> String # # @overload create_certificate_from_csr(params = {}) # @param [Hash] params ({}) def create_certificate_from_csr(params = {}, options = {}) req = build_request(:create_certificate_from_csr, params) req.send_request(options) end # Create a dimension that you can use to limit the scope of a metric # used in a security profile for AWS IoT Device Defender. For example, # using a `TOPIC_FILTER` dimension, you can narrow down the scope of the # metric only to MQTT topics whose name match the pattern specified in # the dimension. # # @option params [required, String] :name # A unique identifier for the dimension. Choose something that describes # the type and value to make it easy to remember what it does. # # @option params [required, String] :type # Specifies the type of dimension. Supported types: `TOPIC_FILTER.` # # @option params [required, Array<String>] :string_values # Specifies the value or list of values for the dimension. For # `TOPIC_FILTER` dimensions, this is a pattern used to match the MQTT # topic (for example, "admin/#"). # # @option params [Array<Types::Tag>] :tags # Metadata that can be used to manage the dimension. # # @option params [required, String] :client_request_token # Each dimension must have a unique client request token. If you try to # create a new dimension with the same token as a dimension that already # exists, an exception occurs. If you omit this value, AWS SDKs will # automatically generate a unique client request. # # **A suitable default value is auto-generated.** You should normally # not need to pass this option.** # # @return [Types::CreateDimensionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateDimensionResponse#name #name} => String # * {Types::CreateDimensionResponse#arn #arn} => String # # @example Request syntax with placeholder values # # resp = client.create_dimension({ # name: "DimensionName", # required # type: "TOPIC_FILTER", # required, accepts TOPIC_FILTER # string_values: ["DimensionStringValue"], # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # client_request_token: "ClientRequestToken", # required # }) # # @example Response structure # # resp.name #=> String # resp.arn #=> String # # @overload create_dimension(params = {}) # @param [Hash] params ({}) def create_dimension(params = {}, options = {}) req = build_request(:create_dimension, params) req.send_request(options) end # Creates a domain configuration. # # <note markdown="1"> The domain configuration feature is in public preview and is subject # to change. # # </note> # # @option params [required, String] :domain_configuration_name # The name of the domain configuration. This value must be unique to a # region. # # @option params [String] :domain_name # The name of the domain. # # @option params [Array<String>] :server_certificate_arns # The ARNs of the certificates that AWS IoT passes to the device during # the TLS handshake. Currently you can specify only one certificate ARN. # This value is not required for AWS-managed domains. # # @option params [String] :validation_certificate_arn # The certificate used to validate the server certificate and prove # domain name ownership. This certificate must be signed by a public # certificate authority. This value is not required for AWS-managed # domains. # # @option params [Types::AuthorizerConfig] :authorizer_config # An object that specifies the authorization service for a domain. # # @option params [String] :service_type # The type of service delivered by the endpoint. # # <note markdown="1"> AWS IoT Core currently supports only the `DATA` service type. # # </note> # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the domain configuration. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: &amp;&amp;tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @return [Types::CreateDomainConfigurationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateDomainConfigurationResponse#domain_configuration_name #domain_configuration_name} => String # * {Types::CreateDomainConfigurationResponse#domain_configuration_arn #domain_configuration_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_domain_configuration({ # domain_configuration_name: "DomainConfigurationName", # required # domain_name: "DomainName", # server_certificate_arns: ["AcmCertificateArn"], # validation_certificate_arn: "AcmCertificateArn", # authorizer_config: { # default_authorizer_name: "AuthorizerName", # allow_authorizer_override: false, # }, # service_type: "DATA", # accepts DATA, CREDENTIAL_PROVIDER, JOBS # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.domain_configuration_name #=> String # resp.domain_configuration_arn #=> String # # @overload create_domain_configuration(params = {}) # @param [Hash] params ({}) def create_domain_configuration(params = {}, options = {}) req = build_request(:create_domain_configuration, params) req.send_request(options) end # Creates a dynamic thing group. # # @option params [required, String] :thing_group_name # The dynamic thing group name to create. # # @option params [Types::ThingGroupProperties] :thing_group_properties # The dynamic thing group properties. # # @option params [String] :index_name # The dynamic thing group index name. # # <note markdown="1"> Currently one index is supported: "AWS\_Things". # # </note> # # @option params [required, String] :query_string # The dynamic thing group search query string. # # See [Query Syntax][1] for information about query string syntax. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/query-syntax.html # # @option params [String] :query_version # The dynamic thing group query version. # # <note markdown="1"> Currently one query version is supported: "2017-09-30". If not # specified, the query version defaults to this value. # # </note> # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the dynamic thing group. # # @return [Types::CreateDynamicThingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateDynamicThingGroupResponse#thing_group_name #thing_group_name} => String # * {Types::CreateDynamicThingGroupResponse#thing_group_arn #thing_group_arn} => String # * {Types::CreateDynamicThingGroupResponse#thing_group_id #thing_group_id} => String # * {Types::CreateDynamicThingGroupResponse#index_name #index_name} => String # * {Types::CreateDynamicThingGroupResponse#query_string #query_string} => String # * {Types::CreateDynamicThingGroupResponse#query_version #query_version} => String # # @example Request syntax with placeholder values # # resp = client.create_dynamic_thing_group({ # thing_group_name: "ThingGroupName", # required # thing_group_properties: { # thing_group_description: "ThingGroupDescription", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # }, # index_name: "IndexName", # query_string: "QueryString", # required # query_version: "QueryVersion", # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.thing_group_name #=> String # resp.thing_group_arn #=> String # resp.thing_group_id #=> String # resp.index_name #=> String # resp.query_string #=> String # resp.query_version #=> String # # @overload create_dynamic_thing_group(params = {}) # @param [Hash] params ({}) def create_dynamic_thing_group(params = {}, options = {}) req = build_request(:create_dynamic_thing_group, params) req.send_request(options) end # Creates a job. # # @option params [required, String] :job_id # A job identifier which must be unique for your AWS account. We # recommend using a UUID. Alpha-numeric characters, "-" and "\_" are # valid for use here. # # @option params [required, Array<String>] :targets # A list of things and thing groups to which the job should be sent. # # @option params [String] :document_source # An S3 link to the job document. # # @option params [String] :document # The job document. # # <note markdown="1"> If the job document resides in an S3 bucket, you must use a # placeholder link when specifying the document. # # The placeholder link is of the following form: # # `$\{aws:iot:s3-presigned-url:https://s3.amazonaws.com/bucket/key\}` # # where *bucket* is your bucket name and *key* is the object in the # bucket to which you are linking. # # </note> # # @option params [String] :description # A short text description of the job. # # @option params [Types::PresignedUrlConfig] :presigned_url_config # Configuration information for pre-signed S3 URLs. # # @option params [String] :target_selection # Specifies whether the job will continue to run (CONTINUOUS), or will # be complete after all those things specified as targets have completed # the job (SNAPSHOT). If continuous, the job may also be run on a thing # when a change is detected in a target. For example, a job will run on # a thing when the thing is added to a target group, even after the job # was completed by all things originally in the group. # # @option params [Types::JobExecutionsRolloutConfig] :job_executions_rollout_config # Allows you to create a staged rollout of the job. # # @option params [Types::AbortConfig] :abort_config # Allows you to create criteria to abort a job. # # @option params [Types::TimeoutConfig] :timeout_config # Specifies the amount of time each device has to finish its execution # of the job. The timer is started when the job execution status is set # to `IN_PROGRESS`. If the job execution status is not set to another # terminal state before the time expires, it will be automatically set # to `TIMED_OUT`. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the job. # # @return [Types::CreateJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateJobResponse#job_arn #job_arn} => String # * {Types::CreateJobResponse#job_id #job_id} => String # * {Types::CreateJobResponse#description #description} => String # # @example Request syntax with placeholder values # # resp = client.create_job({ # job_id: "JobId", # required # targets: ["TargetArn"], # required # document_source: "JobDocumentSource", # document: "JobDocument", # description: "JobDescription", # presigned_url_config: { # role_arn: "RoleArn", # expires_in_sec: 1, # }, # target_selection: "CONTINUOUS", # accepts CONTINUOUS, SNAPSHOT # job_executions_rollout_config: { # maximum_per_minute: 1, # exponential_rate: { # base_rate_per_minute: 1, # required # increment_factor: 1.0, # required # rate_increase_criteria: { # required # number_of_notified_things: 1, # number_of_succeeded_things: 1, # }, # }, # }, # abort_config: { # criteria_list: [ # required # { # failure_type: "FAILED", # required, accepts FAILED, REJECTED, TIMED_OUT, ALL # action: "CANCEL", # required, accepts CANCEL # threshold_percentage: 1.0, # required # min_number_of_executed_things: 1, # required # }, # ], # }, # timeout_config: { # in_progress_timeout_in_minutes: 1, # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.job_arn #=> String # resp.job_id #=> String # resp.description #=> String # # @overload create_job(params = {}) # @param [Hash] params ({}) def create_job(params = {}, options = {}) req = build_request(:create_job, params) req.send_request(options) end # Creates a 2048-bit RSA key pair and issues an X.509 certificate using # the issued public key. You can also call `CreateKeysAndCertificate` # over MQTT from a device, for more information, see [Provisioning MQTT # API][1]. # # **Note** This is the only time AWS IoT issues the private key for this # certificate, so it is important to keep it in a secure location. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#provision-mqtt-api # # @option params [Boolean] :set_as_active # Specifies whether the certificate is active. # # @return [Types::CreateKeysAndCertificateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateKeysAndCertificateResponse#certificate_arn #certificate_arn} => String # * {Types::CreateKeysAndCertificateResponse#certificate_id #certificate_id} => String # * {Types::CreateKeysAndCertificateResponse#certificate_pem #certificate_pem} => String # * {Types::CreateKeysAndCertificateResponse#key_pair #key_pair} => Types::KeyPair # # @example Request syntax with placeholder values # # resp = client.create_keys_and_certificate({ # set_as_active: false, # }) # # @example Response structure # # resp.certificate_arn #=> String # resp.certificate_id #=> String # resp.certificate_pem #=> String # resp.key_pair.public_key #=> String # resp.key_pair.private_key #=> String # # @overload create_keys_and_certificate(params = {}) # @param [Hash] params ({}) def create_keys_and_certificate(params = {}, options = {}) req = build_request(:create_keys_and_certificate, params) req.send_request(options) end # Defines an action that can be applied to audit findings by using # StartAuditMitigationActionsTask. Each mitigation action can apply only # one type of change. # # @option params [required, String] :action_name # A friendly name for the action. Choose a friendly name that accurately # describes the action (for example, `EnableLoggingAction`). # # @option params [required, String] :role_arn # The ARN of the IAM role that is used to apply the mitigation action. # # @option params [required, Types::MitigationActionParams] :action_params # Defines the type of action and the parameters for that action. # # @option params [Array<Types::Tag>] :tags # Metadata that can be used to manage the mitigation action. # # @return [Types::CreateMitigationActionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateMitigationActionResponse#action_arn #action_arn} => String # * {Types::CreateMitigationActionResponse#action_id #action_id} => String # # @example Request syntax with placeholder values # # resp = client.create_mitigation_action({ # action_name: "MitigationActionName", # required # role_arn: "RoleArn", # required # action_params: { # required # update_device_certificate_params: { # action: "DEACTIVATE", # required, accepts DEACTIVATE # }, # update_ca_certificate_params: { # action: "DEACTIVATE", # required, accepts DEACTIVATE # }, # add_things_to_thing_group_params: { # thing_group_names: ["ThingGroupName"], # required # override_dynamic_groups: false, # }, # replace_default_policy_version_params: { # template_name: "BLANK_POLICY", # required, accepts BLANK_POLICY # }, # enable_io_t_logging_params: { # role_arn_for_logging: "RoleArn", # required # log_level: "DEBUG", # required, accepts DEBUG, INFO, ERROR, WARN, DISABLED # }, # publish_finding_to_sns_params: { # topic_arn: "SnsTopicArn", # required # }, # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.action_arn #=> String # resp.action_id #=> String # # @overload create_mitigation_action(params = {}) # @param [Hash] params ({}) def create_mitigation_action(params = {}, options = {}) req = build_request(:create_mitigation_action, params) req.send_request(options) end # Creates an AWS IoT OTAUpdate on a target group of things or groups. # # @option params [required, String] :ota_update_id # The ID of the OTA update to be created. # # @option params [String] :description # The description of the OTA update. # # @option params [required, Array<String>] :targets # The devices targeted to receive OTA updates. # # @option params [Array<String>] :protocols # The protocol used to transfer the OTA update image. Valid values are # \[HTTP\], \[MQTT\], \[HTTP, MQTT\]. When both HTTP and MQTT are # specified, the target device can choose the protocol. # # @option params [String] :target_selection # Specifies whether the update will continue to run (CONTINUOUS), or # will be complete after all the things specified as targets have # completed the update (SNAPSHOT). If continuous, the update may also be # run on a thing when a change is detected in a target. For example, an # update will run on a thing when the thing is added to a target group, # even after the update was completed by all things originally in the # group. Valid values: CONTINUOUS \| SNAPSHOT. # # @option params [Types::AwsJobExecutionsRolloutConfig] :aws_job_executions_rollout_config # Configuration for the rollout of OTA updates. # # @option params [Types::AwsJobPresignedUrlConfig] :aws_job_presigned_url_config # Configuration information for pre-signed URLs. # # @option params [Types::AwsJobAbortConfig] :aws_job_abort_config # The criteria that determine when and how a job abort takes place. # # @option params [Types::AwsJobTimeoutConfig] :aws_job_timeout_config # Specifies the amount of time each device has to finish its execution # of the job. A timer is started when the job execution status is set to # `IN_PROGRESS`. If the job execution status is not set to another # terminal state before the timer expires, it will be automatically set # to `TIMED_OUT`. # # @option params [required, Array<Types::OTAUpdateFile>] :files # The files to be streamed by the OTA update. # # @option params [required, String] :role_arn # The IAM role that grants AWS IoT access to the Amazon S3, AWS IoT jobs # and AWS Code Signing resources to create an OTA update job. # # @option params [Hash<String,String>] :additional_parameters # A list of additional OTA update parameters which are name-value pairs. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage updates. # # @return [Types::CreateOTAUpdateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateOTAUpdateResponse#ota_update_id #ota_update_id} => String # * {Types::CreateOTAUpdateResponse#aws_iot_job_id #aws_iot_job_id} => String # * {Types::CreateOTAUpdateResponse#ota_update_arn #ota_update_arn} => String # * {Types::CreateOTAUpdateResponse#aws_iot_job_arn #aws_iot_job_arn} => String # * {Types::CreateOTAUpdateResponse#ota_update_status #ota_update_status} => String # # @example Request syntax with placeholder values # # resp = client.create_ota_update({ # ota_update_id: "OTAUpdateId", # required # description: "OTAUpdateDescription", # targets: ["Target"], # required # protocols: ["MQTT"], # accepts MQTT, HTTP # target_selection: "CONTINUOUS", # accepts CONTINUOUS, SNAPSHOT # aws_job_executions_rollout_config: { # maximum_per_minute: 1, # exponential_rate: { # base_rate_per_minute: 1, # required # increment_factor: 1.0, # required # rate_increase_criteria: { # required # number_of_notified_things: 1, # number_of_succeeded_things: 1, # }, # }, # }, # aws_job_presigned_url_config: { # expires_in_sec: 1, # }, # aws_job_abort_config: { # abort_criteria_list: [ # required # { # failure_type: "FAILED", # required, accepts FAILED, REJECTED, TIMED_OUT, ALL # action: "CANCEL", # required, accepts CANCEL # threshold_percentage: 1.0, # required # min_number_of_executed_things: 1, # required # }, # ], # }, # aws_job_timeout_config: { # in_progress_timeout_in_minutes: 1, # }, # files: [ # required # { # file_name: "FileName", # file_version: "OTAUpdateFileVersion", # file_location: { # stream: { # stream_id: "StreamId", # file_id: 1, # }, # s3_location: { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # }, # }, # code_signing: { # aws_signer_job_id: "SigningJobId", # start_signing_job_parameter: { # signing_profile_parameter: { # certificate_arn: "CertificateArn", # platform: "Platform", # certificate_path_on_device: "CertificatePathOnDevice", # }, # signing_profile_name: "SigningProfileName", # destination: { # s3_destination: { # bucket: "S3Bucket", # prefix: "Prefix", # }, # }, # }, # custom_code_signing: { # signature: { # inline_document: "data", # }, # certificate_chain: { # certificate_name: "CertificateName", # inline_document: "InlineDocument", # }, # hash_algorithm: "HashAlgorithm", # signature_algorithm: "SignatureAlgorithm", # }, # }, # attributes: { # "AttributeKey" => "Value", # }, # }, # ], # role_arn: "RoleArn", # required # additional_parameters: { # "AttributeKey" => "Value", # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.ota_update_id #=> String # resp.aws_iot_job_id #=> String # resp.ota_update_arn #=> String # resp.aws_iot_job_arn #=> String # resp.ota_update_status #=> String, one of "CREATE_PENDING", "CREATE_IN_PROGRESS", "CREATE_COMPLETE", "CREATE_FAILED" # # @overload create_ota_update(params = {}) # @param [Hash] params ({}) def create_ota_update(params = {}, options = {}) req = build_request(:create_ota_update, params) req.send_request(options) end # Creates an AWS IoT policy. # # The created policy is the default version for the policy. This # operation creates a policy version with a version identifier of **1** # and sets **1** as the policy's default version. # # @option params [required, String] :policy_name # The policy name. # # @option params [required, String] :policy_document # The JSON document that describes the policy. **policyDocument** must # have a minimum length of 1, with a maximum length of 2048, excluding # whitespace. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the policy. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: &amp;&amp;tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @return [Types::CreatePolicyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreatePolicyResponse#policy_name #policy_name} => String # * {Types::CreatePolicyResponse#policy_arn #policy_arn} => String # * {Types::CreatePolicyResponse#policy_document #policy_document} => String # * {Types::CreatePolicyResponse#policy_version_id #policy_version_id} => String # # @example Request syntax with placeholder values # # resp = client.create_policy({ # policy_name: "PolicyName", # required # policy_document: "PolicyDocument", # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.policy_name #=> String # resp.policy_arn #=> String # resp.policy_document #=> String # resp.policy_version_id #=> String # # @overload create_policy(params = {}) # @param [Hash] params ({}) def create_policy(params = {}, options = {}) req = build_request(:create_policy, params) req.send_request(options) end # Creates a new version of the specified AWS IoT policy. To update a # policy, create a new policy version. A managed policy can have up to # five versions. If the policy has five versions, you must use # DeletePolicyVersion to delete an existing version before you create a # new one. # # Optionally, you can set the new version as the policy's default # version. The default version is the operative version (that is, the # version that is in effect for the certificates to which the policy is # attached). # # @option params [required, String] :policy_name # The policy name. # # @option params [required, String] :policy_document # The JSON document that describes the policy. Minimum length of 1. # Maximum length of 2048, excluding whitespace. # # @option params [Boolean] :set_as_default # Specifies whether the policy version is set as the default. When this # parameter is true, the new policy version becomes the operative # version (that is, the version that is in effect for the certificates # to which the policy is attached). # # @return [Types::CreatePolicyVersionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreatePolicyVersionResponse#policy_arn #policy_arn} => String # * {Types::CreatePolicyVersionResponse#policy_document #policy_document} => String # * {Types::CreatePolicyVersionResponse#policy_version_id #policy_version_id} => String # * {Types::CreatePolicyVersionResponse#is_default_version #is_default_version} => Boolean # # @example Request syntax with placeholder values # # resp = client.create_policy_version({ # policy_name: "PolicyName", # required # policy_document: "PolicyDocument", # required # set_as_default: false, # }) # # @example Response structure # # resp.policy_arn #=> String # resp.policy_document #=> String # resp.policy_version_id #=> String # resp.is_default_version #=> Boolean # # @overload create_policy_version(params = {}) # @param [Hash] params ({}) def create_policy_version(params = {}, options = {}) req = build_request(:create_policy_version, params) req.send_request(options) end # Creates a provisioning claim. # # @option params [required, String] :template_name # The name of the provisioning template to use. # # @return [Types::CreateProvisioningClaimResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateProvisioningClaimResponse#certificate_id #certificate_id} => String # * {Types::CreateProvisioningClaimResponse#certificate_pem #certificate_pem} => String # * {Types::CreateProvisioningClaimResponse#key_pair #key_pair} => Types::KeyPair # * {Types::CreateProvisioningClaimResponse#expiration #expiration} => Time # # @example Request syntax with placeholder values # # resp = client.create_provisioning_claim({ # template_name: "TemplateName", # required # }) # # @example Response structure # # resp.certificate_id #=> String # resp.certificate_pem #=> String # resp.key_pair.public_key #=> String # resp.key_pair.private_key #=> String # resp.expiration #=> Time # # @overload create_provisioning_claim(params = {}) # @param [Hash] params ({}) def create_provisioning_claim(params = {}, options = {}) req = build_request(:create_provisioning_claim, params) req.send_request(options) end # Creates a fleet provisioning template. # # @option params [required, String] :template_name # The name of the fleet provisioning template. # # @option params [String] :description # The description of the fleet provisioning template. # # @option params [required, String] :template_body # The JSON formatted contents of the fleet provisioning template. # # @option params [Boolean] :enabled # True to enable the fleet provisioning template, otherwise false. # # @option params [required, String] :provisioning_role_arn # The role ARN for the role associated with the fleet provisioning # template. This IoT role grants permission to provision a device. # # @option params [Types::ProvisioningHook] :pre_provisioning_hook # Creates a pre-provisioning hook template. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the fleet provisioning template. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: &amp;&amp;tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @return [Types::CreateProvisioningTemplateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateProvisioningTemplateResponse#template_arn #template_arn} => String # * {Types::CreateProvisioningTemplateResponse#template_name #template_name} => String # * {Types::CreateProvisioningTemplateResponse#default_version_id #default_version_id} => Integer # # @example Request syntax with placeholder values # # resp = client.create_provisioning_template({ # template_name: "TemplateName", # required # description: "TemplateDescription", # template_body: "TemplateBody", # required # enabled: false, # provisioning_role_arn: "RoleArn", # required # pre_provisioning_hook: { # payload_version: "PayloadVersion", # target_arn: "TargetArn", # required # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.template_arn #=> String # resp.template_name #=> String # resp.default_version_id #=> Integer # # @overload create_provisioning_template(params = {}) # @param [Hash] params ({}) def create_provisioning_template(params = {}, options = {}) req = build_request(:create_provisioning_template, params) req.send_request(options) end # Creates a new version of a fleet provisioning template. # # @option params [required, String] :template_name # The name of the fleet provisioning template. # # @option params [required, String] :template_body # The JSON formatted contents of the fleet provisioning template. # # @option params [Boolean] :set_as_default # Sets a fleet provision template version as the default version. # # @return [Types::CreateProvisioningTemplateVersionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateProvisioningTemplateVersionResponse#template_arn #template_arn} => String # * {Types::CreateProvisioningTemplateVersionResponse#template_name #template_name} => String # * {Types::CreateProvisioningTemplateVersionResponse#version_id #version_id} => Integer # * {Types::CreateProvisioningTemplateVersionResponse#is_default_version #is_default_version} => Boolean # # @example Request syntax with placeholder values # # resp = client.create_provisioning_template_version({ # template_name: "TemplateName", # required # template_body: "TemplateBody", # required # set_as_default: false, # }) # # @example Response structure # # resp.template_arn #=> String # resp.template_name #=> String # resp.version_id #=> Integer # resp.is_default_version #=> Boolean # # @overload create_provisioning_template_version(params = {}) # @param [Hash] params ({}) def create_provisioning_template_version(params = {}, options = {}) req = build_request(:create_provisioning_template_version, params) req.send_request(options) end # Creates a role alias. # # @option params [required, String] :role_alias # The role alias that points to a role ARN. This allows you to change # the role without having to update the device. # # @option params [required, String] :role_arn # The role ARN. # # @option params [Integer] :credential_duration_seconds # How long (in seconds) the credentials will be valid. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the role alias. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: &amp;&amp;tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @return [Types::CreateRoleAliasResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateRoleAliasResponse#role_alias #role_alias} => String # * {Types::CreateRoleAliasResponse#role_alias_arn #role_alias_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_role_alias({ # role_alias: "RoleAlias", # required # role_arn: "RoleArn", # required # credential_duration_seconds: 1, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.role_alias #=> String # resp.role_alias_arn #=> String # # @overload create_role_alias(params = {}) # @param [Hash] params ({}) def create_role_alias(params = {}, options = {}) req = build_request(:create_role_alias, params) req.send_request(options) end # Creates a scheduled audit that is run at a specified time interval. # # @option params [required, String] :frequency # How often the scheduled audit takes place. Can be one of "DAILY", # "WEEKLY", "BIWEEKLY" or "MONTHLY". The start time of each audit # is determined by the system. # # @option params [String] :day_of_month # The day of the month on which the scheduled audit takes place. Can be # "1" through "31" or "LAST". This field is required if the # "frequency" parameter is set to "MONTHLY". If days 29-31 are # specified, and the month does not have that many days, the audit takes # place on the "LAST" day of the month. # # @option params [String] :day_of_week # The day of the week on which the scheduled audit takes place. Can be # one of "SUN", "MON", "TUE", "WED", "THU", "FRI", or # "SAT". This field is required if the "frequency" parameter is set # to "WEEKLY" or "BIWEEKLY". # # @option params [required, Array<String>] :target_check_names # Which checks are performed during the scheduled audit. Checks must be # enabled for your account. (Use `DescribeAccountAuditConfiguration` to # see the list of all checks, including those that are enabled or use # `UpdateAccountAuditConfiguration` to select which checks are enabled.) # # @option params [required, String] :scheduled_audit_name # The name you want to give to the scheduled audit. (Max. 128 chars) # # @option params [Array<Types::Tag>] :tags # Metadata that can be used to manage the scheduled audit. # # @return [Types::CreateScheduledAuditResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateScheduledAuditResponse#scheduled_audit_arn #scheduled_audit_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_scheduled_audit({ # frequency: "DAILY", # required, accepts DAILY, WEEKLY, BIWEEKLY, MONTHLY # day_of_month: "DayOfMonth", # day_of_week: "SUN", # accepts SUN, MON, TUE, WED, THU, FRI, SAT # target_check_names: ["AuditCheckName"], # required # scheduled_audit_name: "ScheduledAuditName", # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.scheduled_audit_arn #=> String # # @overload create_scheduled_audit(params = {}) # @param [Hash] params ({}) def create_scheduled_audit(params = {}, options = {}) req = build_request(:create_scheduled_audit, params) req.send_request(options) end # Creates a Device Defender security profile. # # @option params [required, String] :security_profile_name # The name you are giving to the security profile. # # @option params [String] :security_profile_description # A description of the security profile. # # @option params [Array<Types::Behavior>] :behaviors # Specifies the behaviors that, when violated by a device (thing), cause # an alert. # # @option params [Hash<String,Types::AlertTarget>] :alert_targets # Specifies the destinations to which alerts are sent. (Alerts are # always sent to the console.) Alerts are generated when a device # (thing) violates a behavior. # # @option params [Array<String>] :additional_metrics_to_retain # A list of metrics whose data is retained (stored). By default, data is # retained for any metric used in the profile's `behaviors`, but it is # also retained for any metric specified here. # # **Note:** This API field is deprecated. Please use # CreateSecurityProfileRequest$additionalMetricsToRetainV2 instead. # # @option params [Array<Types::MetricToRetain>] :additional_metrics_to_retain_v2 # A list of metrics whose data is retained (stored). By default, data is # retained for any metric used in the profile's `behaviors`, but it is # also retained for any metric specified here. # # @option params [Array<Types::Tag>] :tags # Metadata that can be used to manage the security profile. # # @return [Types::CreateSecurityProfileResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateSecurityProfileResponse#security_profile_name #security_profile_name} => String # * {Types::CreateSecurityProfileResponse#security_profile_arn #security_profile_arn} => String # # @example Request syntax with placeholder values # # resp = client.create_security_profile({ # security_profile_name: "SecurityProfileName", # required # security_profile_description: "SecurityProfileDescription", # behaviors: [ # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # metric_dimension: { # dimension_name: "DimensionName", # required # operator: "IN", # accepts IN, NOT_IN # }, # criteria: { # comparison_operator: "less-than", # accepts less-than, less-than-equals, greater-than, greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set, not-in-port-set # value: { # count: 1, # cidrs: ["Cidr"], # ports: [1], # }, # duration_seconds: 1, # consecutive_datapoints_to_alarm: 1, # consecutive_datapoints_to_clear: 1, # statistical_threshold: { # statistic: "EvaluationStatistic", # }, # }, # }, # ], # alert_targets: { # "SNS" => { # alert_target_arn: "AlertTargetArn", # required # role_arn: "RoleArn", # required # }, # }, # additional_metrics_to_retain: ["BehaviorMetric"], # additional_metrics_to_retain_v2: [ # { # metric: "BehaviorMetric", # required # metric_dimension: { # dimension_name: "DimensionName", # required # operator: "IN", # accepts IN, NOT_IN # }, # }, # ], # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.security_profile_name #=> String # resp.security_profile_arn #=> String # # @overload create_security_profile(params = {}) # @param [Hash] params ({}) def create_security_profile(params = {}, options = {}) req = build_request(:create_security_profile, params) req.send_request(options) end # Creates a stream for delivering one or more large files in chunks over # MQTT. A stream transports data bytes in chunks or blocks packaged as # MQTT messages from a source like S3. You can have one or more files # associated with a stream. # # @option params [required, String] :stream_id # The stream ID. # # @option params [String] :description # A description of the stream. # # @option params [required, Array<Types::StreamFile>] :files # The files to stream. # # @option params [required, String] :role_arn # An IAM role that allows the IoT service principal assumes to access # your S3 files. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage streams. # # @return [Types::CreateStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateStreamResponse#stream_id #stream_id} => String # * {Types::CreateStreamResponse#stream_arn #stream_arn} => String # * {Types::CreateStreamResponse#description #description} => String # * {Types::CreateStreamResponse#stream_version #stream_version} => Integer # # @example Request syntax with placeholder values # # resp = client.create_stream({ # stream_id: "StreamId", # required # description: "StreamDescription", # files: [ # required # { # file_id: 1, # s3_location: { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # }, # }, # ], # role_arn: "RoleArn", # required # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.stream_id #=> String # resp.stream_arn #=> String # resp.description #=> String # resp.stream_version #=> Integer # # @overload create_stream(params = {}) # @param [Hash] params ({}) def create_stream(params = {}, options = {}) req = build_request(:create_stream, params) req.send_request(options) end # Creates a thing record in the registry. If this call is made multiple # times using the same thing name and configuration, the call will # succeed. If this call is made with the same thing name but different # configuration a `ResourceAlreadyExistsException` is thrown. # # <note markdown="1"> This is a control plane operation. See [Authorization][1] for # information about authorizing control plane actions. # # </note> # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/iot-authorization.html # # @option params [required, String] :thing_name # The name of the thing to create. # # You can't change a thing's name after you create it. To change a # thing's name, you must create a new thing, give it the new name, and # then delete the old thing. # # @option params [String] :thing_type_name # The name of the thing type associated with the new thing. # # @option params [Types::AttributePayload] :attribute_payload # The attribute payload, which consists of up to three name/value pairs # in a JSON document. For example: # # `\{"attributes":\{"string1":"string2"\}\}` # # @option params [String] :billing_group_name # The name of the billing group the thing will be added to. # # @return [Types::CreateThingResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateThingResponse#thing_name #thing_name} => String # * {Types::CreateThingResponse#thing_arn #thing_arn} => String # * {Types::CreateThingResponse#thing_id #thing_id} => String # # @example Request syntax with placeholder values # # resp = client.create_thing({ # thing_name: "ThingName", # required # thing_type_name: "ThingTypeName", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # billing_group_name: "BillingGroupName", # }) # # @example Response structure # # resp.thing_name #=> String # resp.thing_arn #=> String # resp.thing_id #=> String # # @overload create_thing(params = {}) # @param [Hash] params ({}) def create_thing(params = {}, options = {}) req = build_request(:create_thing, params) req.send_request(options) end # Create a thing group. # # <note markdown="1"> This is a control plane operation. See [Authorization][1] for # information about authorizing control plane actions. # # </note> # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/iot-authorization.html # # @option params [required, String] :thing_group_name # The thing group name to create. # # @option params [String] :parent_group_name # The name of the parent thing group. # # @option params [Types::ThingGroupProperties] :thing_group_properties # The thing group properties. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the thing group. # # @return [Types::CreateThingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateThingGroupResponse#thing_group_name #thing_group_name} => String # * {Types::CreateThingGroupResponse#thing_group_arn #thing_group_arn} => String # * {Types::CreateThingGroupResponse#thing_group_id #thing_group_id} => String # # @example Request syntax with placeholder values # # resp = client.create_thing_group({ # thing_group_name: "ThingGroupName", # required # parent_group_name: "ThingGroupName", # thing_group_properties: { # thing_group_description: "ThingGroupDescription", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.thing_group_name #=> String # resp.thing_group_arn #=> String # resp.thing_group_id #=> String # # @overload create_thing_group(params = {}) # @param [Hash] params ({}) def create_thing_group(params = {}, options = {}) req = build_request(:create_thing_group, params) req.send_request(options) end # Creates a new thing type. # # @option params [required, String] :thing_type_name # The name of the thing type. # # @option params [Types::ThingTypeProperties] :thing_type_properties # The ThingTypeProperties for the thing type to create. It contains # information about the new thing type including a description, and a # list of searchable thing attribute names. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the thing type. # # @return [Types::CreateThingTypeResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateThingTypeResponse#thing_type_name #thing_type_name} => String # * {Types::CreateThingTypeResponse#thing_type_arn #thing_type_arn} => String # * {Types::CreateThingTypeResponse#thing_type_id #thing_type_id} => String # # @example Request syntax with placeholder values # # resp = client.create_thing_type({ # thing_type_name: "ThingTypeName", # required # thing_type_properties: { # thing_type_description: "ThingTypeDescription", # searchable_attributes: ["AttributeName"], # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.thing_type_name #=> String # resp.thing_type_arn #=> String # resp.thing_type_id #=> String # # @overload create_thing_type(params = {}) # @param [Hash] params ({}) def create_thing_type(params = {}, options = {}) req = build_request(:create_thing_type, params) req.send_request(options) end # Creates a rule. Creating rules is an administrator-level action. Any # user who has permission to create rules will be able to access data # processed by the rule. # # @option params [required, String] :rule_name # The name of the rule. # # @option params [required, Types::TopicRulePayload] :topic_rule_payload # The rule payload. # # @option params [String] :tags # Metadata which can be used to manage the topic rule. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: --tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.create_topic_rule({ # rule_name: "RuleName", # required # topic_rule_payload: { # required # sql: "SQL", # required # description: "Description", # actions: [ # required # { # dynamo_db: { # table_name: "TableName", # required # role_arn: "AwsArn", # required # operation: "DynamoOperation", # hash_key_field: "HashKeyField", # required # hash_key_value: "HashKeyValue", # required # hash_key_type: "STRING", # accepts STRING, NUMBER # range_key_field: "RangeKeyField", # range_key_value: "RangeKeyValue", # range_key_type: "STRING", # accepts STRING, NUMBER # payload_field: "PayloadField", # }, # dynamo_d_bv_2: { # role_arn: "AwsArn", # required # put_item: { # required # table_name: "TableName", # required # }, # }, # lambda: { # function_arn: "FunctionArn", # required # }, # sns: { # target_arn: "AwsArn", # required # role_arn: "AwsArn", # required # message_format: "RAW", # accepts RAW, JSON # }, # sqs: { # role_arn: "AwsArn", # required # queue_url: "QueueUrl", # required # use_base_64: false, # }, # kinesis: { # role_arn: "AwsArn", # required # stream_name: "StreamName", # required # partition_key: "PartitionKey", # }, # republish: { # role_arn: "AwsArn", # required # topic: "TopicPattern", # required # qos: 1, # }, # s3: { # role_arn: "AwsArn", # required # bucket_name: "BucketName", # required # key: "Key", # required # canned_acl: "private", # accepts private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, bucket-owner-full-control, log-delivery-write # }, # firehose: { # role_arn: "AwsArn", # required # delivery_stream_name: "DeliveryStreamName", # required # separator: "FirehoseSeparator", # }, # cloudwatch_metric: { # role_arn: "AwsArn", # required # metric_namespace: "String", # required # metric_name: "String", # required # metric_value: "String", # required # metric_unit: "String", # required # metric_timestamp: "String", # }, # cloudwatch_alarm: { # role_arn: "AwsArn", # required # alarm_name: "AlarmName", # required # state_reason: "StateReason", # required # state_value: "StateValue", # required # }, # cloudwatch_logs: { # role_arn: "AwsArn", # required # log_group_name: "LogGroupName", # required # }, # elasticsearch: { # role_arn: "AwsArn", # required # endpoint: "ElasticsearchEndpoint", # required # index: "ElasticsearchIndex", # required # type: "ElasticsearchType", # required # id: "ElasticsearchId", # required # }, # salesforce: { # token: "SalesforceToken", # required # url: "SalesforceEndpoint", # required # }, # iot_analytics: { # channel_arn: "AwsArn", # channel_name: "ChannelName", # role_arn: "AwsArn", # }, # iot_events: { # input_name: "InputName", # required # message_id: "MessageId", # role_arn: "AwsArn", # required # }, # iot_site_wise: { # put_asset_property_value_entries: [ # required # { # entry_id: "AssetPropertyEntryId", # asset_id: "AssetId", # property_id: "AssetPropertyId", # property_alias: "AssetPropertyAlias", # property_values: [ # required # { # value: { # required # string_value: "AssetPropertyStringValue", # integer_value: "AssetPropertyIntegerValue", # double_value: "AssetPropertyDoubleValue", # boolean_value: "AssetPropertyBooleanValue", # }, # timestamp: { # required # time_in_seconds: "AssetPropertyTimeInSeconds", # required # offset_in_nanos: "AssetPropertyOffsetInNanos", # }, # quality: "AssetPropertyQuality", # }, # ], # }, # ], # role_arn: "AwsArn", # required # }, # step_functions: { # execution_name_prefix: "ExecutionNamePrefix", # state_machine_name: "StateMachineName", # required # role_arn: "AwsArn", # required # }, # http: { # url: "Url", # required # confirmation_url: "Url", # headers: [ # { # key: "HeaderKey", # required # value: "HeaderValue", # required # }, # ], # auth: { # sigv4: { # signing_region: "SigningRegion", # required # service_name: "ServiceName", # required # role_arn: "AwsArn", # required # }, # }, # }, # }, # ], # rule_disabled: false, # aws_iot_sql_version: "AwsIotSqlVersion", # error_action: { # dynamo_db: { # table_name: "TableName", # required # role_arn: "AwsArn", # required # operation: "DynamoOperation", # hash_key_field: "HashKeyField", # required # hash_key_value: "HashKeyValue", # required # hash_key_type: "STRING", # accepts STRING, NUMBER # range_key_field: "RangeKeyField", # range_key_value: "RangeKeyValue", # range_key_type: "STRING", # accepts STRING, NUMBER # payload_field: "PayloadField", # }, # dynamo_d_bv_2: { # role_arn: "AwsArn", # required # put_item: { # required # table_name: "TableName", # required # }, # }, # lambda: { # function_arn: "FunctionArn", # required # }, # sns: { # target_arn: "AwsArn", # required # role_arn: "AwsArn", # required # message_format: "RAW", # accepts RAW, JSON # }, # sqs: { # role_arn: "AwsArn", # required # queue_url: "QueueUrl", # required # use_base_64: false, # }, # kinesis: { # role_arn: "AwsArn", # required # stream_name: "StreamName", # required # partition_key: "PartitionKey", # }, # republish: { # role_arn: "AwsArn", # required # topic: "TopicPattern", # required # qos: 1, # }, # s3: { # role_arn: "AwsArn", # required # bucket_name: "BucketName", # required # key: "Key", # required # canned_acl: "private", # accepts private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, bucket-owner-full-control, log-delivery-write # }, # firehose: { # role_arn: "AwsArn", # required # delivery_stream_name: "DeliveryStreamName", # required # separator: "FirehoseSeparator", # }, # cloudwatch_metric: { # role_arn: "AwsArn", # required # metric_namespace: "String", # required # metric_name: "String", # required # metric_value: "String", # required # metric_unit: "String", # required # metric_timestamp: "String", # }, # cloudwatch_alarm: { # role_arn: "AwsArn", # required # alarm_name: "AlarmName", # required # state_reason: "StateReason", # required # state_value: "StateValue", # required # }, # cloudwatch_logs: { # role_arn: "AwsArn", # required # log_group_name: "LogGroupName", # required # }, # elasticsearch: { # role_arn: "AwsArn", # required # endpoint: "ElasticsearchEndpoint", # required # index: "ElasticsearchIndex", # required # type: "ElasticsearchType", # required # id: "ElasticsearchId", # required # }, # salesforce: { # token: "SalesforceToken", # required # url: "SalesforceEndpoint", # required # }, # iot_analytics: { # channel_arn: "AwsArn", # channel_name: "ChannelName", # role_arn: "AwsArn", # }, # iot_events: { # input_name: "InputName", # required # message_id: "MessageId", # role_arn: "AwsArn", # required # }, # iot_site_wise: { # put_asset_property_value_entries: [ # required # { # entry_id: "AssetPropertyEntryId", # asset_id: "AssetId", # property_id: "AssetPropertyId", # property_alias: "AssetPropertyAlias", # property_values: [ # required # { # value: { # required # string_value: "AssetPropertyStringValue", # integer_value: "AssetPropertyIntegerValue", # double_value: "AssetPropertyDoubleValue", # boolean_value: "AssetPropertyBooleanValue", # }, # timestamp: { # required # time_in_seconds: "AssetPropertyTimeInSeconds", # required # offset_in_nanos: "AssetPropertyOffsetInNanos", # }, # quality: "AssetPropertyQuality", # }, # ], # }, # ], # role_arn: "AwsArn", # required # }, # step_functions: { # execution_name_prefix: "ExecutionNamePrefix", # state_machine_name: "StateMachineName", # required # role_arn: "AwsArn", # required # }, # http: { # url: "Url", # required # confirmation_url: "Url", # headers: [ # { # key: "HeaderKey", # required # value: "HeaderValue", # required # }, # ], # auth: { # sigv4: { # signing_region: "SigningRegion", # required # service_name: "ServiceName", # required # role_arn: "AwsArn", # required # }, # }, # }, # }, # }, # tags: "String", # }) # # @overload create_topic_rule(params = {}) # @param [Hash] params ({}) def create_topic_rule(params = {}, options = {}) req = build_request(:create_topic_rule, params) req.send_request(options) end # Creates a topic rule destination. The destination must be confirmed # prior to use. # # @option params [required, Types::TopicRuleDestinationConfiguration] :destination_configuration # The topic rule destination configuration. # # @return [Types::CreateTopicRuleDestinationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::CreateTopicRuleDestinationResponse#topic_rule_destination #topic_rule_destination} => Types::TopicRuleDestination # # @example Request syntax with placeholder values # # resp = client.create_topic_rule_destination({ # destination_configuration: { # required # http_url_configuration: { # confirmation_url: "Url", # required # }, # }, # }) # # @example Response structure # # resp.topic_rule_destination.arn #=> String # resp.topic_rule_destination.status #=> String, one of "ENABLED", "IN_PROGRESS", "DISABLED", "ERROR" # resp.topic_rule_destination.status_reason #=> String # resp.topic_rule_destination.http_url_properties.confirmation_url #=> String # # @overload create_topic_rule_destination(params = {}) # @param [Hash] params ({}) def create_topic_rule_destination(params = {}, options = {}) req = build_request(:create_topic_rule_destination, params) req.send_request(options) end # Restores the default settings for Device Defender audits for this # account. Any configuration data you entered is deleted and all audit # checks are reset to disabled. # # @option params [Boolean] :delete_scheduled_audits # If true, all scheduled audits are deleted. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_account_audit_configuration({ # delete_scheduled_audits: false, # }) # # @overload delete_account_audit_configuration(params = {}) # @param [Hash] params ({}) def delete_account_audit_configuration(params = {}, options = {}) req = build_request(:delete_account_audit_configuration, params) req.send_request(options) end # Deletes an authorizer. # # @option params [required, String] :authorizer_name # The name of the authorizer to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_authorizer({ # authorizer_name: "AuthorizerName", # required # }) # # @overload delete_authorizer(params = {}) # @param [Hash] params ({}) def delete_authorizer(params = {}, options = {}) req = build_request(:delete_authorizer, params) req.send_request(options) end # Deletes the billing group. # # @option params [required, String] :billing_group_name # The name of the billing group. # # @option params [Integer] :expected_version # The expected version of the billing group. If the version of the # billing group does not match the expected version specified in the # request, the `DeleteBillingGroup` request is rejected with a # `VersionConflictException`. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_billing_group({ # billing_group_name: "BillingGroupName", # required # expected_version: 1, # }) # # @overload delete_billing_group(params = {}) # @param [Hash] params ({}) def delete_billing_group(params = {}, options = {}) req = build_request(:delete_billing_group, params) req.send_request(options) end # Deletes a registered CA certificate. # # @option params [required, String] :certificate_id # The ID of the certificate to delete. (The last part of the certificate # ARN contains the certificate ID.) # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_ca_certificate({ # certificate_id: "CertificateId", # required # }) # # @overload delete_ca_certificate(params = {}) # @param [Hash] params ({}) def delete_ca_certificate(params = {}, options = {}) req = build_request(:delete_ca_certificate, params) req.send_request(options) end # Deletes the specified certificate. # # A certificate cannot be deleted if it has a policy or IoT thing # attached to it or if its status is set to ACTIVE. To delete a # certificate, first use the DetachPrincipalPolicy API to detach all # policies. Next, use the UpdateCertificate API to set the certificate # to the INACTIVE status. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @option params [Boolean] :force_delete # Forces the deletion of a certificate if it is inactive and is not # attached to an IoT thing. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_certificate({ # certificate_id: "CertificateId", # required # force_delete: false, # }) # # @overload delete_certificate(params = {}) # @param [Hash] params ({}) def delete_certificate(params = {}, options = {}) req = build_request(:delete_certificate, params) req.send_request(options) end # Removes the specified dimension from your AWS account. # # @option params [required, String] :name # The unique identifier for the dimension that you want to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_dimension({ # name: "DimensionName", # required # }) # # @overload delete_dimension(params = {}) # @param [Hash] params ({}) def delete_dimension(params = {}, options = {}) req = build_request(:delete_dimension, params) req.send_request(options) end # Deletes the specified domain configuration. # # <note markdown="1"> The domain configuration feature is in public preview and is subject # to change. # # </note> # # @option params [required, String] :domain_configuration_name # The name of the domain configuration to be deleted. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_domain_configuration({ # domain_configuration_name: "DomainConfigurationName", # required # }) # # @overload delete_domain_configuration(params = {}) # @param [Hash] params ({}) def delete_domain_configuration(params = {}, options = {}) req = build_request(:delete_domain_configuration, params) req.send_request(options) end # Deletes a dynamic thing group. # # @option params [required, String] :thing_group_name # The name of the dynamic thing group to delete. # # @option params [Integer] :expected_version # The expected version of the dynamic thing group to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_dynamic_thing_group({ # thing_group_name: "ThingGroupName", # required # expected_version: 1, # }) # # @overload delete_dynamic_thing_group(params = {}) # @param [Hash] params ({}) def delete_dynamic_thing_group(params = {}, options = {}) req = build_request(:delete_dynamic_thing_group, params) req.send_request(options) end # Deletes a job and its related job executions. # # Deleting a job may take time, depending on the number of job # executions created for the job and various other factors. While the # job is being deleted, the status of the job will be shown as # "DELETION\_IN\_PROGRESS". Attempting to delete or cancel a job whose # status is already "DELETION\_IN\_PROGRESS" will result in an error. # # Only 10 jobs may have status "DELETION\_IN\_PROGRESS" at the same # time, or a LimitExceededException will occur. # # @option params [required, String] :job_id # The ID of the job to be deleted. # # After a job deletion is completed, you may reuse this jobId when you # create a new job. However, this is not recommended, and you must # ensure that your devices are not using the jobId to refer to the # deleted job. # # @option params [Boolean] :force # (Optional) When true, you can delete a job which is "IN\_PROGRESS". # Otherwise, you can only delete a job which is in a terminal state # ("COMPLETED" or "CANCELED") or an exception will occur. The # default is false. # # <note markdown="1"> Deleting a job which is "IN\_PROGRESS", will cause a device which is # executing the job to be unable to access job information or update the # job execution status. Use caution and ensure that each device # executing a job which is deleted is able to recover to a valid state. # # </note> # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_job({ # job_id: "JobId", # required # force: false, # }) # # @overload delete_job(params = {}) # @param [Hash] params ({}) def delete_job(params = {}, options = {}) req = build_request(:delete_job, params) req.send_request(options) end # Deletes a job execution. # # @option params [required, String] :job_id # The ID of the job whose execution on a particular device will be # deleted. # # @option params [required, String] :thing_name # The name of the thing whose job execution will be deleted. # # @option params [required, Integer] :execution_number # The ID of the job execution to be deleted. The `executionNumber` # refers to the execution of a particular job on a particular device. # # Note that once a job execution is deleted, the `executionNumber` may # be reused by IoT, so be sure you get and use the correct value here. # # @option params [Boolean] :force # (Optional) When true, you can delete a job execution which is # "IN\_PROGRESS". Otherwise, you can only delete a job execution which # is in a terminal state ("SUCCEEDED", "FAILED", "REJECTED", # "REMOVED" or "CANCELED") or an exception will occur. The default # is false. # # <note markdown="1"> Deleting a job execution which is "IN\_PROGRESS", will cause the # device to be unable to access job information or update the job # execution status. Use caution and ensure that the device is able to # recover to a valid state. # # </note> # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_job_execution({ # job_id: "JobId", # required # thing_name: "ThingName", # required # execution_number: 1, # required # force: false, # }) # # @overload delete_job_execution(params = {}) # @param [Hash] params ({}) def delete_job_execution(params = {}, options = {}) req = build_request(:delete_job_execution, params) req.send_request(options) end # Deletes a defined mitigation action from your AWS account. # # @option params [required, String] :action_name # The name of the mitigation action that you want to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_mitigation_action({ # action_name: "MitigationActionName", # required # }) # # @overload delete_mitigation_action(params = {}) # @param [Hash] params ({}) def delete_mitigation_action(params = {}, options = {}) req = build_request(:delete_mitigation_action, params) req.send_request(options) end # Delete an OTA update. # # @option params [required, String] :ota_update_id # The ID of the OTA update to delete. # # @option params [Boolean] :delete_stream # Specifies if the stream associated with an OTA update should be # deleted when the OTA update is deleted. # # @option params [Boolean] :force_delete_aws_job # Specifies if the AWS Job associated with the OTA update should be # deleted when the OTA update is deleted. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_ota_update({ # ota_update_id: "OTAUpdateId", # required # delete_stream: false, # force_delete_aws_job: false, # }) # # @overload delete_ota_update(params = {}) # @param [Hash] params ({}) def delete_ota_update(params = {}, options = {}) req = build_request(:delete_ota_update, params) req.send_request(options) end # Deletes the specified policy. # # A policy cannot be deleted if it has non-default versions or it is # attached to any certificate. # # To delete a policy, use the DeletePolicyVersion API to delete all # non-default versions of the policy; use the DetachPrincipalPolicy API # to detach the policy from any certificate; and then use the # DeletePolicy API to delete the policy. # # When a policy is deleted using DeletePolicy, its default version is # deleted with it. # # @option params [required, String] :policy_name # The name of the policy to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_policy({ # policy_name: "PolicyName", # required # }) # # @overload delete_policy(params = {}) # @param [Hash] params ({}) def delete_policy(params = {}, options = {}) req = build_request(:delete_policy, params) req.send_request(options) end # Deletes the specified version of the specified policy. You cannot # delete the default version of a policy using this API. To delete the # default version of a policy, use DeletePolicy. To find out which # version of a policy is marked as the default version, use # ListPolicyVersions. # # @option params [required, String] :policy_name # The name of the policy. # # @option params [required, String] :policy_version_id # The policy version ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_policy_version({ # policy_name: "PolicyName", # required # policy_version_id: "PolicyVersionId", # required # }) # # @overload delete_policy_version(params = {}) # @param [Hash] params ({}) def delete_policy_version(params = {}, options = {}) req = build_request(:delete_policy_version, params) req.send_request(options) end # Deletes a fleet provisioning template. # # @option params [required, String] :template_name # The name of the fleet provision template to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_provisioning_template({ # template_name: "TemplateName", # required # }) # # @overload delete_provisioning_template(params = {}) # @param [Hash] params ({}) def delete_provisioning_template(params = {}, options = {}) req = build_request(:delete_provisioning_template, params) req.send_request(options) end # Deletes a fleet provisioning template version. # # @option params [required, String] :template_name # The name of the fleet provisioning template version to delete. # # @option params [required, Integer] :version_id # The fleet provisioning template version ID to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_provisioning_template_version({ # template_name: "TemplateName", # required # version_id: 1, # required # }) # # @overload delete_provisioning_template_version(params = {}) # @param [Hash] params ({}) def delete_provisioning_template_version(params = {}, options = {}) req = build_request(:delete_provisioning_template_version, params) req.send_request(options) end # Deletes a CA certificate registration code. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @overload delete_registration_code(params = {}) # @param [Hash] params ({}) def delete_registration_code(params = {}, options = {}) req = build_request(:delete_registration_code, params) req.send_request(options) end # Deletes a role alias # # @option params [required, String] :role_alias # The role alias to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_role_alias({ # role_alias: "RoleAlias", # required # }) # # @overload delete_role_alias(params = {}) # @param [Hash] params ({}) def delete_role_alias(params = {}, options = {}) req = build_request(:delete_role_alias, params) req.send_request(options) end # Deletes a scheduled audit. # # @option params [required, String] :scheduled_audit_name # The name of the scheduled audit you want to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_scheduled_audit({ # scheduled_audit_name: "ScheduledAuditName", # required # }) # # @overload delete_scheduled_audit(params = {}) # @param [Hash] params ({}) def delete_scheduled_audit(params = {}, options = {}) req = build_request(:delete_scheduled_audit, params) req.send_request(options) end # Deletes a Device Defender security profile. # # @option params [required, String] :security_profile_name # The name of the security profile to be deleted. # # @option params [Integer] :expected_version # The expected version of the security profile. A new version is # generated whenever the security profile is updated. If you specify a # value that is different from the actual version, a # `VersionConflictException` is thrown. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_security_profile({ # security_profile_name: "SecurityProfileName", # required # expected_version: 1, # }) # # @overload delete_security_profile(params = {}) # @param [Hash] params ({}) def delete_security_profile(params = {}, options = {}) req = build_request(:delete_security_profile, params) req.send_request(options) end # Deletes a stream. # # @option params [required, String] :stream_id # The stream ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_stream({ # stream_id: "StreamId", # required # }) # # @overload delete_stream(params = {}) # @param [Hash] params ({}) def delete_stream(params = {}, options = {}) req = build_request(:delete_stream, params) req.send_request(options) end # Deletes the specified thing. Returns successfully with no error if the # deletion is successful or you specify a thing that doesn't exist. # # @option params [required, String] :thing_name # The name of the thing to delete. # # @option params [Integer] :expected_version # The expected version of the thing record in the registry. If the # version of the record in the registry does not match the expected # version specified in the request, the `DeleteThing` request is # rejected with a `VersionConflictException`. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_thing({ # thing_name: "ThingName", # required # expected_version: 1, # }) # # @overload delete_thing(params = {}) # @param [Hash] params ({}) def delete_thing(params = {}, options = {}) req = build_request(:delete_thing, params) req.send_request(options) end # Deletes a thing group. # # @option params [required, String] :thing_group_name # The name of the thing group to delete. # # @option params [Integer] :expected_version # The expected version of the thing group to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_thing_group({ # thing_group_name: "ThingGroupName", # required # expected_version: 1, # }) # # @overload delete_thing_group(params = {}) # @param [Hash] params ({}) def delete_thing_group(params = {}, options = {}) req = build_request(:delete_thing_group, params) req.send_request(options) end # Deletes the specified thing type. You cannot delete a thing type if it # has things associated with it. To delete a thing type, first mark it # as deprecated by calling DeprecateThingType, then remove any # associated things by calling UpdateThing to change the thing type on # any associated thing, and finally use DeleteThingType to delete the # thing type. # # @option params [required, String] :thing_type_name # The name of the thing type. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_thing_type({ # thing_type_name: "ThingTypeName", # required # }) # # @overload delete_thing_type(params = {}) # @param [Hash] params ({}) def delete_thing_type(params = {}, options = {}) req = build_request(:delete_thing_type, params) req.send_request(options) end # Deletes the rule. # # @option params [required, String] :rule_name # The name of the rule. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_topic_rule({ # rule_name: "RuleName", # required # }) # # @overload delete_topic_rule(params = {}) # @param [Hash] params ({}) def delete_topic_rule(params = {}, options = {}) req = build_request(:delete_topic_rule, params) req.send_request(options) end # Deletes a topic rule destination. # # @option params [required, String] :arn # The ARN of the topic rule destination to delete. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_topic_rule_destination({ # arn: "AwsArn", # required # }) # # @overload delete_topic_rule_destination(params = {}) # @param [Hash] params ({}) def delete_topic_rule_destination(params = {}, options = {}) req = build_request(:delete_topic_rule_destination, params) req.send_request(options) end # Deletes a logging level. # # @option params [required, String] :target_type # The type of resource for which you are configuring logging. Must be # `THING_Group`. # # @option params [required, String] :target_name # The name of the resource for which you are configuring logging. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.delete_v2_logging_level({ # target_type: "DEFAULT", # required, accepts DEFAULT, THING_GROUP # target_name: "LogTargetName", # required # }) # # @overload delete_v2_logging_level(params = {}) # @param [Hash] params ({}) def delete_v2_logging_level(params = {}, options = {}) req = build_request(:delete_v2_logging_level, params) req.send_request(options) end # Deprecates a thing type. You can not associate new things with # deprecated thing type. # # @option params [required, String] :thing_type_name # The name of the thing type to deprecate. # # @option params [Boolean] :undo_deprecate # Whether to undeprecate a deprecated thing type. If **true**, the thing # type will not be deprecated anymore and you can associate it with # things. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.deprecate_thing_type({ # thing_type_name: "ThingTypeName", # required # undo_deprecate: false, # }) # # @overload deprecate_thing_type(params = {}) # @param [Hash] params ({}) def deprecate_thing_type(params = {}, options = {}) req = build_request(:deprecate_thing_type, params) req.send_request(options) end # Gets information about the Device Defender audit settings for this # account. Settings include how audit notifications are sent and which # audit checks are enabled or disabled. # # @return [Types::DescribeAccountAuditConfigurationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeAccountAuditConfigurationResponse#role_arn #role_arn} => String # * {Types::DescribeAccountAuditConfigurationResponse#audit_notification_target_configurations #audit_notification_target_configurations} => Hash&lt;String,Types::AuditNotificationTarget&gt; # * {Types::DescribeAccountAuditConfigurationResponse#audit_check_configurations #audit_check_configurations} => Hash&lt;String,Types::AuditCheckConfiguration&gt; # # @example Response structure # # resp.role_arn #=> String # resp.audit_notification_target_configurations #=> Hash # resp.audit_notification_target_configurations["AuditNotificationType"].target_arn #=> String # resp.audit_notification_target_configurations["AuditNotificationType"].role_arn #=> String # resp.audit_notification_target_configurations["AuditNotificationType"].enabled #=> Boolean # resp.audit_check_configurations #=> Hash # resp.audit_check_configurations["AuditCheckName"].enabled #=> Boolean # # @overload describe_account_audit_configuration(params = {}) # @param [Hash] params ({}) def describe_account_audit_configuration(params = {}, options = {}) req = build_request(:describe_account_audit_configuration, params) req.send_request(options) end # Gets information about a single audit finding. Properties include the # reason for noncompliance, the severity of the issue, and when the # audit that returned the finding was started. # # @option params [required, String] :finding_id # A unique identifier for a single audit finding. You can use this # identifier to apply mitigation actions to the finding. # # @return [Types::DescribeAuditFindingResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeAuditFindingResponse#finding #finding} => Types::AuditFinding # # @example Request syntax with placeholder values # # resp = client.describe_audit_finding({ # finding_id: "FindingId", # required # }) # # @example Response structure # # resp.finding.finding_id #=> String # resp.finding.task_id #=> String # resp.finding.check_name #=> String # resp.finding.task_start_time #=> Time # resp.finding.finding_time #=> Time # resp.finding.severity #=> String, one of "CRITICAL", "HIGH", "MEDIUM", "LOW" # resp.finding.non_compliant_resource.resource_type #=> String, one of "DEVICE_CERTIFICATE", "CA_CERTIFICATE", "IOT_POLICY", "COGNITO_IDENTITY_POOL", "CLIENT_ID", "ACCOUNT_SETTINGS", "ROLE_ALIAS", "IAM_ROLE" # resp.finding.non_compliant_resource.resource_identifier.device_certificate_id #=> String # resp.finding.non_compliant_resource.resource_identifier.ca_certificate_id #=> String # resp.finding.non_compliant_resource.resource_identifier.cognito_identity_pool_id #=> String # resp.finding.non_compliant_resource.resource_identifier.client_id #=> String # resp.finding.non_compliant_resource.resource_identifier.policy_version_identifier.policy_name #=> String # resp.finding.non_compliant_resource.resource_identifier.policy_version_identifier.policy_version_id #=> String # resp.finding.non_compliant_resource.resource_identifier.account #=> String # resp.finding.non_compliant_resource.resource_identifier.iam_role_arn #=> String # resp.finding.non_compliant_resource.resource_identifier.role_alias_arn #=> String # resp.finding.non_compliant_resource.additional_info #=> Hash # resp.finding.non_compliant_resource.additional_info["String"] #=> String # resp.finding.related_resources #=> Array # resp.finding.related_resources[0].resource_type #=> String, one of "DEVICE_CERTIFICATE", "CA_CERTIFICATE", "IOT_POLICY", "COGNITO_IDENTITY_POOL", "CLIENT_ID", "ACCOUNT_SETTINGS", "ROLE_ALIAS", "IAM_ROLE" # resp.finding.related_resources[0].resource_identifier.device_certificate_id #=> String # resp.finding.related_resources[0].resource_identifier.ca_certificate_id #=> String # resp.finding.related_resources[0].resource_identifier.cognito_identity_pool_id #=> String # resp.finding.related_resources[0].resource_identifier.client_id #=> String # resp.finding.related_resources[0].resource_identifier.policy_version_identifier.policy_name #=> String # resp.finding.related_resources[0].resource_identifier.policy_version_identifier.policy_version_id #=> String # resp.finding.related_resources[0].resource_identifier.account #=> String # resp.finding.related_resources[0].resource_identifier.iam_role_arn #=> String # resp.finding.related_resources[0].resource_identifier.role_alias_arn #=> String # resp.finding.related_resources[0].additional_info #=> Hash # resp.finding.related_resources[0].additional_info["String"] #=> String # resp.finding.reason_for_non_compliance #=> String # resp.finding.reason_for_non_compliance_code #=> String # # @overload describe_audit_finding(params = {}) # @param [Hash] params ({}) def describe_audit_finding(params = {}, options = {}) req = build_request(:describe_audit_finding, params) req.send_request(options) end # Gets information about an audit mitigation task that is used to apply # mitigation actions to a set of audit findings. Properties include the # actions being applied, the audit checks to which they're being # applied, the task status, and aggregated task statistics. # # @option params [required, String] :task_id # The unique identifier for the audit mitigation task. # # @return [Types::DescribeAuditMitigationActionsTaskResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeAuditMitigationActionsTaskResponse#task_status #task_status} => String # * {Types::DescribeAuditMitigationActionsTaskResponse#start_time #start_time} => Time # * {Types::DescribeAuditMitigationActionsTaskResponse#end_time #end_time} => Time # * {Types::DescribeAuditMitigationActionsTaskResponse#task_statistics #task_statistics} => Hash&lt;String,Types::TaskStatisticsForAuditCheck&gt; # * {Types::DescribeAuditMitigationActionsTaskResponse#target #target} => Types::AuditMitigationActionsTaskTarget # * {Types::DescribeAuditMitigationActionsTaskResponse#audit_check_to_actions_mapping #audit_check_to_actions_mapping} => Hash&lt;String,Array&lt;String&gt;&gt; # * {Types::DescribeAuditMitigationActionsTaskResponse#actions_definition #actions_definition} => Array&lt;Types::MitigationAction&gt; # # @example Request syntax with placeholder values # # resp = client.describe_audit_mitigation_actions_task({ # task_id: "AuditMitigationActionsTaskId", # required # }) # # @example Response structure # # resp.task_status #=> String, one of "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELED" # resp.start_time #=> Time # resp.end_time #=> Time # resp.task_statistics #=> Hash # resp.task_statistics["AuditCheckName"].total_findings_count #=> Integer # resp.task_statistics["AuditCheckName"].failed_findings_count #=> Integer # resp.task_statistics["AuditCheckName"].succeeded_findings_count #=> Integer # resp.task_statistics["AuditCheckName"].skipped_findings_count #=> Integer # resp.task_statistics["AuditCheckName"].canceled_findings_count #=> Integer # resp.target.audit_task_id #=> String # resp.target.finding_ids #=> Array # resp.target.finding_ids[0] #=> String # resp.target.audit_check_to_reason_code_filter #=> Hash # resp.target.audit_check_to_reason_code_filter["AuditCheckName"] #=> Array # resp.target.audit_check_to_reason_code_filter["AuditCheckName"][0] #=> String # resp.audit_check_to_actions_mapping #=> Hash # resp.audit_check_to_actions_mapping["AuditCheckName"] #=> Array # resp.audit_check_to_actions_mapping["AuditCheckName"][0] #=> String # resp.actions_definition #=> Array # resp.actions_definition[0].name #=> String # resp.actions_definition[0].id #=> String # resp.actions_definition[0].role_arn #=> String # resp.actions_definition[0].action_params.update_device_certificate_params.action #=> String, one of "DEACTIVATE" # resp.actions_definition[0].action_params.update_ca_certificate_params.action #=> String, one of "DEACTIVATE" # resp.actions_definition[0].action_params.add_things_to_thing_group_params.thing_group_names #=> Array # resp.actions_definition[0].action_params.add_things_to_thing_group_params.thing_group_names[0] #=> String # resp.actions_definition[0].action_params.add_things_to_thing_group_params.override_dynamic_groups #=> Boolean # resp.actions_definition[0].action_params.replace_default_policy_version_params.template_name #=> String, one of "BLANK_POLICY" # resp.actions_definition[0].action_params.enable_io_t_logging_params.role_arn_for_logging #=> String # resp.actions_definition[0].action_params.enable_io_t_logging_params.log_level #=> String, one of "DEBUG", "INFO", "ERROR", "WARN", "DISABLED" # resp.actions_definition[0].action_params.publish_finding_to_sns_params.topic_arn #=> String # # @overload describe_audit_mitigation_actions_task(params = {}) # @param [Hash] params ({}) def describe_audit_mitigation_actions_task(params = {}, options = {}) req = build_request(:describe_audit_mitigation_actions_task, params) req.send_request(options) end # Gets information about a Device Defender audit. # # @option params [required, String] :task_id # The ID of the audit whose information you want to get. # # @return [Types::DescribeAuditTaskResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeAuditTaskResponse#task_status #task_status} => String # * {Types::DescribeAuditTaskResponse#task_type #task_type} => String # * {Types::DescribeAuditTaskResponse#task_start_time #task_start_time} => Time # * {Types::DescribeAuditTaskResponse#task_statistics #task_statistics} => Types::TaskStatistics # * {Types::DescribeAuditTaskResponse#scheduled_audit_name #scheduled_audit_name} => String # * {Types::DescribeAuditTaskResponse#audit_details #audit_details} => Hash&lt;String,Types::AuditCheckDetails&gt; # # @example Request syntax with placeholder values # # resp = client.describe_audit_task({ # task_id: "AuditTaskId", # required # }) # # @example Response structure # # resp.task_status #=> String, one of "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELED" # resp.task_type #=> String, one of "ON_DEMAND_AUDIT_TASK", "SCHEDULED_AUDIT_TASK" # resp.task_start_time #=> Time # resp.task_statistics.total_checks #=> Integer # resp.task_statistics.in_progress_checks #=> Integer # resp.task_statistics.waiting_for_data_collection_checks #=> Integer # resp.task_statistics.compliant_checks #=> Integer # resp.task_statistics.non_compliant_checks #=> Integer # resp.task_statistics.failed_checks #=> Integer # resp.task_statistics.canceled_checks #=> Integer # resp.scheduled_audit_name #=> String # resp.audit_details #=> Hash # resp.audit_details["AuditCheckName"].check_run_status #=> String, one of "IN_PROGRESS", "WAITING_FOR_DATA_COLLECTION", "CANCELED", "COMPLETED_COMPLIANT", "COMPLETED_NON_COMPLIANT", "FAILED" # resp.audit_details["AuditCheckName"].check_compliant #=> Boolean # resp.audit_details["AuditCheckName"].total_resources_count #=> Integer # resp.audit_details["AuditCheckName"].non_compliant_resources_count #=> Integer # resp.audit_details["AuditCheckName"].error_code #=> String # resp.audit_details["AuditCheckName"].message #=> String # # @overload describe_audit_task(params = {}) # @param [Hash] params ({}) def describe_audit_task(params = {}, options = {}) req = build_request(:describe_audit_task, params) req.send_request(options) end # Describes an authorizer. # # @option params [required, String] :authorizer_name # The name of the authorizer to describe. # # @return [Types::DescribeAuthorizerResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeAuthorizerResponse#authorizer_description #authorizer_description} => Types::AuthorizerDescription # # @example Request syntax with placeholder values # # resp = client.describe_authorizer({ # authorizer_name: "AuthorizerName", # required # }) # # @example Response structure # # resp.authorizer_description.authorizer_name #=> String # resp.authorizer_description.authorizer_arn #=> String # resp.authorizer_description.authorizer_function_arn #=> String # resp.authorizer_description.token_key_name #=> String # resp.authorizer_description.token_signing_public_keys #=> Hash # resp.authorizer_description.token_signing_public_keys["KeyName"] #=> String # resp.authorizer_description.status #=> String, one of "ACTIVE", "INACTIVE" # resp.authorizer_description.creation_date #=> Time # resp.authorizer_description.last_modified_date #=> Time # resp.authorizer_description.signing_disabled #=> Boolean # # @overload describe_authorizer(params = {}) # @param [Hash] params ({}) def describe_authorizer(params = {}, options = {}) req = build_request(:describe_authorizer, params) req.send_request(options) end # Returns information about a billing group. # # @option params [required, String] :billing_group_name # The name of the billing group. # # @return [Types::DescribeBillingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeBillingGroupResponse#billing_group_name #billing_group_name} => String # * {Types::DescribeBillingGroupResponse#billing_group_id #billing_group_id} => String # * {Types::DescribeBillingGroupResponse#billing_group_arn #billing_group_arn} => String # * {Types::DescribeBillingGroupResponse#version #version} => Integer # * {Types::DescribeBillingGroupResponse#billing_group_properties #billing_group_properties} => Types::BillingGroupProperties # * {Types::DescribeBillingGroupResponse#billing_group_metadata #billing_group_metadata} => Types::BillingGroupMetadata # # @example Request syntax with placeholder values # # resp = client.describe_billing_group({ # billing_group_name: "BillingGroupName", # required # }) # # @example Response structure # # resp.billing_group_name #=> String # resp.billing_group_id #=> String # resp.billing_group_arn #=> String # resp.version #=> Integer # resp.billing_group_properties.billing_group_description #=> String # resp.billing_group_metadata.creation_date #=> Time # # @overload describe_billing_group(params = {}) # @param [Hash] params ({}) def describe_billing_group(params = {}, options = {}) req = build_request(:describe_billing_group, params) req.send_request(options) end # Describes a registered CA certificate. # # @option params [required, String] :certificate_id # The CA certificate identifier. # # @return [Types::DescribeCACertificateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeCACertificateResponse#certificate_description #certificate_description} => Types::CACertificateDescription # * {Types::DescribeCACertificateResponse#registration_config #registration_config} => Types::RegistrationConfig # # @example Request syntax with placeholder values # # resp = client.describe_ca_certificate({ # certificate_id: "CertificateId", # required # }) # # @example Response structure # # resp.certificate_description.certificate_arn #=> String # resp.certificate_description.certificate_id #=> String # resp.certificate_description.status #=> String, one of "ACTIVE", "INACTIVE" # resp.certificate_description.certificate_pem #=> String # resp.certificate_description.owned_by #=> String # resp.certificate_description.creation_date #=> Time # resp.certificate_description.auto_registration_status #=> String, one of "ENABLE", "DISABLE" # resp.certificate_description.last_modified_date #=> Time # resp.certificate_description.customer_version #=> Integer # resp.certificate_description.generation_id #=> String # resp.certificate_description.validity.not_before #=> Time # resp.certificate_description.validity.not_after #=> Time # resp.registration_config.template_body #=> String # resp.registration_config.role_arn #=> String # # @overload describe_ca_certificate(params = {}) # @param [Hash] params ({}) def describe_ca_certificate(params = {}, options = {}) req = build_request(:describe_ca_certificate, params) req.send_request(options) end # Gets information about the specified certificate. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @return [Types::DescribeCertificateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeCertificateResponse#certificate_description #certificate_description} => Types::CertificateDescription # # @example Request syntax with placeholder values # # resp = client.describe_certificate({ # certificate_id: "CertificateId", # required # }) # # @example Response structure # # resp.certificate_description.certificate_arn #=> String # resp.certificate_description.certificate_id #=> String # resp.certificate_description.ca_certificate_id #=> String # resp.certificate_description.status #=> String, one of "ACTIVE", "INACTIVE", "REVOKED", "PENDING_TRANSFER", "REGISTER_INACTIVE", "PENDING_ACTIVATION" # resp.certificate_description.certificate_pem #=> String # resp.certificate_description.owned_by #=> String # resp.certificate_description.previous_owned_by #=> String # resp.certificate_description.creation_date #=> Time # resp.certificate_description.last_modified_date #=> Time # resp.certificate_description.customer_version #=> Integer # resp.certificate_description.transfer_data.transfer_message #=> String # resp.certificate_description.transfer_data.reject_reason #=> String # resp.certificate_description.transfer_data.transfer_date #=> Time # resp.certificate_description.transfer_data.accept_date #=> Time # resp.certificate_description.transfer_data.reject_date #=> Time # resp.certificate_description.generation_id #=> String # resp.certificate_description.validity.not_before #=> Time # resp.certificate_description.validity.not_after #=> Time # resp.certificate_description.certificate_mode #=> String, one of "DEFAULT", "SNI_ONLY" # # @overload describe_certificate(params = {}) # @param [Hash] params ({}) def describe_certificate(params = {}, options = {}) req = build_request(:describe_certificate, params) req.send_request(options) end # Describes the default authorizer. # # @return [Types::DescribeDefaultAuthorizerResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeDefaultAuthorizerResponse#authorizer_description #authorizer_description} => Types::AuthorizerDescription # # @example Response structure # # resp.authorizer_description.authorizer_name #=> String # resp.authorizer_description.authorizer_arn #=> String # resp.authorizer_description.authorizer_function_arn #=> String # resp.authorizer_description.token_key_name #=> String # resp.authorizer_description.token_signing_public_keys #=> Hash # resp.authorizer_description.token_signing_public_keys["KeyName"] #=> String # resp.authorizer_description.status #=> String, one of "ACTIVE", "INACTIVE" # resp.authorizer_description.creation_date #=> Time # resp.authorizer_description.last_modified_date #=> Time # resp.authorizer_description.signing_disabled #=> Boolean # # @overload describe_default_authorizer(params = {}) # @param [Hash] params ({}) def describe_default_authorizer(params = {}, options = {}) req = build_request(:describe_default_authorizer, params) req.send_request(options) end # Provides details about a dimension that is defined in your AWS # account. # # @option params [required, String] :name # The unique identifier for the dimension. # # @return [Types::DescribeDimensionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeDimensionResponse#name #name} => String # * {Types::DescribeDimensionResponse#arn #arn} => String # * {Types::DescribeDimensionResponse#type #type} => String # * {Types::DescribeDimensionResponse#string_values #string_values} => Array&lt;String&gt; # * {Types::DescribeDimensionResponse#creation_date #creation_date} => Time # * {Types::DescribeDimensionResponse#last_modified_date #last_modified_date} => Time # # @example Request syntax with placeholder values # # resp = client.describe_dimension({ # name: "DimensionName", # required # }) # # @example Response structure # # resp.name #=> String # resp.arn #=> String # resp.type #=> String, one of "TOPIC_FILTER" # resp.string_values #=> Array # resp.string_values[0] #=> String # resp.creation_date #=> Time # resp.last_modified_date #=> Time # # @overload describe_dimension(params = {}) # @param [Hash] params ({}) def describe_dimension(params = {}, options = {}) req = build_request(:describe_dimension, params) req.send_request(options) end # Gets summary information about a domain configuration. # # <note markdown="1"> The domain configuration feature is in public preview and is subject # to change. # # </note> # # @option params [required, String] :domain_configuration_name # The name of the domain configuration. # # @return [Types::DescribeDomainConfigurationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeDomainConfigurationResponse#domain_configuration_name #domain_configuration_name} => String # * {Types::DescribeDomainConfigurationResponse#domain_configuration_arn #domain_configuration_arn} => String # * {Types::DescribeDomainConfigurationResponse#domain_name #domain_name} => String # * {Types::DescribeDomainConfigurationResponse#server_certificates #server_certificates} => Array&lt;Types::ServerCertificateSummary&gt; # * {Types::DescribeDomainConfigurationResponse#authorizer_config #authorizer_config} => Types::AuthorizerConfig # * {Types::DescribeDomainConfigurationResponse#domain_configuration_status #domain_configuration_status} => String # * {Types::DescribeDomainConfigurationResponse#service_type #service_type} => String # * {Types::DescribeDomainConfigurationResponse#domain_type #domain_type} => String # # @example Request syntax with placeholder values # # resp = client.describe_domain_configuration({ # domain_configuration_name: "ReservedDomainConfigurationName", # required # }) # # @example Response structure # # resp.domain_configuration_name #=> String # resp.domain_configuration_arn #=> String # resp.domain_name #=> String # resp.server_certificates #=> Array # resp.server_certificates[0].server_certificate_arn #=> String # resp.server_certificates[0].server_certificate_status #=> String, one of "INVALID", "VALID" # resp.server_certificates[0].server_certificate_status_detail #=> String # resp.authorizer_config.default_authorizer_name #=> String # resp.authorizer_config.allow_authorizer_override #=> Boolean # resp.domain_configuration_status #=> String, one of "ENABLED", "DISABLED" # resp.service_type #=> String, one of "DATA", "CREDENTIAL_PROVIDER", "JOBS" # resp.domain_type #=> String, one of "ENDPOINT", "AWS_MANAGED", "CUSTOMER_MANAGED" # # @overload describe_domain_configuration(params = {}) # @param [Hash] params ({}) def describe_domain_configuration(params = {}, options = {}) req = build_request(:describe_domain_configuration, params) req.send_request(options) end # Returns a unique endpoint specific to the AWS account making the call. # # @option params [String] :endpoint_type # The endpoint type. Valid endpoint types include: # # * `iot:Data` - Returns a VeriSign signed data endpoint. # # ^ # ^ # # * `iot:Data-ATS` - Returns an ATS signed data endpoint. # # ^ # ^ # # * `iot:CredentialProvider` - Returns an AWS IoT credentials provider # API endpoint. # # ^ # ^ # # * `iot:Jobs` - Returns an AWS IoT device management Jobs API endpoint. # # ^ # # We strongly recommend that customers use the newer `iot:Data-ATS` # endpoint type to avoid issues related to the widespread distrust of # Symantec certificate authorities. # # @return [Types::DescribeEndpointResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeEndpointResponse#endpoint_address #endpoint_address} => String # # @example Request syntax with placeholder values # # resp = client.describe_endpoint({ # endpoint_type: "EndpointType", # }) # # @example Response structure # # resp.endpoint_address #=> String # # @overload describe_endpoint(params = {}) # @param [Hash] params ({}) def describe_endpoint(params = {}, options = {}) req = build_request(:describe_endpoint, params) req.send_request(options) end # Describes event configurations. # # @return [Types::DescribeEventConfigurationsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeEventConfigurationsResponse#event_configurations #event_configurations} => Hash&lt;String,Types::Configuration&gt; # * {Types::DescribeEventConfigurationsResponse#creation_date #creation_date} => Time # * {Types::DescribeEventConfigurationsResponse#last_modified_date #last_modified_date} => Time # # @example Response structure # # resp.event_configurations #=> Hash # resp.event_configurations["EventType"].enabled #=> Boolean # resp.creation_date #=> Time # resp.last_modified_date #=> Time # # @overload describe_event_configurations(params = {}) # @param [Hash] params ({}) def describe_event_configurations(params = {}, options = {}) req = build_request(:describe_event_configurations, params) req.send_request(options) end # Describes a search index. # # @option params [required, String] :index_name # The index name. # # @return [Types::DescribeIndexResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeIndexResponse#index_name #index_name} => String # * {Types::DescribeIndexResponse#index_status #index_status} => String # * {Types::DescribeIndexResponse#schema #schema} => String # # @example Request syntax with placeholder values # # resp = client.describe_index({ # index_name: "IndexName", # required # }) # # @example Response structure # # resp.index_name #=> String # resp.index_status #=> String, one of "ACTIVE", "BUILDING", "REBUILDING" # resp.schema #=> String # # @overload describe_index(params = {}) # @param [Hash] params ({}) def describe_index(params = {}, options = {}) req = build_request(:describe_index, params) req.send_request(options) end # Describes a job. # # @option params [required, String] :job_id # The unique identifier you assigned to this job when it was created. # # @return [Types::DescribeJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeJobResponse#document_source #document_source} => String # * {Types::DescribeJobResponse#job #job} => Types::Job # # @example Request syntax with placeholder values # # resp = client.describe_job({ # job_id: "JobId", # required # }) # # @example Response structure # # resp.document_source #=> String # resp.job.job_arn #=> String # resp.job.job_id #=> String # resp.job.target_selection #=> String, one of "CONTINUOUS", "SNAPSHOT" # resp.job.status #=> String, one of "IN_PROGRESS", "CANCELED", "COMPLETED", "DELETION_IN_PROGRESS" # resp.job.force_canceled #=> Boolean # resp.job.reason_code #=> String # resp.job.comment #=> String # resp.job.targets #=> Array # resp.job.targets[0] #=> String # resp.job.description #=> String # resp.job.presigned_url_config.role_arn #=> String # resp.job.presigned_url_config.expires_in_sec #=> Integer # resp.job.job_executions_rollout_config.maximum_per_minute #=> Integer # resp.job.job_executions_rollout_config.exponential_rate.base_rate_per_minute #=> Integer # resp.job.job_executions_rollout_config.exponential_rate.increment_factor #=> Float # resp.job.job_executions_rollout_config.exponential_rate.rate_increase_criteria.number_of_notified_things #=> Integer # resp.job.job_executions_rollout_config.exponential_rate.rate_increase_criteria.number_of_succeeded_things #=> Integer # resp.job.abort_config.criteria_list #=> Array # resp.job.abort_config.criteria_list[0].failure_type #=> String, one of "FAILED", "REJECTED", "TIMED_OUT", "ALL" # resp.job.abort_config.criteria_list[0].action #=> String, one of "CANCEL" # resp.job.abort_config.criteria_list[0].threshold_percentage #=> Float # resp.job.abort_config.criteria_list[0].min_number_of_executed_things #=> Integer # resp.job.created_at #=> Time # resp.job.last_updated_at #=> Time # resp.job.completed_at #=> Time # resp.job.job_process_details.processing_targets #=> Array # resp.job.job_process_details.processing_targets[0] #=> String # resp.job.job_process_details.number_of_canceled_things #=> Integer # resp.job.job_process_details.number_of_succeeded_things #=> Integer # resp.job.job_process_details.number_of_failed_things #=> Integer # resp.job.job_process_details.number_of_rejected_things #=> Integer # resp.job.job_process_details.number_of_queued_things #=> Integer # resp.job.job_process_details.number_of_in_progress_things #=> Integer # resp.job.job_process_details.number_of_removed_things #=> Integer # resp.job.job_process_details.number_of_timed_out_things #=> Integer # resp.job.timeout_config.in_progress_timeout_in_minutes #=> Integer # # @overload describe_job(params = {}) # @param [Hash] params ({}) def describe_job(params = {}, options = {}) req = build_request(:describe_job, params) req.send_request(options) end # Describes a job execution. # # @option params [required, String] :job_id # The unique identifier you assigned to this job when it was created. # # @option params [required, String] :thing_name # The name of the thing on which the job execution is running. # # @option params [Integer] :execution_number # A string (consisting of the digits "0" through "9" which is used # to specify a particular job execution on a particular device. # # @return [Types::DescribeJobExecutionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeJobExecutionResponse#execution #execution} => Types::JobExecution # # @example Request syntax with placeholder values # # resp = client.describe_job_execution({ # job_id: "JobId", # required # thing_name: "ThingName", # required # execution_number: 1, # }) # # @example Response structure # # resp.execution.job_id #=> String # resp.execution.status #=> String, one of "QUEUED", "IN_PROGRESS", "SUCCEEDED", "FAILED", "TIMED_OUT", "REJECTED", "REMOVED", "CANCELED" # resp.execution.force_canceled #=> Boolean # resp.execution.status_details.details_map #=> Hash # resp.execution.status_details.details_map["DetailsKey"] #=> String # resp.execution.thing_arn #=> String # resp.execution.queued_at #=> Time # resp.execution.started_at #=> Time # resp.execution.last_updated_at #=> Time # resp.execution.execution_number #=> Integer # resp.execution.version_number #=> Integer # resp.execution.approximate_seconds_before_timed_out #=> Integer # # @overload describe_job_execution(params = {}) # @param [Hash] params ({}) def describe_job_execution(params = {}, options = {}) req = build_request(:describe_job_execution, params) req.send_request(options) end # Gets information about a mitigation action. # # @option params [required, String] :action_name # The friendly name that uniquely identifies the mitigation action. # # @return [Types::DescribeMitigationActionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeMitigationActionResponse#action_name #action_name} => String # * {Types::DescribeMitigationActionResponse#action_type #action_type} => String # * {Types::DescribeMitigationActionResponse#action_arn #action_arn} => String # * {Types::DescribeMitigationActionResponse#action_id #action_id} => String # * {Types::DescribeMitigationActionResponse#role_arn #role_arn} => String # * {Types::DescribeMitigationActionResponse#action_params #action_params} => Types::MitigationActionParams # * {Types::DescribeMitigationActionResponse#creation_date #creation_date} => Time # * {Types::DescribeMitigationActionResponse#last_modified_date #last_modified_date} => Time # # @example Request syntax with placeholder values # # resp = client.describe_mitigation_action({ # action_name: "MitigationActionName", # required # }) # # @example Response structure # # resp.action_name #=> String # resp.action_type #=> String, one of "UPDATE_DEVICE_CERTIFICATE", "UPDATE_CA_CERTIFICATE", "ADD_THINGS_TO_THING_GROUP", "REPLACE_DEFAULT_POLICY_VERSION", "ENABLE_IOT_LOGGING", "PUBLISH_FINDING_TO_SNS" # resp.action_arn #=> String # resp.action_id #=> String # resp.role_arn #=> String # resp.action_params.update_device_certificate_params.action #=> String, one of "DEACTIVATE" # resp.action_params.update_ca_certificate_params.action #=> String, one of "DEACTIVATE" # resp.action_params.add_things_to_thing_group_params.thing_group_names #=> Array # resp.action_params.add_things_to_thing_group_params.thing_group_names[0] #=> String # resp.action_params.add_things_to_thing_group_params.override_dynamic_groups #=> Boolean # resp.action_params.replace_default_policy_version_params.template_name #=> String, one of "BLANK_POLICY" # resp.action_params.enable_io_t_logging_params.role_arn_for_logging #=> String # resp.action_params.enable_io_t_logging_params.log_level #=> String, one of "DEBUG", "INFO", "ERROR", "WARN", "DISABLED" # resp.action_params.publish_finding_to_sns_params.topic_arn #=> String # resp.creation_date #=> Time # resp.last_modified_date #=> Time # # @overload describe_mitigation_action(params = {}) # @param [Hash] params ({}) def describe_mitigation_action(params = {}, options = {}) req = build_request(:describe_mitigation_action, params) req.send_request(options) end # Returns information about a fleet provisioning template. # # @option params [required, String] :template_name # The name of the fleet provisioning template. # # @return [Types::DescribeProvisioningTemplateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeProvisioningTemplateResponse#template_arn #template_arn} => String # * {Types::DescribeProvisioningTemplateResponse#template_name #template_name} => String # * {Types::DescribeProvisioningTemplateResponse#description #description} => String # * {Types::DescribeProvisioningTemplateResponse#creation_date #creation_date} => Time # * {Types::DescribeProvisioningTemplateResponse#last_modified_date #last_modified_date} => Time # * {Types::DescribeProvisioningTemplateResponse#default_version_id #default_version_id} => Integer # * {Types::DescribeProvisioningTemplateResponse#template_body #template_body} => String # * {Types::DescribeProvisioningTemplateResponse#enabled #enabled} => Boolean # * {Types::DescribeProvisioningTemplateResponse#provisioning_role_arn #provisioning_role_arn} => String # * {Types::DescribeProvisioningTemplateResponse#pre_provisioning_hook #pre_provisioning_hook} => Types::ProvisioningHook # # @example Request syntax with placeholder values # # resp = client.describe_provisioning_template({ # template_name: "TemplateName", # required # }) # # @example Response structure # # resp.template_arn #=> String # resp.template_name #=> String # resp.description #=> String # resp.creation_date #=> Time # resp.last_modified_date #=> Time # resp.default_version_id #=> Integer # resp.template_body #=> String # resp.enabled #=> Boolean # resp.provisioning_role_arn #=> String # resp.pre_provisioning_hook.payload_version #=> String # resp.pre_provisioning_hook.target_arn #=> String # # @overload describe_provisioning_template(params = {}) # @param [Hash] params ({}) def describe_provisioning_template(params = {}, options = {}) req = build_request(:describe_provisioning_template, params) req.send_request(options) end # Returns information about a fleet provisioning template version. # # @option params [required, String] :template_name # The template name. # # @option params [required, Integer] :version_id # The fleet provisioning template version ID. # # @return [Types::DescribeProvisioningTemplateVersionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeProvisioningTemplateVersionResponse#version_id #version_id} => Integer # * {Types::DescribeProvisioningTemplateVersionResponse#creation_date #creation_date} => Time # * {Types::DescribeProvisioningTemplateVersionResponse#template_body #template_body} => String # * {Types::DescribeProvisioningTemplateVersionResponse#is_default_version #is_default_version} => Boolean # # @example Request syntax with placeholder values # # resp = client.describe_provisioning_template_version({ # template_name: "TemplateName", # required # version_id: 1, # required # }) # # @example Response structure # # resp.version_id #=> Integer # resp.creation_date #=> Time # resp.template_body #=> String # resp.is_default_version #=> Boolean # # @overload describe_provisioning_template_version(params = {}) # @param [Hash] params ({}) def describe_provisioning_template_version(params = {}, options = {}) req = build_request(:describe_provisioning_template_version, params) req.send_request(options) end # Describes a role alias. # # @option params [required, String] :role_alias # The role alias to describe. # # @return [Types::DescribeRoleAliasResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeRoleAliasResponse#role_alias_description #role_alias_description} => Types::RoleAliasDescription # # @example Request syntax with placeholder values # # resp = client.describe_role_alias({ # role_alias: "RoleAlias", # required # }) # # @example Response structure # # resp.role_alias_description.role_alias #=> String # resp.role_alias_description.role_alias_arn #=> String # resp.role_alias_description.role_arn #=> String # resp.role_alias_description.owner #=> String # resp.role_alias_description.credential_duration_seconds #=> Integer # resp.role_alias_description.creation_date #=> Time # resp.role_alias_description.last_modified_date #=> Time # # @overload describe_role_alias(params = {}) # @param [Hash] params ({}) def describe_role_alias(params = {}, options = {}) req = build_request(:describe_role_alias, params) req.send_request(options) end # Gets information about a scheduled audit. # # @option params [required, String] :scheduled_audit_name # The name of the scheduled audit whose information you want to get. # # @return [Types::DescribeScheduledAuditResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeScheduledAuditResponse#frequency #frequency} => String # * {Types::DescribeScheduledAuditResponse#day_of_month #day_of_month} => String # * {Types::DescribeScheduledAuditResponse#day_of_week #day_of_week} => String # * {Types::DescribeScheduledAuditResponse#target_check_names #target_check_names} => Array&lt;String&gt; # * {Types::DescribeScheduledAuditResponse#scheduled_audit_name #scheduled_audit_name} => String # * {Types::DescribeScheduledAuditResponse#scheduled_audit_arn #scheduled_audit_arn} => String # # @example Request syntax with placeholder values # # resp = client.describe_scheduled_audit({ # scheduled_audit_name: "ScheduledAuditName", # required # }) # # @example Response structure # # resp.frequency #=> String, one of "DAILY", "WEEKLY", "BIWEEKLY", "MONTHLY" # resp.day_of_month #=> String # resp.day_of_week #=> String, one of "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" # resp.target_check_names #=> Array # resp.target_check_names[0] #=> String # resp.scheduled_audit_name #=> String # resp.scheduled_audit_arn #=> String # # @overload describe_scheduled_audit(params = {}) # @param [Hash] params ({}) def describe_scheduled_audit(params = {}, options = {}) req = build_request(:describe_scheduled_audit, params) req.send_request(options) end # Gets information about a Device Defender security profile. # # @option params [required, String] :security_profile_name # The name of the security profile whose information you want to get. # # @return [Types::DescribeSecurityProfileResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeSecurityProfileResponse#security_profile_name #security_profile_name} => String # * {Types::DescribeSecurityProfileResponse#security_profile_arn #security_profile_arn} => String # * {Types::DescribeSecurityProfileResponse#security_profile_description #security_profile_description} => String # * {Types::DescribeSecurityProfileResponse#behaviors #behaviors} => Array&lt;Types::Behavior&gt; # * {Types::DescribeSecurityProfileResponse#alert_targets #alert_targets} => Hash&lt;String,Types::AlertTarget&gt; # * {Types::DescribeSecurityProfileResponse#additional_metrics_to_retain #additional_metrics_to_retain} => Array&lt;String&gt; # * {Types::DescribeSecurityProfileResponse#additional_metrics_to_retain_v2 #additional_metrics_to_retain_v2} => Array&lt;Types::MetricToRetain&gt; # * {Types::DescribeSecurityProfileResponse#version #version} => Integer # * {Types::DescribeSecurityProfileResponse#creation_date #creation_date} => Time # * {Types::DescribeSecurityProfileResponse#last_modified_date #last_modified_date} => Time # # @example Request syntax with placeholder values # # resp = client.describe_security_profile({ # security_profile_name: "SecurityProfileName", # required # }) # # @example Response structure # # resp.security_profile_name #=> String # resp.security_profile_arn #=> String # resp.security_profile_description #=> String # resp.behaviors #=> Array # resp.behaviors[0].name #=> String # resp.behaviors[0].metric #=> String # resp.behaviors[0].metric_dimension.dimension_name #=> String # resp.behaviors[0].metric_dimension.operator #=> String, one of "IN", "NOT_IN" # resp.behaviors[0].criteria.comparison_operator #=> String, one of "less-than", "less-than-equals", "greater-than", "greater-than-equals", "in-cidr-set", "not-in-cidr-set", "in-port-set", "not-in-port-set" # resp.behaviors[0].criteria.value.count #=> Integer # resp.behaviors[0].criteria.value.cidrs #=> Array # resp.behaviors[0].criteria.value.cidrs[0] #=> String # resp.behaviors[0].criteria.value.ports #=> Array # resp.behaviors[0].criteria.value.ports[0] #=> Integer # resp.behaviors[0].criteria.duration_seconds #=> Integer # resp.behaviors[0].criteria.consecutive_datapoints_to_alarm #=> Integer # resp.behaviors[0].criteria.consecutive_datapoints_to_clear #=> Integer # resp.behaviors[0].criteria.statistical_threshold.statistic #=> String # resp.alert_targets #=> Hash # resp.alert_targets["AlertTargetType"].alert_target_arn #=> String # resp.alert_targets["AlertTargetType"].role_arn #=> String # resp.additional_metrics_to_retain #=> Array # resp.additional_metrics_to_retain[0] #=> String # resp.additional_metrics_to_retain_v2 #=> Array # resp.additional_metrics_to_retain_v2[0].metric #=> String # resp.additional_metrics_to_retain_v2[0].metric_dimension.dimension_name #=> String # resp.additional_metrics_to_retain_v2[0].metric_dimension.operator #=> String, one of "IN", "NOT_IN" # resp.version #=> Integer # resp.creation_date #=> Time # resp.last_modified_date #=> Time # # @overload describe_security_profile(params = {}) # @param [Hash] params ({}) def describe_security_profile(params = {}, options = {}) req = build_request(:describe_security_profile, params) req.send_request(options) end # Gets information about a stream. # # @option params [required, String] :stream_id # The stream ID. # # @return [Types::DescribeStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeStreamResponse#stream_info #stream_info} => Types::StreamInfo # # @example Request syntax with placeholder values # # resp = client.describe_stream({ # stream_id: "StreamId", # required # }) # # @example Response structure # # resp.stream_info.stream_id #=> String # resp.stream_info.stream_arn #=> String # resp.stream_info.stream_version #=> Integer # resp.stream_info.description #=> String # resp.stream_info.files #=> Array # resp.stream_info.files[0].file_id #=> Integer # resp.stream_info.files[0].s3_location.bucket #=> String # resp.stream_info.files[0].s3_location.key #=> String # resp.stream_info.files[0].s3_location.version #=> String # resp.stream_info.created_at #=> Time # resp.stream_info.last_updated_at #=> Time # resp.stream_info.role_arn #=> String # # @overload describe_stream(params = {}) # @param [Hash] params ({}) def describe_stream(params = {}, options = {}) req = build_request(:describe_stream, params) req.send_request(options) end # Gets information about the specified thing. # # @option params [required, String] :thing_name # The name of the thing. # # @return [Types::DescribeThingResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeThingResponse#default_client_id #default_client_id} => String # * {Types::DescribeThingResponse#thing_name #thing_name} => String # * {Types::DescribeThingResponse#thing_id #thing_id} => String # * {Types::DescribeThingResponse#thing_arn #thing_arn} => String # * {Types::DescribeThingResponse#thing_type_name #thing_type_name} => String # * {Types::DescribeThingResponse#attributes #attributes} => Hash&lt;String,String&gt; # * {Types::DescribeThingResponse#version #version} => Integer # * {Types::DescribeThingResponse#billing_group_name #billing_group_name} => String # # @example Request syntax with placeholder values # # resp = client.describe_thing({ # thing_name: "ThingName", # required # }) # # @example Response structure # # resp.default_client_id #=> String # resp.thing_name #=> String # resp.thing_id #=> String # resp.thing_arn #=> String # resp.thing_type_name #=> String # resp.attributes #=> Hash # resp.attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil> # resp.version #=> Integer # resp.billing_group_name #=> String # # @overload describe_thing(params = {}) # @param [Hash] params ({}) def describe_thing(params = {}, options = {}) req = build_request(:describe_thing, params) req.send_request(options) end # Describe a thing group. # # @option params [required, String] :thing_group_name # The name of the thing group. # # @return [Types::DescribeThingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeThingGroupResponse#thing_group_name #thing_group_name} => String # * {Types::DescribeThingGroupResponse#thing_group_id #thing_group_id} => String # * {Types::DescribeThingGroupResponse#thing_group_arn #thing_group_arn} => String # * {Types::DescribeThingGroupResponse#version #version} => Integer # * {Types::DescribeThingGroupResponse#thing_group_properties #thing_group_properties} => Types::ThingGroupProperties # * {Types::DescribeThingGroupResponse#thing_group_metadata #thing_group_metadata} => Types::ThingGroupMetadata # * {Types::DescribeThingGroupResponse#index_name #index_name} => String # * {Types::DescribeThingGroupResponse#query_string #query_string} => String # * {Types::DescribeThingGroupResponse#query_version #query_version} => String # * {Types::DescribeThingGroupResponse#status #status} => String # # @example Request syntax with placeholder values # # resp = client.describe_thing_group({ # thing_group_name: "ThingGroupName", # required # }) # # @example Response structure # # resp.thing_group_name #=> String # resp.thing_group_id #=> String # resp.thing_group_arn #=> String # resp.version #=> Integer # resp.thing_group_properties.thing_group_description #=> String # resp.thing_group_properties.attribute_payload.attributes #=> Hash # resp.thing_group_properties.attribute_payload.attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil> # resp.thing_group_properties.attribute_payload.merge #=> Boolean # resp.thing_group_metadata.parent_group_name #=> String # resp.thing_group_metadata.root_to_parent_thing_groups #=> Array # resp.thing_group_metadata.root_to_parent_thing_groups[0].group_name #=> String # resp.thing_group_metadata.root_to_parent_thing_groups[0].group_arn #=> String # resp.thing_group_metadata.creation_date #=> Time # resp.index_name #=> String # resp.query_string #=> String # resp.query_version #=> String # resp.status #=> String, one of "ACTIVE", "BUILDING", "REBUILDING" # # @overload describe_thing_group(params = {}) # @param [Hash] params ({}) def describe_thing_group(params = {}, options = {}) req = build_request(:describe_thing_group, params) req.send_request(options) end # Describes a bulk thing provisioning task. # # @option params [required, String] :task_id # The task ID. # # @return [Types::DescribeThingRegistrationTaskResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeThingRegistrationTaskResponse#task_id #task_id} => String # * {Types::DescribeThingRegistrationTaskResponse#creation_date #creation_date} => Time # * {Types::DescribeThingRegistrationTaskResponse#last_modified_date #last_modified_date} => Time # * {Types::DescribeThingRegistrationTaskResponse#template_body #template_body} => String # * {Types::DescribeThingRegistrationTaskResponse#input_file_bucket #input_file_bucket} => String # * {Types::DescribeThingRegistrationTaskResponse#input_file_key #input_file_key} => String # * {Types::DescribeThingRegistrationTaskResponse#role_arn #role_arn} => String # * {Types::DescribeThingRegistrationTaskResponse#status #status} => String # * {Types::DescribeThingRegistrationTaskResponse#message #message} => String # * {Types::DescribeThingRegistrationTaskResponse#success_count #success_count} => Integer # * {Types::DescribeThingRegistrationTaskResponse#failure_count #failure_count} => Integer # * {Types::DescribeThingRegistrationTaskResponse#percentage_progress #percentage_progress} => Integer # # @example Request syntax with placeholder values # # resp = client.describe_thing_registration_task({ # task_id: "TaskId", # required # }) # # @example Response structure # # resp.task_id #=> String # resp.creation_date #=> Time # resp.last_modified_date #=> Time # resp.template_body #=> String # resp.input_file_bucket #=> String # resp.input_file_key #=> String # resp.role_arn #=> String # resp.status #=> String, one of "InProgress", "Completed", "Failed", "Cancelled", "Cancelling" # resp.message #=> String # resp.success_count #=> Integer # resp.failure_count #=> Integer # resp.percentage_progress #=> Integer # # @overload describe_thing_registration_task(params = {}) # @param [Hash] params ({}) def describe_thing_registration_task(params = {}, options = {}) req = build_request(:describe_thing_registration_task, params) req.send_request(options) end # Gets information about the specified thing type. # # @option params [required, String] :thing_type_name # The name of the thing type. # # @return [Types::DescribeThingTypeResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::DescribeThingTypeResponse#thing_type_name #thing_type_name} => String # * {Types::DescribeThingTypeResponse#thing_type_id #thing_type_id} => String # * {Types::DescribeThingTypeResponse#thing_type_arn #thing_type_arn} => String # * {Types::DescribeThingTypeResponse#thing_type_properties #thing_type_properties} => Types::ThingTypeProperties # * {Types::DescribeThingTypeResponse#thing_type_metadata #thing_type_metadata} => Types::ThingTypeMetadata # # @example Request syntax with placeholder values # # resp = client.describe_thing_type({ # thing_type_name: "ThingTypeName", # required # }) # # @example Response structure # # resp.thing_type_name #=> String # resp.thing_type_id #=> String # resp.thing_type_arn #=> String # resp.thing_type_properties.thing_type_description #=> String # resp.thing_type_properties.searchable_attributes #=> Array # resp.thing_type_properties.searchable_attributes[0] #=> String # resp.thing_type_metadata.deprecated #=> Boolean # resp.thing_type_metadata.deprecation_date #=> Time # resp.thing_type_metadata.creation_date #=> Time # # @overload describe_thing_type(params = {}) # @param [Hash] params ({}) def describe_thing_type(params = {}, options = {}) req = build_request(:describe_thing_type, params) req.send_request(options) end # Detaches a policy from the specified target. # # @option params [required, String] :policy_name # The policy to detach. # # @option params [required, String] :target # The target from which the policy will be detached. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.detach_policy({ # policy_name: "PolicyName", # required # target: "PolicyTarget", # required # }) # # @overload detach_policy(params = {}) # @param [Hash] params ({}) def detach_policy(params = {}, options = {}) req = build_request(:detach_policy, params) req.send_request(options) end # Removes the specified policy from the specified certificate. # # **Note:** This API is deprecated. Please use DetachPolicy instead. # # @option params [required, String] :policy_name # The name of the policy to detach. # # @option params [required, String] :principal # The principal. # # If the principal is a certificate, specify the certificate ARN. If the # principal is an Amazon Cognito identity, specify the identity ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.detach_principal_policy({ # policy_name: "PolicyName", # required # principal: "Principal", # required # }) # # @overload detach_principal_policy(params = {}) # @param [Hash] params ({}) def detach_principal_policy(params = {}, options = {}) req = build_request(:detach_principal_policy, params) req.send_request(options) end # Disassociates a Device Defender security profile from a thing group or # from this account. # # @option params [required, String] :security_profile_name # The security profile that is detached. # # @option params [required, String] :security_profile_target_arn # The ARN of the thing group from which the security profile is # detached. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.detach_security_profile({ # security_profile_name: "SecurityProfileName", # required # security_profile_target_arn: "SecurityProfileTargetArn", # required # }) # # @overload detach_security_profile(params = {}) # @param [Hash] params ({}) def detach_security_profile(params = {}, options = {}) req = build_request(:detach_security_profile, params) req.send_request(options) end # Detaches the specified principal from the specified thing. A principal # can be X.509 certificates, IAM users, groups, and roles, Amazon # Cognito identities or federated identities. # # <note markdown="1"> This call is asynchronous. It might take several seconds for the # detachment to propagate. # # </note> # # @option params [required, String] :thing_name # The name of the thing. # # @option params [required, String] :principal # If the principal is a certificate, this value must be ARN of the # certificate. If the principal is an Amazon Cognito identity, this # value must be the ID of the Amazon Cognito identity. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.detach_thing_principal({ # thing_name: "ThingName", # required # principal: "Principal", # required # }) # # @overload detach_thing_principal(params = {}) # @param [Hash] params ({}) def detach_thing_principal(params = {}, options = {}) req = build_request(:detach_thing_principal, params) req.send_request(options) end # Disables the rule. # # @option params [required, String] :rule_name # The name of the rule to disable. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.disable_topic_rule({ # rule_name: "RuleName", # required # }) # # @overload disable_topic_rule(params = {}) # @param [Hash] params ({}) def disable_topic_rule(params = {}, options = {}) req = build_request(:disable_topic_rule, params) req.send_request(options) end # Enables the rule. # # @option params [required, String] :rule_name # The name of the topic rule to enable. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.enable_topic_rule({ # rule_name: "RuleName", # required # }) # # @overload enable_topic_rule(params = {}) # @param [Hash] params ({}) def enable_topic_rule(params = {}, options = {}) req = build_request(:enable_topic_rule, params) req.send_request(options) end # Returns the approximate count of unique values that match the query. # # @option params [String] :index_name # The name of the index to search. # # @option params [required, String] :query_string # The search query. # # @option params [String] :aggregation_field # The field to aggregate. # # @option params [String] :query_version # The query version. # # @return [Types::GetCardinalityResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetCardinalityResponse#cardinality #cardinality} => Integer # # @example Request syntax with placeholder values # # resp = client.get_cardinality({ # index_name: "IndexName", # query_string: "QueryString", # required # aggregation_field: "AggregationField", # query_version: "QueryVersion", # }) # # @example Response structure # # resp.cardinality #=> Integer # # @overload get_cardinality(params = {}) # @param [Hash] params ({}) def get_cardinality(params = {}, options = {}) req = build_request(:get_cardinality, params) req.send_request(options) end # Gets a list of the policies that have an effect on the authorization # behavior of the specified device when it connects to the AWS IoT # device gateway. # # @option params [String] :principal # The principal. # # @option params [String] :cognito_identity_pool_id # The Cognito identity pool ID. # # @option params [String] :thing_name # The thing name. # # @return [Types::GetEffectivePoliciesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetEffectivePoliciesResponse#effective_policies #effective_policies} => Array&lt;Types::EffectivePolicy&gt; # # @example Request syntax with placeholder values # # resp = client.get_effective_policies({ # principal: "Principal", # cognito_identity_pool_id: "CognitoIdentityPoolId", # thing_name: "ThingName", # }) # # @example Response structure # # resp.effective_policies #=> Array # resp.effective_policies[0].policy_name #=> String # resp.effective_policies[0].policy_arn #=> String # resp.effective_policies[0].policy_document #=> String # # @overload get_effective_policies(params = {}) # @param [Hash] params ({}) def get_effective_policies(params = {}, options = {}) req = build_request(:get_effective_policies, params) req.send_request(options) end # Gets the indexing configuration. # # @return [Types::GetIndexingConfigurationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetIndexingConfigurationResponse#thing_indexing_configuration #thing_indexing_configuration} => Types::ThingIndexingConfiguration # * {Types::GetIndexingConfigurationResponse#thing_group_indexing_configuration #thing_group_indexing_configuration} => Types::ThingGroupIndexingConfiguration # # @example Response structure # # resp.thing_indexing_configuration.thing_indexing_mode #=> String, one of "OFF", "REGISTRY", "REGISTRY_AND_SHADOW" # resp.thing_indexing_configuration.thing_connectivity_indexing_mode #=> String, one of "OFF", "STATUS" # resp.thing_indexing_configuration.managed_fields #=> Array # resp.thing_indexing_configuration.managed_fields[0].name #=> String # resp.thing_indexing_configuration.managed_fields[0].type #=> String, one of "Number", "String", "Boolean" # resp.thing_indexing_configuration.custom_fields #=> Array # resp.thing_indexing_configuration.custom_fields[0].name #=> String # resp.thing_indexing_configuration.custom_fields[0].type #=> String, one of "Number", "String", "Boolean" # resp.thing_group_indexing_configuration.thing_group_indexing_mode #=> String, one of "OFF", "ON" # resp.thing_group_indexing_configuration.managed_fields #=> Array # resp.thing_group_indexing_configuration.managed_fields[0].name #=> String # resp.thing_group_indexing_configuration.managed_fields[0].type #=> String, one of "Number", "String", "Boolean" # resp.thing_group_indexing_configuration.custom_fields #=> Array # resp.thing_group_indexing_configuration.custom_fields[0].name #=> String # resp.thing_group_indexing_configuration.custom_fields[0].type #=> String, one of "Number", "String", "Boolean" # # @overload get_indexing_configuration(params = {}) # @param [Hash] params ({}) def get_indexing_configuration(params = {}, options = {}) req = build_request(:get_indexing_configuration, params) req.send_request(options) end # Gets a job document. # # @option params [required, String] :job_id # The unique identifier you assigned to this job when it was created. # # @return [Types::GetJobDocumentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetJobDocumentResponse#document #document} => String # # @example Request syntax with placeholder values # # resp = client.get_job_document({ # job_id: "JobId", # required # }) # # @example Response structure # # resp.document #=> String # # @overload get_job_document(params = {}) # @param [Hash] params ({}) def get_job_document(params = {}, options = {}) req = build_request(:get_job_document, params) req.send_request(options) end # Gets the logging options. # # NOTE: use of this command is not recommended. Use # `GetV2LoggingOptions` instead. # # @return [Types::GetLoggingOptionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetLoggingOptionsResponse#role_arn #role_arn} => String # * {Types::GetLoggingOptionsResponse#log_level #log_level} => String # # @example Response structure # # resp.role_arn #=> String # resp.log_level #=> String, one of "DEBUG", "INFO", "ERROR", "WARN", "DISABLED" # # @overload get_logging_options(params = {}) # @param [Hash] params ({}) def get_logging_options(params = {}, options = {}) req = build_request(:get_logging_options, params) req.send_request(options) end # Gets an OTA update. # # @option params [required, String] :ota_update_id # The OTA update ID. # # @return [Types::GetOTAUpdateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetOTAUpdateResponse#ota_update_info #ota_update_info} => Types::OTAUpdateInfo # # @example Request syntax with placeholder values # # resp = client.get_ota_update({ # ota_update_id: "OTAUpdateId", # required # }) # # @example Response structure # # resp.ota_update_info.ota_update_id #=> String # resp.ota_update_info.ota_update_arn #=> String # resp.ota_update_info.creation_date #=> Time # resp.ota_update_info.last_modified_date #=> Time # resp.ota_update_info.description #=> String # resp.ota_update_info.targets #=> Array # resp.ota_update_info.targets[0] #=> String # resp.ota_update_info.protocols #=> Array # resp.ota_update_info.protocols[0] #=> String, one of "MQTT", "HTTP" # resp.ota_update_info.aws_job_executions_rollout_config.maximum_per_minute #=> Integer # resp.ota_update_info.aws_job_executions_rollout_config.exponential_rate.base_rate_per_minute #=> Integer # resp.ota_update_info.aws_job_executions_rollout_config.exponential_rate.increment_factor #=> Float # resp.ota_update_info.aws_job_executions_rollout_config.exponential_rate.rate_increase_criteria.number_of_notified_things #=> Integer # resp.ota_update_info.aws_job_executions_rollout_config.exponential_rate.rate_increase_criteria.number_of_succeeded_things #=> Integer # resp.ota_update_info.aws_job_presigned_url_config.expires_in_sec #=> Integer # resp.ota_update_info.target_selection #=> String, one of "CONTINUOUS", "SNAPSHOT" # resp.ota_update_info.ota_update_files #=> Array # resp.ota_update_info.ota_update_files[0].file_name #=> String # resp.ota_update_info.ota_update_files[0].file_version #=> String # resp.ota_update_info.ota_update_files[0].file_location.stream.stream_id #=> String # resp.ota_update_info.ota_update_files[0].file_location.stream.file_id #=> Integer # resp.ota_update_info.ota_update_files[0].file_location.s3_location.bucket #=> String # resp.ota_update_info.ota_update_files[0].file_location.s3_location.key #=> String # resp.ota_update_info.ota_update_files[0].file_location.s3_location.version #=> String # resp.ota_update_info.ota_update_files[0].code_signing.aws_signer_job_id #=> String # resp.ota_update_info.ota_update_files[0].code_signing.start_signing_job_parameter.signing_profile_parameter.certificate_arn #=> String # resp.ota_update_info.ota_update_files[0].code_signing.start_signing_job_parameter.signing_profile_parameter.platform #=> String # resp.ota_update_info.ota_update_files[0].code_signing.start_signing_job_parameter.signing_profile_parameter.certificate_path_on_device #=> String # resp.ota_update_info.ota_update_files[0].code_signing.start_signing_job_parameter.signing_profile_name #=> String # resp.ota_update_info.ota_update_files[0].code_signing.start_signing_job_parameter.destination.s3_destination.bucket #=> String # resp.ota_update_info.ota_update_files[0].code_signing.start_signing_job_parameter.destination.s3_destination.prefix #=> String # resp.ota_update_info.ota_update_files[0].code_signing.custom_code_signing.signature.inline_document #=> String # resp.ota_update_info.ota_update_files[0].code_signing.custom_code_signing.certificate_chain.certificate_name #=> String # resp.ota_update_info.ota_update_files[0].code_signing.custom_code_signing.certificate_chain.inline_document #=> String # resp.ota_update_info.ota_update_files[0].code_signing.custom_code_signing.hash_algorithm #=> String # resp.ota_update_info.ota_update_files[0].code_signing.custom_code_signing.signature_algorithm #=> String # resp.ota_update_info.ota_update_files[0].attributes #=> Hash # resp.ota_update_info.ota_update_files[0].attributes["AttributeKey"] #=> String # resp.ota_update_info.ota_update_status #=> String, one of "CREATE_PENDING", "CREATE_IN_PROGRESS", "CREATE_COMPLETE", "CREATE_FAILED" # resp.ota_update_info.aws_iot_job_id #=> String # resp.ota_update_info.aws_iot_job_arn #=> String # resp.ota_update_info.error_info.code #=> String # resp.ota_update_info.error_info.message #=> String # resp.ota_update_info.additional_parameters #=> Hash # resp.ota_update_info.additional_parameters["AttributeKey"] #=> String # # @overload get_ota_update(params = {}) # @param [Hash] params ({}) def get_ota_update(params = {}, options = {}) req = build_request(:get_ota_update, params) req.send_request(options) end # Groups the aggregated values that match the query into percentile # groupings. The default percentile groupings are: 1,5,25,50,75,95,99, # although you can specify your own when you call `GetPercentiles`. This # function returns a value for each percentile group specified (or the # default percentile groupings). The percentile group "1" contains the # aggregated field value that occurs in approximately one percent of the # values that match the query. The percentile group "5" contains the # aggregated field value that occurs in approximately five percent of # the values that match the query, and so on. The result is an # approximation, the more values that match the query, the more accurate # the percentile values. # # @option params [String] :index_name # The name of the index to search. # # @option params [required, String] :query_string # The query string. # # @option params [String] :aggregation_field # The field to aggregate. # # @option params [String] :query_version # The query version. # # @option params [Array<Float>] :percents # The percentile groups returned. # # @return [Types::GetPercentilesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetPercentilesResponse#percentiles #percentiles} => Array&lt;Types::PercentPair&gt; # # @example Request syntax with placeholder values # # resp = client.get_percentiles({ # index_name: "IndexName", # query_string: "QueryString", # required # aggregation_field: "AggregationField", # query_version: "QueryVersion", # percents: [1.0], # }) # # @example Response structure # # resp.percentiles #=> Array # resp.percentiles[0].percent #=> Float # resp.percentiles[0].value #=> Float # # @overload get_percentiles(params = {}) # @param [Hash] params ({}) def get_percentiles(params = {}, options = {}) req = build_request(:get_percentiles, params) req.send_request(options) end # Gets information about the specified policy with the policy document # of the default version. # # @option params [required, String] :policy_name # The name of the policy. # # @return [Types::GetPolicyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetPolicyResponse#policy_name #policy_name} => String # * {Types::GetPolicyResponse#policy_arn #policy_arn} => String # * {Types::GetPolicyResponse#policy_document #policy_document} => String # * {Types::GetPolicyResponse#default_version_id #default_version_id} => String # * {Types::GetPolicyResponse#creation_date #creation_date} => Time # * {Types::GetPolicyResponse#last_modified_date #last_modified_date} => Time # * {Types::GetPolicyResponse#generation_id #generation_id} => String # # @example Request syntax with placeholder values # # resp = client.get_policy({ # policy_name: "PolicyName", # required # }) # # @example Response structure # # resp.policy_name #=> String # resp.policy_arn #=> String # resp.policy_document #=> String # resp.default_version_id #=> String # resp.creation_date #=> Time # resp.last_modified_date #=> Time # resp.generation_id #=> String # # @overload get_policy(params = {}) # @param [Hash] params ({}) def get_policy(params = {}, options = {}) req = build_request(:get_policy, params) req.send_request(options) end # Gets information about the specified policy version. # # @option params [required, String] :policy_name # The name of the policy. # # @option params [required, String] :policy_version_id # The policy version ID. # # @return [Types::GetPolicyVersionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetPolicyVersionResponse#policy_arn #policy_arn} => String # * {Types::GetPolicyVersionResponse#policy_name #policy_name} => String # * {Types::GetPolicyVersionResponse#policy_document #policy_document} => String # * {Types::GetPolicyVersionResponse#policy_version_id #policy_version_id} => String # * {Types::GetPolicyVersionResponse#is_default_version #is_default_version} => Boolean # * {Types::GetPolicyVersionResponse#creation_date #creation_date} => Time # * {Types::GetPolicyVersionResponse#last_modified_date #last_modified_date} => Time # * {Types::GetPolicyVersionResponse#generation_id #generation_id} => String # # @example Request syntax with placeholder values # # resp = client.get_policy_version({ # policy_name: "PolicyName", # required # policy_version_id: "PolicyVersionId", # required # }) # # @example Response structure # # resp.policy_arn #=> String # resp.policy_name #=> String # resp.policy_document #=> String # resp.policy_version_id #=> String # resp.is_default_version #=> Boolean # resp.creation_date #=> Time # resp.last_modified_date #=> Time # resp.generation_id #=> String # # @overload get_policy_version(params = {}) # @param [Hash] params ({}) def get_policy_version(params = {}, options = {}) req = build_request(:get_policy_version, params) req.send_request(options) end # Gets a registration code used to register a CA certificate with AWS # IoT. # # @return [Types::GetRegistrationCodeResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetRegistrationCodeResponse#registration_code #registration_code} => String # # @example Response structure # # resp.registration_code #=> String # # @overload get_registration_code(params = {}) # @param [Hash] params ({}) def get_registration_code(params = {}, options = {}) req = build_request(:get_registration_code, params) req.send_request(options) end # Returns the count, average, sum, minimum, maximum, sum of squares, # variance, and standard deviation for the specified aggregated field. # If the aggregation field is of type `String`, only the count statistic # is returned. # # @option params [String] :index_name # The name of the index to search. The default value is `AWS_Things`. # # @option params [required, String] :query_string # The query used to search. You can specify "*" for the query string # to get the count of all indexed things in your AWS account. # # @option params [String] :aggregation_field # The aggregation field name. # # @option params [String] :query_version # The version of the query used to search. # # @return [Types::GetStatisticsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetStatisticsResponse#statistics #statistics} => Types::Statistics # # @example Request syntax with placeholder values # # resp = client.get_statistics({ # index_name: "IndexName", # query_string: "QueryString", # required # aggregation_field: "AggregationField", # query_version: "QueryVersion", # }) # # @example Response structure # # resp.statistics.count #=> Integer # resp.statistics.average #=> Float # resp.statistics.sum #=> Float # resp.statistics.minimum #=> Float # resp.statistics.maximum #=> Float # resp.statistics.sum_of_squares #=> Float # resp.statistics.variance #=> Float # resp.statistics.std_deviation #=> Float # # @overload get_statistics(params = {}) # @param [Hash] params ({}) def get_statistics(params = {}, options = {}) req = build_request(:get_statistics, params) req.send_request(options) end # Gets information about the rule. # # @option params [required, String] :rule_name # The name of the rule. # # @return [Types::GetTopicRuleResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetTopicRuleResponse#rule_arn #rule_arn} => String # * {Types::GetTopicRuleResponse#rule #rule} => Types::TopicRule # # @example Request syntax with placeholder values # # resp = client.get_topic_rule({ # rule_name: "RuleName", # required # }) # # @example Response structure # # resp.rule_arn #=> String # resp.rule.rule_name #=> String # resp.rule.sql #=> String # resp.rule.description #=> String # resp.rule.created_at #=> Time # resp.rule.actions #=> Array # resp.rule.actions[0].dynamo_db.table_name #=> String # resp.rule.actions[0].dynamo_db.role_arn #=> String # resp.rule.actions[0].dynamo_db.operation #=> String # resp.rule.actions[0].dynamo_db.hash_key_field #=> String # resp.rule.actions[0].dynamo_db.hash_key_value #=> String # resp.rule.actions[0].dynamo_db.hash_key_type #=> String, one of "STRING", "NUMBER" # resp.rule.actions[0].dynamo_db.range_key_field #=> String # resp.rule.actions[0].dynamo_db.range_key_value #=> String # resp.rule.actions[0].dynamo_db.range_key_type #=> String, one of "STRING", "NUMBER" # resp.rule.actions[0].dynamo_db.payload_field #=> String # resp.rule.actions[0].dynamo_d_bv_2.role_arn #=> String # resp.rule.actions[0].dynamo_d_bv_2.put_item.table_name #=> String # resp.rule.actions[0].lambda.function_arn #=> String # resp.rule.actions[0].sns.target_arn #=> String # resp.rule.actions[0].sns.role_arn #=> String # resp.rule.actions[0].sns.message_format #=> String, one of "RAW", "JSON" # resp.rule.actions[0].sqs.role_arn #=> String # resp.rule.actions[0].sqs.queue_url #=> String # resp.rule.actions[0].sqs.use_base_64 #=> Boolean # resp.rule.actions[0].kinesis.role_arn #=> String # resp.rule.actions[0].kinesis.stream_name #=> String # resp.rule.actions[0].kinesis.partition_key #=> String # resp.rule.actions[0].republish.role_arn #=> String # resp.rule.actions[0].republish.topic #=> String # resp.rule.actions[0].republish.qos #=> Integer # resp.rule.actions[0].s3.role_arn #=> String # resp.rule.actions[0].s3.bucket_name #=> String # resp.rule.actions[0].s3.key #=> String # resp.rule.actions[0].s3.canned_acl #=> String, one of "private", "public-read", "public-read-write", "aws-exec-read", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control", "log-delivery-write" # resp.rule.actions[0].firehose.role_arn #=> String # resp.rule.actions[0].firehose.delivery_stream_name #=> String # resp.rule.actions[0].firehose.separator #=> String # resp.rule.actions[0].cloudwatch_metric.role_arn #=> String # resp.rule.actions[0].cloudwatch_metric.metric_namespace #=> String # resp.rule.actions[0].cloudwatch_metric.metric_name #=> String # resp.rule.actions[0].cloudwatch_metric.metric_value #=> String # resp.rule.actions[0].cloudwatch_metric.metric_unit #=> String # resp.rule.actions[0].cloudwatch_metric.metric_timestamp #=> String # resp.rule.actions[0].cloudwatch_alarm.role_arn #=> String # resp.rule.actions[0].cloudwatch_alarm.alarm_name #=> String # resp.rule.actions[0].cloudwatch_alarm.state_reason #=> String # resp.rule.actions[0].cloudwatch_alarm.state_value #=> String # resp.rule.actions[0].cloudwatch_logs.role_arn #=> String # resp.rule.actions[0].cloudwatch_logs.log_group_name #=> String # resp.rule.actions[0].elasticsearch.role_arn #=> String # resp.rule.actions[0].elasticsearch.endpoint #=> String # resp.rule.actions[0].elasticsearch.index #=> String # resp.rule.actions[0].elasticsearch.type #=> String # resp.rule.actions[0].elasticsearch.id #=> String # resp.rule.actions[0].salesforce.token #=> String # resp.rule.actions[0].salesforce.url #=> String # resp.rule.actions[0].iot_analytics.channel_arn #=> String # resp.rule.actions[0].iot_analytics.channel_name #=> String # resp.rule.actions[0].iot_analytics.role_arn #=> String # resp.rule.actions[0].iot_events.input_name #=> String # resp.rule.actions[0].iot_events.message_id #=> String # resp.rule.actions[0].iot_events.role_arn #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries #=> Array # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].entry_id #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].asset_id #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_id #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_alias #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values #=> Array # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.string_value #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.integer_value #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.double_value #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.boolean_value #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].timestamp.time_in_seconds #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].timestamp.offset_in_nanos #=> String # resp.rule.actions[0].iot_site_wise.put_asset_property_value_entries[0].property_values[0].quality #=> String # resp.rule.actions[0].iot_site_wise.role_arn #=> String # resp.rule.actions[0].step_functions.execution_name_prefix #=> String # resp.rule.actions[0].step_functions.state_machine_name #=> String # resp.rule.actions[0].step_functions.role_arn #=> String # resp.rule.actions[0].http.url #=> String # resp.rule.actions[0].http.confirmation_url #=> String # resp.rule.actions[0].http.headers #=> Array # resp.rule.actions[0].http.headers[0].key #=> String # resp.rule.actions[0].http.headers[0].value #=> String # resp.rule.actions[0].http.auth.sigv4.signing_region #=> String # resp.rule.actions[0].http.auth.sigv4.service_name #=> String # resp.rule.actions[0].http.auth.sigv4.role_arn #=> String # resp.rule.rule_disabled #=> Boolean # resp.rule.aws_iot_sql_version #=> String # resp.rule.error_action.dynamo_db.table_name #=> String # resp.rule.error_action.dynamo_db.role_arn #=> String # resp.rule.error_action.dynamo_db.operation #=> String # resp.rule.error_action.dynamo_db.hash_key_field #=> String # resp.rule.error_action.dynamo_db.hash_key_value #=> String # resp.rule.error_action.dynamo_db.hash_key_type #=> String, one of "STRING", "NUMBER" # resp.rule.error_action.dynamo_db.range_key_field #=> String # resp.rule.error_action.dynamo_db.range_key_value #=> String # resp.rule.error_action.dynamo_db.range_key_type #=> String, one of "STRING", "NUMBER" # resp.rule.error_action.dynamo_db.payload_field #=> String # resp.rule.error_action.dynamo_d_bv_2.role_arn #=> String # resp.rule.error_action.dynamo_d_bv_2.put_item.table_name #=> String # resp.rule.error_action.lambda.function_arn #=> String # resp.rule.error_action.sns.target_arn #=> String # resp.rule.error_action.sns.role_arn #=> String # resp.rule.error_action.sns.message_format #=> String, one of "RAW", "JSON" # resp.rule.error_action.sqs.role_arn #=> String # resp.rule.error_action.sqs.queue_url #=> String # resp.rule.error_action.sqs.use_base_64 #=> Boolean # resp.rule.error_action.kinesis.role_arn #=> String # resp.rule.error_action.kinesis.stream_name #=> String # resp.rule.error_action.kinesis.partition_key #=> String # resp.rule.error_action.republish.role_arn #=> String # resp.rule.error_action.republish.topic #=> String # resp.rule.error_action.republish.qos #=> Integer # resp.rule.error_action.s3.role_arn #=> String # resp.rule.error_action.s3.bucket_name #=> String # resp.rule.error_action.s3.key #=> String # resp.rule.error_action.s3.canned_acl #=> String, one of "private", "public-read", "public-read-write", "aws-exec-read", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control", "log-delivery-write" # resp.rule.error_action.firehose.role_arn #=> String # resp.rule.error_action.firehose.delivery_stream_name #=> String # resp.rule.error_action.firehose.separator #=> String # resp.rule.error_action.cloudwatch_metric.role_arn #=> String # resp.rule.error_action.cloudwatch_metric.metric_namespace #=> String # resp.rule.error_action.cloudwatch_metric.metric_name #=> String # resp.rule.error_action.cloudwatch_metric.metric_value #=> String # resp.rule.error_action.cloudwatch_metric.metric_unit #=> String # resp.rule.error_action.cloudwatch_metric.metric_timestamp #=> String # resp.rule.error_action.cloudwatch_alarm.role_arn #=> String # resp.rule.error_action.cloudwatch_alarm.alarm_name #=> String # resp.rule.error_action.cloudwatch_alarm.state_reason #=> String # resp.rule.error_action.cloudwatch_alarm.state_value #=> String # resp.rule.error_action.cloudwatch_logs.role_arn #=> String # resp.rule.error_action.cloudwatch_logs.log_group_name #=> String # resp.rule.error_action.elasticsearch.role_arn #=> String # resp.rule.error_action.elasticsearch.endpoint #=> String # resp.rule.error_action.elasticsearch.index #=> String # resp.rule.error_action.elasticsearch.type #=> String # resp.rule.error_action.elasticsearch.id #=> String # resp.rule.error_action.salesforce.token #=> String # resp.rule.error_action.salesforce.url #=> String # resp.rule.error_action.iot_analytics.channel_arn #=> String # resp.rule.error_action.iot_analytics.channel_name #=> String # resp.rule.error_action.iot_analytics.role_arn #=> String # resp.rule.error_action.iot_events.input_name #=> String # resp.rule.error_action.iot_events.message_id #=> String # resp.rule.error_action.iot_events.role_arn #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries #=> Array # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].entry_id #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].asset_id #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_id #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_alias #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values #=> Array # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.string_value #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.integer_value #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.double_value #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].value.boolean_value #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].timestamp.time_in_seconds #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].timestamp.offset_in_nanos #=> String # resp.rule.error_action.iot_site_wise.put_asset_property_value_entries[0].property_values[0].quality #=> String # resp.rule.error_action.iot_site_wise.role_arn #=> String # resp.rule.error_action.step_functions.execution_name_prefix #=> String # resp.rule.error_action.step_functions.state_machine_name #=> String # resp.rule.error_action.step_functions.role_arn #=> String # resp.rule.error_action.http.url #=> String # resp.rule.error_action.http.confirmation_url #=> String # resp.rule.error_action.http.headers #=> Array # resp.rule.error_action.http.headers[0].key #=> String # resp.rule.error_action.http.headers[0].value #=> String # resp.rule.error_action.http.auth.sigv4.signing_region #=> String # resp.rule.error_action.http.auth.sigv4.service_name #=> String # resp.rule.error_action.http.auth.sigv4.role_arn #=> String # # @overload get_topic_rule(params = {}) # @param [Hash] params ({}) def get_topic_rule(params = {}, options = {}) req = build_request(:get_topic_rule, params) req.send_request(options) end # Gets information about a topic rule destination. # # @option params [required, String] :arn # The ARN of the topic rule destination. # # @return [Types::GetTopicRuleDestinationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetTopicRuleDestinationResponse#topic_rule_destination #topic_rule_destination} => Types::TopicRuleDestination # # @example Request syntax with placeholder values # # resp = client.get_topic_rule_destination({ # arn: "AwsArn", # required # }) # # @example Response structure # # resp.topic_rule_destination.arn #=> String # resp.topic_rule_destination.status #=> String, one of "ENABLED", "IN_PROGRESS", "DISABLED", "ERROR" # resp.topic_rule_destination.status_reason #=> String # resp.topic_rule_destination.http_url_properties.confirmation_url #=> String # # @overload get_topic_rule_destination(params = {}) # @param [Hash] params ({}) def get_topic_rule_destination(params = {}, options = {}) req = build_request(:get_topic_rule_destination, params) req.send_request(options) end # Gets the fine grained logging options. # # @return [Types::GetV2LoggingOptionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::GetV2LoggingOptionsResponse#role_arn #role_arn} => String # * {Types::GetV2LoggingOptionsResponse#default_log_level #default_log_level} => String # * {Types::GetV2LoggingOptionsResponse#disable_all_logs #disable_all_logs} => Boolean # # @example Response structure # # resp.role_arn #=> String # resp.default_log_level #=> String, one of "DEBUG", "INFO", "ERROR", "WARN", "DISABLED" # resp.disable_all_logs #=> Boolean # # @overload get_v2_logging_options(params = {}) # @param [Hash] params ({}) def get_v2_logging_options(params = {}, options = {}) req = build_request(:get_v2_logging_options, params) req.send_request(options) end # Lists the active violations for a given Device Defender security # profile. # # @option params [String] :thing_name # The name of the thing whose active violations are listed. # # @option params [String] :security_profile_name # The name of the Device Defender security profile for which violations # are listed. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListActiveViolationsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListActiveViolationsResponse#active_violations #active_violations} => Array&lt;Types::ActiveViolation&gt; # * {Types::ListActiveViolationsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_active_violations({ # thing_name: "DeviceDefenderThingName", # security_profile_name: "SecurityProfileName", # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.active_violations #=> Array # resp.active_violations[0].violation_id #=> String # resp.active_violations[0].thing_name #=> String # resp.active_violations[0].security_profile_name #=> String # resp.active_violations[0].behavior.name #=> String # resp.active_violations[0].behavior.metric #=> String # resp.active_violations[0].behavior.metric_dimension.dimension_name #=> String # resp.active_violations[0].behavior.metric_dimension.operator #=> String, one of "IN", "NOT_IN" # resp.active_violations[0].behavior.criteria.comparison_operator #=> String, one of "less-than", "less-than-equals", "greater-than", "greater-than-equals", "in-cidr-set", "not-in-cidr-set", "in-port-set", "not-in-port-set" # resp.active_violations[0].behavior.criteria.value.count #=> Integer # resp.active_violations[0].behavior.criteria.value.cidrs #=> Array # resp.active_violations[0].behavior.criteria.value.cidrs[0] #=> String # resp.active_violations[0].behavior.criteria.value.ports #=> Array # resp.active_violations[0].behavior.criteria.value.ports[0] #=> Integer # resp.active_violations[0].behavior.criteria.duration_seconds #=> Integer # resp.active_violations[0].behavior.criteria.consecutive_datapoints_to_alarm #=> Integer # resp.active_violations[0].behavior.criteria.consecutive_datapoints_to_clear #=> Integer # resp.active_violations[0].behavior.criteria.statistical_threshold.statistic #=> String # resp.active_violations[0].last_violation_value.count #=> Integer # resp.active_violations[0].last_violation_value.cidrs #=> Array # resp.active_violations[0].last_violation_value.cidrs[0] #=> String # resp.active_violations[0].last_violation_value.ports #=> Array # resp.active_violations[0].last_violation_value.ports[0] #=> Integer # resp.active_violations[0].last_violation_time #=> Time # resp.active_violations[0].violation_start_time #=> Time # resp.next_token #=> String # # @overload list_active_violations(params = {}) # @param [Hash] params ({}) def list_active_violations(params = {}, options = {}) req = build_request(:list_active_violations, params) req.send_request(options) end # Lists the policies attached to the specified thing group. # # @option params [required, String] :target # The group or principal for which the policies will be listed. # # @option params [Boolean] :recursive # When true, recursively list attached policies. # # @option params [String] :marker # The token to retrieve the next set of results. # # @option params [Integer] :page_size # The maximum number of results to be returned per request. # # @return [Types::ListAttachedPoliciesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListAttachedPoliciesResponse#policies #policies} => Array&lt;Types::Policy&gt; # * {Types::ListAttachedPoliciesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_attached_policies({ # target: "PolicyTarget", # required # recursive: false, # marker: "Marker", # page_size: 1, # }) # # @example Response structure # # resp.policies #=> Array # resp.policies[0].policy_name #=> String # resp.policies[0].policy_arn #=> String # resp.next_marker #=> String # # @overload list_attached_policies(params = {}) # @param [Hash] params ({}) def list_attached_policies(params = {}, options = {}) req = build_request(:list_attached_policies, params) req.send_request(options) end # Lists the findings (results) of a Device Defender audit or of the # audits performed during a specified time period. (Findings are # retained for 180 days.) # # @option params [String] :task_id # A filter to limit results to the audit with the specified ID. You must # specify either the taskId or the startTime and endTime, but not both. # # @option params [String] :check_name # A filter to limit results to the findings for the specified audit # check. # # @option params [Types::ResourceIdentifier] :resource_identifier # Information identifying the noncompliant resource. # # @option params [Integer] :max_results # The maximum number of results to return at one time. The default is # 25. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Time,DateTime,Date,Integer,String] :start_time # A filter to limit results to those found after the specified time. You # must specify either the startTime and endTime or the taskId, but not # both. # # @option params [Time,DateTime,Date,Integer,String] :end_time # A filter to limit results to those found before the specified time. # You must specify either the startTime and endTime or the taskId, but # not both. # # @return [Types::ListAuditFindingsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListAuditFindingsResponse#findings #findings} => Array&lt;Types::AuditFinding&gt; # * {Types::ListAuditFindingsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_audit_findings({ # task_id: "AuditTaskId", # check_name: "AuditCheckName", # resource_identifier: { # device_certificate_id: "CertificateId", # ca_certificate_id: "CertificateId", # cognito_identity_pool_id: "CognitoIdentityPoolId", # client_id: "ClientId", # policy_version_identifier: { # policy_name: "PolicyName", # policy_version_id: "PolicyVersionId", # }, # account: "AwsAccountId", # iam_role_arn: "RoleArn", # role_alias_arn: "RoleAliasArn", # }, # max_results: 1, # next_token: "NextToken", # start_time: Time.now, # end_time: Time.now, # }) # # @example Response structure # # resp.findings #=> Array # resp.findings[0].finding_id #=> String # resp.findings[0].task_id #=> String # resp.findings[0].check_name #=> String # resp.findings[0].task_start_time #=> Time # resp.findings[0].finding_time #=> Time # resp.findings[0].severity #=> String, one of "CRITICAL", "HIGH", "MEDIUM", "LOW" # resp.findings[0].non_compliant_resource.resource_type #=> String, one of "DEVICE_CERTIFICATE", "CA_CERTIFICATE", "IOT_POLICY", "COGNITO_IDENTITY_POOL", "CLIENT_ID", "ACCOUNT_SETTINGS", "ROLE_ALIAS", "IAM_ROLE" # resp.findings[0].non_compliant_resource.resource_identifier.device_certificate_id #=> String # resp.findings[0].non_compliant_resource.resource_identifier.ca_certificate_id #=> String # resp.findings[0].non_compliant_resource.resource_identifier.cognito_identity_pool_id #=> String # resp.findings[0].non_compliant_resource.resource_identifier.client_id #=> String # resp.findings[0].non_compliant_resource.resource_identifier.policy_version_identifier.policy_name #=> String # resp.findings[0].non_compliant_resource.resource_identifier.policy_version_identifier.policy_version_id #=> String # resp.findings[0].non_compliant_resource.resource_identifier.account #=> String # resp.findings[0].non_compliant_resource.resource_identifier.iam_role_arn #=> String # resp.findings[0].non_compliant_resource.resource_identifier.role_alias_arn #=> String # resp.findings[0].non_compliant_resource.additional_info #=> Hash # resp.findings[0].non_compliant_resource.additional_info["String"] #=> String # resp.findings[0].related_resources #=> Array # resp.findings[0].related_resources[0].resource_type #=> String, one of "DEVICE_CERTIFICATE", "CA_CERTIFICATE", "IOT_POLICY", "COGNITO_IDENTITY_POOL", "CLIENT_ID", "ACCOUNT_SETTINGS", "ROLE_ALIAS", "IAM_ROLE" # resp.findings[0].related_resources[0].resource_identifier.device_certificate_id #=> String # resp.findings[0].related_resources[0].resource_identifier.ca_certificate_id #=> String # resp.findings[0].related_resources[0].resource_identifier.cognito_identity_pool_id #=> String # resp.findings[0].related_resources[0].resource_identifier.client_id #=> String # resp.findings[0].related_resources[0].resource_identifier.policy_version_identifier.policy_name #=> String # resp.findings[0].related_resources[0].resource_identifier.policy_version_identifier.policy_version_id #=> String # resp.findings[0].related_resources[0].resource_identifier.account #=> String # resp.findings[0].related_resources[0].resource_identifier.iam_role_arn #=> String # resp.findings[0].related_resources[0].resource_identifier.role_alias_arn #=> String # resp.findings[0].related_resources[0].additional_info #=> Hash # resp.findings[0].related_resources[0].additional_info["String"] #=> String # resp.findings[0].reason_for_non_compliance #=> String # resp.findings[0].reason_for_non_compliance_code #=> String # resp.next_token #=> String # # @overload list_audit_findings(params = {}) # @param [Hash] params ({}) def list_audit_findings(params = {}, options = {}) req = build_request(:list_audit_findings, params) req.send_request(options) end # Gets the status of audit mitigation action tasks that were executed. # # @option params [required, String] :task_id # Specify this filter to limit results to actions for a specific audit # mitigation actions task. # # @option params [String] :action_status # Specify this filter to limit results to those with a specific status. # # @option params [required, String] :finding_id # Specify this filter to limit results to those that were applied to a # specific audit finding. # # @option params [Integer] :max_results # The maximum number of results to return at one time. The default is # 25. # # @option params [String] :next_token # The token for the next set of results. # # @return [Types::ListAuditMitigationActionsExecutionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListAuditMitigationActionsExecutionsResponse#actions_executions #actions_executions} => Array&lt;Types::AuditMitigationActionExecutionMetadata&gt; # * {Types::ListAuditMitigationActionsExecutionsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_audit_mitigation_actions_executions({ # task_id: "AuditMitigationActionsTaskId", # required # action_status: "IN_PROGRESS", # accepts IN_PROGRESS, COMPLETED, FAILED, CANCELED, SKIPPED, PENDING # finding_id: "FindingId", # required # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.actions_executions #=> Array # resp.actions_executions[0].task_id #=> String # resp.actions_executions[0].finding_id #=> String # resp.actions_executions[0].action_name #=> String # resp.actions_executions[0].action_id #=> String # resp.actions_executions[0].status #=> String, one of "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELED", "SKIPPED", "PENDING" # resp.actions_executions[0].start_time #=> Time # resp.actions_executions[0].end_time #=> Time # resp.actions_executions[0].error_code #=> String # resp.actions_executions[0].message #=> String # resp.next_token #=> String # # @overload list_audit_mitigation_actions_executions(params = {}) # @param [Hash] params ({}) def list_audit_mitigation_actions_executions(params = {}, options = {}) req = build_request(:list_audit_mitigation_actions_executions, params) req.send_request(options) end # Gets a list of audit mitigation action tasks that match the specified # filters. # # @option params [String] :audit_task_id # Specify this filter to limit results to tasks that were applied to # results for a specific audit. # # @option params [String] :finding_id # Specify this filter to limit results to tasks that were applied to a # specific audit finding. # # @option params [String] :task_status # Specify this filter to limit results to tasks that are in a specific # state. # # @option params [Integer] :max_results # The maximum number of results to return at one time. The default is # 25. # # @option params [String] :next_token # The token for the next set of results. # # @option params [required, Time,DateTime,Date,Integer,String] :start_time # Specify this filter to limit results to tasks that began on or after a # specific date and time. # # @option params [required, Time,DateTime,Date,Integer,String] :end_time # Specify this filter to limit results to tasks that were completed or # canceled on or before a specific date and time. # # @return [Types::ListAuditMitigationActionsTasksResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListAuditMitigationActionsTasksResponse#tasks #tasks} => Array&lt;Types::AuditMitigationActionsTaskMetadata&gt; # * {Types::ListAuditMitigationActionsTasksResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_audit_mitigation_actions_tasks({ # audit_task_id: "AuditTaskId", # finding_id: "FindingId", # task_status: "IN_PROGRESS", # accepts IN_PROGRESS, COMPLETED, FAILED, CANCELED # max_results: 1, # next_token: "NextToken", # start_time: Time.now, # required # end_time: Time.now, # required # }) # # @example Response structure # # resp.tasks #=> Array # resp.tasks[0].task_id #=> String # resp.tasks[0].start_time #=> Time # resp.tasks[0].task_status #=> String, one of "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELED" # resp.next_token #=> String # # @overload list_audit_mitigation_actions_tasks(params = {}) # @param [Hash] params ({}) def list_audit_mitigation_actions_tasks(params = {}, options = {}) req = build_request(:list_audit_mitigation_actions_tasks, params) req.send_request(options) end # Lists the Device Defender audits that have been performed during a # given time period. # # @option params [required, Time,DateTime,Date,Integer,String] :start_time # The beginning of the time period. Audit information is retained for a # limited time (180 days). Requesting a start time prior to what is # retained results in an "InvalidRequestException". # # @option params [required, Time,DateTime,Date,Integer,String] :end_time # The end of the time period. # # @option params [String] :task_type # A filter to limit the output to the specified type of audit: can be # one of "ON\_DEMAND\_AUDIT\_TASK" or "SCHEDULED\_\_AUDIT\_TASK". # # @option params [String] :task_status # A filter to limit the output to audits with the specified completion # status: can be one of "IN\_PROGRESS", "COMPLETED", "FAILED", or # "CANCELED". # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. The default is # 25. # # @return [Types::ListAuditTasksResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListAuditTasksResponse#tasks #tasks} => Array&lt;Types::AuditTaskMetadata&gt; # * {Types::ListAuditTasksResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_audit_tasks({ # start_time: Time.now, # required # end_time: Time.now, # required # task_type: "ON_DEMAND_AUDIT_TASK", # accepts ON_DEMAND_AUDIT_TASK, SCHEDULED_AUDIT_TASK # task_status: "IN_PROGRESS", # accepts IN_PROGRESS, COMPLETED, FAILED, CANCELED # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.tasks #=> Array # resp.tasks[0].task_id #=> String # resp.tasks[0].task_status #=> String, one of "IN_PROGRESS", "COMPLETED", "FAILED", "CANCELED" # resp.tasks[0].task_type #=> String, one of "ON_DEMAND_AUDIT_TASK", "SCHEDULED_AUDIT_TASK" # resp.next_token #=> String # # @overload list_audit_tasks(params = {}) # @param [Hash] params ({}) def list_audit_tasks(params = {}, options = {}) req = build_request(:list_audit_tasks, params) req.send_request(options) end # Lists the authorizers registered in your account. # # @option params [Integer] :page_size # The maximum number of results to return at one time. # # @option params [String] :marker # A marker used to get the next set of results. # # @option params [Boolean] :ascending_order # Return the list of authorizers in ascending alphabetical order. # # @option params [String] :status # The status of the list authorizers request. # # @return [Types::ListAuthorizersResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListAuthorizersResponse#authorizers #authorizers} => Array&lt;Types::AuthorizerSummary&gt; # * {Types::ListAuthorizersResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_authorizers({ # page_size: 1, # marker: "Marker", # ascending_order: false, # status: "ACTIVE", # accepts ACTIVE, INACTIVE # }) # # @example Response structure # # resp.authorizers #=> Array # resp.authorizers[0].authorizer_name #=> String # resp.authorizers[0].authorizer_arn #=> String # resp.next_marker #=> String # # @overload list_authorizers(params = {}) # @param [Hash] params ({}) def list_authorizers(params = {}, options = {}) req = build_request(:list_authorizers, params) req.send_request(options) end # Lists the billing groups you have created. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return per request. # # @option params [String] :name_prefix_filter # Limit the results to billing groups whose names have the given prefix. # # @return [Types::ListBillingGroupsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListBillingGroupsResponse#billing_groups #billing_groups} => Array&lt;Types::GroupNameAndArn&gt; # * {Types::ListBillingGroupsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_billing_groups({ # next_token: "NextToken", # max_results: 1, # name_prefix_filter: "BillingGroupName", # }) # # @example Response structure # # resp.billing_groups #=> Array # resp.billing_groups[0].group_name #=> String # resp.billing_groups[0].group_arn #=> String # resp.next_token #=> String # # @overload list_billing_groups(params = {}) # @param [Hash] params ({}) def list_billing_groups(params = {}, options = {}) req = build_request(:list_billing_groups, params) req.send_request(options) end # Lists the CA certificates registered for your AWS account. # # The results are paginated with a default page size of 25. You can use # the returned marker to retrieve additional results. # # @option params [Integer] :page_size # The result page size. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Boolean] :ascending_order # Determines the order of the results. # # @return [Types::ListCACertificatesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListCACertificatesResponse#certificates #certificates} => Array&lt;Types::CACertificate&gt; # * {Types::ListCACertificatesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_ca_certificates({ # page_size: 1, # marker: "Marker", # ascending_order: false, # }) # # @example Response structure # # resp.certificates #=> Array # resp.certificates[0].certificate_arn #=> String # resp.certificates[0].certificate_id #=> String # resp.certificates[0].status #=> String, one of "ACTIVE", "INACTIVE" # resp.certificates[0].creation_date #=> Time # resp.next_marker #=> String # # @overload list_ca_certificates(params = {}) # @param [Hash] params ({}) def list_ca_certificates(params = {}, options = {}) req = build_request(:list_ca_certificates, params) req.send_request(options) end # Lists the certificates registered in your AWS account. # # The results are paginated with a default page size of 25. You can use # the returned marker to retrieve additional results. # # @option params [Integer] :page_size # The result page size. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Boolean] :ascending_order # Specifies the order for results. If True, the results are returned in # ascending order, based on the creation date. # # @return [Types::ListCertificatesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListCertificatesResponse#certificates #certificates} => Array&lt;Types::Certificate&gt; # * {Types::ListCertificatesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_certificates({ # page_size: 1, # marker: "Marker", # ascending_order: false, # }) # # @example Response structure # # resp.certificates #=> Array # resp.certificates[0].certificate_arn #=> String # resp.certificates[0].certificate_id #=> String # resp.certificates[0].status #=> String, one of "ACTIVE", "INACTIVE", "REVOKED", "PENDING_TRANSFER", "REGISTER_INACTIVE", "PENDING_ACTIVATION" # resp.certificates[0].certificate_mode #=> String, one of "DEFAULT", "SNI_ONLY" # resp.certificates[0].creation_date #=> Time # resp.next_marker #=> String # # @overload list_certificates(params = {}) # @param [Hash] params ({}) def list_certificates(params = {}, options = {}) req = build_request(:list_certificates, params) req.send_request(options) end # List the device certificates signed by the specified CA certificate. # # @option params [required, String] :ca_certificate_id # The ID of the CA certificate. This operation will list all registered # device certificate that were signed by this CA certificate. # # @option params [Integer] :page_size # The result page size. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Boolean] :ascending_order # Specifies the order for results. If True, the results are returned in # ascending order, based on the creation date. # # @return [Types::ListCertificatesByCAResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListCertificatesByCAResponse#certificates #certificates} => Array&lt;Types::Certificate&gt; # * {Types::ListCertificatesByCAResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_certificates_by_ca({ # ca_certificate_id: "CertificateId", # required # page_size: 1, # marker: "Marker", # ascending_order: false, # }) # # @example Response structure # # resp.certificates #=> Array # resp.certificates[0].certificate_arn #=> String # resp.certificates[0].certificate_id #=> String # resp.certificates[0].status #=> String, one of "ACTIVE", "INACTIVE", "REVOKED", "PENDING_TRANSFER", "REGISTER_INACTIVE", "PENDING_ACTIVATION" # resp.certificates[0].certificate_mode #=> String, one of "DEFAULT", "SNI_ONLY" # resp.certificates[0].creation_date #=> Time # resp.next_marker #=> String # # @overload list_certificates_by_ca(params = {}) # @param [Hash] params ({}) def list_certificates_by_ca(params = {}, options = {}) req = build_request(:list_certificates_by_ca, params) req.send_request(options) end # List the set of dimensions that are defined for your AWS account. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to retrieve at one time. # # @return [Types::ListDimensionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListDimensionsResponse#dimension_names #dimension_names} => Array&lt;String&gt; # * {Types::ListDimensionsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_dimensions({ # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.dimension_names #=> Array # resp.dimension_names[0] #=> String # resp.next_token #=> String # # @overload list_dimensions(params = {}) # @param [Hash] params ({}) def list_dimensions(params = {}, options = {}) req = build_request(:list_dimensions, params) req.send_request(options) end # Gets a list of domain configurations for the user. This list is sorted # alphabetically by domain configuration name. # # <note markdown="1"> The domain configuration feature is in public preview and is subject # to change. # # </note> # # @option params [String] :marker # The marker for the next set of results. # # @option params [Integer] :page_size # The result page size. # # @option params [String] :service_type # The type of service delivered by the endpoint. # # @return [Types::ListDomainConfigurationsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListDomainConfigurationsResponse#domain_configurations #domain_configurations} => Array&lt;Types::DomainConfigurationSummary&gt; # * {Types::ListDomainConfigurationsResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_domain_configurations({ # marker: "Marker", # page_size: 1, # service_type: "DATA", # accepts DATA, CREDENTIAL_PROVIDER, JOBS # }) # # @example Response structure # # resp.domain_configurations #=> Array # resp.domain_configurations[0].domain_configuration_name #=> String # resp.domain_configurations[0].domain_configuration_arn #=> String # resp.domain_configurations[0].service_type #=> String, one of "DATA", "CREDENTIAL_PROVIDER", "JOBS" # resp.next_marker #=> String # # @overload list_domain_configurations(params = {}) # @param [Hash] params ({}) def list_domain_configurations(params = {}, options = {}) req = build_request(:list_domain_configurations, params) req.send_request(options) end # Lists the search indices. # # @option params [String] :next_token # The token used to get the next set of results, or `null` if there are # no additional results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListIndicesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListIndicesResponse#index_names #index_names} => Array&lt;String&gt; # * {Types::ListIndicesResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_indices({ # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.index_names #=> Array # resp.index_names[0] #=> String # resp.next_token #=> String # # @overload list_indices(params = {}) # @param [Hash] params ({}) def list_indices(params = {}, options = {}) req = build_request(:list_indices, params) req.send_request(options) end # Lists the job executions for a job. # # @option params [required, String] :job_id # The unique identifier you assigned to this job when it was created. # # @option params [String] :status # The status of the job. # # @option params [Integer] :max_results # The maximum number of results to be returned per request. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @return [Types::ListJobExecutionsForJobResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListJobExecutionsForJobResponse#execution_summaries #execution_summaries} => Array&lt;Types::JobExecutionSummaryForJob&gt; # * {Types::ListJobExecutionsForJobResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_job_executions_for_job({ # job_id: "JobId", # required # status: "QUEUED", # accepts QUEUED, IN_PROGRESS, SUCCEEDED, FAILED, TIMED_OUT, REJECTED, REMOVED, CANCELED # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.execution_summaries #=> Array # resp.execution_summaries[0].thing_arn #=> String # resp.execution_summaries[0].job_execution_summary.status #=> String, one of "QUEUED", "IN_PROGRESS", "SUCCEEDED", "FAILED", "TIMED_OUT", "REJECTED", "REMOVED", "CANCELED" # resp.execution_summaries[0].job_execution_summary.queued_at #=> Time # resp.execution_summaries[0].job_execution_summary.started_at #=> Time # resp.execution_summaries[0].job_execution_summary.last_updated_at #=> Time # resp.execution_summaries[0].job_execution_summary.execution_number #=> Integer # resp.next_token #=> String # # @overload list_job_executions_for_job(params = {}) # @param [Hash] params ({}) def list_job_executions_for_job(params = {}, options = {}) req = build_request(:list_job_executions_for_job, params) req.send_request(options) end # Lists the job executions for the specified thing. # # @option params [required, String] :thing_name # The thing name. # # @option params [String] :status # An optional filter that lets you search for jobs that have the # specified status. # # @option params [Integer] :max_results # The maximum number of results to be returned per request. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @return [Types::ListJobExecutionsForThingResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListJobExecutionsForThingResponse#execution_summaries #execution_summaries} => Array&lt;Types::JobExecutionSummaryForThing&gt; # * {Types::ListJobExecutionsForThingResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_job_executions_for_thing({ # thing_name: "ThingName", # required # status: "QUEUED", # accepts QUEUED, IN_PROGRESS, SUCCEEDED, FAILED, TIMED_OUT, REJECTED, REMOVED, CANCELED # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.execution_summaries #=> Array # resp.execution_summaries[0].job_id #=> String # resp.execution_summaries[0].job_execution_summary.status #=> String, one of "QUEUED", "IN_PROGRESS", "SUCCEEDED", "FAILED", "TIMED_OUT", "REJECTED", "REMOVED", "CANCELED" # resp.execution_summaries[0].job_execution_summary.queued_at #=> Time # resp.execution_summaries[0].job_execution_summary.started_at #=> Time # resp.execution_summaries[0].job_execution_summary.last_updated_at #=> Time # resp.execution_summaries[0].job_execution_summary.execution_number #=> Integer # resp.next_token #=> String # # @overload list_job_executions_for_thing(params = {}) # @param [Hash] params ({}) def list_job_executions_for_thing(params = {}, options = {}) req = build_request(:list_job_executions_for_thing, params) req.send_request(options) end # Lists jobs. # # @option params [String] :status # An optional filter that lets you search for jobs that have the # specified status. # # @option params [String] :target_selection # Specifies whether the job will continue to run (CONTINUOUS), or will # be complete after all those things specified as targets have completed # the job (SNAPSHOT). If continuous, the job may also be run on a thing # when a change is detected in a target. For example, a job will run on # a thing when the thing is added to a target group, even after the job # was completed by all things originally in the group. # # @option params [Integer] :max_results # The maximum number of results to return per request. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [String] :thing_group_name # A filter that limits the returned jobs to those for the specified # group. # # @option params [String] :thing_group_id # A filter that limits the returned jobs to those for the specified # group. # # @return [Types::ListJobsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListJobsResponse#jobs #jobs} => Array&lt;Types::JobSummary&gt; # * {Types::ListJobsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_jobs({ # status: "IN_PROGRESS", # accepts IN_PROGRESS, CANCELED, COMPLETED, DELETION_IN_PROGRESS # target_selection: "CONTINUOUS", # accepts CONTINUOUS, SNAPSHOT # max_results: 1, # next_token: "NextToken", # thing_group_name: "ThingGroupName", # thing_group_id: "ThingGroupId", # }) # # @example Response structure # # resp.jobs #=> Array # resp.jobs[0].job_arn #=> String # resp.jobs[0].job_id #=> String # resp.jobs[0].thing_group_id #=> String # resp.jobs[0].target_selection #=> String, one of "CONTINUOUS", "SNAPSHOT" # resp.jobs[0].status #=> String, one of "IN_PROGRESS", "CANCELED", "COMPLETED", "DELETION_IN_PROGRESS" # resp.jobs[0].created_at #=> Time # resp.jobs[0].last_updated_at #=> Time # resp.jobs[0].completed_at #=> Time # resp.next_token #=> String # # @overload list_jobs(params = {}) # @param [Hash] params ({}) def list_jobs(params = {}, options = {}) req = build_request(:list_jobs, params) req.send_request(options) end # Gets a list of all mitigation actions that match the specified filter # criteria. # # @option params [String] :action_type # Specify a value to limit the result to mitigation actions with a # specific action type. # # @option params [Integer] :max_results # The maximum number of results to return at one time. The default is # 25. # # @option params [String] :next_token # The token for the next set of results. # # @return [Types::ListMitigationActionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListMitigationActionsResponse#action_identifiers #action_identifiers} => Array&lt;Types::MitigationActionIdentifier&gt; # * {Types::ListMitigationActionsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_mitigation_actions({ # action_type: "UPDATE_DEVICE_CERTIFICATE", # accepts UPDATE_DEVICE_CERTIFICATE, UPDATE_CA_CERTIFICATE, ADD_THINGS_TO_THING_GROUP, REPLACE_DEFAULT_POLICY_VERSION, ENABLE_IOT_LOGGING, PUBLISH_FINDING_TO_SNS # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.action_identifiers #=> Array # resp.action_identifiers[0].action_name #=> String # resp.action_identifiers[0].action_arn #=> String # resp.action_identifiers[0].creation_date #=> Time # resp.next_token #=> String # # @overload list_mitigation_actions(params = {}) # @param [Hash] params ({}) def list_mitigation_actions(params = {}, options = {}) req = build_request(:list_mitigation_actions, params) req.send_request(options) end # Lists OTA updates. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :next_token # A token used to retrieve the next set of results. # # @option params [String] :ota_update_status # The OTA update job status. # # @return [Types::ListOTAUpdatesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListOTAUpdatesResponse#ota_updates #ota_updates} => Array&lt;Types::OTAUpdateSummary&gt; # * {Types::ListOTAUpdatesResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_ota_updates({ # max_results: 1, # next_token: "NextToken", # ota_update_status: "CREATE_PENDING", # accepts CREATE_PENDING, CREATE_IN_PROGRESS, CREATE_COMPLETE, CREATE_FAILED # }) # # @example Response structure # # resp.ota_updates #=> Array # resp.ota_updates[0].ota_update_id #=> String # resp.ota_updates[0].ota_update_arn #=> String # resp.ota_updates[0].creation_date #=> Time # resp.next_token #=> String # # @overload list_ota_updates(params = {}) # @param [Hash] params ({}) def list_ota_updates(params = {}, options = {}) req = build_request(:list_ota_updates, params) req.send_request(options) end # Lists certificates that are being transferred but not yet accepted. # # @option params [Integer] :page_size # The result page size. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Boolean] :ascending_order # Specifies the order for results. If True, the results are returned in # ascending order, based on the creation date. # # @return [Types::ListOutgoingCertificatesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListOutgoingCertificatesResponse#outgoing_certificates #outgoing_certificates} => Array&lt;Types::OutgoingCertificate&gt; # * {Types::ListOutgoingCertificatesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_outgoing_certificates({ # page_size: 1, # marker: "Marker", # ascending_order: false, # }) # # @example Response structure # # resp.outgoing_certificates #=> Array # resp.outgoing_certificates[0].certificate_arn #=> String # resp.outgoing_certificates[0].certificate_id #=> String # resp.outgoing_certificates[0].transferred_to #=> String # resp.outgoing_certificates[0].transfer_date #=> Time # resp.outgoing_certificates[0].transfer_message #=> String # resp.outgoing_certificates[0].creation_date #=> Time # resp.next_marker #=> String # # @overload list_outgoing_certificates(params = {}) # @param [Hash] params ({}) def list_outgoing_certificates(params = {}, options = {}) req = build_request(:list_outgoing_certificates, params) req.send_request(options) end # Lists your policies. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Integer] :page_size # The result page size. # # @option params [Boolean] :ascending_order # Specifies the order for results. If true, the results are returned in # ascending creation order. # # @return [Types::ListPoliciesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListPoliciesResponse#policies #policies} => Array&lt;Types::Policy&gt; # * {Types::ListPoliciesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_policies({ # marker: "Marker", # page_size: 1, # ascending_order: false, # }) # # @example Response structure # # resp.policies #=> Array # resp.policies[0].policy_name #=> String # resp.policies[0].policy_arn #=> String # resp.next_marker #=> String # # @overload list_policies(params = {}) # @param [Hash] params ({}) def list_policies(params = {}, options = {}) req = build_request(:list_policies, params) req.send_request(options) end # Lists the principals associated with the specified policy. # # **Note:** This API is deprecated. Please use ListTargetsForPolicy # instead. # # @option params [required, String] :policy_name # The policy name. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Integer] :page_size # The result page size. # # @option params [Boolean] :ascending_order # Specifies the order for results. If true, the results are returned in # ascending creation order. # # @return [Types::ListPolicyPrincipalsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListPolicyPrincipalsResponse#principals #principals} => Array&lt;String&gt; # * {Types::ListPolicyPrincipalsResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_policy_principals({ # policy_name: "PolicyName", # required # marker: "Marker", # page_size: 1, # ascending_order: false, # }) # # @example Response structure # # resp.principals #=> Array # resp.principals[0] #=> String # resp.next_marker #=> String # # @overload list_policy_principals(params = {}) # @param [Hash] params ({}) def list_policy_principals(params = {}, options = {}) req = build_request(:list_policy_principals, params) req.send_request(options) end # Lists the versions of the specified policy and identifies the default # version. # # @option params [required, String] :policy_name # The policy name. # # @return [Types::ListPolicyVersionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListPolicyVersionsResponse#policy_versions #policy_versions} => Array&lt;Types::PolicyVersion&gt; # # @example Request syntax with placeholder values # # resp = client.list_policy_versions({ # policy_name: "PolicyName", # required # }) # # @example Response structure # # resp.policy_versions #=> Array # resp.policy_versions[0].version_id #=> String # resp.policy_versions[0].is_default_version #=> Boolean # resp.policy_versions[0].create_date #=> Time # # @overload list_policy_versions(params = {}) # @param [Hash] params ({}) def list_policy_versions(params = {}, options = {}) req = build_request(:list_policy_versions, params) req.send_request(options) end # Lists the policies attached to the specified principal. If you use an # Cognito identity, the ID must be in [AmazonCognito Identity # format][1]. # # **Note:** This API is deprecated. Please use ListAttachedPolicies # instead. # # # # [1]: https://docs.aws.amazon.com/cognitoidentity/latest/APIReference/API_GetCredentialsForIdentity.html#API_GetCredentialsForIdentity_RequestSyntax # # @option params [required, String] :principal # The principal. # # @option params [String] :marker # The marker for the next set of results. # # @option params [Integer] :page_size # The result page size. # # @option params [Boolean] :ascending_order # Specifies the order for results. If true, results are returned in # ascending creation order. # # @return [Types::ListPrincipalPoliciesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListPrincipalPoliciesResponse#policies #policies} => Array&lt;Types::Policy&gt; # * {Types::ListPrincipalPoliciesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_principal_policies({ # principal: "Principal", # required # marker: "Marker", # page_size: 1, # ascending_order: false, # }) # # @example Response structure # # resp.policies #=> Array # resp.policies[0].policy_name #=> String # resp.policies[0].policy_arn #=> String # resp.next_marker #=> String # # @overload list_principal_policies(params = {}) # @param [Hash] params ({}) def list_principal_policies(params = {}, options = {}) req = build_request(:list_principal_policies, params) req.send_request(options) end # Lists the things associated with the specified principal. A principal # can be X.509 certificates, IAM users, groups, and roles, Amazon # Cognito identities or federated identities. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return in this operation. # # @option params [required, String] :principal # The principal. # # @return [Types::ListPrincipalThingsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListPrincipalThingsResponse#things #things} => Array&lt;String&gt; # * {Types::ListPrincipalThingsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_principal_things({ # next_token: "NextToken", # max_results: 1, # principal: "Principal", # required # }) # # @example Response structure # # resp.things #=> Array # resp.things[0] #=> String # resp.next_token #=> String # # @overload list_principal_things(params = {}) # @param [Hash] params ({}) def list_principal_things(params = {}, options = {}) req = build_request(:list_principal_things, params) req.send_request(options) end # A list of fleet provisioning template versions. # # @option params [required, String] :template_name # The name of the fleet provisioning template. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :next_token # A token to retrieve the next set of results. # # @return [Types::ListProvisioningTemplateVersionsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListProvisioningTemplateVersionsResponse#versions #versions} => Array&lt;Types::ProvisioningTemplateVersionSummary&gt; # * {Types::ListProvisioningTemplateVersionsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_provisioning_template_versions({ # template_name: "TemplateName", # required # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.versions #=> Array # resp.versions[0].version_id #=> Integer # resp.versions[0].creation_date #=> Time # resp.versions[0].is_default_version #=> Boolean # resp.next_token #=> String # # @overload list_provisioning_template_versions(params = {}) # @param [Hash] params ({}) def list_provisioning_template_versions(params = {}, options = {}) req = build_request(:list_provisioning_template_versions, params) req.send_request(options) end # Lists the fleet provisioning templates in your AWS account. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :next_token # A token to retrieve the next set of results. # # @return [Types::ListProvisioningTemplatesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListProvisioningTemplatesResponse#templates #templates} => Array&lt;Types::ProvisioningTemplateSummary&gt; # * {Types::ListProvisioningTemplatesResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_provisioning_templates({ # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.templates #=> Array # resp.templates[0].template_arn #=> String # resp.templates[0].template_name #=> String # resp.templates[0].description #=> String # resp.templates[0].creation_date #=> Time # resp.templates[0].last_modified_date #=> Time # resp.templates[0].enabled #=> Boolean # resp.next_token #=> String # # @overload list_provisioning_templates(params = {}) # @param [Hash] params ({}) def list_provisioning_templates(params = {}, options = {}) req = build_request(:list_provisioning_templates, params) req.send_request(options) end # Lists the role aliases registered in your account. # # @option params [Integer] :page_size # The maximum number of results to return at one time. # # @option params [String] :marker # A marker used to get the next set of results. # # @option params [Boolean] :ascending_order # Return the list of role aliases in ascending alphabetical order. # # @return [Types::ListRoleAliasesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListRoleAliasesResponse#role_aliases #role_aliases} => Array&lt;String&gt; # * {Types::ListRoleAliasesResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_role_aliases({ # page_size: 1, # marker: "Marker", # ascending_order: false, # }) # # @example Response structure # # resp.role_aliases #=> Array # resp.role_aliases[0] #=> String # resp.next_marker #=> String # # @overload list_role_aliases(params = {}) # @param [Hash] params ({}) def list_role_aliases(params = {}, options = {}) req = build_request(:list_role_aliases, params) req.send_request(options) end # Lists all of your scheduled audits. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. The default is # 25. # # @return [Types::ListScheduledAuditsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListScheduledAuditsResponse#scheduled_audits #scheduled_audits} => Array&lt;Types::ScheduledAuditMetadata&gt; # * {Types::ListScheduledAuditsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_scheduled_audits({ # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.scheduled_audits #=> Array # resp.scheduled_audits[0].scheduled_audit_name #=> String # resp.scheduled_audits[0].scheduled_audit_arn #=> String # resp.scheduled_audits[0].frequency #=> String, one of "DAILY", "WEEKLY", "BIWEEKLY", "MONTHLY" # resp.scheduled_audits[0].day_of_month #=> String # resp.scheduled_audits[0].day_of_week #=> String, one of "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" # resp.next_token #=> String # # @overload list_scheduled_audits(params = {}) # @param [Hash] params ({}) def list_scheduled_audits(params = {}, options = {}) req = build_request(:list_scheduled_audits, params) req.send_request(options) end # Lists the Device Defender security profiles you have created. You can # use filters to list only those security profiles associated with a # thing group or only those associated with your account. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :dimension_name # A filter to limit results to the security profiles that use the # defined dimension. # # @return [Types::ListSecurityProfilesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListSecurityProfilesResponse#security_profile_identifiers #security_profile_identifiers} => Array&lt;Types::SecurityProfileIdentifier&gt; # * {Types::ListSecurityProfilesResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_security_profiles({ # next_token: "NextToken", # max_results: 1, # dimension_name: "DimensionName", # }) # # @example Response structure # # resp.security_profile_identifiers #=> Array # resp.security_profile_identifiers[0].name #=> String # resp.security_profile_identifiers[0].arn #=> String # resp.next_token #=> String # # @overload list_security_profiles(params = {}) # @param [Hash] params ({}) def list_security_profiles(params = {}, options = {}) req = build_request(:list_security_profiles, params) req.send_request(options) end # Lists the Device Defender security profiles attached to a target # (thing group). # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [Boolean] :recursive # If true, return child groups too. # # @option params [required, String] :security_profile_target_arn # The ARN of the target (thing group) whose attached security profiles # you want to get. # # @return [Types::ListSecurityProfilesForTargetResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListSecurityProfilesForTargetResponse#security_profile_target_mappings #security_profile_target_mappings} => Array&lt;Types::SecurityProfileTargetMapping&gt; # * {Types::ListSecurityProfilesForTargetResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_security_profiles_for_target({ # next_token: "NextToken", # max_results: 1, # recursive: false, # security_profile_target_arn: "SecurityProfileTargetArn", # required # }) # # @example Response structure # # resp.security_profile_target_mappings #=> Array # resp.security_profile_target_mappings[0].security_profile_identifier.name #=> String # resp.security_profile_target_mappings[0].security_profile_identifier.arn #=> String # resp.security_profile_target_mappings[0].target.arn #=> String # resp.next_token #=> String # # @overload list_security_profiles_for_target(params = {}) # @param [Hash] params ({}) def list_security_profiles_for_target(params = {}, options = {}) req = build_request(:list_security_profiles_for_target, params) req.send_request(options) end # Lists all of the streams in your AWS account. # # @option params [Integer] :max_results # The maximum number of results to return at a time. # # @option params [String] :next_token # A token used to get the next set of results. # # @option params [Boolean] :ascending_order # Set to true to return the list of streams in ascending order. # # @return [Types::ListStreamsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListStreamsResponse#streams #streams} => Array&lt;Types::StreamSummary&gt; # * {Types::ListStreamsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_streams({ # max_results: 1, # next_token: "NextToken", # ascending_order: false, # }) # # @example Response structure # # resp.streams #=> Array # resp.streams[0].stream_id #=> String # resp.streams[0].stream_arn #=> String # resp.streams[0].stream_version #=> Integer # resp.streams[0].description #=> String # resp.next_token #=> String # # @overload list_streams(params = {}) # @param [Hash] params ({}) def list_streams(params = {}, options = {}) req = build_request(:list_streams, params) req.send_request(options) end # Lists the tags (metadata) you have assigned to the resource. # # @option params [required, String] :resource_arn # The ARN of the resource. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @return [Types::ListTagsForResourceResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTagsForResourceResponse#tags #tags} => Array&lt;Types::Tag&gt; # * {Types::ListTagsForResourceResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_tags_for_resource({ # resource_arn: "ResourceArn", # required # next_token: "NextToken", # }) # # @example Response structure # # resp.tags #=> Array # resp.tags[0].key #=> String # resp.tags[0].value #=> String # resp.next_token #=> String # # @overload list_tags_for_resource(params = {}) # @param [Hash] params ({}) def list_tags_for_resource(params = {}, options = {}) req = build_request(:list_tags_for_resource, params) req.send_request(options) end # List targets for the specified policy. # # @option params [required, String] :policy_name # The policy name. # # @option params [String] :marker # A marker used to get the next set of results. # # @option params [Integer] :page_size # The maximum number of results to return at one time. # # @return [Types::ListTargetsForPolicyResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTargetsForPolicyResponse#targets #targets} => Array&lt;String&gt; # * {Types::ListTargetsForPolicyResponse#next_marker #next_marker} => String # # @example Request syntax with placeholder values # # resp = client.list_targets_for_policy({ # policy_name: "PolicyName", # required # marker: "Marker", # page_size: 1, # }) # # @example Response structure # # resp.targets #=> Array # resp.targets[0] #=> String # resp.next_marker #=> String # # @overload list_targets_for_policy(params = {}) # @param [Hash] params ({}) def list_targets_for_policy(params = {}, options = {}) req = build_request(:list_targets_for_policy, params) req.send_request(options) end # Lists the targets (thing groups) associated with a given Device # Defender security profile. # # @option params [required, String] :security_profile_name # The security profile. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListTargetsForSecurityProfileResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTargetsForSecurityProfileResponse#security_profile_targets #security_profile_targets} => Array&lt;Types::SecurityProfileTarget&gt; # * {Types::ListTargetsForSecurityProfileResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_targets_for_security_profile({ # security_profile_name: "SecurityProfileName", # required # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.security_profile_targets #=> Array # resp.security_profile_targets[0].arn #=> String # resp.next_token #=> String # # @overload list_targets_for_security_profile(params = {}) # @param [Hash] params ({}) def list_targets_for_security_profile(params = {}, options = {}) req = build_request(:list_targets_for_security_profile, params) req.send_request(options) end # List the thing groups in your account. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :parent_group # A filter that limits the results to those with the specified parent # group. # # @option params [String] :name_prefix_filter # A filter that limits the results to those with the specified name # prefix. # # @option params [Boolean] :recursive # If true, return child groups as well. # # @return [Types::ListThingGroupsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingGroupsResponse#thing_groups #thing_groups} => Array&lt;Types::GroupNameAndArn&gt; # * {Types::ListThingGroupsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_thing_groups({ # next_token: "NextToken", # max_results: 1, # parent_group: "ThingGroupName", # name_prefix_filter: "ThingGroupName", # recursive: false, # }) # # @example Response structure # # resp.thing_groups #=> Array # resp.thing_groups[0].group_name #=> String # resp.thing_groups[0].group_arn #=> String # resp.next_token #=> String # # @overload list_thing_groups(params = {}) # @param [Hash] params ({}) def list_thing_groups(params = {}, options = {}) req = build_request(:list_thing_groups, params) req.send_request(options) end # List the thing groups to which the specified thing belongs. # # @option params [required, String] :thing_name # The thing name. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListThingGroupsForThingResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingGroupsForThingResponse#thing_groups #thing_groups} => Array&lt;Types::GroupNameAndArn&gt; # * {Types::ListThingGroupsForThingResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_thing_groups_for_thing({ # thing_name: "ThingName", # required # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.thing_groups #=> Array # resp.thing_groups[0].group_name #=> String # resp.thing_groups[0].group_arn #=> String # resp.next_token #=> String # # @overload list_thing_groups_for_thing(params = {}) # @param [Hash] params ({}) def list_thing_groups_for_thing(params = {}, options = {}) req = build_request(:list_thing_groups_for_thing, params) req.send_request(options) end # Lists the principals associated with the specified thing. A principal # can be X.509 certificates, IAM users, groups, and roles, Amazon # Cognito identities or federated identities. # # @option params [required, String] :thing_name # The name of the thing. # # @return [Types::ListThingPrincipalsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingPrincipalsResponse#principals #principals} => Array&lt;String&gt; # # @example Request syntax with placeholder values # # resp = client.list_thing_principals({ # thing_name: "ThingName", # required # }) # # @example Response structure # # resp.principals #=> Array # resp.principals[0] #=> String # # @overload list_thing_principals(params = {}) # @param [Hash] params ({}) def list_thing_principals(params = {}, options = {}) req = build_request(:list_thing_principals, params) req.send_request(options) end # Information about the thing registration tasks. # # @option params [required, String] :task_id # The id of the task. # # @option params [required, String] :report_type # The type of task report. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return per request. # # @return [Types::ListThingRegistrationTaskReportsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingRegistrationTaskReportsResponse#resource_links #resource_links} => Array&lt;String&gt; # * {Types::ListThingRegistrationTaskReportsResponse#report_type #report_type} => String # * {Types::ListThingRegistrationTaskReportsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_thing_registration_task_reports({ # task_id: "TaskId", # required # report_type: "ERRORS", # required, accepts ERRORS, RESULTS # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.resource_links #=> Array # resp.resource_links[0] #=> String # resp.report_type #=> String, one of "ERRORS", "RESULTS" # resp.next_token #=> String # # @overload list_thing_registration_task_reports(params = {}) # @param [Hash] params ({}) def list_thing_registration_task_reports(params = {}, options = {}) req = build_request(:list_thing_registration_task_reports, params) req.send_request(options) end # List bulk thing provisioning tasks. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :status # The status of the bulk thing provisioning task. # # @return [Types::ListThingRegistrationTasksResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingRegistrationTasksResponse#task_ids #task_ids} => Array&lt;String&gt; # * {Types::ListThingRegistrationTasksResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_thing_registration_tasks({ # next_token: "NextToken", # max_results: 1, # status: "InProgress", # accepts InProgress, Completed, Failed, Cancelled, Cancelling # }) # # @example Response structure # # resp.task_ids #=> Array # resp.task_ids[0] #=> String # resp.next_token #=> String # # @overload list_thing_registration_tasks(params = {}) # @param [Hash] params ({}) def list_thing_registration_tasks(params = {}, options = {}) req = build_request(:list_thing_registration_tasks, params) req.send_request(options) end # Lists the existing thing types. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return in this operation. # # @option params [String] :thing_type_name # The name of the thing type. # # @return [Types::ListThingTypesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingTypesResponse#thing_types #thing_types} => Array&lt;Types::ThingTypeDefinition&gt; # * {Types::ListThingTypesResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_thing_types({ # next_token: "NextToken", # max_results: 1, # thing_type_name: "ThingTypeName", # }) # # @example Response structure # # resp.thing_types #=> Array # resp.thing_types[0].thing_type_name #=> String # resp.thing_types[0].thing_type_arn #=> String # resp.thing_types[0].thing_type_properties.thing_type_description #=> String # resp.thing_types[0].thing_type_properties.searchable_attributes #=> Array # resp.thing_types[0].thing_type_properties.searchable_attributes[0] #=> String # resp.thing_types[0].thing_type_metadata.deprecated #=> Boolean # resp.thing_types[0].thing_type_metadata.deprecation_date #=> Time # resp.thing_types[0].thing_type_metadata.creation_date #=> Time # resp.next_token #=> String # # @overload list_thing_types(params = {}) # @param [Hash] params ({}) def list_thing_types(params = {}, options = {}) req = build_request(:list_thing_types, params) req.send_request(options) end # Lists your things. Use the **attributeName** and **attributeValue** # parameters to filter your things. For example, calling `ListThings` # with attributeName=Color and attributeValue=Red retrieves all things # in the registry that contain an attribute **Color** with the value # **Red**. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return in this operation. # # @option params [String] :attribute_name # The attribute name used to search for things. # # @option params [String] :attribute_value # The attribute value used to search for things. # # @option params [String] :thing_type_name # The name of the thing type used to search for things. # # @return [Types::ListThingsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingsResponse#things #things} => Array&lt;Types::ThingAttribute&gt; # * {Types::ListThingsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_things({ # next_token: "NextToken", # max_results: 1, # attribute_name: "AttributeName", # attribute_value: "AttributeValue", # thing_type_name: "ThingTypeName", # }) # # @example Response structure # # resp.things #=> Array # resp.things[0].thing_name #=> String # resp.things[0].thing_type_name #=> String # resp.things[0].thing_arn #=> String # resp.things[0].attributes #=> Hash # resp.things[0].attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil> # resp.things[0].version #=> Integer # resp.next_token #=> String # # @overload list_things(params = {}) # @param [Hash] params ({}) def list_things(params = {}, options = {}) req = build_request(:list_things, params) req.send_request(options) end # Lists the things you have added to the given billing group. # # @option params [required, String] :billing_group_name # The name of the billing group. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return per request. # # @return [Types::ListThingsInBillingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingsInBillingGroupResponse#things #things} => Array&lt;String&gt; # * {Types::ListThingsInBillingGroupResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_things_in_billing_group({ # billing_group_name: "BillingGroupName", # required # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.things #=> Array # resp.things[0] #=> String # resp.next_token #=> String # # @overload list_things_in_billing_group(params = {}) # @param [Hash] params ({}) def list_things_in_billing_group(params = {}, options = {}) req = build_request(:list_things_in_billing_group, params) req.send_request(options) end # Lists the things in the specified group. # # @option params [required, String] :thing_group_name # The thing group name. # # @option params [Boolean] :recursive # When true, list things in this thing group and in all child groups as # well. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListThingsInThingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListThingsInThingGroupResponse#things #things} => Array&lt;String&gt; # * {Types::ListThingsInThingGroupResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_things_in_thing_group({ # thing_group_name: "ThingGroupName", # required # recursive: false, # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.things #=> Array # resp.things[0] #=> String # resp.next_token #=> String # # @overload list_things_in_thing_group(params = {}) # @param [Hash] params ({}) def list_things_in_thing_group(params = {}, options = {}) req = build_request(:list_things_in_thing_group, params) req.send_request(options) end # Lists all the topic rule destinations in your AWS account. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :next_token # The token to retrieve the next set of results. # # @return [Types::ListTopicRuleDestinationsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTopicRuleDestinationsResponse#destination_summaries #destination_summaries} => Array&lt;Types::TopicRuleDestinationSummary&gt; # * {Types::ListTopicRuleDestinationsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_topic_rule_destinations({ # max_results: 1, # next_token: "NextToken", # }) # # @example Response structure # # resp.destination_summaries #=> Array # resp.destination_summaries[0].arn #=> String # resp.destination_summaries[0].status #=> String, one of "ENABLED", "IN_PROGRESS", "DISABLED", "ERROR" # resp.destination_summaries[0].status_reason #=> String # resp.destination_summaries[0].http_url_summary.confirmation_url #=> String # resp.next_token #=> String # # @overload list_topic_rule_destinations(params = {}) # @param [Hash] params ({}) def list_topic_rule_destinations(params = {}, options = {}) req = build_request(:list_topic_rule_destinations, params) req.send_request(options) end # Lists the rules for the specific topic. # # @option params [String] :topic # The topic. # # @option params [Integer] :max_results # The maximum number of results to return. # # @option params [String] :next_token # A token used to retrieve the next value. # # @option params [Boolean] :rule_disabled # Specifies whether the rule is disabled. # # @return [Types::ListTopicRulesResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListTopicRulesResponse#rules #rules} => Array&lt;Types::TopicRuleListItem&gt; # * {Types::ListTopicRulesResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_topic_rules({ # topic: "Topic", # max_results: 1, # next_token: "NextToken", # rule_disabled: false, # }) # # @example Response structure # # resp.rules #=> Array # resp.rules[0].rule_arn #=> String # resp.rules[0].rule_name #=> String # resp.rules[0].topic_pattern #=> String # resp.rules[0].created_at #=> Time # resp.rules[0].rule_disabled #=> Boolean # resp.next_token #=> String # # @overload list_topic_rules(params = {}) # @param [Hash] params ({}) def list_topic_rules(params = {}, options = {}) req = build_request(:list_topic_rules, params) req.send_request(options) end # Lists logging levels. # # @option params [String] :target_type # The type of resource for which you are configuring logging. Must be # `THING_Group`. # # @option params [String] :next_token # The token used to get the next set of results, or **null** if there # are no additional results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListV2LoggingLevelsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListV2LoggingLevelsResponse#log_target_configurations #log_target_configurations} => Array&lt;Types::LogTargetConfiguration&gt; # * {Types::ListV2LoggingLevelsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_v2_logging_levels({ # target_type: "DEFAULT", # accepts DEFAULT, THING_GROUP # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.log_target_configurations #=> Array # resp.log_target_configurations[0].log_target.target_type #=> String, one of "DEFAULT", "THING_GROUP" # resp.log_target_configurations[0].log_target.target_name #=> String # resp.log_target_configurations[0].log_level #=> String, one of "DEBUG", "INFO", "ERROR", "WARN", "DISABLED" # resp.next_token #=> String # # @overload list_v2_logging_levels(params = {}) # @param [Hash] params ({}) def list_v2_logging_levels(params = {}, options = {}) req = build_request(:list_v2_logging_levels, params) req.send_request(options) end # Lists the Device Defender security profile violations discovered # during the given time period. You can use filters to limit the results # to those alerts issued for a particular security profile, behavior, or # thing (device). # # @option params [required, Time,DateTime,Date,Integer,String] :start_time # The start time for the alerts to be listed. # # @option params [required, Time,DateTime,Date,Integer,String] :end_time # The end time for the alerts to be listed. # # @option params [String] :thing_name # A filter to limit results to those alerts caused by the specified # thing. # # @option params [String] :security_profile_name # A filter to limit results to those alerts generated by the specified # security profile. # # @option params [String] :next_token # The token for the next set of results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @return [Types::ListViolationEventsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ListViolationEventsResponse#violation_events #violation_events} => Array&lt;Types::ViolationEvent&gt; # * {Types::ListViolationEventsResponse#next_token #next_token} => String # # @example Request syntax with placeholder values # # resp = client.list_violation_events({ # start_time: Time.now, # required # end_time: Time.now, # required # thing_name: "DeviceDefenderThingName", # security_profile_name: "SecurityProfileName", # next_token: "NextToken", # max_results: 1, # }) # # @example Response structure # # resp.violation_events #=> Array # resp.violation_events[0].violation_id #=> String # resp.violation_events[0].thing_name #=> String # resp.violation_events[0].security_profile_name #=> String # resp.violation_events[0].behavior.name #=> String # resp.violation_events[0].behavior.metric #=> String # resp.violation_events[0].behavior.metric_dimension.dimension_name #=> String # resp.violation_events[0].behavior.metric_dimension.operator #=> String, one of "IN", "NOT_IN" # resp.violation_events[0].behavior.criteria.comparison_operator #=> String, one of "less-than", "less-than-equals", "greater-than", "greater-than-equals", "in-cidr-set", "not-in-cidr-set", "in-port-set", "not-in-port-set" # resp.violation_events[0].behavior.criteria.value.count #=> Integer # resp.violation_events[0].behavior.criteria.value.cidrs #=> Array # resp.violation_events[0].behavior.criteria.value.cidrs[0] #=> String # resp.violation_events[0].behavior.criteria.value.ports #=> Array # resp.violation_events[0].behavior.criteria.value.ports[0] #=> Integer # resp.violation_events[0].behavior.criteria.duration_seconds #=> Integer # resp.violation_events[0].behavior.criteria.consecutive_datapoints_to_alarm #=> Integer # resp.violation_events[0].behavior.criteria.consecutive_datapoints_to_clear #=> Integer # resp.violation_events[0].behavior.criteria.statistical_threshold.statistic #=> String # resp.violation_events[0].metric_value.count #=> Integer # resp.violation_events[0].metric_value.cidrs #=> Array # resp.violation_events[0].metric_value.cidrs[0] #=> String # resp.violation_events[0].metric_value.ports #=> Array # resp.violation_events[0].metric_value.ports[0] #=> Integer # resp.violation_events[0].violation_event_type #=> String, one of "in-alarm", "alarm-cleared", "alarm-invalidated" # resp.violation_events[0].violation_event_time #=> Time # resp.next_token #=> String # # @overload list_violation_events(params = {}) # @param [Hash] params ({}) def list_violation_events(params = {}, options = {}) req = build_request(:list_violation_events, params) req.send_request(options) end # Registers a CA certificate with AWS IoT. This CA certificate can then # be used to sign device certificates, which can be then registered with # AWS IoT. You can register up to 10 CA certificates per AWS account # that have the same subject field. This enables you to have up to 10 # certificate authorities sign your device certificates. If you have # more than one CA certificate registered, make sure you pass the CA # certificate when you register your device certificates with the # RegisterCertificate API. # # @option params [required, String] :ca_certificate # The CA certificate. # # @option params [required, String] :verification_certificate # The private key verification certificate. # # @option params [Boolean] :set_as_active # A boolean value that specifies if the CA certificate is set to active. # # @option params [Boolean] :allow_auto_registration # Allows this CA certificate to be used for auto registration of device # certificates. # # @option params [Types::RegistrationConfig] :registration_config # Information about the registration configuration. # # @option params [Array<Types::Tag>] :tags # Metadata which can be used to manage the CA certificate. # # <note markdown="1"> For URI Request parameters use format: # ...key1=value1&amp;key2=value2... # # For the CLI command-line parameter use format: &amp;&amp;tags # "key1=value1&amp;key2=value2..." # # For the cli-input-json file use format: "tags": # "key1=value1&amp;key2=value2..." # # </note> # # @return [Types::RegisterCACertificateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RegisterCACertificateResponse#certificate_arn #certificate_arn} => String # * {Types::RegisterCACertificateResponse#certificate_id #certificate_id} => String # # @example Request syntax with placeholder values # # resp = client.register_ca_certificate({ # ca_certificate: "CertificatePem", # required # verification_certificate: "CertificatePem", # required # set_as_active: false, # allow_auto_registration: false, # registration_config: { # template_body: "TemplateBody", # role_arn: "RoleArn", # }, # tags: [ # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @example Response structure # # resp.certificate_arn #=> String # resp.certificate_id #=> String # # @overload register_ca_certificate(params = {}) # @param [Hash] params ({}) def register_ca_certificate(params = {}, options = {}) req = build_request(:register_ca_certificate, params) req.send_request(options) end # Registers a device certificate with AWS IoT. If you have more than one # CA certificate that has the same subject field, you must specify the # CA certificate that was used to sign the device certificate being # registered. # # @option params [required, String] :certificate_pem # The certificate data, in PEM format. # # @option params [String] :ca_certificate_pem # The CA certificate used to sign the device certificate being # registered. # # @option params [Boolean] :set_as_active # A boolean value that specifies if the certificate is set to active. # # @option params [String] :status # The status of the register certificate request. # # @return [Types::RegisterCertificateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RegisterCertificateResponse#certificate_arn #certificate_arn} => String # * {Types::RegisterCertificateResponse#certificate_id #certificate_id} => String # # @example Request syntax with placeholder values # # resp = client.register_certificate({ # certificate_pem: "CertificatePem", # required # ca_certificate_pem: "CertificatePem", # set_as_active: false, # status: "ACTIVE", # accepts ACTIVE, INACTIVE, REVOKED, PENDING_TRANSFER, REGISTER_INACTIVE, PENDING_ACTIVATION # }) # # @example Response structure # # resp.certificate_arn #=> String # resp.certificate_id #=> String # # @overload register_certificate(params = {}) # @param [Hash] params ({}) def register_certificate(params = {}, options = {}) req = build_request(:register_certificate, params) req.send_request(options) end # Register a certificate that does not have a certificate authority # (CA). # # @option params [required, String] :certificate_pem # The certificate data, in PEM format. # # @option params [String] :status # The status of the register certificate request. # # @return [Types::RegisterCertificateWithoutCAResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RegisterCertificateWithoutCAResponse#certificate_arn #certificate_arn} => String # * {Types::RegisterCertificateWithoutCAResponse#certificate_id #certificate_id} => String # # @example Request syntax with placeholder values # # resp = client.register_certificate_without_ca({ # certificate_pem: "CertificatePem", # required # status: "ACTIVE", # accepts ACTIVE, INACTIVE, REVOKED, PENDING_TRANSFER, REGISTER_INACTIVE, PENDING_ACTIVATION # }) # # @example Response structure # # resp.certificate_arn #=> String # resp.certificate_id #=> String # # @overload register_certificate_without_ca(params = {}) # @param [Hash] params ({}) def register_certificate_without_ca(params = {}, options = {}) req = build_request(:register_certificate_without_ca, params) req.send_request(options) end # Provisions a thing in the device registry. RegisterThing calls other # AWS IoT control plane APIs. These calls might exceed your account # level [ AWS IoT Throttling Limits][1] and cause throttle errors. # Please contact [AWS Customer Support][2] to raise your throttling # limits if necessary. # # # # [1]: https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_iot # [2]: https://console.aws.amazon.com/support/home # # @option params [required, String] :template_body # The provisioning template. See [Provisioning Devices That Have Device # Certificates][1] for more information. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/provision-w-cert.html # # @option params [Hash<String,String>] :parameters # The parameters for provisioning a thing. See [Provisioning # Templates][1] for more information. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/provision-template.html # # @return [Types::RegisterThingResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::RegisterThingResponse#certificate_pem #certificate_pem} => String # * {Types::RegisterThingResponse#resource_arns #resource_arns} => Hash&lt;String,String&gt; # # @example Request syntax with placeholder values # # resp = client.register_thing({ # template_body: "TemplateBody", # required # parameters: { # "Parameter" => "Value", # }, # }) # # @example Response structure # # resp.certificate_pem #=> String # resp.resource_arns #=> Hash # resp.resource_arns["ResourceLogicalId"] #=> String # # @overload register_thing(params = {}) # @param [Hash] params ({}) def register_thing(params = {}, options = {}) req = build_request(:register_thing, params) req.send_request(options) end # Rejects a pending certificate transfer. After AWS IoT rejects a # certificate transfer, the certificate status changes from # **PENDING\_TRANSFER** to **INACTIVE**. # # To check for pending certificate transfers, call ListCertificates to # enumerate your certificates. # # This operation can only be called by the transfer destination. After # it is called, the certificate will be returned to the source's # account in the INACTIVE state. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @option params [String] :reject_reason # The reason the certificate transfer was rejected. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.reject_certificate_transfer({ # certificate_id: "CertificateId", # required # reject_reason: "Message", # }) # # @overload reject_certificate_transfer(params = {}) # @param [Hash] params ({}) def reject_certificate_transfer(params = {}, options = {}) req = build_request(:reject_certificate_transfer, params) req.send_request(options) end # Removes the given thing from the billing group. # # @option params [String] :billing_group_name # The name of the billing group. # # @option params [String] :billing_group_arn # The ARN of the billing group. # # @option params [String] :thing_name # The name of the thing to be removed from the billing group. # # @option params [String] :thing_arn # The ARN of the thing to be removed from the billing group. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.remove_thing_from_billing_group({ # billing_group_name: "BillingGroupName", # billing_group_arn: "BillingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # }) # # @overload remove_thing_from_billing_group(params = {}) # @param [Hash] params ({}) def remove_thing_from_billing_group(params = {}, options = {}) req = build_request(:remove_thing_from_billing_group, params) req.send_request(options) end # Remove the specified thing from the specified group. # # You must specify either a `thingGroupArn` or a `thingGroupName` to # identify the thing group and either a `thingArn` or a `thingName` to # identify the thing to remove from the thing group. # # @option params [String] :thing_group_name # The group name. # # @option params [String] :thing_group_arn # The group ARN. # # @option params [String] :thing_name # The name of the thing to remove from the group. # # @option params [String] :thing_arn # The ARN of the thing to remove from the group. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.remove_thing_from_thing_group({ # thing_group_name: "ThingGroupName", # thing_group_arn: "ThingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # }) # # @overload remove_thing_from_thing_group(params = {}) # @param [Hash] params ({}) def remove_thing_from_thing_group(params = {}, options = {}) req = build_request(:remove_thing_from_thing_group, params) req.send_request(options) end # Replaces the rule. You must specify all parameters for the new rule. # Creating rules is an administrator-level action. Any user who has # permission to create rules will be able to access data processed by # the rule. # # @option params [required, String] :rule_name # The name of the rule. # # @option params [required, Types::TopicRulePayload] :topic_rule_payload # The rule payload. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.replace_topic_rule({ # rule_name: "RuleName", # required # topic_rule_payload: { # required # sql: "SQL", # required # description: "Description", # actions: [ # required # { # dynamo_db: { # table_name: "TableName", # required # role_arn: "AwsArn", # required # operation: "DynamoOperation", # hash_key_field: "HashKeyField", # required # hash_key_value: "HashKeyValue", # required # hash_key_type: "STRING", # accepts STRING, NUMBER # range_key_field: "RangeKeyField", # range_key_value: "RangeKeyValue", # range_key_type: "STRING", # accepts STRING, NUMBER # payload_field: "PayloadField", # }, # dynamo_d_bv_2: { # role_arn: "AwsArn", # required # put_item: { # required # table_name: "TableName", # required # }, # }, # lambda: { # function_arn: "FunctionArn", # required # }, # sns: { # target_arn: "AwsArn", # required # role_arn: "AwsArn", # required # message_format: "RAW", # accepts RAW, JSON # }, # sqs: { # role_arn: "AwsArn", # required # queue_url: "QueueUrl", # required # use_base_64: false, # }, # kinesis: { # role_arn: "AwsArn", # required # stream_name: "StreamName", # required # partition_key: "PartitionKey", # }, # republish: { # role_arn: "AwsArn", # required # topic: "TopicPattern", # required # qos: 1, # }, # s3: { # role_arn: "AwsArn", # required # bucket_name: "BucketName", # required # key: "Key", # required # canned_acl: "private", # accepts private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, bucket-owner-full-control, log-delivery-write # }, # firehose: { # role_arn: "AwsArn", # required # delivery_stream_name: "DeliveryStreamName", # required # separator: "FirehoseSeparator", # }, # cloudwatch_metric: { # role_arn: "AwsArn", # required # metric_namespace: "String", # required # metric_name: "String", # required # metric_value: "String", # required # metric_unit: "String", # required # metric_timestamp: "String", # }, # cloudwatch_alarm: { # role_arn: "AwsArn", # required # alarm_name: "AlarmName", # required # state_reason: "StateReason", # required # state_value: "StateValue", # required # }, # cloudwatch_logs: { # role_arn: "AwsArn", # required # log_group_name: "LogGroupName", # required # }, # elasticsearch: { # role_arn: "AwsArn", # required # endpoint: "ElasticsearchEndpoint", # required # index: "ElasticsearchIndex", # required # type: "ElasticsearchType", # required # id: "ElasticsearchId", # required # }, # salesforce: { # token: "SalesforceToken", # required # url: "SalesforceEndpoint", # required # }, # iot_analytics: { # channel_arn: "AwsArn", # channel_name: "ChannelName", # role_arn: "AwsArn", # }, # iot_events: { # input_name: "InputName", # required # message_id: "MessageId", # role_arn: "AwsArn", # required # }, # iot_site_wise: { # put_asset_property_value_entries: [ # required # { # entry_id: "AssetPropertyEntryId", # asset_id: "AssetId", # property_id: "AssetPropertyId", # property_alias: "AssetPropertyAlias", # property_values: [ # required # { # value: { # required # string_value: "AssetPropertyStringValue", # integer_value: "AssetPropertyIntegerValue", # double_value: "AssetPropertyDoubleValue", # boolean_value: "AssetPropertyBooleanValue", # }, # timestamp: { # required # time_in_seconds: "AssetPropertyTimeInSeconds", # required # offset_in_nanos: "AssetPropertyOffsetInNanos", # }, # quality: "AssetPropertyQuality", # }, # ], # }, # ], # role_arn: "AwsArn", # required # }, # step_functions: { # execution_name_prefix: "ExecutionNamePrefix", # state_machine_name: "StateMachineName", # required # role_arn: "AwsArn", # required # }, # http: { # url: "Url", # required # confirmation_url: "Url", # headers: [ # { # key: "HeaderKey", # required # value: "HeaderValue", # required # }, # ], # auth: { # sigv4: { # signing_region: "SigningRegion", # required # service_name: "ServiceName", # required # role_arn: "AwsArn", # required # }, # }, # }, # }, # ], # rule_disabled: false, # aws_iot_sql_version: "AwsIotSqlVersion", # error_action: { # dynamo_db: { # table_name: "TableName", # required # role_arn: "AwsArn", # required # operation: "DynamoOperation", # hash_key_field: "HashKeyField", # required # hash_key_value: "HashKeyValue", # required # hash_key_type: "STRING", # accepts STRING, NUMBER # range_key_field: "RangeKeyField", # range_key_value: "RangeKeyValue", # range_key_type: "STRING", # accepts STRING, NUMBER # payload_field: "PayloadField", # }, # dynamo_d_bv_2: { # role_arn: "AwsArn", # required # put_item: { # required # table_name: "TableName", # required # }, # }, # lambda: { # function_arn: "FunctionArn", # required # }, # sns: { # target_arn: "AwsArn", # required # role_arn: "AwsArn", # required # message_format: "RAW", # accepts RAW, JSON # }, # sqs: { # role_arn: "AwsArn", # required # queue_url: "QueueUrl", # required # use_base_64: false, # }, # kinesis: { # role_arn: "AwsArn", # required # stream_name: "StreamName", # required # partition_key: "PartitionKey", # }, # republish: { # role_arn: "AwsArn", # required # topic: "TopicPattern", # required # qos: 1, # }, # s3: { # role_arn: "AwsArn", # required # bucket_name: "BucketName", # required # key: "Key", # required # canned_acl: "private", # accepts private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, bucket-owner-full-control, log-delivery-write # }, # firehose: { # role_arn: "AwsArn", # required # delivery_stream_name: "DeliveryStreamName", # required # separator: "FirehoseSeparator", # }, # cloudwatch_metric: { # role_arn: "AwsArn", # required # metric_namespace: "String", # required # metric_name: "String", # required # metric_value: "String", # required # metric_unit: "String", # required # metric_timestamp: "String", # }, # cloudwatch_alarm: { # role_arn: "AwsArn", # required # alarm_name: "AlarmName", # required # state_reason: "StateReason", # required # state_value: "StateValue", # required # }, # cloudwatch_logs: { # role_arn: "AwsArn", # required # log_group_name: "LogGroupName", # required # }, # elasticsearch: { # role_arn: "AwsArn", # required # endpoint: "ElasticsearchEndpoint", # required # index: "ElasticsearchIndex", # required # type: "ElasticsearchType", # required # id: "ElasticsearchId", # required # }, # salesforce: { # token: "SalesforceToken", # required # url: "SalesforceEndpoint", # required # }, # iot_analytics: { # channel_arn: "AwsArn", # channel_name: "ChannelName", # role_arn: "AwsArn", # }, # iot_events: { # input_name: "InputName", # required # message_id: "MessageId", # role_arn: "AwsArn", # required # }, # iot_site_wise: { # put_asset_property_value_entries: [ # required # { # entry_id: "AssetPropertyEntryId", # asset_id: "AssetId", # property_id: "AssetPropertyId", # property_alias: "AssetPropertyAlias", # property_values: [ # required # { # value: { # required # string_value: "AssetPropertyStringValue", # integer_value: "AssetPropertyIntegerValue", # double_value: "AssetPropertyDoubleValue", # boolean_value: "AssetPropertyBooleanValue", # }, # timestamp: { # required # time_in_seconds: "AssetPropertyTimeInSeconds", # required # offset_in_nanos: "AssetPropertyOffsetInNanos", # }, # quality: "AssetPropertyQuality", # }, # ], # }, # ], # role_arn: "AwsArn", # required # }, # step_functions: { # execution_name_prefix: "ExecutionNamePrefix", # state_machine_name: "StateMachineName", # required # role_arn: "AwsArn", # required # }, # http: { # url: "Url", # required # confirmation_url: "Url", # headers: [ # { # key: "HeaderKey", # required # value: "HeaderValue", # required # }, # ], # auth: { # sigv4: { # signing_region: "SigningRegion", # required # service_name: "ServiceName", # required # role_arn: "AwsArn", # required # }, # }, # }, # }, # }, # }) # # @overload replace_topic_rule(params = {}) # @param [Hash] params ({}) def replace_topic_rule(params = {}, options = {}) req = build_request(:replace_topic_rule, params) req.send_request(options) end # The query search index. # # @option params [String] :index_name # The search index name. # # @option params [required, String] :query_string # The search query string. # # @option params [String] :next_token # The token used to get the next set of results, or `null` if there are # no additional results. # # @option params [Integer] :max_results # The maximum number of results to return at one time. # # @option params [String] :query_version # The query version. # # @return [Types::SearchIndexResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::SearchIndexResponse#next_token #next_token} => String # * {Types::SearchIndexResponse#things #things} => Array&lt;Types::ThingDocument&gt; # * {Types::SearchIndexResponse#thing_groups #thing_groups} => Array&lt;Types::ThingGroupDocument&gt; # # @example Request syntax with placeholder values # # resp = client.search_index({ # index_name: "IndexName", # query_string: "QueryString", # required # next_token: "NextToken", # max_results: 1, # query_version: "QueryVersion", # }) # # @example Response structure # # resp.next_token #=> String # resp.things #=> Array # resp.things[0].thing_name #=> String # resp.things[0].thing_id #=> String # resp.things[0].thing_type_name #=> String # resp.things[0].thing_group_names #=> Array # resp.things[0].thing_group_names[0] #=> String # resp.things[0].attributes #=> Hash # resp.things[0].attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil> # resp.things[0].shadow #=> String # resp.things[0].connectivity.connected #=> Boolean # resp.things[0].connectivity.timestamp #=> Integer # resp.thing_groups #=> Array # resp.thing_groups[0].thing_group_name #=> String # resp.thing_groups[0].thing_group_id #=> String # resp.thing_groups[0].thing_group_description #=> String # resp.thing_groups[0].attributes #=> Hash # resp.thing_groups[0].attributes["AttributeName"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil> # resp.thing_groups[0].parent_group_names #=> Array # resp.thing_groups[0].parent_group_names[0] #=> String # # @overload search_index(params = {}) # @param [Hash] params ({}) def search_index(params = {}, options = {}) req = build_request(:search_index, params) req.send_request(options) end # Sets the default authorizer. This will be used if a websocket # connection is made without specifying an authorizer. # # @option params [required, String] :authorizer_name # The authorizer name. # # @return [Types::SetDefaultAuthorizerResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::SetDefaultAuthorizerResponse#authorizer_name #authorizer_name} => String # * {Types::SetDefaultAuthorizerResponse#authorizer_arn #authorizer_arn} => String # # @example Request syntax with placeholder values # # resp = client.set_default_authorizer({ # authorizer_name: "AuthorizerName", # required # }) # # @example Response structure # # resp.authorizer_name #=> String # resp.authorizer_arn #=> String # # @overload set_default_authorizer(params = {}) # @param [Hash] params ({}) def set_default_authorizer(params = {}, options = {}) req = build_request(:set_default_authorizer, params) req.send_request(options) end # Sets the specified version of the specified policy as the policy's # default (operative) version. This action affects all certificates to # which the policy is attached. To list the principals the policy is # attached to, use the ListPrincipalPolicy API. # # @option params [required, String] :policy_name # The policy name. # # @option params [required, String] :policy_version_id # The policy version ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.set_default_policy_version({ # policy_name: "PolicyName", # required # policy_version_id: "PolicyVersionId", # required # }) # # @overload set_default_policy_version(params = {}) # @param [Hash] params ({}) def set_default_policy_version(params = {}, options = {}) req = build_request(:set_default_policy_version, params) req.send_request(options) end # Sets the logging options. # # NOTE: use of this command is not recommended. Use # `SetV2LoggingOptions` instead. # # @option params [required, Types::LoggingOptionsPayload] :logging_options_payload # The logging options payload. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.set_logging_options({ # logging_options_payload: { # required # role_arn: "AwsArn", # required # log_level: "DEBUG", # accepts DEBUG, INFO, ERROR, WARN, DISABLED # }, # }) # # @overload set_logging_options(params = {}) # @param [Hash] params ({}) def set_logging_options(params = {}, options = {}) req = build_request(:set_logging_options, params) req.send_request(options) end # Sets the logging level. # # @option params [required, Types::LogTarget] :log_target # The log target. # # @option params [required, String] :log_level # The log level. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.set_v2_logging_level({ # log_target: { # required # target_type: "DEFAULT", # required, accepts DEFAULT, THING_GROUP # target_name: "LogTargetName", # }, # log_level: "DEBUG", # required, accepts DEBUG, INFO, ERROR, WARN, DISABLED # }) # # @overload set_v2_logging_level(params = {}) # @param [Hash] params ({}) def set_v2_logging_level(params = {}, options = {}) req = build_request(:set_v2_logging_level, params) req.send_request(options) end # Sets the logging options for the V2 logging service. # # @option params [String] :role_arn # The ARN of the role that allows IoT to write to Cloudwatch logs. # # @option params [String] :default_log_level # The default logging level. # # @option params [Boolean] :disable_all_logs # If true all logs are disabled. The default is false. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.set_v2_logging_options({ # role_arn: "AwsArn", # default_log_level: "DEBUG", # accepts DEBUG, INFO, ERROR, WARN, DISABLED # disable_all_logs: false, # }) # # @overload set_v2_logging_options(params = {}) # @param [Hash] params ({}) def set_v2_logging_options(params = {}, options = {}) req = build_request(:set_v2_logging_options, params) req.send_request(options) end # Starts a task that applies a set of mitigation actions to the # specified target. # # @option params [required, String] :task_id # A unique identifier for the task. You can use this identifier to check # the status of the task or to cancel it. # # @option params [required, Types::AuditMitigationActionsTaskTarget] :target # Specifies the audit findings to which the mitigation actions are # applied. You can apply them to a type of audit check, to all findings # from an audit, or to a speecific set of findings. # # @option params [required, Hash<String,Array>] :audit_check_to_actions_mapping # For an audit check, specifies which mitigation actions to apply. Those # actions must be defined in your AWS account. # # @option params [required, String] :client_request_token # Each audit mitigation task must have a unique client request token. If # you try to start a new task with the same token as a task that already # exists, an exception occurs. If you omit this value, a unique client # request token is generated automatically. # # **A suitable default value is auto-generated.** You should normally # not need to pass this option.** # # @return [Types::StartAuditMitigationActionsTaskResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::StartAuditMitigationActionsTaskResponse#task_id #task_id} => String # # @example Request syntax with placeholder values # # resp = client.start_audit_mitigation_actions_task({ # task_id: "AuditMitigationActionsTaskId", # required # target: { # required # audit_task_id: "AuditTaskId", # finding_ids: ["FindingId"], # audit_check_to_reason_code_filter: { # "AuditCheckName" => ["ReasonForNonComplianceCode"], # }, # }, # audit_check_to_actions_mapping: { # required # "AuditCheckName" => ["MitigationActionName"], # }, # client_request_token: "ClientRequestToken", # required # }) # # @example Response structure # # resp.task_id #=> String # # @overload start_audit_mitigation_actions_task(params = {}) # @param [Hash] params ({}) def start_audit_mitigation_actions_task(params = {}, options = {}) req = build_request(:start_audit_mitigation_actions_task, params) req.send_request(options) end # Starts an on-demand Device Defender audit. # # @option params [required, Array<String>] :target_check_names # Which checks are performed during the audit. The checks you specify # must be enabled for your account or an exception occurs. Use # `DescribeAccountAuditConfiguration` to see the list of all checks, # including those that are enabled or `UpdateAccountAuditConfiguration` # to select which checks are enabled. # # @return [Types::StartOnDemandAuditTaskResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::StartOnDemandAuditTaskResponse#task_id #task_id} => String # # @example Request syntax with placeholder values # # resp = client.start_on_demand_audit_task({ # target_check_names: ["AuditCheckName"], # required # }) # # @example Response structure # # resp.task_id #=> String # # @overload start_on_demand_audit_task(params = {}) # @param [Hash] params ({}) def start_on_demand_audit_task(params = {}, options = {}) req = build_request(:start_on_demand_audit_task, params) req.send_request(options) end # Creates a bulk thing provisioning task. # # @option params [required, String] :template_body # The provisioning template. # # @option params [required, String] :input_file_bucket # The S3 bucket that contains the input file. # # @option params [required, String] :input_file_key # The name of input file within the S3 bucket. This file contains a # newline delimited JSON file. Each line contains the parameter values # to provision one device (thing). # # @option params [required, String] :role_arn # The IAM role ARN that grants permission the input file. # # @return [Types::StartThingRegistrationTaskResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::StartThingRegistrationTaskResponse#task_id #task_id} => String # # @example Request syntax with placeholder values # # resp = client.start_thing_registration_task({ # template_body: "TemplateBody", # required # input_file_bucket: "RegistryS3BucketName", # required # input_file_key: "RegistryS3KeyName", # required # role_arn: "RoleArn", # required # }) # # @example Response structure # # resp.task_id #=> String # # @overload start_thing_registration_task(params = {}) # @param [Hash] params ({}) def start_thing_registration_task(params = {}, options = {}) req = build_request(:start_thing_registration_task, params) req.send_request(options) end # Cancels a bulk thing provisioning task. # # @option params [required, String] :task_id # The bulk thing provisioning task ID. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.stop_thing_registration_task({ # task_id: "TaskId", # required # }) # # @overload stop_thing_registration_task(params = {}) # @param [Hash] params ({}) def stop_thing_registration_task(params = {}, options = {}) req = build_request(:stop_thing_registration_task, params) req.send_request(options) end # Adds to or modifies the tags of the given resource. Tags are metadata # which can be used to manage a resource. # # @option params [required, String] :resource_arn # The ARN of the resource. # # @option params [required, Array<Types::Tag>] :tags # The new or modified tags for the resource. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.tag_resource({ # resource_arn: "ResourceArn", # required # tags: [ # required # { # key: "TagKey", # required # value: "TagValue", # }, # ], # }) # # @overload tag_resource(params = {}) # @param [Hash] params ({}) def tag_resource(params = {}, options = {}) req = build_request(:tag_resource, params) req.send_request(options) end # Tests if a specified principal is authorized to perform an AWS IoT # action on a specified resource. Use this to test and debug the # authorization behavior of devices that connect to the AWS IoT device # gateway. # # @option params [String] :principal # The principal. # # @option params [String] :cognito_identity_pool_id # The Cognito identity pool ID. # # @option params [required, Array<Types::AuthInfo>] :auth_infos # A list of authorization info objects. Simulating authorization will # create a response for each `authInfo` object in the list. # # @option params [String] :client_id # The MQTT client ID. # # @option params [Array<String>] :policy_names_to_add # When testing custom authorization, the policies specified here are # treated as if they are attached to the principal being authorized. # # @option params [Array<String>] :policy_names_to_skip # When testing custom authorization, the policies specified here are # treated as if they are not attached to the principal being authorized. # # @return [Types::TestAuthorizationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::TestAuthorizationResponse#auth_results #auth_results} => Array&lt;Types::AuthResult&gt; # # @example Request syntax with placeholder values # # resp = client.test_authorization({ # principal: "Principal", # cognito_identity_pool_id: "CognitoIdentityPoolId", # auth_infos: [ # required # { # action_type: "PUBLISH", # accepts PUBLISH, SUBSCRIBE, RECEIVE, CONNECT # resources: ["Resource"], # required # }, # ], # client_id: "ClientId", # policy_names_to_add: ["PolicyName"], # policy_names_to_skip: ["PolicyName"], # }) # # @example Response structure # # resp.auth_results #=> Array # resp.auth_results[0].auth_info.action_type #=> String, one of "PUBLISH", "SUBSCRIBE", "RECEIVE", "CONNECT" # resp.auth_results[0].auth_info.resources #=> Array # resp.auth_results[0].auth_info.resources[0] #=> String # resp.auth_results[0].allowed.policies #=> Array # resp.auth_results[0].allowed.policies[0].policy_name #=> String # resp.auth_results[0].allowed.policies[0].policy_arn #=> String # resp.auth_results[0].denied.implicit_deny.policies #=> Array # resp.auth_results[0].denied.implicit_deny.policies[0].policy_name #=> String # resp.auth_results[0].denied.implicit_deny.policies[0].policy_arn #=> String # resp.auth_results[0].denied.explicit_deny.policies #=> Array # resp.auth_results[0].denied.explicit_deny.policies[0].policy_name #=> String # resp.auth_results[0].denied.explicit_deny.policies[0].policy_arn #=> String # resp.auth_results[0].auth_decision #=> String, one of "ALLOWED", "EXPLICIT_DENY", "IMPLICIT_DENY" # resp.auth_results[0].missing_context_values #=> Array # resp.auth_results[0].missing_context_values[0] #=> String # # @overload test_authorization(params = {}) # @param [Hash] params ({}) def test_authorization(params = {}, options = {}) req = build_request(:test_authorization, params) req.send_request(options) end # Tests a custom authorization behavior by invoking a specified custom # authorizer. Use this to test and debug the custom authorization # behavior of devices that connect to the AWS IoT device gateway. # # @option params [required, String] :authorizer_name # The custom authorizer name. # # @option params [String] :token # The token returned by your custom authentication service. # # @option params [String] :token_signature # The signature made with the token and your custom authentication # service's private key. This value must be Base-64-encoded. # # @option params [Types::HttpContext] :http_context # Specifies a test HTTP authorization request. # # @option params [Types::MqttContext] :mqtt_context # Specifies a test MQTT authorization request. # # @option params [Types::TlsContext] :tls_context # Specifies a test TLS authorization request. # # @return [Types::TestInvokeAuthorizerResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::TestInvokeAuthorizerResponse#is_authenticated #is_authenticated} => Boolean # * {Types::TestInvokeAuthorizerResponse#principal_id #principal_id} => String # * {Types::TestInvokeAuthorizerResponse#policy_documents #policy_documents} => Array&lt;String&gt; # * {Types::TestInvokeAuthorizerResponse#refresh_after_in_seconds #refresh_after_in_seconds} => Integer # * {Types::TestInvokeAuthorizerResponse#disconnect_after_in_seconds #disconnect_after_in_seconds} => Integer # # @example Request syntax with placeholder values # # resp = client.test_invoke_authorizer({ # authorizer_name: "AuthorizerName", # required # token: "Token", # token_signature: "TokenSignature", # http_context: { # headers: { # "HttpHeaderName" => "HttpHeaderValue", # }, # query_string: "HttpQueryString", # }, # mqtt_context: { # username: "MqttUsername", # password: "data", # client_id: "MqttClientId", # }, # tls_context: { # server_name: "ServerName", # }, # }) # # @example Response structure # # resp.is_authenticated #=> Boolean # resp.principal_id #=> String # resp.policy_documents #=> Array # resp.policy_documents[0] #=> String # resp.refresh_after_in_seconds #=> Integer # resp.disconnect_after_in_seconds #=> Integer # # @overload test_invoke_authorizer(params = {}) # @param [Hash] params ({}) def test_invoke_authorizer(params = {}, options = {}) req = build_request(:test_invoke_authorizer, params) req.send_request(options) end # Transfers the specified certificate to the specified AWS account. # # You can cancel the transfer until it is acknowledged by the recipient. # # No notification is sent to the transfer destination's account. It is # up to the caller to notify the transfer target. # # The certificate being transferred must not be in the ACTIVE state. You # can use the UpdateCertificate API to deactivate it. # # The certificate must not have any policies attached to it. You can use # the DetachPrincipalPolicy API to detach them. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @option params [required, String] :target_aws_account # The AWS account. # # @option params [String] :transfer_message # The transfer message. # # @return [Types::TransferCertificateResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::TransferCertificateResponse#transferred_certificate_arn #transferred_certificate_arn} => String # # @example Request syntax with placeholder values # # resp = client.transfer_certificate({ # certificate_id: "CertificateId", # required # target_aws_account: "AwsAccountId", # required # transfer_message: "Message", # }) # # @example Response structure # # resp.transferred_certificate_arn #=> String # # @overload transfer_certificate(params = {}) # @param [Hash] params ({}) def transfer_certificate(params = {}, options = {}) req = build_request(:transfer_certificate, params) req.send_request(options) end # Removes the given tags (metadata) from the resource. # # @option params [required, String] :resource_arn # The ARN of the resource. # # @option params [required, Array<String>] :tag_keys # A list of the keys of the tags to be removed from the resource. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.untag_resource({ # resource_arn: "ResourceArn", # required # tag_keys: ["TagKey"], # required # }) # # @overload untag_resource(params = {}) # @param [Hash] params ({}) def untag_resource(params = {}, options = {}) req = build_request(:untag_resource, params) req.send_request(options) end # Configures or reconfigures the Device Defender audit settings for this # account. Settings include how audit notifications are sent and which # audit checks are enabled or disabled. # # @option params [String] :role_arn # The ARN of the role that grants permission to AWS IoT to access # information about your devices, policies, certificates and other items # as required when performing an audit. # # @option params [Hash<String,Types::AuditNotificationTarget>] :audit_notification_target_configurations # Information about the targets to which audit notifications are sent. # # @option params [Hash<String,Types::AuditCheckConfiguration>] :audit_check_configurations # Specifies which audit checks are enabled and disabled for this # account. Use `DescribeAccountAuditConfiguration` to see the list of # all checks, including those that are currently enabled. # # Some data collection might start immediately when certain checks are # enabled. When a check is disabled, any data collected so far in # relation to the check is deleted. # # You cannot disable a check if it is used by any scheduled audit. You # must first delete the check from the scheduled audit or delete the # scheduled audit itself. # # On the first call to `UpdateAccountAuditConfiguration`, this parameter # is required and must specify at least one enabled check. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_account_audit_configuration({ # role_arn: "RoleArn", # audit_notification_target_configurations: { # "SNS" => { # target_arn: "TargetArn", # role_arn: "RoleArn", # enabled: false, # }, # }, # audit_check_configurations: { # "AuditCheckName" => { # enabled: false, # }, # }, # }) # # @overload update_account_audit_configuration(params = {}) # @param [Hash] params ({}) def update_account_audit_configuration(params = {}, options = {}) req = build_request(:update_account_audit_configuration, params) req.send_request(options) end # Updates an authorizer. # # @option params [required, String] :authorizer_name # The authorizer name. # # @option params [String] :authorizer_function_arn # The ARN of the authorizer's Lambda function. # # @option params [String] :token_key_name # The key used to extract the token from the HTTP headers. # # @option params [Hash<String,String>] :token_signing_public_keys # The public keys used to verify the token signature. # # @option params [String] :status # The status of the update authorizer request. # # @return [Types::UpdateAuthorizerResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateAuthorizerResponse#authorizer_name #authorizer_name} => String # * {Types::UpdateAuthorizerResponse#authorizer_arn #authorizer_arn} => String # # @example Request syntax with placeholder values # # resp = client.update_authorizer({ # authorizer_name: "AuthorizerName", # required # authorizer_function_arn: "AuthorizerFunctionArn", # token_key_name: "TokenKeyName", # token_signing_public_keys: { # "KeyName" => "KeyValue", # }, # status: "ACTIVE", # accepts ACTIVE, INACTIVE # }) # # @example Response structure # # resp.authorizer_name #=> String # resp.authorizer_arn #=> String # # @overload update_authorizer(params = {}) # @param [Hash] params ({}) def update_authorizer(params = {}, options = {}) req = build_request(:update_authorizer, params) req.send_request(options) end # Updates information about the billing group. # # @option params [required, String] :billing_group_name # The name of the billing group. # # @option params [required, Types::BillingGroupProperties] :billing_group_properties # The properties of the billing group. # # @option params [Integer] :expected_version # The expected version of the billing group. If the version of the # billing group does not match the expected version specified in the # request, the `UpdateBillingGroup` request is rejected with a # `VersionConflictException`. # # @return [Types::UpdateBillingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateBillingGroupResponse#version #version} => Integer # # @example Request syntax with placeholder values # # resp = client.update_billing_group({ # billing_group_name: "BillingGroupName", # required # billing_group_properties: { # required # billing_group_description: "BillingGroupDescription", # }, # expected_version: 1, # }) # # @example Response structure # # resp.version #=> Integer # # @overload update_billing_group(params = {}) # @param [Hash] params ({}) def update_billing_group(params = {}, options = {}) req = build_request(:update_billing_group, params) req.send_request(options) end # Updates a registered CA certificate. # # @option params [required, String] :certificate_id # The CA certificate identifier. # # @option params [String] :new_status # The updated status of the CA certificate. # # **Note:** The status value REGISTER\_INACTIVE is deprecated and should # not be used. # # @option params [String] :new_auto_registration_status # The new value for the auto registration status. Valid values are: # "ENABLE" or "DISABLE". # # @option params [Types::RegistrationConfig] :registration_config # Information about the registration configuration. # # @option params [Boolean] :remove_auto_registration # If true, removes auto registration. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_ca_certificate({ # certificate_id: "CertificateId", # required # new_status: "ACTIVE", # accepts ACTIVE, INACTIVE # new_auto_registration_status: "ENABLE", # accepts ENABLE, DISABLE # registration_config: { # template_body: "TemplateBody", # role_arn: "RoleArn", # }, # remove_auto_registration: false, # }) # # @overload update_ca_certificate(params = {}) # @param [Hash] params ({}) def update_ca_certificate(params = {}, options = {}) req = build_request(:update_ca_certificate, params) req.send_request(options) end # Updates the status of the specified certificate. This operation is # idempotent. # # Moving a certificate from the ACTIVE state (including REVOKED) will # not disconnect currently connected devices, but these devices will be # unable to reconnect. # # The ACTIVE state is required to authenticate devices connecting to AWS # IoT using a certificate. # # @option params [required, String] :certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # # @option params [required, String] :new_status # The new status. # # **Note:** Setting the status to PENDING\_TRANSFER or # PENDING\_ACTIVATION will result in an exception being thrown. # PENDING\_TRANSFER and PENDING\_ACTIVATION are statuses used internally # by AWS IoT. They are not intended for developer use. # # **Note:** The status value REGISTER\_INACTIVE is deprecated and should # not be used. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_certificate({ # certificate_id: "CertificateId", # required # new_status: "ACTIVE", # required, accepts ACTIVE, INACTIVE, REVOKED, PENDING_TRANSFER, REGISTER_INACTIVE, PENDING_ACTIVATION # }) # # @overload update_certificate(params = {}) # @param [Hash] params ({}) def update_certificate(params = {}, options = {}) req = build_request(:update_certificate, params) req.send_request(options) end # Updates the definition for a dimension. You cannot change the type of # a dimension after it is created (you can delete it and re-create it). # # @option params [required, String] :name # A unique identifier for the dimension. Choose something that describes # the type and value to make it easy to remember what it does. # # @option params [required, Array<String>] :string_values # Specifies the value or list of values for the dimension. For # `TOPIC_FILTER` dimensions, this is a pattern used to match the MQTT # topic (for example, "admin/#"). # # @return [Types::UpdateDimensionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateDimensionResponse#name #name} => String # * {Types::UpdateDimensionResponse#arn #arn} => String # * {Types::UpdateDimensionResponse#type #type} => String # * {Types::UpdateDimensionResponse#string_values #string_values} => Array&lt;String&gt; # * {Types::UpdateDimensionResponse#creation_date #creation_date} => Time # * {Types::UpdateDimensionResponse#last_modified_date #last_modified_date} => Time # # @example Request syntax with placeholder values # # resp = client.update_dimension({ # name: "DimensionName", # required # string_values: ["DimensionStringValue"], # required # }) # # @example Response structure # # resp.name #=> String # resp.arn #=> String # resp.type #=> String, one of "TOPIC_FILTER" # resp.string_values #=> Array # resp.string_values[0] #=> String # resp.creation_date #=> Time # resp.last_modified_date #=> Time # # @overload update_dimension(params = {}) # @param [Hash] params ({}) def update_dimension(params = {}, options = {}) req = build_request(:update_dimension, params) req.send_request(options) end # Updates values stored in the domain configuration. Domain # configurations for default endpoints can't be updated. # # <note markdown="1"> The domain configuration feature is in public preview and is subject # to change. # # </note> # # @option params [required, String] :domain_configuration_name # The name of the domain configuration to be updated. # # @option params [Types::AuthorizerConfig] :authorizer_config # An object that specifies the authorization service for a domain. # # @option params [String] :domain_configuration_status # The status to which the domain configuration should be updated. # # @option params [Boolean] :remove_authorizer_config # Removes the authorization configuration from a domain. # # @return [Types::UpdateDomainConfigurationResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateDomainConfigurationResponse#domain_configuration_name #domain_configuration_name} => String # * {Types::UpdateDomainConfigurationResponse#domain_configuration_arn #domain_configuration_arn} => String # # @example Request syntax with placeholder values # # resp = client.update_domain_configuration({ # domain_configuration_name: "ReservedDomainConfigurationName", # required # authorizer_config: { # default_authorizer_name: "AuthorizerName", # allow_authorizer_override: false, # }, # domain_configuration_status: "ENABLED", # accepts ENABLED, DISABLED # remove_authorizer_config: false, # }) # # @example Response structure # # resp.domain_configuration_name #=> String # resp.domain_configuration_arn #=> String # # @overload update_domain_configuration(params = {}) # @param [Hash] params ({}) def update_domain_configuration(params = {}, options = {}) req = build_request(:update_domain_configuration, params) req.send_request(options) end # Updates a dynamic thing group. # # @option params [required, String] :thing_group_name # The name of the dynamic thing group to update. # # @option params [required, Types::ThingGroupProperties] :thing_group_properties # The dynamic thing group properties to update. # # @option params [Integer] :expected_version # The expected version of the dynamic thing group to update. # # @option params [String] :index_name # The dynamic thing group index to update. # # <note markdown="1"> Currently one index is supported: 'AWS\_Things'. # # </note> # # @option params [String] :query_string # The dynamic thing group search query string to update. # # @option params [String] :query_version # The dynamic thing group query version to update. # # <note markdown="1"> Currently one query version is supported: "2017-09-30". If not # specified, the query version defaults to this value. # # </note> # # @return [Types::UpdateDynamicThingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateDynamicThingGroupResponse#version #version} => Integer # # @example Request syntax with placeholder values # # resp = client.update_dynamic_thing_group({ # thing_group_name: "ThingGroupName", # required # thing_group_properties: { # required # thing_group_description: "ThingGroupDescription", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # }, # expected_version: 1, # index_name: "IndexName", # query_string: "QueryString", # query_version: "QueryVersion", # }) # # @example Response structure # # resp.version #=> Integer # # @overload update_dynamic_thing_group(params = {}) # @param [Hash] params ({}) def update_dynamic_thing_group(params = {}, options = {}) req = build_request(:update_dynamic_thing_group, params) req.send_request(options) end # Updates the event configurations. # # @option params [Hash<String,Types::Configuration>] :event_configurations # The new event configuration values. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_event_configurations({ # event_configurations: { # "THING" => { # enabled: false, # }, # }, # }) # # @overload update_event_configurations(params = {}) # @param [Hash] params ({}) def update_event_configurations(params = {}, options = {}) req = build_request(:update_event_configurations, params) req.send_request(options) end # Updates the search configuration. # # @option params [Types::ThingIndexingConfiguration] :thing_indexing_configuration # Thing indexing configuration. # # @option params [Types::ThingGroupIndexingConfiguration] :thing_group_indexing_configuration # Thing group indexing configuration. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_indexing_configuration({ # thing_indexing_configuration: { # thing_indexing_mode: "OFF", # required, accepts OFF, REGISTRY, REGISTRY_AND_SHADOW # thing_connectivity_indexing_mode: "OFF", # accepts OFF, STATUS # managed_fields: [ # { # name: "FieldName", # type: "Number", # accepts Number, String, Boolean # }, # ], # custom_fields: [ # { # name: "FieldName", # type: "Number", # accepts Number, String, Boolean # }, # ], # }, # thing_group_indexing_configuration: { # thing_group_indexing_mode: "OFF", # required, accepts OFF, ON # managed_fields: [ # { # name: "FieldName", # type: "Number", # accepts Number, String, Boolean # }, # ], # custom_fields: [ # { # name: "FieldName", # type: "Number", # accepts Number, String, Boolean # }, # ], # }, # }) # # @overload update_indexing_configuration(params = {}) # @param [Hash] params ({}) def update_indexing_configuration(params = {}, options = {}) req = build_request(:update_indexing_configuration, params) req.send_request(options) end # Updates supported fields of the specified job. # # @option params [required, String] :job_id # The ID of the job to be updated. # # @option params [String] :description # A short text description of the job. # # @option params [Types::PresignedUrlConfig] :presigned_url_config # Configuration information for pre-signed S3 URLs. # # @option params [Types::JobExecutionsRolloutConfig] :job_executions_rollout_config # Allows you to create a staged rollout of the job. # # @option params [Types::AbortConfig] :abort_config # Allows you to create criteria to abort a job. # # @option params [Types::TimeoutConfig] :timeout_config # Specifies the amount of time each device has to finish its execution # of the job. The timer is started when the job execution status is set # to `IN_PROGRESS`. If the job execution status is not set to another # terminal state before the time expires, it will be automatically set # to `TIMED_OUT`. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_job({ # job_id: "JobId", # required # description: "JobDescription", # presigned_url_config: { # role_arn: "RoleArn", # expires_in_sec: 1, # }, # job_executions_rollout_config: { # maximum_per_minute: 1, # exponential_rate: { # base_rate_per_minute: 1, # required # increment_factor: 1.0, # required # rate_increase_criteria: { # required # number_of_notified_things: 1, # number_of_succeeded_things: 1, # }, # }, # }, # abort_config: { # criteria_list: [ # required # { # failure_type: "FAILED", # required, accepts FAILED, REJECTED, TIMED_OUT, ALL # action: "CANCEL", # required, accepts CANCEL # threshold_percentage: 1.0, # required # min_number_of_executed_things: 1, # required # }, # ], # }, # timeout_config: { # in_progress_timeout_in_minutes: 1, # }, # }) # # @overload update_job(params = {}) # @param [Hash] params ({}) def update_job(params = {}, options = {}) req = build_request(:update_job, params) req.send_request(options) end # Updates the definition for the specified mitigation action. # # @option params [required, String] :action_name # The friendly name for the mitigation action. You can't change the # name by using `UpdateMitigationAction`. Instead, you must delete and # re-create the mitigation action with the new name. # # @option params [String] :role_arn # The ARN of the IAM role that is used to apply the mitigation action. # # @option params [Types::MitigationActionParams] :action_params # Defines the type of action and the parameters for that action. # # @return [Types::UpdateMitigationActionResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateMitigationActionResponse#action_arn #action_arn} => String # * {Types::UpdateMitigationActionResponse#action_id #action_id} => String # # @example Request syntax with placeholder values # # resp = client.update_mitigation_action({ # action_name: "MitigationActionName", # required # role_arn: "RoleArn", # action_params: { # update_device_certificate_params: { # action: "DEACTIVATE", # required, accepts DEACTIVATE # }, # update_ca_certificate_params: { # action: "DEACTIVATE", # required, accepts DEACTIVATE # }, # add_things_to_thing_group_params: { # thing_group_names: ["ThingGroupName"], # required # override_dynamic_groups: false, # }, # replace_default_policy_version_params: { # template_name: "BLANK_POLICY", # required, accepts BLANK_POLICY # }, # enable_io_t_logging_params: { # role_arn_for_logging: "RoleArn", # required # log_level: "DEBUG", # required, accepts DEBUG, INFO, ERROR, WARN, DISABLED # }, # publish_finding_to_sns_params: { # topic_arn: "SnsTopicArn", # required # }, # }, # }) # # @example Response structure # # resp.action_arn #=> String # resp.action_id #=> String # # @overload update_mitigation_action(params = {}) # @param [Hash] params ({}) def update_mitigation_action(params = {}, options = {}) req = build_request(:update_mitigation_action, params) req.send_request(options) end # Updates a fleet provisioning template. # # @option params [required, String] :template_name # The name of the fleet provisioning template. # # @option params [String] :description # The description of the fleet provisioning template. # # @option params [Boolean] :enabled # True to enable the fleet provisioning template, otherwise false. # # @option params [Integer] :default_version_id # The ID of the default provisioning template version. # # @option params [String] :provisioning_role_arn # The ARN of the role associated with the provisioning template. This # IoT role grants permission to provision a device. # # @option params [Types::ProvisioningHook] :pre_provisioning_hook # Updates the pre-provisioning hook template. # # @option params [Boolean] :remove_pre_provisioning_hook # Removes pre-provisioning hook template. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_provisioning_template({ # template_name: "TemplateName", # required # description: "TemplateDescription", # enabled: false, # default_version_id: 1, # provisioning_role_arn: "RoleArn", # pre_provisioning_hook: { # payload_version: "PayloadVersion", # target_arn: "TargetArn", # required # }, # remove_pre_provisioning_hook: false, # }) # # @overload update_provisioning_template(params = {}) # @param [Hash] params ({}) def update_provisioning_template(params = {}, options = {}) req = build_request(:update_provisioning_template, params) req.send_request(options) end # Updates a role alias. # # @option params [required, String] :role_alias # The role alias to update. # # @option params [String] :role_arn # The role ARN. # # @option params [Integer] :credential_duration_seconds # The number of seconds the credential will be valid. # # @return [Types::UpdateRoleAliasResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateRoleAliasResponse#role_alias #role_alias} => String # * {Types::UpdateRoleAliasResponse#role_alias_arn #role_alias_arn} => String # # @example Request syntax with placeholder values # # resp = client.update_role_alias({ # role_alias: "RoleAlias", # required # role_arn: "RoleArn", # credential_duration_seconds: 1, # }) # # @example Response structure # # resp.role_alias #=> String # resp.role_alias_arn #=> String # # @overload update_role_alias(params = {}) # @param [Hash] params ({}) def update_role_alias(params = {}, options = {}) req = build_request(:update_role_alias, params) req.send_request(options) end # Updates a scheduled audit, including which checks are performed and # how often the audit takes place. # # @option params [String] :frequency # How often the scheduled audit takes place. Can be one of "DAILY", # "WEEKLY", "BIWEEKLY", or "MONTHLY". The start time of each audit # is determined by the system. # # @option params [String] :day_of_month # The day of the month on which the scheduled audit takes place. Can be # "1" through "31" or "LAST". This field is required if the # "frequency" parameter is set to "MONTHLY". If days 29-31 are # specified, and the month does not have that many days, the audit takes # place on the "LAST" day of the month. # # @option params [String] :day_of_week # The day of the week on which the scheduled audit takes place. Can be # one of "SUN", "MON", "TUE", "WED", "THU", "FRI", or # "SAT". This field is required if the "frequency" parameter is set # to "WEEKLY" or "BIWEEKLY". # # @option params [Array<String>] :target_check_names # Which checks are performed during the scheduled audit. Checks must be # enabled for your account. (Use `DescribeAccountAuditConfiguration` to # see the list of all checks, including those that are enabled or use # `UpdateAccountAuditConfiguration` to select which checks are enabled.) # # @option params [required, String] :scheduled_audit_name # The name of the scheduled audit. (Max. 128 chars) # # @return [Types::UpdateScheduledAuditResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateScheduledAuditResponse#scheduled_audit_arn #scheduled_audit_arn} => String # # @example Request syntax with placeholder values # # resp = client.update_scheduled_audit({ # frequency: "DAILY", # accepts DAILY, WEEKLY, BIWEEKLY, MONTHLY # day_of_month: "DayOfMonth", # day_of_week: "SUN", # accepts SUN, MON, TUE, WED, THU, FRI, SAT # target_check_names: ["AuditCheckName"], # scheduled_audit_name: "ScheduledAuditName", # required # }) # # @example Response structure # # resp.scheduled_audit_arn #=> String # # @overload update_scheduled_audit(params = {}) # @param [Hash] params ({}) def update_scheduled_audit(params = {}, options = {}) req = build_request(:update_scheduled_audit, params) req.send_request(options) end # Updates a Device Defender security profile. # # @option params [required, String] :security_profile_name # The name of the security profile you want to update. # # @option params [String] :security_profile_description # A description of the security profile. # # @option params [Array<Types::Behavior>] :behaviors # Specifies the behaviors that, when violated by a device (thing), cause # an alert. # # @option params [Hash<String,Types::AlertTarget>] :alert_targets # Where the alerts are sent. (Alerts are always sent to the console.) # # @option params [Array<String>] :additional_metrics_to_retain # A list of metrics whose data is retained (stored). By default, data is # retained for any metric used in the profile's `behaviors`, but it is # also retained for any metric specified here. # # **Note:** This API field is deprecated. Please use # UpdateSecurityProfileRequest$additionalMetricsToRetainV2 instead. # # @option params [Array<Types::MetricToRetain>] :additional_metrics_to_retain_v2 # A list of metrics whose data is retained (stored). By default, data is # retained for any metric used in the profile's behaviors, but it is # also retained for any metric specified here. # # @option params [Boolean] :delete_behaviors # If true, delete all `behaviors` defined for this security profile. If # any `behaviors` are defined in the current invocation, an exception # occurs. # # @option params [Boolean] :delete_alert_targets # If true, delete all `alertTargets` defined for this security profile. # If any `alertTargets` are defined in the current invocation, an # exception occurs. # # @option params [Boolean] :delete_additional_metrics_to_retain # If true, delete all `additionalMetricsToRetain` defined for this # security profile. If any `additionalMetricsToRetain` are defined in # the current invocation, an exception occurs. # # @option params [Integer] :expected_version # The expected version of the security profile. A new version is # generated whenever the security profile is updated. If you specify a # value that is different from the actual version, a # `VersionConflictException` is thrown. # # @return [Types::UpdateSecurityProfileResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateSecurityProfileResponse#security_profile_name #security_profile_name} => String # * {Types::UpdateSecurityProfileResponse#security_profile_arn #security_profile_arn} => String # * {Types::UpdateSecurityProfileResponse#security_profile_description #security_profile_description} => String # * {Types::UpdateSecurityProfileResponse#behaviors #behaviors} => Array&lt;Types::Behavior&gt; # * {Types::UpdateSecurityProfileResponse#alert_targets #alert_targets} => Hash&lt;String,Types::AlertTarget&gt; # * {Types::UpdateSecurityProfileResponse#additional_metrics_to_retain #additional_metrics_to_retain} => Array&lt;String&gt; # * {Types::UpdateSecurityProfileResponse#additional_metrics_to_retain_v2 #additional_metrics_to_retain_v2} => Array&lt;Types::MetricToRetain&gt; # * {Types::UpdateSecurityProfileResponse#version #version} => Integer # * {Types::UpdateSecurityProfileResponse#creation_date #creation_date} => Time # * {Types::UpdateSecurityProfileResponse#last_modified_date #last_modified_date} => Time # # @example Request syntax with placeholder values # # resp = client.update_security_profile({ # security_profile_name: "SecurityProfileName", # required # security_profile_description: "SecurityProfileDescription", # behaviors: [ # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # metric_dimension: { # dimension_name: "DimensionName", # required # operator: "IN", # accepts IN, NOT_IN # }, # criteria: { # comparison_operator: "less-than", # accepts less-than, less-than-equals, greater-than, greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set, not-in-port-set # value: { # count: 1, # cidrs: ["Cidr"], # ports: [1], # }, # duration_seconds: 1, # consecutive_datapoints_to_alarm: 1, # consecutive_datapoints_to_clear: 1, # statistical_threshold: { # statistic: "EvaluationStatistic", # }, # }, # }, # ], # alert_targets: { # "SNS" => { # alert_target_arn: "AlertTargetArn", # required # role_arn: "RoleArn", # required # }, # }, # additional_metrics_to_retain: ["BehaviorMetric"], # additional_metrics_to_retain_v2: [ # { # metric: "BehaviorMetric", # required # metric_dimension: { # dimension_name: "DimensionName", # required # operator: "IN", # accepts IN, NOT_IN # }, # }, # ], # delete_behaviors: false, # delete_alert_targets: false, # delete_additional_metrics_to_retain: false, # expected_version: 1, # }) # # @example Response structure # # resp.security_profile_name #=> String # resp.security_profile_arn #=> String # resp.security_profile_description #=> String # resp.behaviors #=> Array # resp.behaviors[0].name #=> String # resp.behaviors[0].metric #=> String # resp.behaviors[0].metric_dimension.dimension_name #=> String # resp.behaviors[0].metric_dimension.operator #=> String, one of "IN", "NOT_IN" # resp.behaviors[0].criteria.comparison_operator #=> String, one of "less-than", "less-than-equals", "greater-than", "greater-than-equals", "in-cidr-set", "not-in-cidr-set", "in-port-set", "not-in-port-set" # resp.behaviors[0].criteria.value.count #=> Integer # resp.behaviors[0].criteria.value.cidrs #=> Array # resp.behaviors[0].criteria.value.cidrs[0] #=> String # resp.behaviors[0].criteria.value.ports #=> Array # resp.behaviors[0].criteria.value.ports[0] #=> Integer # resp.behaviors[0].criteria.duration_seconds #=> Integer # resp.behaviors[0].criteria.consecutive_datapoints_to_alarm #=> Integer # resp.behaviors[0].criteria.consecutive_datapoints_to_clear #=> Integer # resp.behaviors[0].criteria.statistical_threshold.statistic #=> String # resp.alert_targets #=> Hash # resp.alert_targets["AlertTargetType"].alert_target_arn #=> String # resp.alert_targets["AlertTargetType"].role_arn #=> String # resp.additional_metrics_to_retain #=> Array # resp.additional_metrics_to_retain[0] #=> String # resp.additional_metrics_to_retain_v2 #=> Array # resp.additional_metrics_to_retain_v2[0].metric #=> String # resp.additional_metrics_to_retain_v2[0].metric_dimension.dimension_name #=> String # resp.additional_metrics_to_retain_v2[0].metric_dimension.operator #=> String, one of "IN", "NOT_IN" # resp.version #=> Integer # resp.creation_date #=> Time # resp.last_modified_date #=> Time # # @overload update_security_profile(params = {}) # @param [Hash] params ({}) def update_security_profile(params = {}, options = {}) req = build_request(:update_security_profile, params) req.send_request(options) end # Updates an existing stream. The stream version will be incremented by # one. # # @option params [required, String] :stream_id # The stream ID. # # @option params [String] :description # The description of the stream. # # @option params [Array<Types::StreamFile>] :files # The files associated with the stream. # # @option params [String] :role_arn # An IAM role that allows the IoT service principal assumes to access # your S3 files. # # @return [Types::UpdateStreamResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateStreamResponse#stream_id #stream_id} => String # * {Types::UpdateStreamResponse#stream_arn #stream_arn} => String # * {Types::UpdateStreamResponse#description #description} => String # * {Types::UpdateStreamResponse#stream_version #stream_version} => Integer # # @example Request syntax with placeholder values # # resp = client.update_stream({ # stream_id: "StreamId", # required # description: "StreamDescription", # files: [ # { # file_id: 1, # s3_location: { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # }, # }, # ], # role_arn: "RoleArn", # }) # # @example Response structure # # resp.stream_id #=> String # resp.stream_arn #=> String # resp.description #=> String # resp.stream_version #=> Integer # # @overload update_stream(params = {}) # @param [Hash] params ({}) def update_stream(params = {}, options = {}) req = build_request(:update_stream, params) req.send_request(options) end # Updates the data for a thing. # # @option params [required, String] :thing_name # The name of the thing to update. # # You can't change a thing's name. To change a thing's name, you must # create a new thing, give it the new name, and then delete the old # thing. # # @option params [String] :thing_type_name # The name of the thing type. # # @option params [Types::AttributePayload] :attribute_payload # A list of thing attributes, a JSON string containing name-value pairs. # For example: # # `\{"attributes":\{"name1":"value2"\}\}` # # This data is used to add new attributes or update existing attributes. # # @option params [Integer] :expected_version # The expected version of the thing record in the registry. If the # version of the record in the registry does not match the expected # version specified in the request, the `UpdateThing` request is # rejected with a `VersionConflictException`. # # @option params [Boolean] :remove_thing_type # Remove a thing type association. If **true**, the association is # removed. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_thing({ # thing_name: "ThingName", # required # thing_type_name: "ThingTypeName", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # expected_version: 1, # remove_thing_type: false, # }) # # @overload update_thing(params = {}) # @param [Hash] params ({}) def update_thing(params = {}, options = {}) req = build_request(:update_thing, params) req.send_request(options) end # Update a thing group. # # @option params [required, String] :thing_group_name # The thing group to update. # # @option params [required, Types::ThingGroupProperties] :thing_group_properties # The thing group properties. # # @option params [Integer] :expected_version # The expected version of the thing group. If this does not match the # version of the thing group being updated, the update will fail. # # @return [Types::UpdateThingGroupResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::UpdateThingGroupResponse#version #version} => Integer # # @example Request syntax with placeholder values # # resp = client.update_thing_group({ # thing_group_name: "ThingGroupName", # required # thing_group_properties: { # required # thing_group_description: "ThingGroupDescription", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # }, # expected_version: 1, # }) # # @example Response structure # # resp.version #=> Integer # # @overload update_thing_group(params = {}) # @param [Hash] params ({}) def update_thing_group(params = {}, options = {}) req = build_request(:update_thing_group, params) req.send_request(options) end # Updates the groups to which the thing belongs. # # @option params [String] :thing_name # The thing whose group memberships will be updated. # # @option params [Array<String>] :thing_groups_to_add # The groups to which the thing will be added. # # @option params [Array<String>] :thing_groups_to_remove # The groups from which the thing will be removed. # # @option params [Boolean] :override_dynamic_groups # Override dynamic thing groups with static thing groups when 10-group # limit is reached. If a thing belongs to 10 thing groups, and one or # more of those groups are dynamic thing groups, adding a thing to a # static group removes the thing from the last dynamic group. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_thing_groups_for_thing({ # thing_name: "ThingName", # thing_groups_to_add: ["ThingGroupName"], # thing_groups_to_remove: ["ThingGroupName"], # override_dynamic_groups: false, # }) # # @overload update_thing_groups_for_thing(params = {}) # @param [Hash] params ({}) def update_thing_groups_for_thing(params = {}, options = {}) req = build_request(:update_thing_groups_for_thing, params) req.send_request(options) end # Updates a topic rule destination. You use this to change the status, # endpoint URL, or confirmation URL of the destination. # # @option params [required, String] :arn # The ARN of the topic rule destination. # # @option params [required, String] :status # The status of the topic rule destination. Valid values are: # # IN\_PROGRESS # # : A topic rule destination was created but has not been confirmed. You # can set `status` to `IN_PROGRESS` by calling # `UpdateTopicRuleDestination`. Calling `UpdateTopicRuleDestination` # causes a new confirmation challenge to be sent to your confirmation # endpoint. # # ENABLED # # : Confirmation was completed, and traffic to this destination is # allowed. You can set `status` to `DISABLED` by calling # `UpdateTopicRuleDestination`. # # DISABLED # # : Confirmation was completed, and traffic to this destination is not # allowed. You can set `status` to `ENABLED` by calling # `UpdateTopicRuleDestination`. # # ERROR # # : Confirmation could not be completed, for example if the confirmation # timed out. You can call `GetTopicRuleDestination` for details about # the error. You can set `status` to `IN_PROGRESS` by calling # `UpdateTopicRuleDestination`. Calling `UpdateTopicRuleDestination` # causes a new confirmation challenge to be sent to your confirmation # endpoint. # # @return [Struct] Returns an empty {Seahorse::Client::Response response}. # # @example Request syntax with placeholder values # # resp = client.update_topic_rule_destination({ # arn: "AwsArn", # required # status: "ENABLED", # required, accepts ENABLED, IN_PROGRESS, DISABLED, ERROR # }) # # @overload update_topic_rule_destination(params = {}) # @param [Hash] params ({}) def update_topic_rule_destination(params = {}, options = {}) req = build_request(:update_topic_rule_destination, params) req.send_request(options) end # Validates a Device Defender security profile behaviors specification. # # @option params [required, Array<Types::Behavior>] :behaviors # Specifies the behaviors that, when violated by a device (thing), cause # an alert. # # @return [Types::ValidateSecurityProfileBehaviorsResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods: # # * {Types::ValidateSecurityProfileBehaviorsResponse#valid #valid} => Boolean # * {Types::ValidateSecurityProfileBehaviorsResponse#validation_errors #validation_errors} => Array&lt;Types::ValidationError&gt; # # @example Request syntax with placeholder values # # resp = client.validate_security_profile_behaviors({ # behaviors: [ # required # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # metric_dimension: { # dimension_name: "DimensionName", # required # operator: "IN", # accepts IN, NOT_IN # }, # criteria: { # comparison_operator: "less-than", # accepts less-than, less-than-equals, greater-than, greater-than-equals, in-cidr-set, not-in-cidr-set, in-port-set, not-in-port-set # value: { # count: 1, # cidrs: ["Cidr"], # ports: [1], # }, # duration_seconds: 1, # consecutive_datapoints_to_alarm: 1, # consecutive_datapoints_to_clear: 1, # statistical_threshold: { # statistic: "EvaluationStatistic", # }, # }, # }, # ], # }) # # @example Response structure # # resp.valid #=> Boolean # resp.validation_errors #=> Array # resp.validation_errors[0].error_message #=> String # # @overload validate_security_profile_behaviors(params = {}) # @param [Hash] params ({}) def validate_security_profile_behaviors(params = {}, options = {}) req = build_request(:validate_security_profile_behaviors, params) req.send_request(options) end # @!endgroup # @param params ({}) # @api private def build_request(operation_name, params = {}) handlers = @handlers.for(operation_name) context = Seahorse::Client::RequestContext.new( operation_name: operation_name, operation: config.api.operation(operation_name), client: self, params: params, config: config) context[:gem_name] = 'aws-sdk-iot' context[:gem_version] = '1.53.0' Seahorse::Client::Request.new(handlers, context) end # @api private # @deprecated def waiter_names [] end class << self # @api private attr_reader :identifier # @api private def errors_module Errors end end end end
41.98039
229
0.647061
e288b3500459129420e2c2b24e95b9bf8e8dca31
2,036
require 'json' require 'morpheus/api' class MorpheusRole < Inspec.resource(1) name 'morpheus_role' desc 'Verifies settings for a morpheus role' example " describe morpheus_role(name: 'System Admin') do it { should exist } end " def initialize(opts) @opts = opts @display_name = @opts[:name] Morpheus::RestClient.enable_ssl_verification = false @client = Morpheus::APIClient.new(url:ENV['MORPHEUS_API_URL'], access_token: ENV['MORPHEUS_API_TOKEN'], verify_ssl: false) begin output = @client.roles.list(nil, {max:10000,sort:""}) roles = output["roles"] @roleid = nil roles.each do |role| if role["authority"] == @opts[:name] @roleid = role["id"] end end @role = @client.roles.get(nil, @roleid) rescue => e @role = e end end def name if @role @role["authority"] else @error['error']['message'] end end def persona_permissions if @role permissions = Hash.new @role["personaPermissions"].each do |permission| permissions[permission["name"]] = permission["access"] end permissions else @error['error']['message'] end end def global_site_access if @role @role["globalSiteAccess"] else @error['error']['message'] end end def global_zone_access if @role @role["globalZoneAccess"] else @error['error']['message'] end end def global_catalog_item_type_access if @role @role["globalCatalogItemTypeAccess"] else @error['error']['message'] end end def global_app_template_access if @role @role["globalAppTemplateAccess"] else @error['error']['message'] end end def global_instance_type_access if @role @role["globalInstanceTypeAccess"] else @error['error']['message'] end end def exists? !@role.nil? end def to_s "role #{@display_name}" end end
19.960784
126
0.600196
91c79a1ddac30879a232969b274afd09398bc527
59
require 'spec_helper' describe FeaturesController do end
9.833333
30
0.830508
ac41d1d770bb09ed0eb8fd6cc491b6e871016a08
261
namespace :vasco do desc "Examines current routes and models and emits updated data for Explorer" task :explore => :environment do Vasco.write_json_data end task :preview => :environment do puts Vasco.create_vasco_json_data end end
20.076923
79
0.720307
f8ca70385e1ed3a3ee33ba23d5ba1d54095c0720
39,108
# frozen_string_literal: true # -*- ruby -*- #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rbconfig' module Gem VERSION = "3.1.6".freeze end # Must be first since it unloads the prelude from 1.9.2 require 'rubygems/compatibility' require 'rubygems/defaults' require 'rubygems/deprecate' require 'rubygems/errors' ## # RubyGems is the Ruby standard for publishing and managing third party # libraries. # # For user documentation, see: # # * <tt>gem help</tt> and <tt>gem help [command]</tt> # * {RubyGems User Guide}[https://guides.rubygems.org/] # * {Frequently Asked Questions}[https://guides.rubygems.org/faqs] # # For gem developer documentation see: # # * {Creating Gems}[https://guides.rubygems.org/make-your-own-gem] # * Gem::Specification # * Gem::Version for version dependency notes # # Further RubyGems documentation can be found at: # # * {RubyGems Guides}[https://guides.rubygems.org] # * {RubyGems API}[https://www.rubydoc.info/github/rubygems/rubygems] (also available from # <tt>gem server</tt>) # # == RubyGems Plugins # # As of RubyGems 1.3.2, RubyGems will load plugins installed in gems or # $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and # placed at the root of your gem's #require_path. Plugins are discovered via # Gem::find_files and then loaded. # # For an example plugin, see the {Graph gem}[https://github.com/seattlerb/graph] # which adds a `gem graph` command. # # == RubyGems Defaults, Packaging # # RubyGems defaults are stored in lib/rubygems/defaults.rb. If you're packaging # RubyGems or implementing Ruby you can change RubyGems' defaults. # # For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb # and override any defaults from lib/rubygems/defaults.rb. # # For Ruby implementers, provide lib/rubygems/defaults/#{RUBY_ENGINE}.rb and # override any defaults from lib/rubygems/defaults.rb. # # If you need RubyGems to perform extra work on install or uninstall, your # defaults override file can set pre/post install and uninstall hooks. # See Gem::pre_install, Gem::pre_uninstall, Gem::post_install, # Gem::post_uninstall. # # == Bugs # # You can submit bugs to the # {RubyGems bug tracker}[https://github.com/rubygems/rubygems/issues] # on GitHub # # == Credits # # RubyGems is currently maintained by Eric Hodel. # # RubyGems was originally developed at RubyConf 2003 by: # # * Rich Kilmer -- rich(at)infoether.com # * Chad Fowler -- chad(at)chadfowler.com # * David Black -- dblack(at)wobblini.net # * Paul Brannan -- paul(at)atdesk.com # * Jim Weirich -- jim(at)weirichhouse.org # # Contributors: # # * Gavin Sinclair -- gsinclair(at)soyabean.com.au # * George Marrows -- george.marrows(at)ntlworld.com # * Dick Davies -- rasputnik(at)hellooperator.net # * Mauricio Fernandez -- batsman.geo(at)yahoo.com # * Simon Strandgaard -- neoneye(at)adslhome.dk # * Dave Glasser -- glasser(at)mit.edu # * Paul Duncan -- pabs(at)pablotron.org # * Ville Aine -- vaine(at)cs.helsinki.fi # * Eric Hodel -- drbrain(at)segment7.net # * Daniel Berger -- djberg96(at)gmail.com # * Phil Hagelberg -- technomancy(at)gmail.com # * Ryan Davis -- ryand-ruby(at)zenspider.com # * Evan Phoenix -- evan(at)fallingsnow.net # * Steve Klabnik -- steve(at)steveklabnik.com # # (If your name is missing, PLEASE let us know!) # # == License # # See {LICENSE.txt}[rdoc-ref:lib/rubygems/LICENSE.txt] for permissions. # # Thanks! # # -The RubyGems Team module Gem RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__) # Taint support is deprecated in Ruby 2.7. # This allows switching ".untaint" to ".tap(&Gem::UNTAINT)", # to avoid deprecation warnings in Ruby 2.7. UNTAINT = RUBY_VERSION < '2.7' ? :untaint.to_sym : proc{} ## # An Array of Regexps that match windows Ruby platforms. WIN_PATTERNS = [ /bccwin/i, /cygwin/i, /djgpp/i, /mingw/i, /mswin/i, /wince/i, ].freeze GEM_DEP_FILES = %w[ gem.deps.rb gems.rb Gemfile Isolate ].freeze ## # Subdirectories in a gem repository REPOSITORY_SUBDIRECTORIES = %w[ build_info cache doc extensions gems specifications ].freeze ## # Subdirectories in a gem repository for default gems REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES = %w[ gems specifications/default ].freeze ## # Exception classes used in a Gem.read_binary +rescue+ statement READ_BINARY_ERRORS = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS, Errno::ENOTSUP].freeze ## # Exception classes used in Gem.write_binary +rescue+ statement WRITE_BINARY_ERRORS = [Errno::ENOSYS, Errno::ENOTSUP].freeze @@win_platform = nil @configuration = nil @gemdeps = nil @loaded_specs = {} LOADED_SPECS_MUTEX = Mutex.new @path_to_default_spec_map = {} @platforms = [] @ruby = nil @ruby_api_version = nil @sources = nil @post_build_hooks ||= [] @post_install_hooks ||= [] @post_uninstall_hooks ||= [] @pre_uninstall_hooks ||= [] @pre_install_hooks ||= [] @pre_reset_hooks ||= [] @post_reset_hooks ||= [] @default_source_date_epoch = nil ## # Try to activate a gem containing +path+. Returns true if # activation succeeded or wasn't needed because it was already # activated. Returns false if it can't find the path in a gem. def self.try_activate(path) # finds the _latest_ version... regardless of loaded specs and their deps # if another gem had a requirement that would mean we shouldn't # activate the latest version, then either it would already be activated # or if it was ambiguous (and thus unresolved) the code in our custom # require will try to activate the more specific version. spec = Gem::Specification.find_by_path path return false unless spec return true if spec.activated? begin spec.activate rescue Gem::LoadError => e # this could fail due to gem dep collisions, go lax spec_by_name = Gem::Specification.find_by_name(spec.name) if spec_by_name.nil? raise e else spec_by_name.activate end end return true end def self.needs rs = Gem::RequestSet.new yield rs finish_resolve rs end def self.finish_resolve(request_set=Gem::RequestSet.new) request_set.import Gem::Specification.unresolved_deps.values request_set.import Gem.loaded_specs.values.map {|s| Gem::Dependency.new(s.name, s.version) } request_set.resolve_current.each do |s| s.full_spec.activate end end ## # Find the full path to the executable for gem +name+. If the +exec_name+ # is not given, an exception will be raised, otherwise the # specified executable's path is returned. +requirements+ allows # you to specify specific gem versions. def self.bin_path(name, exec_name = nil, *requirements) # TODO: fails test_self_bin_path_bin_file_gone_in_latest # Gem::Specification.find_by_name(name, *requirements).bin_file exec_name requirements = Gem::Requirement.default if requirements.empty? find_spec_for_exe(name, exec_name, requirements).bin_file exec_name end def self.find_spec_for_exe(name, exec_name, requirements) raise ArgumentError, "you must supply exec_name" unless exec_name dep = Gem::Dependency.new name, requirements loaded = Gem.loaded_specs[name] return loaded if loaded && dep.matches_spec?(loaded) specs = dep.matching_specs(true) specs = specs.find_all do |spec| spec.executables.include? exec_name end if exec_name unless spec = specs.first msg = "can't find gem #{dep} with executable #{exec_name}" if name == "bundler" && bundler_message = Gem::BundlerVersionFinder.missing_version_message msg = bundler_message end raise Gem::GemNotFoundException, msg end spec end private_class_method :find_spec_for_exe ## # Find the full path to the executable for gem +name+. If the +exec_name+ # is not given, an exception will be raised, otherwise the # specified executable's path is returned. +requirements+ allows # you to specify specific gem versions. # # A side effect of this method is that it will activate the gem that # contains the executable. # # This method should *only* be used in bin stub files. def self.activate_bin_path(name, exec_name = nil, *requirements) # :nodoc: spec = find_spec_for_exe name, exec_name, requirements Gem::LOADED_SPECS_MUTEX.synchronize do spec.activate finish_resolve end spec.bin_file exec_name end ## # The mode needed to read a file as straight binary. def self.binary_mode 'rb' end ## # The path where gem executables are to be installed. def self.bindir(install_dir=Gem.dir) return File.join install_dir, 'bin' unless install_dir.to_s == Gem.default_dir.to_s Gem.default_bindir end ## # Reset the +dir+ and +path+ values. The next time +dir+ or +path+ # is requested, the values will be calculated from scratch. This is # mainly used by the unit tests to provide test isolation. def self.clear_paths @paths = nil @user_home = nil Gem::Specification.reset Gem::Security.reset if defined?(Gem::Security) end ## # The path to standard location of the user's .gemrc file. def self.config_file @config_file ||= File.join Gem.user_home, '.gemrc' end ## # The standard configuration object for gems. def self.configuration @configuration ||= Gem::ConfigFile.new [] end ## # Use the given configuration object (which implements the ConfigFile # protocol) as the standard configuration object. def self.configuration=(config) @configuration = config end ## # The path to the data directory specified by the gem name. If the # package is not available as a gem, return nil. def self.datadir(gem_name) spec = @loaded_specs[gem_name] return nil if spec.nil? spec.datadir end ## # A Zlib::Deflate.deflate wrapper def self.deflate(data) require 'zlib' Zlib::Deflate.deflate data end # Retrieve the PathSupport object that RubyGems uses to # lookup files. def self.paths @paths ||= Gem::PathSupport.new(ENV) end # Initialize the filesystem paths to use from +env+. # +env+ is a hash-like object (typically ENV) that # is queried for 'GEM_HOME', 'GEM_PATH', and 'GEM_SPEC_CACHE' # Keys for the +env+ hash should be Strings, and values of the hash should # be Strings or +nil+. def self.paths=(env) clear_paths target = {} env.each_pair do |k,v| case k when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE' case v when nil, String target[k] = v when Array unless Gem::Deprecate.skip warn <<-eowarn Array values in the parameter to `Gem.paths=` are deprecated. Please use a String or nil. An Array (#{env.inspect}) was passed in from #{caller[3]} eowarn end target[k] = v.join File::PATH_SEPARATOR end else target[k] = v end end @paths = Gem::PathSupport.new ENV.to_hash.merge(target) Gem::Specification.dirs = @paths.path end ## # The path where gems are to be installed. #-- # FIXME deprecate these once everything else has been done -ebh def self.dir paths.home end def self.path paths.path end def self.spec_cache_dir paths.spec_cache_dir end ## # Quietly ensure the Gem directory +dir+ contains all the proper # subdirectories. If we can't create a directory due to a permission # problem, then we will silently continue. # # If +mode+ is given, missing directories are created with this mode. # # World-writable directories will never be created. def self.ensure_gem_subdirectories(dir = Gem.dir, mode = nil) ensure_subdirectories(dir, mode, REPOSITORY_SUBDIRECTORIES) end ## # Quietly ensure the Gem directory +dir+ contains all the proper # subdirectories for handling default gems. If we can't create a # directory due to a permission problem, then we will silently continue. # # If +mode+ is given, missing directories are created with this mode. # # World-writable directories will never be created. def self.ensure_default_gem_subdirectories(dir = Gem.dir, mode = nil) ensure_subdirectories(dir, mode, REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES) end def self.ensure_subdirectories(dir, mode, subdirs) # :nodoc: old_umask = File.umask File.umask old_umask | 002 require 'fileutils' options = {} options[:mode] = mode if mode subdirs.each do |name| subdir = File.join dir, name next if File.exist? subdir FileUtils.mkdir_p subdir, **options rescue nil end ensure File.umask old_umask end ## # The extension API version of ruby. This includes the static vs non-static # distinction as extensions cannot be shared between the two. def self.extension_api_version # :nodoc: if 'no' == RbConfig::CONFIG['ENABLE_SHARED'] "#{ruby_api_version}-static" else ruby_api_version end end ## # Returns a list of paths matching +glob+ that can be used by a gem to pick # up features from other gems. For example: # # Gem.find_files('rdoc/discover').each do |path| load path end # # if +check_load_path+ is true (the default), then find_files also searches # $LOAD_PATH for files as well as gems. # # Note that find_files will return all files even if they are from different # versions of the same gem. See also find_latest_files def self.find_files(glob, check_load_path=true) files = [] files = find_files_from_load_path glob if check_load_path gem_specifications = @gemdeps ? Gem.loaded_specs.values : Gem::Specification.stubs files.concat gem_specifications.map { |spec| spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}") }.flatten # $LOAD_PATH might contain duplicate entries or reference # the spec dirs directly, so we prune. files.uniq! if check_load_path return files end def self.find_files_from_load_path(glob) # :nodoc: glob_with_suffixes = "#{glob}#{Gem.suffix_pattern}" $LOAD_PATH.map do |load_path| Gem::Util.glob_files_in_dir(glob_with_suffixes, load_path) end.flatten.select { |file| File.file? file.tap(&Gem::UNTAINT) } end ## # Returns a list of paths matching +glob+ from the latest gems that can be # used by a gem to pick up features from other gems. For example: # # Gem.find_latest_files('rdoc/discover').each do |path| load path end # # if +check_load_path+ is true (the default), then find_latest_files also # searches $LOAD_PATH for files as well as gems. # # Unlike find_files, find_latest_files will return only files from the # latest version of a gem. def self.find_latest_files(glob, check_load_path=true) files = [] files = find_files_from_load_path glob if check_load_path files.concat Gem::Specification.latest_specs(true).map { |spec| spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}") }.flatten # $LOAD_PATH might contain duplicate entries or reference # the spec dirs directly, so we prune. files.uniq! if check_load_path return files end ## # Finds the user's home directory. #-- # Some comments from the ruby-talk list regarding finding the home # directory: # # I have HOME, USERPROFILE and HOMEDRIVE + HOMEPATH. Ruby seems # to be depending on HOME in those code samples. I propose that # it should fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at # least on Win32). #++ #-- # #++ def self.find_home Dir.home.dup rescue if Gem.win_platform? File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/') else File.expand_path "/" end end private_class_method :find_home # TODO: remove in RubyGems 4.0 ## # Zlib::GzipReader wrapper that unzips +data+. def self.gunzip(data) Gem::Util.gunzip data end class << self extend Gem::Deprecate deprecate :gunzip, "Gem::Util.gunzip", 2018, 12 end ## # Zlib::GzipWriter wrapper that zips +data+. def self.gzip(data) Gem::Util.gzip data end class << self extend Gem::Deprecate deprecate :gzip, "Gem::Util.gzip", 2018, 12 end ## # A Zlib::Inflate#inflate wrapper def self.inflate(data) Gem::Util.inflate data end class << self extend Gem::Deprecate deprecate :inflate, "Gem::Util.inflate", 2018, 12 end ## # Top level install helper method. Allows you to install gems interactively: # # % irb # >> Gem.install "minitest" # Fetching: minitest-3.0.1.gem (100%) # => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>] def self.install(name, version = Gem::Requirement.default, *options) require "rubygems/dependency_installer" inst = Gem::DependencyInstaller.new(*options) inst.install name, version inst.installed_gems end ## # Get the default RubyGems API host. This is normally # <tt>https://rubygems.org</tt>. def self.host @host ||= Gem::DEFAULT_HOST end ## Set the default RubyGems API host. def self.host=(host) @host = host end ## # The index to insert activated gem paths into the $LOAD_PATH. The activated # gem's paths are inserted before site lib directory by default. def self.load_path_insert_index $LOAD_PATH.each_with_index do |path, i| return i if path.instance_variable_defined?(:@gem_prelude_index) end index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir'] index || 0 end ## # The number of paths in the `$LOAD_PATH` from activated gems. Used to # prioritize `-I` and `ENV['RUBYLIB`]` entries during `require`. def self.activated_gem_paths @activated_gem_paths ||= 0 end ## # Add a list of paths to the $LOAD_PATH at the proper place. def self.add_to_load_path(*paths) @activated_gem_paths = activated_gem_paths + paths.size # gem directories must come after -I and ENV['RUBYLIB'] $LOAD_PATH.insert(Gem.load_path_insert_index, *paths) end @yaml_loaded = false ## # Loads YAML, preferring Psych def self.load_yaml return if @yaml_loaded return unless defined?(gem) begin gem 'psych', '>= 2.0.0' rescue Gem::LoadError # It's OK if the user does not have the psych gem installed. We will # attempt to require the stdlib version end begin # Try requiring the gem version *or* stdlib version of psych. require 'psych' rescue ::LoadError # If we can't load psych, thats fine, go on. else # If 'yaml' has already been required, then we have to # be sure to switch it over to the newly loaded psych. if defined?(YAML::ENGINE) && YAML::ENGINE.yamler != "psych" YAML::ENGINE.yamler = "psych" end require 'rubygems/psych_additions' require 'rubygems/psych_tree' end require 'yaml' require 'rubygems/safe_yaml' # Now that we're sure some kind of yaml library is loaded, pull # in our hack to deal with Syck's DefaultKey ugliness. require 'rubygems/syck_hack' @yaml_loaded = true end ## # The file name and line number of the caller of the caller of this method. # # +depth+ is how many layers up the call stack it should go. # # e.g., # # def a; Gem.location_of_caller; end # a #=> ["x.rb", 2] # (it'll vary depending on file name and line number) # # def b; c; end # def c; Gem.location_of_caller(2); end # b #=> ["x.rb", 6] # (it'll vary depending on file name and line number) def self.location_of_caller(depth = 1) caller[depth] =~ /(.*?):(\d+).*?$/i file = $1 lineno = $2.to_i [file, lineno] end ## # The version of the Marshal format for your Ruby. def self.marshal_version "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" end ## # Set array of platforms this RubyGems supports (primarily for testing). def self.platforms=(platforms) @platforms = platforms end ## # Array of platforms this RubyGems supports. def self.platforms @platforms ||= [] if @platforms.empty? @platforms = [Gem::Platform::RUBY, Gem::Platform.local] end @platforms end ## # Adds a post-build hook that will be passed an Gem::Installer instance # when Gem::Installer#install is called. The hook is called after the gem # has been extracted and extensions have been built but before the # executables or gemspec has been written. If the hook returns +false+ then # the gem's files will be removed and the install will be aborted. def self.post_build(&hook) @post_build_hooks << hook end ## # Adds a post-install hook that will be passed an Gem::Installer instance # when Gem::Installer#install is called def self.post_install(&hook) @post_install_hooks << hook end ## # Adds a post-installs hook that will be passed a Gem::DependencyInstaller # and a list of installed specifications when # Gem::DependencyInstaller#install is complete def self.done_installing(&hook) @done_installing_hooks << hook end ## # Adds a hook that will get run after Gem::Specification.reset is # run. def self.post_reset(&hook) @post_reset_hooks << hook end ## # Adds a post-uninstall hook that will be passed a Gem::Uninstaller instance # and the spec that was uninstalled when Gem::Uninstaller#uninstall is # called def self.post_uninstall(&hook) @post_uninstall_hooks << hook end ## # Adds a pre-install hook that will be passed an Gem::Installer instance # when Gem::Installer#install is called. If the hook returns +false+ then # the install will be aborted. def self.pre_install(&hook) @pre_install_hooks << hook end ## # Adds a hook that will get run before Gem::Specification.reset is # run. def self.pre_reset(&hook) @pre_reset_hooks << hook end ## # Adds a pre-uninstall hook that will be passed an Gem::Uninstaller instance # and the spec that will be uninstalled when Gem::Uninstaller#uninstall is # called def self.pre_uninstall(&hook) @pre_uninstall_hooks << hook end ## # The directory prefix this RubyGems was installed at. If your # prefix is in a standard location (ie, rubygems is installed where # you'd expect it to be), then prefix returns nil. def self.prefix prefix = File.dirname RUBYGEMS_DIR if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and prefix != File.expand_path(RbConfig::CONFIG['libdir']) and 'lib' == File.basename(RUBYGEMS_DIR) prefix end end ## # Refresh available gems from disk. def self.refresh Gem::Specification.reset end ## # Safely read a file in binary mode on all platforms. def self.read_binary(path) File.open path, 'rb+' do |f| f.flock(File::LOCK_EX) f.read end rescue *READ_BINARY_ERRORS File.open path, 'rb' do |f| f.read end rescue Errno::ENOLCK # NFS if Thread.main != Thread.current raise else File.open path, 'rb' do |f| f.read end end end ## # Safely write a file in binary mode on all platforms. def self.write_binary(path, data) open(path, 'wb') do |io| begin io.flock(File::LOCK_EX) rescue *WRITE_BINARY_ERRORS end io.write data end rescue Errno::ENOLCK # NFS if Thread.main != Thread.current raise else open(path, 'wb') do |io| io.write data end end end ## # The path to the running Ruby interpreter. def self.ruby if @ruby.nil? @ruby = File.join(RbConfig::CONFIG['bindir'], "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}") @ruby = "\"#{@ruby}\"" if @ruby =~ /\s/ end @ruby end ## # Returns a String containing the API compatibility version of Ruby def self.ruby_api_version @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup end def self.env_requirement(gem_name) @env_requirements_by_name ||= {} @env_requirements_by_name[gem_name] ||= begin req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || '>= 0'.freeze Gem::Requirement.create(req) end end post_reset { @env_requirements_by_name = {} } ## # Returns the latest release-version specification for the gem +name+. def self.latest_spec_for(name) dependency = Gem::Dependency.new name fetcher = Gem::SpecFetcher.fetcher spec_tuples, = fetcher.spec_for_dependency dependency spec, = spec_tuples.first spec end ## # Returns the latest release version of RubyGems. def self.latest_rubygems_version latest_version_for('rubygems-update') or raise "Can't find 'rubygems-update' in any repo. Check `gem source list`." end ## # Returns the version of the latest release-version of gem +name+ def self.latest_version_for(name) spec = latest_spec_for name spec and spec.version end ## # A Gem::Version for the currently running Ruby. def self.ruby_version return @ruby_version if defined? @ruby_version version = RUBY_VERSION.dup if defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL != -1 version << ".#{RUBY_PATCHLEVEL}" elsif defined?(RUBY_DESCRIPTION) if RUBY_ENGINE == "ruby" desc = RUBY_DESCRIPTION[/\Aruby #{Regexp.quote(RUBY_VERSION)}([^ ]+) /, 1] else desc = RUBY_DESCRIPTION[/\A#{RUBY_ENGINE} #{Regexp.quote(RUBY_ENGINE_VERSION)} \(#{RUBY_VERSION}([^ ]+)\) /, 1] end version << ".#{desc}" if desc end @ruby_version = Gem::Version.new version end ## # A Gem::Version for the currently running RubyGems def self.rubygems_version return @rubygems_version if defined? @rubygems_version @rubygems_version = Gem::Version.new Gem::VERSION end ## # Returns an Array of sources to fetch remote gems from. Uses # default_sources if the sources list is empty. def self.sources source_list = configuration.sources || default_sources @sources ||= Gem::SourceList.from(source_list) end ## # Need to be able to set the sources without calling # Gem.sources.replace since that would cause an infinite loop. # # DOC: This comment is not documentation about the method itself, it's # more of a code comment about the implementation. def self.sources=(new_sources) if !new_sources @sources = nil else @sources = Gem::SourceList.from(new_sources) end end ## # Glob pattern for require-able path suffixes. def self.suffix_pattern @suffix_pattern ||= "{#{suffixes.join(',')}}" end def self.suffix_regexp @suffix_regexp ||= /#{Regexp.union(suffixes)}\z/ end ## # Suffixes for require-able paths. def self.suffixes @suffixes ||= ['', '.rb', *%w(DLEXT DLEXT2).map do |key| val = RbConfig::CONFIG[key] next unless val and not val.empty? ".#{val}" end ].compact.uniq end ## # Prints the amount of time the supplied block takes to run using the debug # UI output. def self.time(msg, width = 0, display = Gem.configuration.verbose) now = Time.now value = yield elapsed = Time.now - now ui.say "%2$*1$s: %3$3.3fs" % [-width, msg, elapsed] if display value end ## # Lazily loads DefaultUserInteraction and returns the default UI. def self.ui require 'rubygems/user_interaction' Gem::DefaultUserInteraction.ui end ## # Use the +home+ and +paths+ values for Gem.dir and Gem.path. Used mainly # by the unit tests to provide environment isolation. def self.use_paths(home, *paths) paths.flatten! paths.compact! hash = { "GEM_HOME" => home, "GEM_PATH" => paths.empty? ? home : paths.join(File::PATH_SEPARATOR) } hash.delete_if { |_, v| v.nil? } self.paths = hash end ## # The home directory for the user. def self.user_home @user_home ||= find_home.tap(&Gem::UNTAINT) end ## # Is this a windows platform? def self.win_platform? if @@win_platform.nil? ruby_platform = RbConfig::CONFIG['host_os'] @@win_platform = !!WIN_PATTERNS.find { |r| ruby_platform =~ r } end @@win_platform end ## # Is this a java platform? def self.java_platform? RUBY_PLATFORM == "java" end ## # Load +plugins+ as Ruby files def self.load_plugin_files(plugins) # :nodoc: plugins.each do |plugin| # Skip older versions of the GemCutter plugin: Its commands are in # RubyGems proper now. next if plugin =~ /gemcutter-0\.[0-3]/ begin load plugin rescue ::Exception => e details = "#{plugin.inspect}: #{e.message} (#{e.class})" warn "Error loading RubyGems plugin #{details}" end end end ## # Find the 'rubygems_plugin' files in the latest installed gems and load # them def self.load_plugins # Remove this env var by at least 3.0 if ENV['RUBYGEMS_LOAD_ALL_PLUGINS'] load_plugin_files find_files('rubygems_plugin', false) else load_plugin_files find_latest_files('rubygems_plugin', false) end end ## # Find all 'rubygems_plugin' files in $LOAD_PATH and load them def self.load_env_plugins path = "rubygems_plugin" files = [] glob = "#{path}#{Gem.suffix_pattern}" $LOAD_PATH.each do |load_path| globbed = Gem::Util.glob_files_in_dir(glob, load_path) globbed.each do |load_path_file| files << load_path_file if File.file?(load_path_file.tap(&Gem::UNTAINT)) end end load_plugin_files files end ## # Looks for a gem dependency file at +path+ and activates the gems in the # file if found. If the file is not found an ArgumentError is raised. # # If +path+ is not given the RUBYGEMS_GEMDEPS environment variable is used, # but if no file is found no exception is raised. # # If '-' is given for +path+ RubyGems searches up from the current working # directory for gem dependency files (gem.deps.rb, Gemfile, Isolate) and # activates the gems in the first one found. # # You can run this automatically when rubygems starts. To enable, set # the <code>RUBYGEMS_GEMDEPS</code> environment variable to either the path # of your gem dependencies file or "-" to auto-discover in parent # directories. # # NOTE: Enabling automatic discovery on multiuser systems can lead to # execution of arbitrary code when used from directories outside your # control. def self.use_gemdeps(path = nil) raise_exception = path path ||= ENV['RUBYGEMS_GEMDEPS'] return unless path path = path.dup if path == "-" Gem::Util.traverse_parents Dir.pwd do |directory| dep_file = GEM_DEP_FILES.find { |f| File.file?(f) } next unless dep_file path = File.join directory, dep_file break end end path.tap(&Gem::UNTAINT) unless File.file? path return unless raise_exception raise ArgumentError, "Unable to find gem dependencies file at #{path}" end ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path) require 'rubygems/user_interaction' Gem::DefaultUserInteraction.use_ui(ui) do require "bundler" begin Bundler.ui.silence do @gemdeps = Bundler.setup end ensure Gem::DefaultUserInteraction.ui.close end @gemdeps.requested_specs.map(&:to_spec).sort_by(&:name) end rescue => e case e when Gem::LoadError, Gem::UnsatisfiableDependencyError, (defined?(Bundler::GemNotFound) ? Bundler::GemNotFound : Gem::LoadError) warn e.message warn "You may need to `gem install -g` to install missing gems" warn "" else raise end end class << self ## # TODO remove with RubyGems 4.0 alias detect_gemdeps use_gemdeps # :nodoc: extend Gem::Deprecate deprecate :detect_gemdeps, "Gem.use_gemdeps", 2018, 12 end ## # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value. # Otherwise, returns the time that `Gem.source_date_epoch_string` was # first called in the same format as SOURCE_DATE_EPOCH. # # NOTE(@duckinator): The implementation is a tad weird because we want to: # 1. Make builds reproducible by default, by having this function always # return the same result during a given run. # 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple # tests that set this variable will be run in a single process. # # If you simplify this function and a lot of tests fail, that is likely # due to #2 above. # # Details on SOURCE_DATE_EPOCH: # https://reproducible-builds.org/specs/source-date-epoch/ def self.source_date_epoch_string # The value used if $SOURCE_DATE_EPOCH is not set. @default_source_date_epoch ||= Time.now.to_i.to_s specified_epoch = ENV["SOURCE_DATE_EPOCH"] # If it's empty or just whitespace, treat it like it wasn't set at all. specified_epoch = nil if !specified_epoch.nil? && specified_epoch.strip.empty? epoch = specified_epoch || @default_source_date_epoch epoch.strip end ## # Returns the value of Gem.source_date_epoch_string, as a Time object. # # This is used throughout RubyGems for enabling reproducible builds. def self.source_date_epoch Time.at(self.source_date_epoch_string.to_i).utc.freeze end # FIX: Almost everywhere else we use the `def self.` way of defining class # methods, and then we switch over to `class << self` here. Pick one or the # other. class << self ## # Hash of loaded Gem::Specification keyed by name attr_reader :loaded_specs ## # GemDependencyAPI object, which is set when .use_gemdeps is called. # This contains all the information from the Gemfile. attr_reader :gemdeps ## # Register a Gem::Specification for default gem. # # Two formats for the specification are supported: # # * MRI 2.0 style, where spec.files contains unprefixed require names. # The spec's filenames will be registered as-is. # * New style, where spec.files contains files prefixed with paths # from spec.require_paths. The prefixes are stripped before # registering the spec's filenames. Unprefixed files are omitted. # def register_default_spec(spec) extended_require_paths = spec.require_paths.map {|f| f + "/"} new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } } if new_format prefix_group = extended_require_paths.join("|") prefix_pattern = /^(#{prefix_group})/ end spec.files.each do |file| if new_format file = file.sub(prefix_pattern, "") next unless $~ end @path_to_default_spec_map[file] = spec @path_to_default_spec_map[file.sub(suffix_regexp, "")] = spec end end ## # Find a Gem::Specification of default gem from +path+ def find_unresolved_default_spec(path) default_spec = @path_to_default_spec_map[path] return default_spec if default_spec && loaded_specs[default_spec.name] != default_spec end ## # Clear default gem related variables. It is for test def clear_default_specs @path_to_default_spec_map.clear end ## # The list of hooks to be run after Gem::Installer#install extracts files # and builds extensions attr_reader :post_build_hooks ## # The list of hooks to be run after Gem::Installer#install completes # installation attr_reader :post_install_hooks ## # The list of hooks to be run after Gem::DependencyInstaller installs a # set of gems attr_reader :done_installing_hooks ## # The list of hooks to be run after Gem::Specification.reset is run. attr_reader :post_reset_hooks ## # The list of hooks to be run after Gem::Uninstaller#uninstall completes # installation attr_reader :post_uninstall_hooks ## # The list of hooks to be run before Gem::Installer#install does any work attr_reader :pre_install_hooks ## # The list of hooks to be run before Gem::Specification.reset is run. attr_reader :pre_reset_hooks ## # The list of hooks to be run before Gem::Uninstaller#uninstall does any # work attr_reader :pre_uninstall_hooks end ## # Location of Marshal quick gemspecs on remote repositories MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__) autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__) autoload :Dependency, File.expand_path('rubygems/dependency', __dir__) autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__) autoload :Installer, File.expand_path('rubygems/installer', __dir__) autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__) autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__) autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__) autoload :Platform, File.expand_path('rubygems/platform', __dir__) autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__) autoload :Requirement, File.expand_path('rubygems/requirement', __dir__) autoload :Resolver, File.expand_path('rubygems/resolver', __dir__) autoload :Source, File.expand_path('rubygems/source', __dir__) autoload :SourceList, File.expand_path('rubygems/source_list', __dir__) autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__) autoload :Specification, File.expand_path('rubygems/specification', __dir__) autoload :Util, File.expand_path('rubygems/util', __dir__) autoload :Version, File.expand_path('rubygems/version', __dir__) require "rubygems/specification" end require 'rubygems/exceptions' # REFACTOR: This should be pulled out into some kind of hacks file. begin ## # Defaults the operating system (or packager) wants to provide for RubyGems. require 'rubygems/defaults/operating_system' rescue LoadError end begin ## # Defaults the Ruby implementation wants to provide for RubyGems require "rubygems/defaults/#{RUBY_ENGINE}" rescue LoadError end ## # Loads the default specs. Gem::Specification.load_defaults require 'rubygems/core_ext/kernel_gem' require 'rubygems/core_ext/kernel_require' require 'rubygems/core_ext/kernel_warn' Gem.use_gemdeps
27.008287
132
0.679145
624e7bc2712331c3b596319e571d4dca130bdbf8
664
require_relative '../../app/models/list' require_relative '../../app/models/item' module Todoable RSpec.describe 'List SQL associations', :db do let(:goals) { List.create(name: 'Life Goals', user_id: 1) } let(:yosemite) { Item.new(name: 'Yosemite') } let(:grand_canyon) { Item.new(name: 'Grand Canyon') } describe 'association with List' do it 'has a many_to_one relationship with List' do expect(goals.items).to eq([]) goals.add_item(yosemite) goals.add_item(grand_canyon) expect(goals.items).to include(grand_canyon, yosemite) expect(yosemite.list_id).to eq(goals.id) end end end end
31.619048
63
0.658133
bbc235bb859a951590d50f0fefe4601f9accb990
3,119
module Trizetto module Api module Eligibility module WebService # A Patient is either a Subscriber or Depedent. This is the common # attributes between the two class Patient < Node prepend Rejectable # @see PatientName attr_accessor :name # The benefits this patient has. attr_accessor :benefits # The traces, by source (uppercased), in the response # # *Example* # # patient.traces # => {"99TRIZETTO" => "812341292"} # # *Example* # # patient.trace_number("99TRIZETTO") # => "812341292" # patient.trace_number("99Trizeeto") # => "812341292" attr_accessor :traces KEY_CLEANUP = { :patientid => :id } def initialize(raw_hash = {}) trace_ids, trace_numbers = Array(raw_hash.delete(:trace_id)), Array(raw_hash.delete(:trace_number)) super(raw_hash) self.name = PatientName.new(raw_hash[:patientname]) if raw_hash.has_key?(:patientname) benefits_xml = raw_hash[:benefit] || [] benefits_xml = [benefits_xml] if benefits_xml.is_a?(Hash) self.benefits = benefits_xml.map do |benefit_xml| Benefit.new(benefit_xml) end self.traces = {} if trace_ids.length == trace_numbers.length trace_ids.each.with_index do |id, index| traces[id.upcase] = trace_numbers[index] end end self.additional_info = [] if self.subscriberaddinfo.is_a?(Hash) self.subscriberaddinfo = [self.subscriberaddinfo] self.additional_info = self.subscriberaddinfo.map do |additional_info_hash| AdditionalInfo.new(additional_info_hash) end || [] end end # Looks in the additional info returned with the patient for a group number # # The group number is the additinal infomation node with a id of 6P # or Group Number. # # @see https://www.eedi.net/4010/278004010X094A1%5C29_278004010X094A1.htm # # @return [String] def group_number # it seems 6P is group number self.additional_info.detect do |additional_info| ["6P", "Group Number"].include?(additional_info.id) end.group_policy_number end # Looks in the additional info returned with the patient for a group number # @return [String] def plan_number self.additional_info.detect do |additional_info| additional_info.id == "Plan Number" end.group_policy_number end # Looks for a trace number by trace_id (who added the trace). # # @return [String] def trace_number(trace_id="99Trizetto") self.traces[trace_id.upcase] end end end end end end
31.505051
111
0.556909
7ad0e61bcf87805d99e48b441c93e9dcb51a18d3
870
require 'pathname' class Symlink def self.all Dir['**/*.symlink'].map { |path| new(path) } end attr_reader :source_pathname def initialize(source_path) @source_pathname = Pathname.new(source_path).realpath end def create print "#{source_pathname} -> #{destination_pathname} " if destination_pathname.exist? if destination_pathname.symlink? puts '[OK - symlink exists]' else puts '[FAILED - file exists]' end else destination_pathname.make_symlink(source_pathname) puts '[OK - symlink created]' end end private def destination_pathname home_pathname + destination_filename end def home_pathname Pathname.new(ENV['HOME']) end def destination_filename '.' + @source_pathname.basename('.*').to_s end end puts 'Creating symlinks' Symlink.all.each(&:create)
18.913043
58
0.677011
1a9f891dded80b0673dbca249dfb9c1bb04a3c03
12,759
require 'singleton' require 'pathname' class SpecConfig include Singleton # NB: constructor should not do I/O as SpecConfig may be used by tests # only loading the lite spec helper. Do I/O eagerly in accessor methods. def initialize @uri_options = {} if ENV['MONGODB_URI'] @mongodb_uri = Mongo::URI.new(ENV['MONGODB_URI']) @uri_options = Mongo::Options::Mapper.transform_keys_to_symbols(@mongodb_uri.uri_options) if @uri_options[:replica_set] @addresses = @mongodb_uri.servers @connect_options = { connect: :replica_set, replica_set: @uri_options[:replica_set] } elsif @uri_options[:connect] == :sharded || ENV['TOPOLOGY'] == 'sharded-cluster' @addresses = @mongodb_uri.servers @connect_options = { connect: :sharded } elsif @uri_options[:connect] == :direct @addresses = @mongodb_uri.servers @connect_options = { connect: :direct } end if @uri_options[:ssl].nil? @ssl = (ENV['SSL'] == 'ssl') || (ENV['SSL_ENABLED'] == 'true') else @ssl = @uri_options[:ssl] end elsif ENV['MONGODB_ADDRESSES'] @addresses = ENV['MONGODB_ADDRESSES'] ? ENV['MONGODB_ADDRESSES'].split(',').freeze : [ '127.0.0.1:27017' ].freeze if ENV['RS_ENABLED'] @connect_options = { connect: :replica_set, replica_set: ENV['RS_NAME'] } elsif ENV['SHARDED_ENABLED'] @connect_options = { connect: :sharded } else @connect_options = { connect: :direct } end end @uri_tls_options = {} @uri_options.each do |k, v| k = k.to_s.downcase if k.start_with?('ssl') @uri_tls_options[k] = v end end @ssl ||= false end attr_reader :uri_options, :connect_options def addresses @addresses ||= begin if @mongodb_uri @mongodb_uri.servers else client = Mongo::Client.new(['localhost:27017'], server_selection_timeout: 5.02) begin client.cluster.next_primary @addresses = client.cluster.servers_list.map do |server| server.address.to_s end ensure client.close end end end end def connect_options @connect_options ||= begin # Discover deployment topology. # TLS options need to be merged for evergreen due to # https://github.com/10gen/mongo-orchestration/issues/268 client = Mongo::Client.new(addresses, Mongo::Options::Redacted.new( server_selection_timeout: 5, ).merge(ssl_options)) begin case client.cluster.topology.class.name when /Replica/ { connect: :replica_set, replica_set: client.cluster.topology.replica_set_name } when /Sharded/ { connect: :sharded } when /Single/ { connect: :direct } when /Unknown/ raise "Could not detect topology because the test client failed to connect to MongoDB deployment" else raise "Weird topology #{client.cluster.topology}" end ensure client.close end end end # Environment def ci? !!ENV['CI'] end def mri? !jruby? end def jruby? !!(RUBY_PLATFORM =~ /\bjava\b/) end def platform RUBY_PLATFORM end def stress_spec? !!ENV['STRESS_SPEC'] end # Test suite configuration def client_debug? %w(1 true yes).include?(ENV['MONGO_RUBY_DRIVER_CLIENT_DEBUG']&.downcase) end def drivers_tools? !!ENV['DRIVERS_TOOLS'] end def active_support? %w(1 true yes).include?(ENV['WITH_ACTIVE_SUPPORT']) end # What compressor to use, if any. def compressors uri_options[:compressors] end def retry_reads uri_option_or_env_var(:retry_reads, 'RETRY_READS') end def retry_writes uri_option_or_env_var(:retry_writes, 'RETRY_WRITES') end def uri_option_or_env_var(driver_option_symbol, env_var_key) case uri_options[driver_option_symbol] when true true when false false else case (ENV[env_var_key] || '').downcase when 'yes', 'true', 'on', '1' true when 'no', 'false', 'off', '0' false else nil end end end def retry_writes? if retry_writes == false false else # Current default is to retry writes true end end def ssl? @ssl end # Username, not user object def user @mongodb_uri && @mongodb_uri.credentials[:user] end def password @mongodb_uri && @mongodb_uri.credentials[:password] end def auth_source uri_options[:auth_source] end def connect_replica_set? connect_options[:connect] == :replica_set end def print_summary puts "Connection options: #{test_options}" client = ClientRegistry.instance.global_client('basic') client.cluster.next_primary puts <<-EOT Topology: #{client.cluster.topology.class} connect: #{connect_options[:connect]} EOT end # Derived data def any_port addresses.first.split(':')[1] || '27017' end def spec_root File.join(File.dirname(__FILE__), '..') end def ssl_certs_dir Pathname.new("#{spec_root}/support/certificates") end # TLS certificates & keys def local_client_key_path "#{ssl_certs_dir}/client.key" end def client_key_path if drivers_tools? && ENV['DRIVER_TOOLS_CLIENT_KEY_PEM'] ENV['DRIVER_TOOLS_CLIENT_KEY_PEM'] else local_client_key_path end end def local_client_cert_path "#{ssl_certs_dir}/client.crt" end def client_cert_path if drivers_tools? && ENV['DRIVER_TOOLS_CLIENT_CERT_PEM'] ENV['DRIVER_TOOLS_CLIENT_CERT_PEM'] else local_client_cert_path end end def local_client_pem_path "#{ssl_certs_dir}/client.pem" end def client_pem_path if drivers_tools? && ENV['DRIVER_TOOLS_CLIENT_CERT_KEY_PEM'] ENV['DRIVER_TOOLS_CLIENT_CERT_KEY_PEM'] else local_client_pem_path end end def client_x509_pem_path "#{ssl_certs_dir}/client-x509.pem" end def second_level_cert_path "#{ssl_certs_dir}/client-second-level.crt" end def second_level_key_path "#{ssl_certs_dir}/client-second-level.key" end def second_level_cert_bundle_path "#{ssl_certs_dir}/client-second-level-bundle.pem" end def local_client_encrypted_key_path "#{ssl_certs_dir}/client-encrypted.key" end def client_encrypted_key_path if drivers_tools? && ENV['DRIVER_TOOLS_CLIENT_KEY_ENCRYPTED_PEM'] ENV['DRIVER_TOOLS_CLIENT_KEY_ENCRYPTED_PEM'] else local_client_encrypted_key_path end end def client_encrypted_key_passphrase 'passphrase' end def local_ca_cert_path "#{ssl_certs_dir}/ca.crt" end def ca_cert_path if drivers_tools? && ENV['DRIVER_TOOLS_CA_PEM'] ENV['DRIVER_TOOLS_CA_PEM'] else local_ca_cert_path end end def multi_ca_path "#{ssl_certs_dir}/multi-ca.crt" end # The default test database for all specs. def test_db 'ruby-driver'.freeze end # AWS IAM user access key id def fle_aws_key ENV['MONGO_RUBY_DRIVER_AWS_KEY'] end # AWS IAM user secret access key def fle_aws_secret ENV['MONGO_RUBY_DRIVER_AWS_SECRET'] end # Region of AWS customer master key def fle_aws_region ENV['MONGO_RUBY_DRIVER_AWS_REGION'] end # Amazon resource name (ARN) of AWS customer master key def fle_aws_arn ENV['MONGO_RUBY_DRIVER_AWS_ARN'] end def mongocryptd_port if ENV['MONGO_RUBY_DRIVER_MONGOCRYPTD_PORT'] && !ENV['MONGO_RUBY_DRIVER_MONGOCRYPTD_PORT'].empty? then ENV['MONGO_RUBY_DRIVER_MONGOCRYPTD_PORT'].to_i else 27020 end end # Option hashes def auth_options if x509_auth? { auth_mech: uri_options[:auth_mech], auth_source: '$external', } else { user: user, password: password, }.tap do |options| if auth_source options[:auth_source] = auth_source end %i(auth_mech auth_mech_properties).each do |key| if uri_options[key] options[key] = uri_options[key] end end end end end def ssl_options if ssl? { ssl: true, ssl_verify: true, ssl_cert: client_cert_path, ssl_key: client_key_path, ssl_ca_cert: ca_cert_path, }.merge(Utils.underscore_hash(@uri_tls_options)) else {} end end def compressor_options if compressors {compressors: compressors} else {} end end def retry_writes_options {retry_writes: retry_writes?} end # Base test options. def base_test_options { # Automatic encryption tests require a minimum of three connections: # - The driver checks out a connection to build a command. # - It may need to encrypt the command, which could require a query to # the key vault collection triggered by libmongocrypt. # - If the key vault client has auto encryption options, it will also # attempt to encrypt this query, resulting in a third connection. # In the worst case using FLE may end up tripling the number of # connections that the driver uses at any one time. max_pool_size: 3, heartbeat_frequency: 20, # The test suite seems to perform a number of operations # requiring server selection. Hence a timeout of 1 here, # together with e.g. a misconfigured replica set, # means the test suite hangs for about 4 seconds before # failing. # Server selection timeout of 1 is insufficient for evergreen. server_selection_timeout: uri_options[:server_selection_timeout] || (ssl? ? 4.01 : 2.01), # Since connections are established under the wait queue timeout, # the wait queue timeout should be at least as long as the # connect timeout. wait_queue_timeout: 4, connect_timeout: 3, socket_timeout: 3, max_idle_time: 5 } end # Options for test suite clients. def test_options base_test_options.merge(connect_options). merge(ssl_options).merge(compressor_options).merge(retry_writes_options) end # TODO auth_options should probably be in test_options def all_test_options test_options.merge(auth_options) end # User objects # Gets the root system administrator user. def root_user Mongo::Auth::User.new( user: user || 'root-user', password: password || 'password', roles: [ Mongo::Auth::Roles::USER_ADMIN_ANY_DATABASE, Mongo::Auth::Roles::DATABASE_ADMIN_ANY_DATABASE, Mongo::Auth::Roles::READ_WRITE_ANY_DATABASE, Mongo::Auth::Roles::HOST_MANAGER, Mongo::Auth::Roles::CLUSTER_ADMIN ] ) end # Get the default test user for the suite on versions 2.6 and higher. def test_user Mongo::Auth::User.new( database: test_db, user: 'test-user', password: 'password', roles: [ { role: Mongo::Auth::Roles::READ_WRITE, db: test_db }, { role: Mongo::Auth::Roles::DATABASE_ADMIN, db: test_db }, { role: Mongo::Auth::Roles::READ_WRITE, db: 'invalid_database' }, { role: Mongo::Auth::Roles::DATABASE_ADMIN, db: 'invalid_database' }, # For transactions examples { role: Mongo::Auth::Roles::READ_WRITE, db: 'hr' }, { role: Mongo::Auth::Roles::DATABASE_ADMIN, db: 'hr' }, { role: Mongo::Auth::Roles::READ_WRITE, db: 'reporting' }, { role: Mongo::Auth::Roles::DATABASE_ADMIN, db: 'reporting' }, # For transaction api spec tests #{ role: Mongo::Auth::Roles::READ_WRITE, db: 'withTransaction-tests' }, #{ role: Mongo::Auth::Roles::DATABASE_ADMIN, db: 'withTransaction-tests' }, ] ) end def x509_auth? uri_options[:auth_mech] == :mongodb_x509 end # When we authenticate with a username & password mechanism (scram, cr) # we create a variety of users in the test suite for different purposes. # When we authenticate with passwordless mechanisms (x509, aws) we use # the globally specified user for all operations. def external_user? case uri_options[:auth_mech] when :mongodb_x509, :aws true when nil, :scram, :scram256 false else raise "Unknown auth mechanism value: #{uri_options[:auth_mech]}" end end # When we use external authentication, omit all of the users we normally # create and authenticate with the external mechanism. This also ensures # our various helpers work correctly when the only users available are # the external ones. def credentials_or_external_user(creds) if external_user? auth_options else creds end end end
25.017647
119
0.656713
e997ad8204a7fa55772e279b44b54e8a52eab48a
1,130
class ReportsController < ApplicationController before_action :set_report, only: [:show, :update, :destroy] # GET /reports def index player = Player.find(params['player_id']) @reports = player.reports render json: @reports end # GET /reports/1 def show render json: @report end # POST /reports def create @report = Report.new(report_params) if @report.save render json: @report, status: :created else render json: @report.errors, status: :unprocessable_entity end end # PATCH/PUT /reports/1 def update if @report.update(report_params) render json: @report else render json: @report.errors, status: :unprocessable_entity end end # DELETE /reports/1 def destroy @report.destroy render json: @report end private # Use callbacks to share common setup or constraints between actions. def set_report @report = Report.find(params[:id]) end # Only allow a list of trusted parameters through. def report_params params.require(:report).permit(:text, :report_type, :player_id) end end
20.545455
73
0.669912
33f5a203af1e32ddb1ae5c4cdfcfc8261149e321
15,335
# Code Review plugin for Redmine # Copyright (C) 2009-2013 Haruyuki Iida # # 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. class CodeReviewController < ApplicationController unloadable before_filter :find_project, :authorize, :find_user, :find_setting, :find_repository helper :sort include SortHelper helper :journals helper :projects include ProjectsHelper helper :issues include IssuesHelper helper :code_review include CodeReviewHelper helper :custom_fields include CustomFieldsHelper def index sort_init "#{Issue.table_name}.id", 'desc' sort_update ["#{Issue.table_name}.id", "#{Issue.table_name}.status_id", "#{Issue.table_name}.subject", "path", "updated_at", "user_id", "#{Changeset.table_name}.committer", "#{Changeset.table_name}.revision"] limit = per_page_option @review_count = CodeReview.count(:conditions => ['project_id = ? and issue_id is NOT NULL', @project.id]) @all_review_count = CodeReview.count(:conditions => ['project_id = ?', @project.id]) @review_pages = Paginator.new self, @review_count, limit, params['page'] @show_closed = (params['show_closed'] == 'true') show_closed_option = " and #{IssueStatus.table_name}.is_closed = ? " if (@show_closed) show_closed_option = '' end conditions = ["#{CodeReview.table_name}.project_id = ? and issue_id is NOT NULL" + show_closed_option, @project.id] unless (@show_closed) conditions << false end @reviews = CodeReview.order(sort_clause).limit(limit).where(conditions).joins( "left join #{Change.table_name} on change_id = #{Change.table_name}.id left join #{Changeset.table_name} on #{Change.table_name}.changeset_id = #{Changeset.table_name}.id " + "left join #{Issue.table_name} on issue_id = #{Issue.table_name}.id " + "left join #{IssueStatus.table_name} on #{Issue.table_name}.status_id = #{IssueStatus.table_name}.id").offset(@review_pages.current.offset) @i_am_member = @user.member_of?(@project) render :template => 'code_review/index.html.erb', :layout => !request.xhr? end def new begin CodeReview.transaction { @review = CodeReview.new @review.issue = Issue.new if params[:issue] and params[:issue][:tracker_id] @review.issue.tracker_id = params[:issue][:tracker_id].to_i else @review.issue.tracker_id = @setting.tracker_id end @review.safe_attributes = params[:review] @review.project_id = @project.id @review.issue.project_id = @project.id @review.user_id = @user.id @review.updated_by_id = @user.id @review.issue.start_date = Date.today @review.action_type = params[:action_type] @review.rev = params[:rev] unless params[:rev].blank? @review.rev_to = params[:rev_to] unless params[:rev_to].blank? @review.file_path = params[:path] unless params[:path].blank? @review.file_count = params[:file_count].to_i unless params[:file_count].blank? @review.attachment_id = params[:attachment_id].to_i unless params[:attachment_id].blank? @issue = @review.issue @review.issue.safe_attributes = params[:issue] unless params[:issue].blank? @review.diff_all = (params[:diff_all] == 'true') @parent_candidate = get_parent_candidate(@review.rev) if @review.rev if request.post? @review.issue.save! if @review.changeset @review.changeset.issues.each {|issue| create_relation @review, issue, @setting.issue_relation_type } if @setting.auto_relation? elsif @review.attachment and @review.attachment.container_type == 'Issue' issue = Issue.find_by_id(@review.attachment.container_id) create_relation @review, issue, @setting.issue_relation_type if @setting.auto_relation? end @review.open_assignment_issues(@user.id).each {|issue| create_relation @review, issue, IssueRelation::TYPE_RELATES watcher = Watcher.new watcher.watchable_id = @review.issue.id watcher.watchable_type = 'Issue' watcher.user = issue.author watcher.save! } @review.save! render :partial => 'add_success', :status => 200 return else change_id = params[:change_id].to_i unless params[:change_id].blank? @review.change = Change.find(change_id) if change_id @review.line = params[:line].to_i unless params[:line].blank? if (@review.changeset and @review.changeset.user_id) @review.issue.assigned_to_id = @review.changeset.user_id end @default_version_id = @review.issue.fixed_version.id if @review.issue.fixed_version if @review.changeset and @default_version_id.blank? @review.changeset.issues.each {|issue| if issue.fixed_version @default_version_id = issue.fixed_version.id break; end } end @review.open_assignment_issues(@user.id).each {|issue| if issue.fixed_version @default_version_id = issue.fixed_version.id break; end } unless @default_version_id end render :partial => 'new_form', :status => 200 } rescue ActiveRecord::RecordInvalid render :partial => 'new_form', :status => 200 end end def assign code = {} code[:action_type] = params[:action_type] unless params[:action_type].blank? code[:rev] = params[:rev] unless params[:rev].blank? code[:rev_to] = params[:rev_to] unless params[:rev_to].blank? code[:path] = params[:path] unless params[:path].blank? code[:change_id] = params[:change_id].to_i unless params[:change_id].blank? code[:changeset_id] = params[:changeset_id].to_i unless params[:changeset_id].blank? code[:attachment_id] = params[:attachment_id].to_i unless params[:attachment_id].blank? code[:repository_id] = @repository_id if @repository_id changeset = Changeset.find(code[:changeset_id]) if code[:changeset_id] if (changeset == nil and code[:change_id] != nil) change = Change.find(code[:change_id]) changeset = change.changeset if change end attachment = Attachment.find(code[:attachment_id]) if code[:attachment_id] issue = {} issue[:subject] = l(:code_review_requrest) issue[:subject] << " [#{changeset.text_tag}: #{changeset.short_comments}]" if changeset unless changeset issue[:subject] << " [#{attachment.filename}]" if attachment end issue[:tracker_id] = @setting.assignment_tracker_id if @setting.assignment_tracker_id redirect_to :controller => 'issues', :action => "new" , :project_id => @project, :issue => issue, :code => code end def update_diff_view @show_review_id = params[:review_id].to_i unless params[:review_id].blank? @show_review = CodeReview.find(@show_review_id) if @show_review_id @review = CodeReview.new @rev = params[:rev] unless params[:rev].blank? @rev_to = params[:rev_to] unless params[:rev_to].blank? @path = params[:path] unless params[:path].blank? @paths = [] @paths << @path unless @path.blank? @action_type = params[:action_type] changeset = @repository.find_changeset_by_name(@rev) if @paths.empty? changeset.filechanges.each{|chg| } end url = @repository.url root_url = @repository.root_url if (url == nil || root_url == nil) fullpath = @path else rootpath = url[root_url.length, url.length - root_url.length] if rootpath.blank? fullpath = @path else fullpath = (rootpath + '/' + @path).gsub(/[\/]+/, '/') end end @change = nil changeset.filechanges.each{|chg| @change = chg if ((chg.path == fullpath) or ("/#{chg.path}" == fullpath)) or (chg.path == "/#{@path}") } unless @path.blank? @changeset = changeset if @path @reviews = CodeReview.where(['file_path = ? and rev = ? and issue_id is NOT NULL', @path, @rev]).all else @reviews = CodeReview.where(['rev = ? and issue_id is NOT NULL', @rev]).all end @review.change_id = @change.id if @change #render :partial => 'show_error' #return render :partial => 'update_diff_view' end def update_attachment_view @show_review_id = params[:review_id].to_i unless params[:review_id].blank? @attachment_id = params[:attachment_id].to_i @show_review = CodeReview.find(@show_review_id) if @show_review_id @review = CodeReview.new @action_type = 'attachment' @attachment = Attachment.find(@attachment_id) @reviews = CodeReview.where(['attachment_id = (?) and issue_id is NOT NULL', @attachment_id]).all render :partial => 'update_diff_view' end def show @review = CodeReview.find(params[:review_id].to_i) unless params[:review_id].blank? @repository = @review.repository if @review @assignment = CodeReviewAssignment.find(params[:assignment_id].to_i) unless params[:assignment_id].blank? @repository_id = @assignment.repository_identifier if @assignment @issue = @review.issue if @review @allowed_statuses = @review.issue.new_statuses_allowed_to(User.current) if @review target = @review if @review target = @assignment if @assignment @repository_id = target.repository_identifier if request.xhr? or !params[:update].blank? render :partial => 'show' elsif target.path #@review = @review.root path = URI.decode(target.path) #path = '/' + path unless path.match(/^\//) action_name = target.action_type rev_to = '' rev_to = '&rev_to=' + target.rev_to if target.rev_to if action_name == 'attachment' attachment = target.attachment url = url_for(:controller => 'attachments', :action => 'show', :id => attachment.id) + '/' + URI.escape(attachment.filename) url << '?review_id=' + @review.id.to_s if @review redirect_to(url) else path = nil if target.diff_all url = url_for(:controller => 'repositories', :action => action_name, :id => @project, :repository_id => @repository_id, :rev => target.revision, :path => path) #url = url_for(:controller => 'repositories', :action => action_name, :id => @project, :repository_id => @repository_id) + path + '?rev=' + target.revision url << '?review_id=' + @review.id.to_s + rev_to if @review redirect_to url end end end def reply begin @review = CodeReview.find(params[:review_id].to_i) @issue = @review.issue @issue.lock_version = params[:issue][:lock_version] comment = params[:reply][:comment] journal = @issue.init_journal(User.current, comment) @review.safe_attributes = params[:review] @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @issue.save! if !journal.new_record? # Only send notification if something was actually changed flash[:notice] = l(:notice_successful_update) end render :partial => 'show' rescue ActiveRecord::StaleObjectError # Optimistic locking exception @error = l(:notice_locking_conflict) render :partial => 'show' end end def update begin CodeReview.transaction { @review = CodeReview.find(params[:review_id].to_i) journal = @review.issue.init_journal(User.current, nil) @allowed_statuses = @review.issue.new_statuses_allowed_to(User.current) @issue = @review.issue @issue.lock_version = params[:issue][:lock_version] @review.safe_attributes = params[:review] @review.updated_by_id = @user.id @review.save! @review.issue.save! @notice = l(:notice_review_updated) lang = current_language Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') set_language lang if respond_to? 'set_language' render :partial => 'show' } rescue ActiveRecord::StaleObjectError # Optimistic locking exception @error = l(:notice_locking_conflict) render :partial => 'show' rescue render :partial => 'show' end end def destroy @review = CodeReview.find(params[:review_id].to_i) @review.issue.destroy if @review render :text => 'delete success.' end def forward_to_revision path = params[:path] rev = params[:rev] changesets = @repository.latest_changesets(path, rev, Setting.repository_log_display_limit.to_i) change = changesets[0] identifier = change.identifier redirect_to url_for(:controller => 'repositories', :action => 'entry', :id => @project, :repository_id => @repository_id) + '/' + path + '?rev=' + identifier.to_s end def preview @text = params[:review][:comment] @text = params[:reply][:comment] unless @text render :partial => 'common/preview' end def update_revisions_view changeset_ids = [] #changeset_ids = CGI.unescape(params[:changeset_ids]).split(',') unless params[:changeset_ids].blank? changeset_ids = params[:changeset_ids].split(',') unless params[:changeset_ids].blank? @changesets = [] changeset_ids.each {|id| @changesets << @repository.find_changeset_by_name(id) unless id.blank? } render :partial => 'update_revisions' end private def find_repository if params[:repository_id].present? and @project.repositories @repository = @project.repositories.find_by_identifier_param(params[:repository_id]) else @repository = @project.repository end @repository_id = @repository.identifier_param if @repository.respond_to?("identifier_param") end def find_project # @project variable must be set before calling the authorize filter @project = Project.find(params[:id]) end def find_user @user = User.current end def find_setting @setting = CodeReviewProjectSetting.find_or_create(@project) end def get_parent_candidate(revision) changeset = @repository.find_changeset_by_name(revision) changeset.issues.each {|issue| return Issue.find(issue.parent_issue_id) if issue.parent_issue_id } nil end def create_relation(review, issue, type) return unless issue.project == @project relation = IssueRelation.new relation.relation_type = type relation.issue_from_id = review.issue.id relation.issue_to_id = issue.id relation.save! end end
38.433584
213
0.663384
6ab9400464c79f592db76d472b8ab769afcc970a
1,968
module VCAP::CloudController class SyslogDrainUrlsController < RestController::BaseController # Endpoint does its own basic auth allow_unauthenticated_access authenticate_basic_auth('/v2/syslog_drain_urls') do [VCAP::CloudController::Config.config[:bulk_api][:auth_user], VCAP::CloudController::Config.config[:bulk_api][:auth_password]] end get '/v2/syslog_drain_urls', :list def list guid_to_drain_maps = AppModel. join(ServiceBinding, app_guid: :guid). where('syslog_drain_url IS NOT NULL'). where("syslog_drain_url != ''"). group("#{AppModel.table_name}__guid".to_sym). select( "#{AppModel.table_name}__guid".to_sym, aggregate_function("#{ServiceBinding.table_name}__syslog_drain_url".to_sym).as(:syslog_drain_urls) ). order(:guid). limit(batch_size). offset(last_id). all next_page_token = nil drain_urls = {} guid_to_drain_maps.each do |guid_and_drains| drain_urls[guid_and_drains[:guid]] = guid_and_drains[:syslog_drain_urls].split(',') end next_page_token = last_id + batch_size unless guid_to_drain_maps.empty? [HTTP::OK, {}, MultiJson.dump({ results: drain_urls, next_id: next_page_token }, pretty: true)] end private def aggregate_function(column) if AppModel.db.database_type == :postgres Sequel.function(:string_agg, column, ',') elsif AppModel.db.database_type == :mysql Sequel.function(:group_concat, column) else raise 'Unknown database type' end end def last_id Integer(params.fetch('next_id', 0)) end def batch_size Integer(params.fetch('batch_size', 50)) end end end
32.8
108
0.597561
08e40e64e3edd68c9ee18b0fda013433debd4147
3,173
#!/usr/bin/env ruby require 'gitlab' def client @client ||= Gitlab.client end def devops_group unless @devops_group begin @devops_group = client.create_group('devops', 'devops') rescue Gitlab::Error::BadRequest => e if e.response_status == 400 @devops_group = client.group('devops') end end end @devops_group end def create_puppet_file(proj) begin client.create_file(proj.id, 'Puppetfile', 'master', puppetfile_content, 'init commit') rescue Gitlab::Error::BadRequest => e if e.response_status == 400 # already created end end end def create_branch(proj_id, branch, ref) begin client.create_branch(proj_id, branch, ref) rescue Gitlab::Error::BadRequest => e if e.response_status == 400 puts "Branch already created" else raise e end end end def create_control_repo begin proj = client.create_project('control-repo', namespace_id: devops_group.id) create_puppet_file(proj) create_branch(proj.id, 'dev', 'master') create_branch(proj.id, 'qa', 'master') create_branch(proj.id, 'integration', 'master') create_branch(proj.id, 'acceptance', 'master') create_branch(proj.id, 'production', 'master') client.unprotect_branch(proj.id, 'master') rescue Gitlab::Error::BadRequest => e if e.response_status == 400 # already created proj = client.project("devops/control-repo") create_branch(proj.id, 'dev', 'master') create_branch(proj.id, 'qa', 'master') create_branch(proj.id, 'integration', 'master') create_branch(proj.id, 'acceptance', 'master') create_branch(proj.id, 'production', 'master') client.unprotect_branch(proj.id, 'master') # client.delete_branch(proj.id, 'master') create_puppet_file(proj) end end end def modules <<-EOF # Example42 v4.x modules (Used in various profiles) mod 'docker', :git => 'https://github.com/example42/puppet-docker' mod 'network', :git => 'https://github.com/example42/puppet-network' mod 'apache', :git => 'https://github.com/example42/puppet-apache', :branch => '4.x' mod 'puppet', :git => 'https://github.com/example42/puppet-puppet', :branch => 'master' mod 'rails', :git => 'https://github.com/example42/puppet-rails' mod 'ansible', :git => 'https://github.com/example42/puppet-ansible' mod 'icinga', :git => 'https://github.com/example42/puppet-icinga', :branch => '4.x' EOF end def puppetfile_content @puppetfile_content ||= '' end def mod(name, *args) url = args.first[:git] begin proj = client.create_project(name, import_url: url, namespace_id: devops_group.id) rescue Gitlab::Error::BadRequest => e if e.response_status == 400 proj = client.project("devops/#{name}") end end args.first[:git] = proj.ssh_url_to_repo data = args.first.sort.map { |k, v| ":#{k} => '#{v}'" }.join(",\n ") puppetfile_content << "mod '#{name}',\n #{data}\n\n" end create_control_repo eval(modules) # # client.create_user('joe@foo.org', 'password', 'joe', { name: 'Joe Smith' }) # add the ssh key # create_ssh_key(title, key)
26.663866
90
0.655846
91336e083ecb7cae8a79f968e4a5e9f460e0bc4f
581
require 'dropbox_api' require File.expand_path('../dropbox_scaffold_builder', __FILE__) namespace :test do # Example: `rake test:build_scaffold[get_metadata]` desc "Regenerates the scaffolding required to test the given endpoint" task :build_scaffold, [:endpoint] => [:show_account_warning] do |t, args| puts "Regenerating #{args[:endpoint].inspect}" DropboxScaffoldBuilder.regenerate args[:endpoint] end task :show_account_warning do print "NOTE: This task will make changes on a real Dropbox account..." sleep 5 puts " ok, going ahead!" end end
32.277778
75
0.738382
334e1e442f5d83ff4288a7d22621f5f71051a5e2
2,055
class Cumulus < Oxidized::Model prompt /^((\w*)@(.*)):/ comment '# ' # add a comment in the final conf def add_comment comment "\n###### #{comment} ######\n" end cmd :all do |cfg| cfg.each_line.to_a[1..-2].join end # show the persistent configuration pre do cfg = add_comment 'THE HOSTNAME' cfg += cmd 'cat /etc/hostname' cfg += add_comment 'THE HOSTS' cfg += cmd 'cat /etc/hosts' cfg += add_comment 'THE INTERFACES' cfg += cmd 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-' cfg += add_comment 'RESOLV.CONF' cfg += cmd 'cat /etc/resolv.conf' cfg += add_comment 'NTP.CONF' cfg += cmd 'cat /etc/ntp.conf' cfg += add_comment 'IP Routes' cfg += cmd 'netstat -rn' cfg += add_comment 'SNMP settings' cfg += cmd 'cat /etc/snmp/snmpd.conf' cfg += add_comment 'QUAGGA DAEMONS' cfg += cmd 'cat /etc/quagga/daemons' cfg += add_comment 'QUAGGA ZEBRA' cfg += cmd 'cat /etc/quagga/zebra.conf' cfg += add_comment 'QUAGGA BGP' cfg += cmd 'cat /etc/quagga/bgpd.conf' cfg += add_comment 'QUAGGA OSPF' cfg += cmd 'cat /etc/quagga/ospfd.conf' cfg += add_comment 'QUAGGA OSPF6' cfg += cmd 'cat /etc/quagga/ospf6d.conf' cfg += add_comment 'QUAGGA CONF' cfg += cmd 'cat /etc/quagga/Quagga.conf' cfg += add_comment 'MOTD' cfg += cmd 'cat /etc/motd' cfg += add_comment 'PASSWD' cfg += cmd 'cat /etc/passwd' cfg += add_comment 'SWITCHD' cfg += cmd 'cat /etc/cumulus/switchd.conf' cfg += add_comment 'PORTS' cfg += cmd 'cat /etc/cumulus/ports.conf' cfg += add_comment 'TRAFFIC' cfg += cmd 'cat /etc/cumulus/datapath/traffic.conf' cfg += add_comment 'ACL' cfg += cmd 'iptables -L -n' cfg += add_comment 'VERSION' cfg += cmd 'cat /etc/cumulus/etc.replace/os-release' cfg += add_comment 'License' cfg += cmd 'cl-license' end cfg :telnet do username /^Username:/ password /^Password:/ end cfg :telnet, :ssh do pre_logout 'exit' end end
23.089888
70
0.602433
abcd607f4a74032a79315008cae2ed91d68591ca
1,899
# frozen_string_literal: true module DmphubMocks BASE_API_URL = 'https://api.test.dmphub.org/' ERROR_RESPONSE = File.read( Rails.root.join('spec', 'support', 'mocks', 'dmphub', 'error.json') ).freeze SUCCESS_RESPONSE = File.read( Rails.root.join('spec', 'support', 'mocks', 'dmphub', 'success.json') ).freeze TOKEN_SUCCESS_RESPONSE = { access_token: SecureRandom.uuid.to_s, token_type: 'Bearer', expires_in: Faker::Number.number(digits: 10), created_at: Time.now.to_formatted_s(:iso8601) }.freeze TOKEN_FAILURE_RESPONSE = { application: Faker::Lorem.word, status: 'Unauthorized', code: 401, time: Time.now.to_formatted_s(:iso8601), caller: Faker::Internet.private_ip_v4_address, source: 'POST https://localhost:3001/api/v0/authenticate', total_items: 0, errors: { client_authentication: 'Invalid credentials' } }.freeze def stub_auth_success! stub_request(:post, "#{BASE_API_URL}authenticate") .to_return(status: 200, body: TOKEN_SUCCESS_RESPONSE.to_json, headers: {}) end def stub_auth_error! stub_request(:post, "#{BASE_API_URL}authenticate") .to_return(status: 401, body: TOKEN_FAILURE_RESPONSE.to_json, headers: {}) end def stub_minting_success! stub_request(:post, "#{BASE_API_URL}data_management_plans") .to_return(status: 201, body: SUCCESS_RESPONSE, headers: {}) end def stub_minting_error! stub_request(:post, "#{BASE_API_URL}data_management_plans") .to_return(status: 400, body: ERROR_RESPONSE, headers: {}) end def stub_update_success! stub_request(:put, %r{#{BASE_API_URL}data_management_plans/.*}) .to_return(status: 200, body: SUCCESS_RESPONSE, headers: {}) end def stub_update_error! stub_request(:put, %r{#{BASE_API_URL}data_management_plans/.*}) .to_return(status: 500, body: ERROR_RESPONSE, headers: {}) end end
30.629032
80
0.704055
335ced9a4be85ecbeba62250afe08df0b2b218bc
1,078
# frozen_string_literal: true module Hyrax module Test ## # A simple Hyrax::Resource with some metadata. # # Use this for testing valkyrie models generically, with Hyrax assumptions # but no PCDM modelling behavior. class BookResource < Hyrax::Resource attribute :author, Valkyrie::Types::String attribute :created, Valkyrie::Types::Date attribute :isbn, Valkyrie::Types::String attribute :pubisher, Valkyrie::Types::String attribute :title, Valkyrie::Types::String end class Book < ActiveFedora::Base property :author, predicate: ::RDF::URI('http://example.com/ns/author') property :created, predicate: ::RDF::URI('http://example.com/ns/created') property :isbn, predicate: ::RDF::URI('http://example.com/ns/isbn') property :publisher, predicate: ::RDF::URI('http://example.com/ns/publisher') property :title, predicate: ::RDF::URI("http://example.com/ns/title") end end end Wings::ModelRegistry.register(Hyrax::Test::BookResource, Hyrax::Test::Book)
38.5
83
0.669759
61eaef953b11403e81ec7d134c1e71f9b1fc2266
1,664
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. module Elasticsearch module API module Actions # Allows an arbitrary script to be executed and a result to be returned # # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The script to execute # # @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html # def scripts_painless_execute(arguments = {}) headers = arguments.delete(:headers) || {} arguments = arguments.clone method = if arguments[:body] Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = "_scripts/painless/_execute" params = {} body = arguments[:body] perform_request(method, path, params, body, headers).body end end end end
34.666667
100
0.680889
d59b60540e35137d8394ecde2f0f45f6f2a37e27
11,499
# frozen_string_literal: true require 'spec_helper' describe Gitlab::Client do it { is_expected.to respond_to :repo_commits } it { is_expected.to respond_to :repo_commit } it { is_expected.to respond_to :repo_commit_diff } it { is_expected.to respond_to :repo_commit_comments } it { is_expected.to respond_to :repo_create_commit_comment } it { is_expected.to respond_to :repo_commit_status } it { is_expected.to respond_to :repo_update_commit_status } it { is_expected.to respond_to :repo_commit_merge_requests } describe '.commits' do before do stub_get('/projects/3/repository/commits', 'project_commits') .with(query: { ref: 'api' }) @commits = Gitlab.commits(3, ref: 'api') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits') .with(query: { ref: 'api' })).to have_been_made end it 'returns a paginated response of repository commits' do expect(@commits).to be_a Gitlab::PaginatedResponse expect(@commits.first.id).to eq('f7dd067490fe57505f7226c3b54d3127d2f7fd46') end end describe '.commit' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6', 'project_commit') @commit = Gitlab.commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6')) .to have_been_made end it 'returns a repository commit' do expect(@commit.id).to eq('6104942438c14ec7bd21c6cd5bd995272b3faff6') end end describe '.commit_refs' do before do stub_get('/projects/3/repository/commits/0b4cd14ccc6a5c392526df719d29baf4315a4bbb/refs', 'project_commit_refs') @refs = Gitlab.commit_refs(3, '0b4cd14ccc6a5c392526df719d29baf4315a4bbb') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/0b4cd14ccc6a5c392526df719d29baf4315a4bbb/refs')) .to have_been_made end it 'returns an Array of refs' do expect(@refs.map(&:to_h)) .to include('type' => 'branch', 'name' => '12-1-stable') .and include('type' => 'tag', 'name' => 'v12.1.0') end end describe '.cherry_pick_commit' do context 'on success' do before do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick', 'project_commit').with(body: { branch: 'master' }) @cherry_pick_commit = Gitlab.cherry_pick_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick') .with(body: { branch: 'master' })) .to have_been_made end it 'returns the correct response' do expect(@cherry_pick_commit).to be_a Gitlab::ObjectifiedHash expect(@cherry_pick_commit.id).to eq('6104942438c14ec7bd21c6cd5bd995272b3faff6') end end context 'on failure' do it 'includes the error_code' do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick', 'cherry_pick_commit_failure', 400) expect { Gitlab.cherry_pick_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master') }.to raise_error(Gitlab::Error::BadRequest) do |ex| expect(ex.error_code).to eq('conflict') end end end context 'with additional options' do it 'passes additional options' do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick', 'project_commit') .with(body: { branch: 'master', dry_run: true }) Gitlab.cherry_pick_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master', dry_run: true) expect(a_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/cherry_pick') .with(body: { branch: 'master', dry_run: true })) .to have_been_made end end end describe '.revert_commit' do context 'on success' do before do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/revert', 'project_commit').with(body: { branch: 'master' }) @revert_commit = Gitlab.revert_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master') end it 'gets the correct resource' do expect(a_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/revert') .with(body: { branch: 'master' })) .to have_been_made end it 'returns the correct response' do expect(@revert_commit).to be_a Gitlab::ObjectifiedHash expect(@revert_commit.id).to eq('6104942438c14ec7bd21c6cd5bd995272b3faff6') end end context 'on failure' do it 'includes the error_code' do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/revert', 'revert_commit_failure', 400) expect { Gitlab.revert_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master') }.to raise_error(Gitlab::Error::BadRequest) do |ex| expect(ex.error_code).to eq('empty') end end end context 'with additional options' do it 'passes additional options' do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/revert', 'project_commit') .with(body: { branch: 'master', dry_run: true }) Gitlab.revert_commit(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'master', dry_run: true) expect(a_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/revert') .with(body: { branch: 'master', dry_run: true })) .to have_been_made end end end describe '.commit_diff' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff', 'project_commit_diff') @diff = Gitlab.commit_diff(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/diff')) .to have_been_made end it 'returns a diff of a commit' do expect(@diff.new_path).to eq('doc/update/5.4-to-6.0.md') end end describe '.commit_comments' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments', 'project_commit_comments') @commit_comments = Gitlab.commit_comments(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments')) .to have_been_made end it "returns commit's comments" do expect(@commit_comments).to be_a Gitlab::PaginatedResponse expect(@commit_comments.length).to eq(2) expect(@commit_comments[0].note).to eq('this is the 1st comment on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6') expect(@commit_comments[0].author.id).to eq(11) expect(@commit_comments[1].note).to eq('another discussion point on commit 6104942438c14ec7bd21c6cd5bd995272b3faff6') expect(@commit_comments[1].author.id).to eq(12) end end describe '.create_commit_comment' do before do stub_post('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/comments', 'project_commit_comment') @merge_request = Gitlab.create_commit_comment(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6', 'Nice code!') end it 'returns information about the newly created comment' do expect(@merge_request.note).to eq('Nice code!') expect(@merge_request.author.id).to eq(1) end end describe '.commit_status' do before do stub_get('/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses', 'project_commit_status') .with(query: { all: 'true' }) @statuses = Gitlab.commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', all: true) end it 'gets the correct resource' do expect(a_get('/projects/6/repository/commits/7d938cb8ac15788d71f4b67c035515a160ea76d8/statuses') .with(query: { all: true })) end it 'gets statuses of a commit' do expect(@statuses).to be_kind_of Gitlab::PaginatedResponse expect(@statuses.first.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') expect(@statuses.first.ref).to eq('decreased-spec') expect(@statuses.first.status).to eq('failed') expect(@statuses.last.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') expect(@statuses.last.status).to eq('success') end end describe '.update_commit_status' do before do stub_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8', 'project_update_commit_status') .with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' }) @status = Gitlab.update_commit_status(6, '7d938cb8ac15788d71f4b67c035515a160ea76d8', 'failed', name: 'test', ref: 'decreased-spec') end it 'gets the correct resource' do expect(a_post('/projects/6/statuses/7d938cb8ac15788d71f4b67c035515a160ea76d8') .with(query: { name: 'test', ref: 'decreased-spec', state: 'failed' })) end it 'returns information about the newly created status' do expect(@status).to be_kind_of Gitlab::ObjectifiedHash expect(@status.id).to eq(498) expect(@status.sha).to eq('7d938cb8ac15788d71f4b67c035515a160ea76d8') expect(@status.status).to eq('failed') expect(@status.ref).to eq('decreased-spec') end end describe '.create_commit' do let(:actions) do [ { action: 'create', file_path: 'foo/bar', content: 'some content' } ] end let(:query) do { branch: 'dev', commit_message: 'refactors everything', actions: actions, author_email: 'joe@sample.org', author_name: 'Joe Sample' } end before do stub_post('/projects/6/repository/commits', 'project_commit_create').with(body: query) @commit = Gitlab.create_commit(6, 'dev', 'refactors everything', actions, author_email: 'joe@sample.org', author_name: 'Joe Sample') end it 'returns id of a created commit' do expect(@commit.id).to eq('ed899a2f4b50b4370feeea94676502b42383c746') end end describe '.repo_commit_merge_requests' do before do stub_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/merge_requests', 'project_commit_merge_requests') @commit_merge_requests = Gitlab.commit_merge_requests(3, '6104942438c14ec7bd21c6cd5bd995272b3faff6') end it 'gets the correct resource' do expect(a_get('/projects/3/repository/commits/6104942438c14ec7bd21c6cd5bd995272b3faff6/merge_requests')) .to have_been_made end it "returns commit's associated merge_requests" do expect(@commit_merge_requests).to be_a Gitlab::PaginatedResponse expect(@commit_merge_requests.length).to eq(2) expect(@commit_merge_requests[0].iid).to eq(1) expect(@commit_merge_requests[0].author.id).to eq(1) expect(@commit_merge_requests[1].iid).to eq(2) expect(@commit_merge_requests[1].author.id).to eq(2) end end end
38.717172
155
0.705801
6a9b476f31d7bdfc359cec3b8894b846cecbf08b
1,715
class Xmrig < Formula desc "Monero (XMR) CPU miner" homepage "https://github.com/xmrig/xmrig" url "https://github.com/xmrig/xmrig/archive/v6.5.2.tar.gz" sha256 "6cb24c2f38d33d63b0526cee53debffb0d7969af305c89949bc2505cc10b2416" license "GPL-3.0-or-later" head "https://github.com/xmrig/xmrig.git" livecheck do url "https://github.com/xmrig/xmrig/releases/latest" regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i) end bottle do sha256 "510e8dbd4c364020ddc94353bd306403f2e0dbe65031e1ade2e7450288d18ffa" => :catalina sha256 "ffa7a2750f524d78df9425b94290883c07ece92a3731404e2961cb8e986d0031" => :mojave sha256 "0118d0b8e69fa3852a83cf9d0d6cb036d9d12fcc8af350cad7b356c96b24db29" => :high_sierra end depends_on "cmake" => :build depends_on "hwloc" depends_on "libmicrohttpd" depends_on "libuv" depends_on "openssl@1.1" def install mkdir "build" do system "cmake", "..", "-DWITH_CN_GPU=OFF", *std_cmake_args system "make" bin.install "xmrig" end pkgshare.install "src/config.json" end test do assert_match version.to_s, shell_output("#{bin}/xmrig -V") test_server="donotexist.localhost:65535" timeout=10 begin read, write = IO.pipe pid = fork do exec "#{bin}/xmrig", "--no-color", "--max-cpu-usage=1", "--print-time=1", "--threads=1", "--retries=1", "--url=#{test_server}", out: write end start_time=Time.now loop do assert (Time.now - start_time <= timeout), "No server connect after timeout" break if read.gets.include? "#{test_server} DNS error: \"unknown node or service\"" end ensure Process.kill("SIGINT", pid) end end end
31.181818
93
0.669388
f797ae4f30e628f3e05eb848422a71a4d6533dfd
7,808
# frozen_string_literal: true require "spec_helper" module PracticeTerraforming module Resource describe S3 do let(:buckets) do [ { creation_date: Time.parse("2014-01-01T12:12:12.000Z"), name: "hoge" }, { creation_date: Time.parse("2015-01-01T00:00:00.000Z"), name: "fuga" }, { creation_date: Time.parse("2015-01-01T00:00:00.000Z"), name: "piyo" } ] end let(:owner) do { display_name: "owner", id: "12345678abcdefgh12345678abcdefgh12345678abcdefgh12345678abcdefgh" } end let(:hoge_policy) do "{\"Version\":\"2012-10-17\",\"Id\":\"Policy123456789012\",\"Statement\":[{\"Sid\":\"Stmt123456789012\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:user/hoge\"},\"Action\":\"s3:*\",\"Resource\":\"arn:aws:s3:::hoge/*\"}]}" end let(:hoge_location) do { location_constraint: "ap-northeast-1" } end let(:fuga_location) do { location_constraint: "ap-northeast-1" } end let(:piyo_location) do { location_constraint: "" } end context "from ap-northeast-1" do let(:client) do Aws::S3::Client.new(region: "ap-northeast-1", stub_responses: true) end before do client.stub_responses(:list_buckets, buckets: buckets, owner: owner) client.stub_responses(:get_bucket_policy, [ { policy: hoge_policy }, "NoSuchBucketPolicy", ]) client.stub_responses(:get_bucket_location, [hoge_location, fuga_location, piyo_location]) end describe ".tf" do it "should generate tf" do expect(described_class.tf(client: client)).to eq <<~EOS resource "aws_s3_bucket" "hoge" { bucket = "hoge" acl = "private" policy = <<POLICY { "Version": "2012-10-17", "Id": "Policy123456789012", "Statement": [ { "Sid": "Stmt123456789012", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:user/hoge" }, "Action": "s3:*", "Resource": "arn:aws:s3:::hoge/*" } ] } POLICY } resource "aws_s3_bucket" "fuga" { bucket = "fuga" acl = "private" } EOS end end describe ".tfstate" do it "should generate tfstate" do expect(described_class.tfstate(client: client)).to eq({ "aws_s3_bucket.hoge" => { "type" => "aws_s3_bucket", "primary" => { "id" => "hoge", "attributes" => { "acl" => "private", "bucket" => "hoge", "force_destroy" => "false", "id" => "hoge", "policy" => "{\"Version\":\"2012-10-17\",\"Id\":\"Policy123456789012\",\"Statement\":[{\"Sid\":\"Stmt123456789012\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:user/hoge\"},\"Action\":\"s3:*\",\"Resource\":\"arn:aws:s3:::hoge/*\"}]}" } } }, "aws_s3_bucket.fuga" => { "type" => "aws_s3_bucket", "primary" => { "id" => "fuga", "attributes" => { "acl" => "private", "bucket" => "fuga", "force_destroy" => "false", "id" => "fuga", "policy" => "" } } } }) end end end context "from us-east-1" do let(:client) do Aws::S3::Client.new(region: "us-east-1", stub_responses: true) end before do client.stub_responses(:list_buckets, buckets: buckets, owner: owner) client.stub_responses(:get_bucket_policy, [ "NoSuchBucketPolicy", ]) client.stub_responses(:get_bucket_location, [hoge_location, fuga_location, piyo_location]) end describe ".tf" do it "should generate tf" do expect(described_class.tf(client: client)).to eq <<~EOS resource "aws_s3_bucket" "piyo" { bucket = "piyo" acl = "private" } EOS end end describe ".tfstate" do it "should generate tfstate" do expect(described_class.tfstate(client: client)).to eq({ "aws_s3_bucket.piyo" => { "type" => "aws_s3_bucket", "primary" => { "id" => "piyo", "attributes" => { "acl" => "private", "bucket" => "piyo", "force_destroy" => "false", "id" => "piyo", "policy" => "" } } } }) end end end end end end
43.865169
335
0.303407
4adaa3afa2937d6083975472e7b1281e5eed5877
1,136
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'magician/version' Gem::Specification.new do |spec| spec.name = "magician" spec.version = Magician::VERSION spec.authors = ["Nicolas McCurdy"] spec.email = ["thenickperson@gmail.com"] spec.description = "A suite of handy methods for doing calculations in irb." spec.summary = "A suite of handy methods for doing calculations in irb." spec.homepage = "http://github.com/thenickperson/magician" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.13" spec.add_development_dependency "yard", "~> 0.7" spec.add_development_dependency "rdoc", "~> 4.0" spec.add_development_dependency "simplecov", "~> 0.7" end
39.172414
80
0.672535
261e10e300c262440815d13cc2b41df9995fcd57
2,036
module GapIntelligence # @see https://api.gapintelligence.com/api/doc/v1/promo_matrix.html module PromoMatrix # Requests and returns a list of products # # @param params [Hash] parameters of the http request # @param options [Hash] the options to make the request with # @yield [req] The Faraday request # @return [RecordSet<PromoMatrixProductVersion>] the list of requested products # @see https://api.gapintelligence.com/api/doc/v1/promo_matrix/product_versions.html def promo_matrix_product_versions(params = {}, options = {}, &block) default_option(options, :record_class, PromoMatrixProductVersion) perform_request(:post, 'promo_matrix/product_versions', options.merge(body: params), &block) end # Requests and returns a list of product placements # # @param params [Hash] parameters of the http request # @param options [Hash] the options to make the request with # @yield [req] The Faraday request # @return [RecordSet<PromoMatrixProductVersion>] the list of requested product placements # @see https://api.gapintelligence.com/api/doc/v1/promo_matrix/product_placements.html def promo_matrix_product_placements(params = {}, options = {}, &block) default_option(options, :record_class, PromoMatrixProductVersion) perform_request(:post, 'promo_matrix/product_placements', options.merge(body: params), &block) end # Requests and returns a list of pricing data # # @param params [Hash] parameters of the http request # @param options [Hash] the options to make the request with # @yield [req] The Faraday request # @return [RecordSet<PromoMatrixPricing>] the list of requested products # @see https://api.gapintelligence.com/api/doc/v1/promo_matrix/pricings.html def promo_matrix_pricings(params = {}, options = {}, &block) default_option(options, :record_class, PromoMatrixPricing) perform_request(:get, 'promo_matrix/pricings', options.merge(params: params), &block) end end end
49.658537
100
0.727898
38ae1a6f00654ad55c8daab9689de28c3b093197
229
require 'spec_helper' describe 'security_baseline::rules::sec_squashfs' do on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } it { is_expected.to compile } end end end
19.083333
52
0.668122
1c09bbd5989ed4901774989f35a14e6c88520399
65
namespace :admin do |admin| admin.resources :jskit_ratings end
16.25
32
0.784615
ab0da36435aaddd1f3fbc7fc5ac3d5922d157129
820
module ID3Tag module Frames module V2 class GenreFrame < TextFrame class MissingGenreParser < StandardError; end def genres @genres ||= get_genres end alias text_frame_content content private :text_frame_content def content genres.join(", ") end alias inspectable_content content private def get_genres genre_parser.new(text_frame_content).genres end def genre_parser case @major_version_number when 0...4 GenreParserPre24 when 4 GenreParser24 else raise(MissingGenreParser, "Missing genre parser for tag version v.2.#{@major_version_number}") end end end end end end
20.5
106
0.57439
111dfb239410fc26ed4e18427d446389a22ef402
3,906
# Copyright 2017 Google Inc. All rights reserved. # # 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 "helper" require "rails" require "rails/railtie" require "active_support/ordered_options" require "google/cloud/debugger/rails" describe Google::Cloud::Debugger::Railtie do let(:rails_config) do config = ::ActiveSupport::OrderedOptions.new config.google_cloud = ::ActiveSupport::OrderedOptions.new config.google_cloud.debugger = ::ActiveSupport::OrderedOptions.new config.google_cloud.project_id = "test-project" config.google_cloud.keyfile = "test/keyfile" config.google_cloud.debugger.service_name = "test-module" config.google_cloud.debugger.service_version = "test-version" config end after { Google::Cloud::Debugger.configure.instance_variable_get(:@configs).clear Google::Cloud.configure.delete :use_debugger } describe ".consolidate_rails_config" do it "merges configs from Rails configuration" do STDOUT.stub :puts, nil do Google::Cloud::Debugger::Railtie.send :consolidate_rails_config, rails_config Google::Cloud::Debugger.configure do |config| config.project_id.must_equal "test-project" config.keyfile.must_equal "test/keyfile" config.service_name.must_equal "test-module" config.service_version.must_equal "test-version" end end end it "doesn't override instrumentation configs" do Google::Cloud::Debugger.configure do |config| config.project_id = "another-test-project" config.keyfile = "/another/test/keyfile" config.service_name = "another-test-module" config.service_version = "another-test-version" end STDOUT.stub :puts, nil do Google::Cloud::Debugger::Railtie.send :consolidate_rails_config, rails_config Google::Cloud::Debugger.configure do |config| config.project_id.must_equal "another-test-project" config.keyfile.must_equal "/another/test/keyfile" config.service_name.must_equal "another-test-module" config.service_version.must_equal "another-test-version" end end end it "Set use_debugger to false if credentials aren't valid" do Google::Cloud.configure.use_debugger = true Google::Cloud::Debugger::Railtie.stub :valid_credentials?, false do Google::Cloud::Debugger::Railtie.send :consolidate_rails_config, rails_config Google::Cloud.configure.use_debugger.must_equal false end end it "Set use_debugger to true if Rails is in production" do Google::Cloud::Debugger::Railtie.stub :valid_credentials?, true do Rails.env.stub :production?, true do Google::Cloud.configure.use_debugger.must_be_nil Google::Cloud::Debugger::Railtie.send :consolidate_rails_config, rails_config Google::Cloud.configure.use_debugger.must_equal true end end end it "returns true if use_debugger is explicitly true even Rails is not in production" do rails_config.google_cloud.use_debugger = true Google::Cloud::Debugger::Railtie.stub :valid_credentials?, true do Rails.env.stub :production?, false do Google::Cloud::Debugger::Railtie.send :consolidate_rails_config, rails_config Google::Cloud.configure.use_debugger.must_equal true end end end end end
37.557692
91
0.716078
bff66e0cef7e63dae32ce6e005233b08f0950d73
1,398
# frozen_string_literal: true require "rom/relation" RSpec.describe ROM::Relation, "#map_with" do subject(:relation) do ROM::Relation.new( dataset, name: ROM::Relation::Name[:users], schema: schema, mappers: mapper_registry ) end let(:mapper_registry) { ROM::MapperRegistry.build(mappers) } let(:dataset) do [{id: 1, name: "Jane"}, {id: 2, name: "Joe"}] end context "without the default mapper" do let(:schema) do define_schema(:users, id: :Integer, name: :String) end let(:mappers) do { name_list: -> users { users.map { |u| u[:name] } }, upcase_names: -> names { names.map(&:upcase) }, identity: -> users { users } } end it "sends the relation through custom mappers" do expect(relation.map_with(:name_list, :upcase_names).to_a).to match_array(%w[JANE JOE]) end it "does not use the default mapper" do expect(relation.map_with(:identity).to_a).to eql(dataset) end end context "with the default mapper" do let(:schema) do define_schema(:users, id: :Integer, name: :String).prefix(:user) end let(:mappers) do {name_list: -> users { users.map { |u| u[:user_name] } }} end it "sends the relation through custom mappers" do expect(relation.map_with(:name_list).to_a).to match_array(%w[Jane Joe]) end end end
24.526316
92
0.622318
2124c8e914e84d0f38b6c63ad571501ee4dece16
201
class AddAdditionalAttributesToDatasetExtra < ActiveRecord::Migration def change add_column :dataset_extras, :searchable_attributes, :text add_column :dataset_extras, :orbit, :text end end
28.714286
69
0.79602
4a98a0915132510faa9d788c41c188fcf955277a
283
module NumberHelper def to_currency(i) options = {} options[:unit] = ENV['FRAB_CURRENCY_UNIT'] unless ENV['FRAB_CURRENCY_UNIT'].nil? options[:format] = ENV['FRAB_CURRENCY_FORMAT'] unless ENV['FRAB_CURRENCY_FORMAT'].nil? number_to_currency i, options end end
28.3
90
0.713781
01245329d369d536e631037df704d1c0b6bb17f2
75
json.partial! "api/v1/ppg_measures/ppg_measure", ppg_measure: @ppg_measure
37.5
74
0.813333
793190fbe1fb229a982c13f2f582687a2939b777
4,552
# frozen_string_literal: true require_relative '../base' require_relative '../share_buying' require_relative '../../action/buy_company.rb' require_relative '../../action/buy_shares' require_relative '../../action/par' module Engine module Step module G1860 class BuySellParShares < BuySellParShares include ShareBuying def actions(entity) return [] unless entity == current_entity return ['sell_shares'] if must_sell?(entity) actions = [] actions << 'buy_shares' if can_buy_any?(entity) actions << 'par' if can_ipo_any?(entity) actions << 'buy_company' if can_buy_any_companies?(entity) actions << 'sell_shares' if can_sell_any?(entity) actions << 'sell_company' if can_sell_any_companies?(entity) actions << 'pass' if actions.any? actions end def description 'Sell then Buy Certificates' end def pass_description if @current_actions.empty? 'Pass (Certificates)' else 'Done (Certificates)' end end def purchasable_companies(_entity) [] end def can_buy_company?(player, company) !did_sell?(company, player) end def can_buy_any_companies?(entity) return false if bought? || !entity.cash.positive? || @game.num_certs(entity) >= @game.cert_limit @game.companies.select { |c| c.owner == @game.bank }.reject { |c| did_sell?(c, entity) }.any? end def get_par_prices(_entity, corp) @game.par_prices(corp) end def sell_shares(entity, shares) @game.game_error("Cannot sell shares of #{shares.corporation.name}") unless can_sell?(entity, shares) @players_sold[shares.owner][shares.corporation] = :now @game.sell_shares_and_change_price(shares) end def process_buy_shares(action) super corporation = action.bundle.corporation place_home_track(corporation) if corporation.floated? @game.check_new_layer end def process_buy_company(action) player = action.entity company = action.company price = action.price owner = company.owner @game.game_error("Cannot buy #{company.name} from #{owner.name}") unless owner == @game.bank company.owner = player player.companies << company player.spend(price, owner) @current_actions << action @log << "#{player.name} buys #{company.name} from #{owner.name} for #{@game.format_currency(price)}" @game.close_other_companies!(company) if company.sym == 'FFC' end def process_sell_company(action) company = action.company player = action.entity @game.game_error("Cannot sell #{company.id}") unless can_sell_company?(company) sell_company(player, company, action.price) @round.last_to_act = player end def sell_price(entity) return 0 unless can_sell_company?(entity) entity.value - 30 end def can_sell_any_companies?(entity) !bought? && sellable_companies(entity).any? end def sellable_companies(entity) return [] unless @game.turn > 1 return [] unless entity.player? entity.companies end def can_sell_company?(entity) return false unless entity.company? return false if entity.owner == @game.bank return false unless @game.turn > 1 true end def sell_company(player, company, price) company.owner = @game.bank player.companies.delete(company) @game.bank.spend(price, player) if price.positive? @log << "#{player.name} sells #{company.name} to bank for #{@game.format_currency(price)}" @players_sold[player][company] = :now end def place_home_track(corporation) hex = @game.hex_by_id(corporation.coordinates) tile = hex.tile # skip if a tile is already in home location return unless tile.color == :white @log << "#{corporation.name} must choose tile for home location" @round.pending_tracks << { entity: corporation, hexes: [hex], } @round.clear_cache! end end end end end
28.993631
111
0.592487
2838809ab6cfbc4a6a3527e1469492aa8c3ae0d4
303
module Travis::API::V3 class Renderer::Cron < ModelRenderer representation(:minimal, :id) representation(:standard, :id, :repository, :branch, :interval, :dont_run_if_recent_build_exists, :last_run, :next_run, :created_at) def repository model.branch.repository end end end
25.25
136
0.719472
034320900461ddc0fbae17d2abcd581b9597e4bf
78
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'myGemObi'
26
58
0.730769
bf69046fac11609b0e7809f9bbc037459eb72545
1,750
# -*- encoding: utf-8 -*- # stub: sass-rails 5.1.0 ruby lib Gem::Specification.new do |s| s.name = "sass-rails".freeze s.version = "5.1.0" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["wycats".freeze, "chriseppstein".freeze] s.date = "2019-08-16" s.description = "Sass adapter for the Rails asset pipeline.".freeze s.email = ["wycats@gmail.com".freeze, "chris@eppsteins.net".freeze] s.homepage = "https://github.com/rails/sass-rails".freeze s.licenses = ["MIT".freeze] s.required_ruby_version = Gem::Requirement.new(">= 2.4.0".freeze) s.rubygems_version = "3.1.4".freeze s.summary = "Sass adapter for the Rails asset pipeline.".freeze s.installed_by_version = "3.1.4" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 end if s.respond_to? :add_runtime_dependency then s.add_runtime_dependency(%q<railties>.freeze, [">= 5.2.0"]) s.add_runtime_dependency(%q<sass>.freeze, ["~> 3.1"]) s.add_runtime_dependency(%q<sprockets-rails>.freeze, [">= 2.0", "< 4.0"]) s.add_runtime_dependency(%q<sprockets>.freeze, [">= 2.8", "< 4.0"]) s.add_runtime_dependency(%q<tilt>.freeze, [">= 1.1", "< 3"]) s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"]) else s.add_dependency(%q<railties>.freeze, [">= 5.2.0"]) s.add_dependency(%q<sass>.freeze, ["~> 3.1"]) s.add_dependency(%q<sprockets-rails>.freeze, [">= 2.0", "< 4.0"]) s.add_dependency(%q<sprockets>.freeze, [">= 2.8", "< 4.0"]) s.add_dependency(%q<tilt>.freeze, [">= 1.1", "< 3"]) s.add_dependency(%q<sqlite3>.freeze, [">= 0"]) end end
41.666667
112
0.656571
876dbd259eb923fe418518d7b5001e104e041f6a
359
module Skale class Node < Common::Resource field :id field :name, type: :string field :public_ip field :start_block, type: :integer field :last_reward_date, type: :timestamp field :next_reward_date, type: :timestamp field :validator_id, type: :integer field :status, type: :string field :address, type: :string end end
25.642857
45
0.685237
ab5b7b642276f935ec9d9ef7abd266b2bfcc0132
1,752
# frozen_string_literal: true # The MIT License (MIT) # # Copyright <YEAR> <COPYRIGHT HOLDER> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! # [START showcase_v0_generated_Identity_GetUser_sync] require "google/showcase/v1beta1/identity" # Create a client object. The client can be reused for multiple calls. client = Google::Showcase::V1beta1::Identity::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Showcase::V1beta1::GetUserRequest.new # Call the get_user method. result = client.get_user request # The returned object is of type Google::Showcase::V1beta1::User. p result # [END showcase_v0_generated_Identity_GetUser_sync]
41.714286
79
0.781963
79bf7339c5bb1a04f7b747a6c6081b9abc7a5b07
13,003
module ViewModel module SapSchema112 class CommonSchema < ViewModel::DomesticEpcViewModel def assessment_id xpath(%w[RRN]) end def address_line1 xpath(%w[Property Address Address-Line-1]) end def address_line2 xpath(%w[Property Address Address-Line-2]).to_s end def address_line3 xpath(%w[Property Address Address-Line-3]).to_s end def address_line4 xpath(%w[Property Address Address-Line-4]).to_s end def town xpath(%w[Property Address Post-Town]) end def postcode xpath(%w[Property Address Postcode]) end def scheme_assessor_id xpath(%w[Certificate-Number]) end def assessor_name [ xpath(%w[Home-Inspector Name Prefix]), xpath(%w[Home-Inspector Name First-Name]), xpath(%w[Home-Inspector Name Surname]), xpath(%w[Home-Inspector Name Suffix]), ].reject { |e| e.to_s.empty? }.join(" ") end def assessor_email xpath(%w[Home-Inspector E-Mail]) end def assessor_telephone xpath(%w[Home-Inspector Telephone]) end def date_of_assessment xpath(%w[Inspection-Date]) end def date_of_registration xpath(%w[Registration-Date]) end def address_id "LPRN-#{xpath(%w[UPRN])}" end def date_of_expiry expires_at = (Date.parse(date_of_registration) - 1) >> 12 * 10 expires_at.to_s end def property_summary @xml_doc.search("Energy-Assessment Property-Summary").children.select( &:element? ).map { |node| next if xpath(%w[Energy-Efficiency-Rating], node).nil? { energy_efficiency_rating: xpath(%w[Energy-Efficiency-Rating], node).to_i, environmental_efficiency_rating: xpath(%w[Environmental-Efficiency-Rating], node).to_i, name: node.name.underscore, description: xpath(%w[Description], node), } }.compact end def related_party_disclosure_text xpath(%w[Related-Party-Disclosure]) end def related_party_disclosure_number nil end def improvements @xml_doc .search("Suggested-Improvements/Improvement") .map do |node| { energy_performance_rating_improvement: xpath(%w[Energy-Performance-Rating], node).to_i, environmental_impact_rating_improvement: xpath(%w[Environmental-Impact-Rating], node).to_i, green_deal_category_code: xpath(%w[Green-Deal-Category], node), improvement_category: xpath(%w[Improvement-Category], node), improvement_code: xpath(%w[Improvement-Details Improvement-Number], node), improvement_description: xpath(%w[Improvement-Description], node), improvement_title: improvement_title(node), improvement_type: xpath(%w[Improvement-Type], node), indicative_cost: xpath(%w[Indicative-Cost], node), sequence: xpath(%w[Sequence], node).to_i, typical_saving: xpath(%w[Typical-Saving], node), } end end def recommendations_for_report @xml_doc .search("Suggested-Improvements Improvement") .map do |node| { sequence: xpath(%w[Sequence], node).to_i, improvement_summary: xpath(%w[Improvement-Summary], node), improvement_description: xpath(%w[Improvement-Description], node), improvement_code: xpath(%w[Improvement-Details Improvement-Number], node), indicative_cost: xpath(%w[Indicative-Cost], node), } end end def hot_water_cost_potential xpath(%w[Hot-Water-Cost-Potential]) end def heating_cost_potential xpath(%w[Heating-Cost-Potential]) end def lighting_cost_potential xpath(%w[Lighting-Cost-Potential]) end def hot_water_cost_current xpath(%w[Hot-Water-Cost-Current]) end def heating_cost_current xpath(%w[Heating-Cost-Current]) end def lighting_cost_current xpath(%w[Lighting-Cost-Current]) end def potential_carbon_emission xpath(%w[CO2-Emissions-Potential]) end def current_carbon_emission xpath(%w[CO2-Emissions-Current]) end def potential_energy_rating xpath(%w[Energy-Rating-Potential]).to_i end def current_energy_rating xpath(%w[Energy-Rating-Current]).to_i end def primary_energy_use xpath(%w[Energy-Consumption-Current]) end def energy_consumption_potential xpath(%w[Energy-Consumption-Potential]) end def estimated_energy_cost xpath(%w[Estimated-Energy-Cost]) end def total_floor_area building_part_areas = @xml_doc.search("//SAP-Building-Part/SAP-Floor-Dimensions/SAP-Floor-Dimension/Total-Floor-Area").map(&:content) room_in_roof_areas = @xml_doc.search("//SAP-Building-Part/SAP-Room-In-Roof/Floor-Area").map(&:content) all_areas = (building_part_areas + room_in_roof_areas).map(&:to_f) all_areas.sum.round.to_i.to_s end def dwelling_type; end def potential_energy_saving; end def property_age_band xpath(%w[Construction-Year]) end def tenure nil end def transaction_type nil end def current_space_heating_demand xpath(%w[Space-Heating-Existing-Dwelling]) end def current_water_heating_demand xpath(%w[Water-Heating]) end def impact_of_cavity_insulation if xpath(%w[Impact-Of-Cavity-Insulation]) xpath(%w[Impact-Of-Cavity-Insulation]).to_i end end def impact_of_loft_insulation if xpath(%w[Impact-Of-Loft-Insulation]) xpath(%w[Impact-Of-Loft-Insulation]).to_i end end def impact_of_solid_wall_insulation if xpath(%w[Impact-Of-Solid-Wall-Insulation]) xpath(%w[Impact-Of-Solid-Wall-Insulation]).to_i end end def country_code xpath(%w[Country-Code]) end def main_fuel_type xpath(%w[Main-Fuel-Type]) end def secondary_fuel_type xpath(%w[Secondary-Fuel-Type]) end def type_of_assessment case xpath(%w[Report-Type]).to_i when 1 "HCR" when 2 "RdSAP" when 3 "SAP" end end def environmental_impact_current xpath(%w[Environmental-Impact-Current]) end def environmental_impact_potential xpath(%w[Environmental-Impact-Potential]) end def co2_emissions_current_per_floor_area xpath(%w[CO2-Emissions-Current-Per-Floor-Area]) end def mains_gas nil end def level xpath(%w[Level]) end def top_storey flat_level_code = xpath(%w[Level]) flat_level_code == "3" ? "Y" : "N" end def storey_count nil end def main_heating_controls xpath(%w[Main-Heating-Controls Description]) end def multiple_glazed_proportion xpath(%w[Multiple-Glazed-Proportion]) end def glazed_area nil end def habitable_room_count nil end def heated_room_count nil end def low_energy_lighting xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Percentage]) end def fixed_lighting_outlets_count xpath(%w[Fixed-Lighting-Outlets-Count]) end def low_energy_fixed_lighting_outlets_count xpath(%w[Low-Energy-Fixed-Lighting-Outlets-Count]) end def open_fireplaces_count xpath(%w[Open-Fireplaces-Count]) end def hot_water_description xpath(%w[Hot-Water Description]) end def hot_water_energy_efficiency_rating xpath(%w[Hot-Water Energy-Efficiency-Rating]) end def hot_water_environmental_efficiency_rating xpath(%w[Hot-Water Environmental-Efficiency-Rating]) end def window_description xpath(%w[Windows Description]) end def window_energy_efficiency_rating xpath(%w[Windows Energy-Efficiency-Rating]) end def window_environmental_efficiency_rating xpath(%w[Windows Environmental-Efficiency-Rating]) end def secondary_heating_description xpath(%w[Secondary-Heating Description]) end def secondary_heating_energy_efficiency_rating xpath(%w[Secondary-Heating Energy-Efficiency-Rating]) end def secondary_heating_environmental_efficiency_rating xpath(%w[Secondary-Heating Environmental-Efficiency-Rating]) end def lighting_description xpath(%w[Lighting Description]) end def lighting_energy_efficiency_rating xpath(%w[Lighting Energy-Efficiency-Rating]) end def lighting_environmental_efficiency_rating xpath(%w[Lighting Environmental-Efficiency-Rating]) end def photovoltaic_roof_area_percent nil end def built_form xpath(%w[Built-Form]) end def heat_loss_corridor xpath(%w[Heat-Loss-Corridor]) end def wind_turbine_count xpath(%w[Wind-Turbines-Count]) end def unheated_corridor_length xpath(%w[Unheated-Corridor-Length]) end def all_main_heating_descriptions @xml_doc.search("Main-Heating/Description").map(&:content) end def all_main_heating_controls_descriptions @xml_doc.search("Main-Heating-Controls/Description").map(&:content) end def report_type xpath(%w[Report-Type]) end def all_roof_descriptions @xml_doc.search("Roof/Description").map(&:content) end def all_roof_energy_efficiency_rating @xml_doc.search("Roof/Energy-Efficiency-Rating").map(&:content) end def all_roof_env_energy_efficiency_rating @xml_doc.search("Roof/Environmental-Efficiency-Rating").map(&:content) end def all_wall_descriptions @xml_doc.search("Walls/Description").map(&:content) end def all_wall_energy_efficiency_rating @xml_doc.search("Walls/Energy-Efficiency-Rating").map(&:content) end def all_wall_env_energy_efficiency_rating @xml_doc.search("Walls/Environmental-Efficiency-Rating").map(&:content) end def energy_tariff xpath(%w[Electricity-Tariff]) end def extensions_count xpath(%w[Extensions-Count]) end def solar_water_heating_flag nil end def mechanical_ventilation nil end def floor_level xpath(%w[SAP-Flat-Details Level]) end def floor_height @xml_doc.search("Storey-Height").map(&:content) end def all_floor_descriptions @xml_doc.search("Property-Summary/Floor/Description").map(&:content) end def all_floor_energy_efficiency_rating @xml_doc .search("Property-Summary/Floor/Energy-Efficiency-Rating") .map(&:content) end def all_floor_env_energy_efficiency_rating @xml_doc .search("Property-Summary/Floor/Environmental-Efficiency-Rating") .map(&:content) end def all_main_heating_energy_efficiency @xml_doc.search("Main-Heating/Energy-Efficiency-Rating").map(&:content) end def all_main_heating_controls_energy_efficiency @xml_doc .search("Main-Heating-Controls/Energy-Efficiency-Rating") .map(&:content) end def all_main_heating_controls_environmental_efficiency @xml_doc .search("Main-Heating-Controls/Environmental-Efficiency-Rating") .map(&:content) end def all_main_heating_environmental_efficiency @xml_doc .search("Main-Heating/Environmental-Efficiency-Rating") .map(&:content) end def main_dwelling_construction_age_band_or_year sap_building_parts = @xml_doc.xpath("//SAP-Building-Parts/SAP-Building-Part") sap_building_parts.each do |sap_building_part| building_part_number = sap_building_part.at("Building-Part-Number") # Identifies the Main Dwelling if building_part_number&.content == "1" return( sap_building_part.at_xpath( "Construction-Age-Band | Construction-Year", )&.content ) end end nil end end end end
25.546169
141
0.61978
791485b4fcfdacd5af2e703022157780ee3f78b5
189
class Product::ClassifiedAdvertisement::Candidature < ::Candidature protected def validate_resource_id? resource_type == 'User' || vacancy.resource_type == 'User' end end
27
68
0.719577
8719815dc5db820fdb40e11239a19af94bdfce2f
922
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Cocina --> MODS mappings for note' do describe 'Abstract' do it_behaves_like 'cocina MODS mapping' do let(:cocina) do { note: [ { type: 'abstract', value: 'My paper is about dolphins.' } ] } end let(:mods) do <<~XML <abstract>My paper is about dolphins.</abstract> XML end end end describe 'Preferred citation' do it_behaves_like 'cocina MODS mapping' do let(:cocina) do { note: [ type: 'preferred citation', value: 'Me (2002). Our friend the dolphin.' ] } end let(:mods) do <<~XML <note type="preferred citation">Me (2002). Our friend the dolphin.</note> XML end end end end
20.043478
83
0.505423
384b765f1559f43de006b8ae09a5aab469447d47
569
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) Ingredient.create(name: "Chicken") Ingredient.create(name: "Beef") Ingredient.create(name: "Pork") Ingredient.create(name: "Salmon") Ingredient.create(name: "Trout") Ingredient.create(name: "Rice")
37.933333
111
0.72935
5df2f0ba73dfd3a021bf4863599c7fbd567d3dd7
7,392
#encoding:utf-8 require 'rails_helper' RSpec.shared_examples "redirect to edit_user_path" do let(:action) { nil } let(:anchor) { nil } context "when user is logged" do let(:current_user) { create(:user) } before do allow(controller).to receive(:current_user).and_return(current_user) get action, id: current_user.id, locale: :pt end it { is_expected.to redirect_to edit_user_path(current_user, anchor: (anchor || action.to_s)) } end context "when user is not logged" do let(:current_user) { create(:user) } before do allow(controller).to receive(:current_user).and_return(nil) get :settings, id: current_user.id, locale: :pt end it { is_expected.to redirect_to sign_up_path } end end RSpec.describe UsersController, type: :controller do render_views subject{ response } before do allow(controller).to receive(:current_user).and_return(current_user) end let(:successful_project){ create(:project, state: 'successful') } let(:failed_project){ create(:project, state: 'failed') } let(:contribution){ create(:contribution, state: 'confirmed', user: user, project: failed_project) } let(:user){ create(:user, password: 'current_password', password_confirmation: 'current_password', authorizations: [create(:authorization, uid: 666, oauth_provider: create(:oauth_provider, name: 'facebook'))]) } let(:current_user){ user } describe "GET settings" do it_should_behave_like "redirect to edit_user_path" do let(:action) { :settings } end end describe "GET billing" do it_should_behave_like "redirect to edit_user_path" do let(:action) { :billing } end end describe "GET reactivate" do let(:current_user) { nil } before do user.deactivate end context "when token is nil" do let(:token){ 'nil' } before do expect(controller).to_not receive(:sign_in) get :reactivate, id: user.id, token: token, locale: :pt end it "should not set deactivated_at to nil" do expect(user.reload.deactivated_at).to_not be_nil end it { is_expected.to redirect_to root_path } end context "when token is NOT valid" do let(:token){ 'invalid token' } before do expect(controller).to_not receive(:sign_in) get :reactivate, id: user.id, token: token, locale: :pt end it "should not set deactivated_at to nil" do expect(user.reload.deactivated_at).to_not be_nil end it { is_expected.to redirect_to root_path } end context "when token is valid" do let(:token){ user.reactivate_token } before do expect(controller).to receive(:sign_in).with(user) get :reactivate, id: user.id, token: token, locale: :pt end it "should set deactivated_at to nil" do expect(user.reload.deactivated_at).to be_nil end it { is_expected.to redirect_to root_path } end end describe "DELETE destroy" do context "when user is beign deactivated by admin" do before do allow(controller).to receive(:current_user).and_call_original sign_in(create(:user, admin: true)) delete :destroy, id: user.id, locale: :pt end it "should set deactivated_at" do expect(user.reload.deactivated_at).to_not be_nil end it "should not sign user out" do expect(controller.current_user).to_not be_nil end it { is_expected.to redirect_to root_path } end context "when user is loged" do before do allow(controller).to receive(:current_user).and_call_original sign_in(current_user) delete :destroy, id: user.id, locale: :pt end it "should set deactivated_at" do expect(user.reload.deactivated_at).to_not be_nil end it "should sign user out" do expect(controller.current_user).to be_nil end it { is_expected.to redirect_to root_path } end context "when user is not loged" do let(:current_user) { nil } before do delete :destroy, id: user.id, locale: :pt end it "should not set deactivated_at" do expect(user.reload.deactivated_at).to be_nil end it { is_expected.not_to redirect_to user_path(user, anchor: 'settings') } end end describe "GET unsubscribe_notifications" do context "when user is loged" do before do get :unsubscribe_notifications, id: user.id, locale: 'pt' end it { is_expected.to redirect_to edit_user_path(user, anchor: 'notifications') } end context "when user is not loged" do let(:current_user) { nil } before do get :unsubscribe_notifications, id: user.id, locale: 'pt' end it { is_expected.to redirect_to new_user_registration_path } end end describe "PUT update" do context "with password parameters" do let(:current_password){ 'current_password' } let(:password){ 'newpassword123' } let(:password_confirmation){ 'newpassword123' } before do put :update, id: user.id, locale: 'pt', user: { current_password: current_password, password: password, password_confirmation: password_confirmation } end context "with wrong current password" do let(:current_password){ 'wrong_password' } it{ expect(user.errors).not_to be_nil } it{ is_expected.not_to redirect_to edit_user_path(user) } end context "with right current password and right confirmation" do it{ expect(flash[:notice]).not_to be_empty } it{ is_expected.to redirect_to edit_user_path(user) } end end context "with out password parameters" do let(:project){ create(:project, state: 'successful') } let(:category){ create(:category) } before do create(:category_follower, user: user) put :update, id: user.id, locale: 'pt', user: { twitter: 'test', unsubscribes: {project.id.to_s=>"1"}} end it("should update the user and nested models") do user.reload expect(user.twitter).to eq('test') expect(user.category_followers.size).to eq(1) end it{ is_expected.to redirect_to edit_user_path(user) } end context "removing category followers" do let(:project){ create(:project, state: 'successful') } before do create(:category_follower, user: user) put :update, id: user.id, category_followers_form: true, locale: 'pt', user: { twitter: 'test', unsubscribes: {project.id.to_s=>"1"}, category_followers_attributes: []} end it("should clear category followers") do user.reload expect(user.category_followers.size).to eq(0) end it{ is_expected.to redirect_to edit_user_path(user) } end end describe "GET show" do before do get :show, id: user.id, locale: 'pt', ref: 'test' end context "when user is no longer active" do let(:user){ create(:user, deactivated_at: Time.now) } its(:status){ should eq 404 } end context "when user is active" do it{ is_expected.to be_successful } it{ expect(assigns(:fb_admins)).to include(user.facebook_id.to_i) } end it "should set referral session" do expect(session[:referral_link]).to eq 'test' end end end
29.450199
213
0.656791
263c2762fa37d796f4a9c2daf523b7ceb9ce507a
312
cask 'todour' do version '2.14' sha256 '7f86aebc70f8ad8135bfe27be2d78b702e3bcf791f6aa1602c169e6b749c0fee' url "http://nerdur.com/Todour-#{version}.dmg" appcast 'https://github.com/SverrirValgeirsson/Todour/releases.atom' name 'Todour' homepage 'http://nerdur.com/todour-pl/' app 'Todour.app' end
26
75
0.753205
e9f3ad82654f7b36ce8c43e6e32404664a56ece4
1,054
# frozen_string_literal: true ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'mocha/test_unit' module ActiveSupport class TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all OmniAuth.config.test_mode = true Rails.configuration.google_client_domain_list = %w[test] def new_dolphin(from: :default, to: :default, source: 'Test', created_at: nil, updated_at: nil) from = new_user if from == :default to = new_user(email: 'test2@test', uid: '2') if to == :default Dolphin.new(from: from, to: to, source: source, created_at: created_at, updated_at: updated_at) end def new_user(email: 'test@test', image_url: '/', name: 'Test User', nickname: nil, provider: 'test', uid: '0') User.new(email: email, image_url: image_url, name: name, nickname: nickname, provider: provider, uid: uid) end end end
34
84
0.648956
5df247abcdbd373c3901ce25b232a527699f02ff
4,957
require 'set' module Audited # Audit saves the changes to ActiveRecord models. It has the following attributes: # # * <tt>auditable</tt>: the ActiveRecord model that was changed # * <tt>user</tt>: the user that performed the change; a string or an ActiveRecord model # * <tt>action</tt>: one of create, update, or delete # * <tt>audited_changes</tt>: a serialized hash of all the changes # * <tt>comment</tt>: a comment set with the audit # * <tt>version</tt>: the version of the model # * <tt>request_uuid</tt>: a uuid based that allows audits from the same controller request # * <tt>created_at</tt>: Time that the change was performed # class Audit < ::ActiveRecord::Base include ActiveModel::Observing belongs_to :auditable, polymorphic: true belongs_to :user, polymorphic: true belongs_to :associated, polymorphic: true before_create :set_version_number, :set_audit_user, :set_request_uuid cattr_accessor :audited_class_names self.audited_class_names = Set.new serialize :audited_changes scope :ascending, ->{ reorder(version: :asc) } scope :descending, ->{ reorder(version: :desc)} scope :creates, ->{ where(action: 'create')} scope :updates, ->{ where(action: 'update')} scope :destroys, ->{ where(action: 'destroy')} scope :up_until, ->(date_or_time){where("created_at <= ?", date_or_time) } scope :from_version, ->(version){where(['version >= ?', version]) } scope :to_version, ->(version){where(['version <= ?', version]) } scope :auditable_finder, ->(auditable_id, auditable_type){where(auditable_id: auditable_id, auditable_type: auditable_type)} # Return all audits older than the current one. def ancestors self.class.ascending.auditable_finder(auditable_id, auditable_type).to_version(version) end # Return an instance of what the object looked like at this revision. If # the object has been destroyed, this will be a new record. def revision clazz = auditable_type.constantize (clazz.find_by_id(auditable_id) || clazz.new).tap do |m| self.class.assign_revision_attributes(m, self.class.reconstruct_attributes(ancestors).merge(version: version)) end end # Returns a hash of the changed attributes with the new values def new_attributes (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)| attrs[attr] = values.is_a?(Array) ? values.last : values attrs end end # Returns a hash of the changed attributes with the old values def old_attributes (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)| attrs[attr] = Array(values).first attrs end end # Allows user to be set to either a string or an ActiveRecord object # @private def user_as_string=(user) # reset both either way self.user_as_model = self.username = nil user.is_a?(::ActiveRecord::Base) ? self.user_as_model = user : self.username = user end alias_method :user_as_model=, :user= alias_method :user=, :user_as_string= # @private def user_as_string user_as_model || username end alias_method :user_as_model, :user alias_method :user, :user_as_string # Returns the list of classes that are being audited def self.audited_classes audited_class_names.map(&:constantize) end # All audits made during the block called will be recorded as made # by +user+. This method is hopefully threadsafe, making it ideal # for background operations that require audit information. def self.as_user(user, &block) Thread.current[:audited_user] = user yield ensure Thread.current[:audited_user] = nil end # @private def self.reconstruct_attributes(audits) attributes = {} result = audits.collect do |audit| attributes.merge!(audit.new_attributes).merge!(version: audit.version) yield attributes if block_given? end block_given? ? result : attributes end # @private def self.assign_revision_attributes(record, attributes) attributes.each do |attr, val| record = record.dup if record.frozen? if record.respond_to?("#{attr}=") record.attributes.key?(attr.to_s) ? record[attr] = val : record.send("#{attr}=", val) end end record end private def set_version_number max = self.class.auditable_finder(auditable_id, auditable_type).descending.first.try(:version) || 0 self.version = max + 1 end def set_audit_user self.user = Thread.current[:audited_user] if Thread.current[:audited_user] nil # prevent stopping callback chains end def set_request_uuid self.request_uuid ||= SecureRandom.uuid end end end
33.952055
128
0.669356
08d44c3b5a709d3930d818b1b3d9239713cc323e
201
class CreateLists < ActiveRecord::Migration[6.0] def change create_table :lists do |t| t.string :name t.string :content t.integer :user_id t.timestamps end end end
18.272727
48
0.636816
08b1bead647dc0ae6c7c1e4bfe730a317412648c
5,664
module Steep module Drivers class Watch class Options attr_accessor :fallback_any_is_error attr_accessor :allow_missing_definitions def initialize self.fallback_any_is_error = false self.allow_missing_definitions = true end end attr_reader :source_dirs attr_reader :signature_dirs attr_reader :stdout attr_reader :stderr attr_reader :options attr_reader :queue include Utils::EachSignature def initialize(source_dirs:, signature_dirs:, stdout:, stderr:) @source_dirs = source_dirs @signature_dirs = signature_dirs @stdout = stdout @stderr = stderr @options = Options.new @queue = Thread::Queue.new end def project_options Project::Options.new.tap do |opt| opt.fallback_any_is_error = options.fallback_any_is_error opt.allow_missing_definitions = options.allow_missing_definitions end end def source_listener @source_listener ||= yield_self do Listen.to(*source_dirs.map(&:to_s), only: /\.rb$/) do |modified, added, removed| queue << [:source, modified, added, removed] end end end def signature_listener @signature_listener ||= yield_self do Listen.to(*signature_dirs.map(&:to_s), only: /\.rbi$/) do |modified, added, removed| queue << [:signature, modified, added, removed] end end end def type_check_thread(project) Thread.new do until queue.closed? begin events = [] events << queue.deq until queue.empty? events << queue.deq(nonblock: true) end events.compact.each do |name, modified, added, removed| case name when :source (modified + added).each do |name| path = Pathname(name).relative_path_from(Pathname.pwd) file = project.source_files[path] || Project::SourceFile.new(path: path, options: project_options) file.content = path.read project.source_files[path] = file end removed.each do |name| path = Pathname(name).relative_path_from(Pathname.pwd) project.source_files.delete(path) end when :signature (modified + added).each do |name| path = Pathname(name).relative_path_from(Pathname.pwd) file = project.signature_files[path] || Project::SignatureFile.new(path: path) file.content = path.read project.signature_files[path] = file end removed.each do |name| path = Pathname(name).relative_path_from(Pathname.pwd) project.signature_files.delete(path) end end end begin project.type_check rescue Racc::ParseError => exn stderr.puts exn.message project.clear end end end rescue ClosedQueueError # nop end end class WatchListener < Project::NullListener attr_reader :stdout attr_reader :stderr def initialize(stdout:, stderr:, verbose:) @stdout = stdout @stderr = stderr end def check(project:) yield.tap do if project.success? if project.has_type_error? stdout.puts "Detected #{project.errors.size} errors... 🔥" else stdout.puts "No error detected. 🎉" end else stdout.puts "Type checking failed... 🔥" end end end def type_check_source(project:, file:) yield.tap do case when file.source.is_a?(Source) && file.errors file.errors.each do |error| error.print_to stdout end end end end def load_signature(project:) # @type var project: Project yield.tap do case sig = project.signature when Project::SignatureHasError when Project::SignatureHasSyntaxError sig.errors.each do |path, exn| stdout.puts "#{path} has a syntax error: #{exn.inspect}" end end end end end def run(block: true) project = Project.new(WatchListener.new(stdout: stdout, stderr: stderr, verbose: false)) source_dirs.each do |path| each_file_in_path(".rb", path) do |file_path| file = Project::SourceFile.new(path: file_path, options: options) file.content = file_path.read project.source_files[file_path] = file end end signature_dirs.each do |path| each_file_in_path(".rbi", path) do |file_path| file = Project::SignatureFile.new(path: file_path) file.content = file_path.read project.signature_files[file_path] = file end end project.type_check source_listener.start signature_listener.start t = type_check_thread(project) binding.pry(quiet: true) if block queue.close t.join end end end end
29.968254
118
0.538489
332793a1f7b0f6e42c9f76eb18e18dc7789970fe
2,039
class UsersController < ApplicationController # Only when :edit, :update, Execute :logged_in_user, which require user to be logged in. before_action :logged_in_user, only: [:index, :edit, :update, :destroy, :following, :followers] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.where(activated: true).paginate(page: params[:page]) # :pageはwill_paginateが自動生成 end def show @user = User.find(params[:id]) @microposts = @user.microposts.paginate(page: params[:page]) redirect_to root_url and return unless @user.activated? end def new @user = User.new end def create @user = User.new(user_params) if @user.save @user.send_activation_email flash[:info] = 'Please check your email to activate your account' redirect_to root_url else render 'new' end end def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update_attributes(user_params) # Update success flash[:success] = 'Profile updated!' redirect_to @user else render 'edit' end end def destroy User.find(params[:id]).destroy flash[:success] = "User deleted" redirect_to users_url end def following @title = "Following" @user = User.find(params[:id]) @users = @user.following.paginate(page: params[:page]) render 'show_follow' end def followers @title = "Followers" @user = User.find(params[:id]) @users = @user.followers.paginate(page: params[:page]) render 'show_follow' end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end def correct_user @user = User.find(params[:id]) unless current_user?(@user) flash[:danger] = 'Action not permitted' redirect_to root_url end end def admin_user redirect_to(root_url) unless current_user.admin? end end
24.27381
98
0.660618
3990a04c7c12319deca70a57286605af943eea1d
833
require "spec_helper" describe JsonSpec::Matchers::HaveJsonPath do it "matches hash keys" do %({"one":{"two":{"three":4}}}).should have_json_path("one/two/three") end it "doesn't match values" do %({"one":{"two":{"three":4}}}).should_not have_json_path("one/two/three/4") end it "matches array indexes" do %([1,[1,2,[1,2,3,4]]]).should have_json_path("1/2/3") end it "respects null array values" do %([null,[null,null,[null,null,null,null]]]).should have_json_path("1/2/3") end it "matches hash keys and array indexes" do %({"one":[1,2,{"three":4}]}).should have_json_path("one/2/three") end it "provides a description message" do matcher = have_json_path("json") matcher.matches?(%({"id":1,"json":"spec"})) matcher.description.should == %(have JSON path "json") end end
27.766667
79
0.641056
338ea21d3e0cf721f3a234df351a408bb717a2f0
4,517
module Gendered describe Name do let :value do "Sean" end subject do described_class.new value end it "initializes with a value" do expect(subject.value).to eq value end describe "#to_s" do it "converts with its value" do expect(subject.to_s).to eq subject.value end end describe "guess!" do it "sets the gender" do subject.guess! expect(subject.gender).to eq :male end it "sets the probability" do subject.guess! expect(subject.probability).to be_a BigDecimal end it "sets the sample size" do subject.guess! expect(subject.sample_size).to be_a Integer end it "returns the gender" do expect(subject.guess!).to eq :male end it "returns gender by country id" do name = Gendered::Name.new("kim") expect(name.guess!).to eq :female expect(name.guess!(:country_id => "dk")).to eq :male end end describe "#gender=" do described_class::VALID_GENDERS.each do |value| it "can set the gender to #{value}" do subject.gender = value expect(subject.gender).to eq value end end it "raises an argument error if the gender is set to something invalid" do %w(eunich).each do |value| expect{subject.gender = value}.to raise_error(ArgumentError) end end end describe "#gender" do it "is not_guessed" do expect(subject.gender).to eq :not_guessed end end context "when the gender is male" do before { subject.gender = :male } it "is male" do expect(subject).to be_male end it "is not female" do expect(subject).to_not be_female end end context "when the gender is female" do before { subject.gender = :female } it "is female" do expect(subject).to be_female end it "is not male" do expect(subject).to_not be_male end end context "when the gender is not set" do describe "#male?" do it "is not_guessed" do expect(subject.male?).to eq :not_guessed end end describe "#female?" do it "is not_guessed" do expect(subject.female?).to eq :not_guessed end end end describe "#guessed" do context "when the gender is set" do before do subject.gender = :male end it "is guessed" do expect(subject).to be_guessed end end context "when the gender is not set" do it "is not guessed" do expect(subject).to_not be_guessed end end end describe "#probability=" do it "can set probability greater than 0 and less than or equal to 1" do probabilities = [BigDecimal("0.01")] until probabilities.last == 1 probabilities << (probabilities.last + BigDecimal("0.01")) end probabilities.each do |p| subject.probability = p expect(subject.probability).to eq BigDecimal(p.to_s) end end it "raises an ArgumentError if the value is 0" do expect{subject.probability = 0}.to raise_error(ArgumentError) end it "raises an ArgumentError if the value is greater than 1" do expect{subject.probability = 1.01}.to raise_error(ArgumentError) end it "raises an ArgumentError if the value can't convert to a decimal" do expect{subject.probability = "not a decimal"}.to raise_error(ArgumentError) end end describe "#sample_size=" do it "raises an ArgumentError if the value can't be converted to an Integer" do expect{subject.sample_size = "not an integer"}.to raise_error(ArgumentError) end it "can set an integer sample size greater than or equal to 0" do (0..1).each do |value| subject.sample_size = value expect(subject.sample_size).to eq value end end it "raises an ArgumentError if the value is less than 0" do expect{subject.sample_size = -1}.to raise_error(ArgumentError) end end describe "#probability" do it "is :unknown unless set" do expect(subject.probability).to eq :unknown end end describe "#sample_size" do it "is :unknown unless set" do expect(subject.sample_size).to eq :unknown end end end end
26.570588
84
0.601948
21304b30dd7a5a4cee5009a9cac28d5188f79294
1,183
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'serverspec/version' Gem::Specification.new do |spec| spec.name = "serverspec" spec.version = Serverspec::VERSION spec.authors = ["Gosuke Miyashita"] spec.email = ["gosukenator@gmail.com"] spec.description = %q{RSpec tests for your servers configured by Puppet, Chef or anything else} spec.summary = %q{RSpec tests for your servers configured by Puppet, Chef or anything else} spec.homepage = "http://serverspec.org/" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "net-ssh" spec.add_runtime_dependency "rspec", ">= 2.13.0" spec.add_runtime_dependency "highline" spec.add_runtime_dependency "specinfra", ">= 0.5.6" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "octorelease" end
40.793103
99
0.687236
e9acebd7e9415b4ed10149c703b4bcf743e2c49a
799
# -*- coding: binary -*- require 'msf/core' module Msf::Payload::Python # # Encode the given python command in base64 and wrap it with a stub # that will decode and execute it on the fly. The code will be condensed to # one line and compatible with all Python versions supported by the Python # Meterpreter stage. # # @param cmd [String] The python code to execute. # @return [String] Full python stub to execute the command. # def self.create_exec_stub(cmd) # Base64 encoding is required in order to handle Python's formatting b64_stub = "exec(__import__('base64').b64decode(__import__('codecs').getencoder('utf-8')('#{Rex::Text.encode_base64(cmd)}')[0]))" b64_stub end def py_create_exec_stub(cmd) Msf::Payload::Python.create_exec_stub(cmd) end end
30.730769
133
0.709637
1a2fd04d307c21d507ba84a3f9f5204aed9760fc
107
module WelcomeEmailComponent module Controls ID = Identifier::UUID::Controls::Incrementing end end
17.833333
49
0.775701
e903ad57b2bce0c4bc010fd16d24053dfa246af9
3,023
# frozen_string_literal: true require "support/vacols_database_cleaner" describe "BVA Decision Progress report", :all_dbs do include SQLHelpers context "one row for each category" do let(:expected_report) do [ { "decision_status" => "1. Not distributed", "num" => 1 }, { "decision_status" => "2. Distributed to judge", "num" => 1 }, { "decision_status" => "3. Assigned to attorney", "num" => 2 }, { "decision_status" => "4. Assigned to colocated", "num" => 1 }, { "decision_status" => "5. Decision in progress", "num" => 1 }, { "decision_status" => "6. Decision ready for signature", "num" => 1 }, { "decision_status" => "7. Decision signed", "num" => 1 }, { "decision_status" => "8. Decision dispatched", "num" => 1 }, { "decision_status" => "CANCELLED", "num" => 1 }, { "decision_status" => "MISC", "num" => 1 }, { "decision_status" => "ON HOLD", "num" => 2 } ] end let(:user) { create(:default_user) } let!(:not_distributed) { create(:appeal, :ready_for_distribution) } let!(:not_distributed_with_timed_hold) do create(:appeal, :ready_for_distribution).tap do |appeal| create(:timed_hold_task, appeal: appeal) end end let!(:distributed_to_judge) { create(:appeal, :assigned_to_judge) } let!(:assigned_to_attorney) { create(:appeal).tap { |appeal| create(:ama_attorney_task, appeal: appeal) } } let!(:assigned_to_colocated) do create(:appeal).tap do |appeal| create(:ama_colocated_task, appeal: appeal, assigned_to: user) end end let!(:decision_in_progress) do create(:appeal).tap do |appeal| create(:ama_attorney_task, :in_progress, appeal: appeal) end end let!(:decision_ready_for_signature) do create(:appeal).tap do |appeal| create(:ama_judge_decision_review_task, :in_progress, appeal: appeal) end end let!(:decision_signed) do create(:appeal).tap do |appeal| create(:bva_dispatch_task, :in_progress, appeal: appeal) end end let!(:decision_dispatched) do create(:appeal).tap do |appeal| create(:bva_dispatch_task, :completed, appeal: appeal) end end let!(:dispatched_with_subsequent_assigned_task) do create(:appeal).tap do |appeal| create(:bva_dispatch_task, :completed, appeal: appeal) create(:ama_attorney_task, assigned_to: user, appeal: appeal) end end let!(:cancelled) do create(:appeal).tap do |appeal| create(:root_task, :cancelled, appeal: appeal) end end let!(:on_hold) do create(:appeal).tap do |appeal| create(:timed_hold_task, appeal: appeal) end end let!(:misc) do create(:appeal).tap do |appeal| create(:ama_judge_dispatch_return_task, appeal: appeal) end end it "generates correct report" do expect_sql("bva-decision-progress").to eq(expected_report) end end end
35.151163
111
0.625538
089534e2247e46f21025ccb0f417b7100b79f2aa
1,365
class Convox < Formula desc "Command-line interface for the Rack PaaS on AWS" homepage "https://convox.com/" url "https://github.com/convox/rack/archive/20190808190811.tar.gz" sha256 "f2c6f4dadea44dd79714e4e8d34993a7010607c4cd3284f5ae23d10014ffaead" bottle do cellar :any_skip_relocation sha256 "e6f8e907a3bf74d07a1cc5c0763a7d91e8c1db8e75ca0b5fb963b1c1eb9a5ca9" => :mojave sha256 "3198731aba7624070995b9992e7518f5ea995461c285302fde87d8d609a4a4b1" => :high_sierra sha256 "7c0b74a22dc21ee190a0e321a2f30b9bb2da97042852ea8ddb4c8eb2ab3566ce" => :sierra sha256 "1cb9f6b631d9296b34b585d3d2f3cef70a9939304f69f62427cb672953c01f2e" => :x86_64_linux end depends_on "go" => :build resource "packr" do url "https://github.com/gobuffalo/packr/archive/v2.0.1.tar.gz" sha256 "cc0488e99faeda4cf56631666175335e1cce021746972ce84b8a3083aa88622f" end def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/convox/rack").install Dir["*"] resource("packr").stage { system "go", "install", "./packr" } cd buildpath/"src/github.com/convox/rack" do system buildpath/"bin/packr" end system "go", "build", "-ldflags=-X main.version=#{version}", "-o", bin/"convox", "-v", "github.com/convox/rack/cmd/convox" prefix.install_metafiles end test do system bin/"convox" end end
33.292683
94
0.738462
265cd5d628b5f203eb0130b2055b6ee151efad52
287
cask 'kubernetes-cli-1.12.1' do version '1.12.1' sha256 '406949fbf4c319a7b723ac98d3785266ee50a94b368dc386abad947052e58232' url "https://dl.k8s.io/v#{version}/kubernetes-client-darwin-amd64.tar.gz" name 'Kubernetes Client' homepage 'https://kubernetes.io/' end
31.888889
77
0.721254
0162eeba1d70c5f80715225b67cc2a57d91fe477
579
module DevisePermittedParams extend ActiveSupport::Concern included do before_action :configure_devise_permitted_parameters, if: :devise_controller? end def configure_devise_permitted_parameters edit_user_params = [:first_name, :last_name, :description, :city_id, :photo, :identity_card, :specialties, :reception_days => []] if params[:action] == 'update' devise_parameter_sanitizer.permit(:account_update, keys: edit_user_params) elsif params[:action] == 'create' devise_parameter_sanitizer.permit(:sign_up, keys: [:host]) end end end
36.1875
133
0.753022
f8f189adf2e8d82486b512d4bd88fd56d29131f2
717
Given /^the fixture file "(.*?)"$/ do |filename| @input = fixture_file(filename) @filename = filename end Given /^I put them through the kernel$/ do @output = "output_#{rand(1000)}_#{@filename}" kernel(@input, tmp_file(@output)).classify end Then /^the output should match the fixture "(.*?)"$/ do |filename| fixture_output = File.readlines(fixture_file(filename))[1..-1].join() output = File.readlines(tmp_file(@output))[1..-1].join() output.should eql(fixture_output) File.delete(tmp_file(@output)) end def fixture_file(filename) File.absolute_path("features/fixtures/", kernel_root) + "/#{filename}" end def tmp_file(filename) File.absolute_path("tmp/", kernel_root) + "/#{filename}" end
27.576923
72
0.698745
b90333fd981b26b9ac0bb03fa05ac589b10eb592
516
class OrganizationMemberPaymentsController < ApplicationController before_filter :load_organization_member authorize_resource :organization_member def edit end def update end def load_organization_member logger.debug("ABC") @organization_member = OrganizationMember.where(:payment_code => params[:id]).first render :status => 404, :text => "Organization member not found -- please check the URL" unless @organization_member end protected :load_organization_member end
24.571429
119
0.75969
5da06fe1c25a89843cab8360942c2ad31942e009
237
# frozen_string_literal: true module HykuAddons class QualificationNameService < HykuAddons::QaSelectService def initialize(model: nil, locale: nil) super("qualification_name", model: model, locale: locale) end end end
26.333333
63
0.755274