Class: Google::Apis::SecuritypostureV1::GoogleCloudSecuritypostureV1CustomConstraint

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

Overview

A custom, user-defined constraint. You can apply the constraint only to the resource types specified in the constraint, and only within the organization where the constraint is defined. When you create a custom constraint, it is not enforced automatically. You must use an organization policy to enforce the constraint.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ GoogleCloudSecuritypostureV1CustomConstraint

Returns a new instance of GoogleCloudSecuritypostureV1CustomConstraint.



398
399
400
# File 'lib/google/apis/securityposture_v1/classes.rb', line 398

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

Instance Attribute Details

#action_typeString

Whether to allow or deny the action. Corresponds to the JSON property actionType

Returns:

  • (String)


348
349
350
# File 'lib/google/apis/securityposture_v1/classes.rb', line 348

def action_type
  @action_type
end

#conditionString

A Common Expression Language (CEL) condition expression that must evaluate to true for the constraint to be enforced. The maximum length is 1000 characters. For example: + resource.instanceName.matches('(production|test)_(.+_)?[\d]+') : Evaluates to true if the resource's instanceName attribute contains the following: + The prefix production or test + An underscore (_) + Optional: One or more characters, followed by an underscore (_) + One or more digits + resource.management.auto_upgrade == true: Evaluates to true if the resource's management.auto_upgrade attribute is true. Corresponds to the JSON property condition

Returns:

  • (String)


360
361
362
# File 'lib/google/apis/securityposture_v1/classes.rb', line 360

def condition
  @condition
end

#descriptionString

A description of the constraint. The maximum length is 2000 characters. Corresponds to the JSON property description

Returns:

  • (String)


365
366
367
# File 'lib/google/apis/securityposture_v1/classes.rb', line 365

def description
  @description
end

#display_nameString

A display name for the constraint. The maximum length is 200 characters. Corresponds to the JSON property displayName

Returns:

  • (String)


370
371
372
# File 'lib/google/apis/securityposture_v1/classes.rb', line 370

def display_name
  @display_name
end

#method_typesArray<String>

The types of operations that the constraint applies to. Corresponds to the JSON property methodTypes

Returns:

  • (Array<String>)


375
376
377
# File 'lib/google/apis/securityposture_v1/classes.rb', line 375

def method_types
  @method_types
end

#nameString

Immutable. The name of the constraint, in the format organizations/ organization_id/customConstraints/custom.custom_constraint_id`. For example, organizations/123456789012/customConstraints/custom.createOnlyE2TypeVms. Must contain 1 to 62 characters, excluding the prefixorganizations/ organization_id/customConstraints/custom.. Corresponds to the JSON propertyname`

Returns:

  • (String)


384
385
386
# File 'lib/google/apis/securityposture_v1/classes.rb', line 384

def name
  @name
end

#resource_typesArray<String>

Immutable. The resource type that the constraint applies to, in the format canonical_service_name`/`resource_type_name. For example, compute. googleapis.com/Instance. Corresponds to the JSON property resourceTypes

Returns:

  • (Array<String>)


391
392
393
# File 'lib/google/apis/securityposture_v1/classes.rb', line 391

def resource_types
  @resource_types
end

#update_timeString

Output only. The last time at which the constraint was updated or created. Corresponds to the JSON property updateTime

Returns:

  • (String)


396
397
398
# File 'lib/google/apis/securityposture_v1/classes.rb', line 396

def update_time
  @update_time
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



403
404
405
406
407
408
409
410
411
412
# File 'lib/google/apis/securityposture_v1/classes.rb', line 403

def update!(**args)
  @action_type = args[:action_type] if args.key?(:action_type)
  @condition = args[:condition] if args.key?(:condition)
  @description = args[:description] if args.key?(:description)
  @display_name = args[:display_name] if args.key?(:display_name)
  @method_types = args[:method_types] if args.key?(:method_types)
  @name = args[:name] if args.key?(:name)
  @resource_types = args[:resource_types] if args.key?(:resource_types)
  @update_time = args[:update_time] if args.key?(:update_time)
end