Class: OCI::Adm::Models::ScmConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/adm/models/scm_configuration.rb

Overview

A configuration for the Source Code Management tool/platform used by a remediation recipe. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

SCM_TYPE_ENUM =
[
  SCM_TYPE_OCI_CODE_REPOSITORY = 'OCI_CODE_REPOSITORY'.freeze,
  SCM_TYPE_EXTERNAL_SCM = 'EXTERNAL_SCM'.freeze,
  SCM_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ScmConfiguration

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :scm_type (String)

    The value to assign to the #scm_type property

  • :branch (String)

    The value to assign to the #branch property

  • :build_file_location (String)

    The value to assign to the #build_file_location property

  • :is_automerge_enabled (BOOLEAN)

    The value to assign to the #is_automerge_enabled property



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
# File 'lib/oci/adm/models/scm_configuration.rb', line 89

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

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

  self.scm_type = attributes[:'scmType'] if attributes[:'scmType']

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

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

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

  self.build_file_location = attributes[:'buildFileLocation'] if attributes[:'buildFileLocation']

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

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

  self.is_automerge_enabled = attributes[:'isAutomergeEnabled'] unless attributes[:'isAutomergeEnabled'].nil?

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

  self.is_automerge_enabled = attributes[:'is_automerge_enabled'] unless attributes[:'is_automerge_enabled'].nil?
end

Instance Attribute Details

#branchString

[Required] The branch used by ADM to patch vulnerabilities.

Returns:

  • (String)


25
26
27
# File 'lib/oci/adm/models/scm_configuration.rb', line 25

def branch
  @branch
end

#build_file_locationString

The location of the build file relative to the root of the repository. Only Maven build files (POM) are currently supported. If this property is not specified, ADM will use the build file located at the root of the repository.

Returns:

  • (String)


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

def build_file_location
  @build_file_location
end

#is_automerge_enabledBOOLEAN

[Required] If true, the Pull Request (PR) will be merged after the verify stage completes successfully If false, the PR with the proposed changes must be reviewed and manually merged.

Returns:

  • (BOOLEAN)


37
38
39
# File 'lib/oci/adm/models/scm_configuration.rb', line 37

def is_automerge_enabled
  @is_automerge_enabled
end

#scm_typeString

[Required] The type of Source Code Management.

Returns:

  • (String)


21
22
23
# File 'lib/oci/adm/models/scm_configuration.rb', line 21

def scm_type
  @scm_type
end

Class Method Details

.attribute_mapObject

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



40
41
42
43
44
45
46
47
48
49
# File 'lib/oci/adm/models/scm_configuration.rb', line 40

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'scm_type': :'scmType',
    'branch': :'branch',
    'build_file_location': :'buildFileLocation',
    'is_automerge_enabled': :'isAutomergeEnabled'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



68
69
70
71
72
73
74
75
76
# File 'lib/oci/adm/models/scm_configuration.rb', line 68

def self.get_subtype(object_hash)
  type = object_hash[:'scmType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::Adm::Models::OciCodeRepositoryConfiguration' if type == 'OCI_CODE_REPOSITORY'
  return 'OCI::Adm::Models::ExternalScmConfiguration' if type == 'EXTERNAL_SCM'

  # TODO: Log a warning when the subtype is not found.
  'OCI::Adm::Models::ScmConfiguration'
end

.swagger_typesObject

Attribute type mapping.



52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/adm/models/scm_configuration.rb', line 52

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'scm_type': :'String',
    'branch': :'String',
    'build_file_location': :'String',
    'is_automerge_enabled': :'BOOLEAN'
    # 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



136
137
138
139
140
141
142
143
144
# File 'lib/oci/adm/models/scm_configuration.rb', line 136

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
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



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/oci/adm/models/scm_configuration.rb', line 169

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


149
150
151
# File 'lib/oci/adm/models/scm_configuration.rb', line 149

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



158
159
160
# File 'lib/oci/adm/models/scm_configuration.rb', line 158

def hash
  [scm_type, branch, build_file_location, is_automerge_enabled].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



202
203
204
205
206
207
208
209
210
211
# File 'lib/oci/adm/models/scm_configuration.rb', line 202

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



196
197
198
# File 'lib/oci/adm/models/scm_configuration.rb', line 196

def to_s
  to_hash.to_s
end