Class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Constraint

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/orgpolicy_v2/classes.rb,
lib/google/apis/orgpolicy_v2/representations.rb,
lib/google/apis/orgpolicy_v2/representations.rb

Overview

A constraint describes a way to restrict resource's configuration. For example, you could enforce a constraint that controls which Google Cloud services can be activated across an organization, or whether a Compute Engine instance can have serial port connections established. Constraints can be configured by the organization policy administrator to fit the needs of the organization by setting a policy that includes constraints at different locations in the organization's resource hierarchy. Policies are inherited down the resource hierarchy from higher levels, but can also be overridden. For details about the inheritance rules, see Policy. Constraints have a default behavior determined by the constraint_default field, which is the enforcement behavior that is used in the absence of a policy being defined or inherited for the resource in question.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudOrgpolicyV2Constraint

Returns a new instance of GoogleCloudOrgpolicyV2Constraint.



124
125
126
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 124

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#boolean_constraintGoogle::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ConstraintBooleanConstraint

A constraint type is enforced or not enforced, which is configured in the PolicyRule. If customConstraintDefinition is defined, this constraint is a managed constraint. Corresponds to the JSON property booleanConstraint



73
74
75
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 73

def boolean_constraint
  @boolean_constraint
end

#constraint_defaultString

The evaluation behavior of this constraint in the absence of a policy. Corresponds to the JSON property constraintDefault

Returns:

  • (String)


78
79
80
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 78

def constraint_default
  @constraint_default
end

#descriptionString

Detailed description of what this constraint controls as well as how and where it is enforced. Mutable. Corresponds to the JSON property description

Returns:

  • (String)


84
85
86
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 84

def description
  @description
end

#display_nameString

The human readable name. Mutable. Corresponds to the JSON property displayName

Returns:

  • (String)


89
90
91
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 89

def display_name
  @display_name
end

#equivalent_constraintString

Managed constraint and canned constraint sometimes can have equivalents. This field is used to store the equivalent constraint name. Corresponds to the JSON property equivalentConstraint

Returns:

  • (String)


95
96
97
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 95

def equivalent_constraint
  @equivalent_constraint
end

#list_constraintGoogle::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ConstraintListConstraint

A constraint type that allows or disallows a list of string values, which are configured in the PolicyRule. Corresponds to the JSON property listConstraint



101
102
103
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 101

def list_constraint
  @list_constraint
end

#nameString

Immutable. The resource name of the constraint. Must be in one of the following forms: * projects/project_number/constraints/constraint_name* `folders/`folder_id`/constraints/`constraint_name * organizations/ organization_id/constraints/constraint_name`For example, "/projects/123/ constraints/compute.disableSerialPortAccess". Corresponds to the JSON propertyname`

Returns:

  • (String)


110
111
112
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 110

def name
  @name
end

#supports_dry_runBoolean Also known as: supports_dry_run?

Shows if dry run is supported for this constraint or not. Corresponds to the JSON property supportsDryRun

Returns:

  • (Boolean)


115
116
117
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 115

def supports_dry_run
  @supports_dry_run
end

#supports_simulationBoolean Also known as: supports_simulation?

Shows if simulation is supported for this constraint or not. Corresponds to the JSON property supportsSimulation

Returns:

  • (Boolean)


121
122
123
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 121

def supports_simulation
  @supports_simulation
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



129
130
131
132
133
134
135
136
137
138
139
# File 'lib/google/apis/orgpolicy_v2/classes.rb', line 129

def update!(**args)
  @boolean_constraint = args[:boolean_constraint] if args.key?(:boolean_constraint)
  @constraint_default = args[:constraint_default] if args.key?(:constraint_default)
  @description = args[:description] if args.key?(:description)
  @display_name = args[:display_name] if args.key?(:display_name)
  @equivalent_constraint = args[:equivalent_constraint] if args.key?(:equivalent_constraint)
  @list_constraint = args[:list_constraint] if args.key?(:list_constraint)
  @name = args[:name] if args.key?(:name)
  @supports_dry_run = args[:supports_dry_run] if args.key?(:supports_dry_run)
  @supports_simulation = args[:supports_simulation] if args.key?(:supports_simulation)
end