=begin #Datadog API V2 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'date' require 'time' module DatadogAPIClient::V2 # If pipelines are triggered due to actions to a Git repository, then all payloads must contain this. # Note that either `tag` or `branch` has to be provided, but not both. class CIAppGitInfo include BaseGenericModel # The commit author email. attr_reader :author_email # The commit author name. attr_accessor :author_name # The commit author timestamp in RFC3339 format. attr_accessor :author_time # The branch name (if a tag use the tag parameter). attr_accessor :branch # The commit timestamp in RFC3339 format. attr_accessor :commit_time # The committer email. attr_accessor :committer_email # The committer name. attr_accessor :committer_name # The Git repository's default branch. attr_accessor :default_branch # The commit message. attr_accessor :message # The URL of the repository. attr_reader :repository_url # The git commit SHA. attr_reader :sha # The tag name (if a branch use the branch parameter). attr_accessor :tag attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map { :'author_email' => :'author_email', :'author_name' => :'author_name', :'author_time' => :'author_time', :'branch' => :'branch', :'commit_time' => :'commit_time', :'committer_email' => :'committer_email', :'committer_name' => :'committer_name', :'default_branch' => :'default_branch', :'message' => :'message', :'repository_url' => :'repository_url', :'sha' => :'sha', :'tag' => :'tag' } end # Attribute type mapping. # @!visibility private def self.openapi_types { :'author_email' => :'String', :'author_name' => :'String', :'author_time' => :'String', :'branch' => :'String', :'commit_time' => :'String', :'committer_email' => :'String', :'committer_name' => :'String', :'default_branch' => :'String', :'message' => :'String', :'repository_url' => :'String', :'sha' => :'String', :'tag' => :'String' } end # List of attributes with nullable: true # @!visibility private def self.openapi_nullable Set.new([ :'author_name', :'author_time', :'branch', :'commit_time', :'committer_email', :'committer_name', :'default_branch', :'message', :'tag', ]) end # Initializes the object # @param attributes [Hash] Model attributes in the form of hash # @!visibility private def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CIAppGitInfo` initialize method" end self.additional_properties = {} # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) self.additional_properties[k.to_sym] = v else h[k.to_sym] = v end } if attributes.key?(:'author_email') self.author_email = attributes[:'author_email'] end if attributes.key?(:'author_name') self.author_name = attributes[:'author_name'] end if attributes.key?(:'author_time') self.author_time = attributes[:'author_time'] end if attributes.key?(:'branch') self.branch = attributes[:'branch'] end if attributes.key?(:'commit_time') self.commit_time = attributes[:'commit_time'] end if attributes.key?(:'committer_email') self.committer_email = attributes[:'committer_email'] end if attributes.key?(:'committer_name') self.committer_name = attributes[:'committer_name'] end if attributes.key?(:'default_branch') self.default_branch = attributes[:'default_branch'] end if attributes.key?(:'message') self.message = attributes[:'message'] end if attributes.key?(:'repository_url') self.repository_url = attributes[:'repository_url'] end if attributes.key?(:'sha') self.sha = attributes[:'sha'] end if attributes.key?(:'tag') self.tag = attributes[:'tag'] end end # Check to see if the all the properties in the model are valid # @return true if the model is valid # @!visibility private def valid? return false if @author_email.nil? return false if @repository_url.nil? return false if @sha.nil? pattern = Regexp.new(/^[a-fA-F0-9]{40}$/) return false if @sha !~ pattern true end # Custom attribute writer method with validation # @param author_email [Object] Object to be assigned # @!visibility private def author_email=(author_email) if author_email.nil? fail ArgumentError, 'invalid value for "author_email", author_email cannot be nil.' end @author_email = author_email end # Custom attribute writer method with validation # @param repository_url [Object] Object to be assigned # @!visibility private def repository_url=(repository_url) if repository_url.nil? fail ArgumentError, 'invalid value for "repository_url", repository_url cannot be nil.' end @repository_url = repository_url end # Custom attribute writer method with validation # @param sha [Object] Object to be assigned # @!visibility private def sha=(sha) if sha.nil? fail ArgumentError, 'invalid value for "sha", sha cannot be nil.' end pattern = Regexp.new(/^[a-fA-F0-9]{40}$/) if sha !~ pattern fail ArgumentError, "invalid value for \"sha\", must conform to the pattern #{pattern}." end @sha = sha end # Returns the object in the form of hash, with additionalProperties support. # @return [Hash] Returns the object in the form of hash # @!visibility private def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end self.additional_properties.each_pair do |attr, value| hash[attr] = value end hash end # Checks equality by comparing each attribute. # @param o [Object] Object to be compared # @!visibility private def ==(o) return true if self.equal?(o) self.class == o.class && author_email == o.author_email && author_name == o.author_name && author_time == o.author_time && branch == o.branch && commit_time == o.commit_time && committer_email == o.committer_email && committer_name == o.committer_name && default_branch == o.default_branch && message == o.message && repository_url == o.repository_url && sha == o.sha && tag == o.tag additional_properties == o.additional_properties end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash [author_email, author_name, author_time, branch, commit_time, committer_email, committer_name, default_branch, message, repository_url, sha, tag].hash end end end