Class: OCI::Adm::Models::ExternalScmConfiguration

Inherits:
ScmConfiguration show all
Defined in:
lib/oci/adm/models/external_scm_configuration.rb

Overview

An external SCM configuration extends a SCM Configuration with necessary data to reach and use the Source Code Management tool/platform used by a Remediation Recipe. An external SCM in ADM refers to GitHub, or GitLab.

Constant Summary collapse

EXTERNAL_SCM_TYPE_ENUM =
[
  EXTERNAL_SCM_TYPE_GITHUB = 'GITHUB'.freeze,
  EXTERNAL_SCM_TYPE_GITLAB = 'GITLAB'.freeze,
  EXTERNAL_SCM_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from ScmConfiguration

ScmConfiguration::SCM_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from ScmConfiguration

#branch, #build_file_location, #is_automerge_enabled, #scm_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScmConfiguration

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ ExternalScmConfiguration

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :branch (String)

    The value to assign to the #branch proprety

  • :build_file_location (String)

    The value to assign to the #build_file_location proprety

  • :is_automerge_enabled (BOOLEAN)

    The value to assign to the #is_automerge_enabled proprety

  • :external_scm_type (String)

    The value to assign to the #external_scm_type property

  • :repository_url (String)

    The value to assign to the #repository_url property

  • :username (String)

    The value to assign to the #username property

  • :pat_secret_id (String)

    The value to assign to the #pat_secret_id property



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 88

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['scmType'] = 'EXTERNAL_SCM'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.external_scm_type = attributes[:'externalScmType'] if attributes[:'externalScmType']

  raise 'You cannot provide both :externalScmType and :external_scm_type' if attributes.key?(:'externalScmType') && attributes.key?(:'external_scm_type')

  self.external_scm_type = attributes[:'external_scm_type'] if attributes[:'external_scm_type']

  self.repository_url = attributes[:'repositoryUrl'] if attributes[:'repositoryUrl']

  raise 'You cannot provide both :repositoryUrl and :repository_url' if attributes.key?(:'repositoryUrl') && attributes.key?(:'repository_url')

  self.repository_url = attributes[:'repository_url'] if attributes[:'repository_url']

  self.username = attributes[:'username'] if attributes[:'username']

  self.pat_secret_id = attributes[:'patSecretId'] if attributes[:'patSecretId']

  raise 'You cannot provide both :patSecretId and :pat_secret_id' if attributes.key?(:'patSecretId') && attributes.key?(:'pat_secret_id')

  self.pat_secret_id = attributes[:'pat_secret_id'] if attributes[:'pat_secret_id']
end

Instance Attribute Details

#external_scm_typeString

[Required] The type of External Source Code Management.

Returns:

  • (String)


23
24
25
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 23

def external_scm_type
  @external_scm_type
end

#pat_secret_idString

[Required] The Oracle Cloud Identifier (OCID) of the Private Access Token (PAT) Secret. The secret provides the credentials necessary to authenticate against the SCM.

Returns:

  • (String)


41
42
43
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 41

def pat_secret_id
  @pat_secret_id
end

#repository_urlString

[Required] The repository URL for the SCM. For Non-Enterprise GitHub the expected format is github.com/[owner]/[repoName] For Enterprise GitHub the expected format is http(s):///api/v3/repos//[repoName] For GitLab the expected format is gitlab.com/[groupName]/[repoName]

Returns:

  • (String)


31
32
33
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 31

def repository_url
  @repository_url
end

#usernameString

The username for the SCM (to perform operations such as cloning or pushing via HTTP).

Returns:

  • (String)


35
36
37
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 35

def username
  @username
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 44

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'scm_type': :'scmType',
    'branch': :'branch',
    'build_file_location': :'buildFileLocation',
    'is_automerge_enabled': :'isAutomergeEnabled',
    'external_scm_type': :'externalScmType',
    'repository_url': :'repositoryUrl',
    'username': :'username',
    'pat_secret_id': :'patSecretId'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 60

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'scm_type': :'String',
    'branch': :'String',
    'build_file_location': :'String',
    'is_automerge_enabled': :'BOOLEAN',
    'external_scm_type': :'String',
    'repository_url': :'String',
    'username': :'String',
    'pat_secret_id': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 139

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    scm_type == other.scm_type &&
    branch == other.branch &&
    build_file_location == other.build_file_location &&
    is_automerge_enabled == other.is_automerge_enabled &&
    external_scm_type == other.external_scm_type &&
    repository_url == other.repository_url &&
    username == other.username &&
    pat_secret_id == other.pat_secret_id
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 176

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


156
157
158
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 156

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



165
166
167
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 165

def hash
  [scm_type, branch, build_file_location, is_automerge_enabled, external_scm_type, repository_url, username, pat_secret_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 209

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



203
204
205
# File 'lib/oci/adm/models/external_scm_configuration.rb', line 203

def to_s
  to_hash.to_s
end