Skip to content

Commit

Permalink
Automatically generated by magic modules for service: orgpolicy_v2 an…
Browse files Browse the repository at this point in the history
…d resource: Projects__constraint.

This commit includes the following changes:
- Singular Resource ERB File
- Plural Resource ERB File
- Terraform configuration
- api.yaml configuration for product orgpolicy_v2 and resource Projects__constraint

Signed-off-by: Samir <[email protected]>
  • Loading branch information
sa-progress committed Apr 29, 2024
1 parent 35a315b commit 9a2602e
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 0 deletions.
212 changes: 212 additions & 0 deletions mmv1/products/orgpolicy/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,215 @@ objects:
description: |
Indicates whether values grouped into categories can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"in:Python"` would match any value in the 'Python' group.



- !ruby/object:Api::Resource
name: ProjectConstraint
base_url: '{{+parent}}/constraints'
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation':
api: 'https://cloud.google.com/orgpolicy/docs'
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
path: 'name'
base_url: '{op_id}'
wait_ms: 1000
result: !ruby/object:Api::OpAsync::Result
path: 'response'
resource_inside_response: true
status: !ruby/object:Api::OpAsync::Status
path: 'done'
complete: True
allowed:
- True
- False
error: !ruby/object:Api::OpAsync::Error
path: 'error'
message: 'message'
description: |-
The response returned from the ListConstraints method.
properties:

- !ruby/object:Api::Type::String
name: 'nextPageToken'
description: |
Page token used to retrieve the next page. This is currently not used.
- !ruby/object:Api::Type::Array
name: 'constraints'
description: |
The collection of constraints that are available on the targeted resource.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: 'displayName'
description: |
The human readable name. Mutable.
- !ruby/object:Api::Type::NestedObject
name: 'googleManagedConstraint'
description: |
A Google managed constraint. This represents a subset of fields missing from Constraint proto that are required to describe CustomConstraint
properties:
- !ruby/object:Api::Type::Enum
name: 'actionType'
description: |
Allow or deny type.
values:
- :ACTION_TYPE_UNSPECIFIED
- :ALLOW
- :DENY
- !ruby/object:Api::Type::Array
name: 'resourceTypes'
description: |
The resource instance type on which this policy applies. Format will be of the form : `/` Example: * `compute.googleapis.com/Instance`.
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'condition'
description: |
Org policy condition/expression. For example: `resource.instanceName.matches("[production|test]_.*_(\d)+")` or, `resource.management.auto_upgrade == true` The max length of the condition is 1000 characters.
- !ruby/object:Api::Type::Array
name: 'methodTypes'
description: |
All the operations being applied for this constraint.
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'description'
description: |
Detailed description of what this constraint controls as well as how and where it is enforced. Mutable.
- !ruby/object:Api::Type::Enum
name: 'constraintDefault'
description: |
The evaluation behavior of this constraint in the absence of a policy.
values:
- :CONSTRAINT_DEFAULT_UNSPECIFIED
- :ALLOW
- :DENY
- !ruby/object:Api::Type::Boolean
name: 'supportsDryRun'
description: |
Shows if dry run is supported for this constraint or not.
- !ruby/object:Api::Type::String
name: 'name'
description: |
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".
- !ruby/object:Api::Type::NestedObject
name: 'listConstraint'
description: |
A constraint that allows or disallows a list of string values, which are configured by an Organization Policy administrator with a policy.
properties:
- !ruby/object:Api::Type::Boolean
name: 'supportsUnder'
description: |
Indicates whether subtrees of the Resource Manager resource hierarchy can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"under:folders/123"` would match any resource under the 'folders/123' folder.
- !ruby/object:Api::Type::Boolean
name: 'supportsIn'
description: |
Indicates whether values grouped into categories can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"in:Python"` would match any value in the 'Python' group.



- !ruby/object:Api::Resource
name: ProjectConstraint
base_url: '{{+parent}}/constraints'
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation':
api: 'https://cloud.google.com/orgpolicy/docs'
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
path: 'name'
base_url: '{op_id}'
wait_ms: 1000
result: !ruby/object:Api::OpAsync::Result
path: 'response'
resource_inside_response: true
status: !ruby/object:Api::OpAsync::Status
path: 'done'
complete: True
allowed:
- True
- False
error: !ruby/object:Api::OpAsync::Error
path: 'error'
message: 'message'
description: |-
The response returned from the ListConstraints method.
properties:

- !ruby/object:Api::Type::String
name: 'nextPageToken'
description: |
Page token used to retrieve the next page. This is currently not used.
- !ruby/object:Api::Type::Array
name: 'constraints'
description: |
The collection of constraints that are available on the targeted resource.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: 'displayName'
description: |
The human readable name. Mutable.
- !ruby/object:Api::Type::NestedObject
name: 'googleManagedConstraint'
description: |
A Google managed constraint. This represents a subset of fields missing from Constraint proto that are required to describe CustomConstraint
properties:
- !ruby/object:Api::Type::Enum
name: 'actionType'
description: |
Allow or deny type.
values:
- :ACTION_TYPE_UNSPECIFIED
- :ALLOW
- :DENY
- !ruby/object:Api::Type::Array
name: 'resourceTypes'
description: |
The resource instance type on which this policy applies. Format will be of the form : `/` Example: * `compute.googleapis.com/Instance`.
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'condition'
description: |
Org policy condition/expression. For example: `resource.instanceName.matches("[production|test]_.*_(\d)+")` or, `resource.management.auto_upgrade == true` The max length of the condition is 1000 characters.
- !ruby/object:Api::Type::Array
name: 'methodTypes'
description: |
All the operations being applied for this constraint.
item_type: Api::Type::String
- !ruby/object:Api::Type::String
name: 'description'
description: |
Detailed description of what this constraint controls as well as how and where it is enforced. Mutable.
- !ruby/object:Api::Type::Enum
name: 'constraintDefault'
description: |
The evaluation behavior of this constraint in the absence of a policy.
values:
- :CONSTRAINT_DEFAULT_UNSPECIFIED
- :ALLOW
- :DENY
- !ruby/object:Api::Type::Boolean
name: 'supportsDryRun'
description: |
Shows if dry run is supported for this constraint or not.
- !ruby/object:Api::Type::String
name: 'name'
description: |
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".
- !ruby/object:Api::Type::NestedObject
name: 'listConstraint'
description: |
A constraint that allows or disallows a list of string values, which are configured by an Organization Policy administrator with a policy.
properties:
- !ruby/object:Api::Type::Boolean
name: 'supportsUnder'
description: |
Indicates whether subtrees of the Resource Manager resource hierarchy can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"under:folders/123"` would match any resource under the 'folders/123' folder.
- !ruby/object:Api::Type::Boolean
name: 'supportsIn'
description: |
Indicates whether values grouped into categories can be used in `Policy.allowed_values` and `Policy.denied_values`. For example, `"in:Python"` would match any value in the 'Python' group.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% project_constraint = grab_attributes(pwd)['project_constraint'] -%>
describe google_orgpolicy_project_constraint() do
it { should exist }

end

describe google_orgpolicy_project_constraint() do
it { should_not exist }
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.')

project_constraint = input('project_constraint', value: <%= JSON.pretty_generate(grab_attributes(pwd)['project_constraint']) -%>, description: 'project_constraint description')
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%>
<% project_constraint = grab_attributes(pwd)['project_constraint'] -%>
describe google_orgpolicy_project_constraints(parent: <%= doc_generation ? "' #{project_constraint['parent']}'":"project_constraint['parent']" -%>) do
it { should exist }
end
Original file line number Diff line number Diff line change
Expand Up @@ -1072,4 +1072,6 @@ interconnect_attachment:
remote_service : "value_remoteservice"

organization_constraint:
parent : "value_parent"
project_constraint:
parent : "value_parent"

0 comments on commit 9a2602e

Please sign in to comment.