From 98fdafc95ace48b4328a85df71fd5b50d4890e2f Mon Sep 17 00:00:00 2001 From: Samir <85890442+sa-progress@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:32:56 +0530 Subject: [PATCH] Automatically generated by magic modules for service: monitoring_v3 and resource: Projects__group. This commit includes the following changes: - Singular Resource ERB File - Plural Resource ERB File - Terraform configuration - api.yaml configuration for product monitoring_v3 and resource Projects__group Signed-off-by: Samir <85890442+sa-progress@users.noreply.github.com> --- mmv1/products/monitoring/api.yaml | 106 ++++++++++++++++++ .../google_monitoring_project_group.erb | 14 +++ ...le_monitoring_project_group_attributes.erb | 3 + .../google_monitoring_project_groups.erb | 5 + .../configuration/mm-attributes.yml | 7 +- 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group.erb create mode 100644 mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group_attributes.erb create mode 100644 mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_groups.erb diff --git a/mmv1/products/monitoring/api.yaml b/mmv1/products/monitoring/api.yaml index c9b20771b..0a0facd92 100644 --- a/mmv1/products/monitoring/api.yaml +++ b/mmv1/products/monitoring/api.yaml @@ -2114,3 +2114,109 @@ objects: This field allows time series to be associated with the intersection of this metric type and the monitored resource types in this list. item_type: Api::Type::String + + + + - !ruby/object:Api::Resource + name: ProjectGroup + base_url: '{{+name}}/groups' + self_link: '{{+name}}' + references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': + api: 'https://cloud.google.com/monitoring/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 description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups.Groups can be nested in parent-child hierarchies. The parentName field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource.For example, consider an infrastructure running a set of instances with two user-defined tags: "environment" and "role". A parent group has a filter, environment="production". A child of that parent group has a filter, role="transcoder". The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role and are in the production environment.The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors. + properties: + + - !ruby/object:Api::Type::String + name: 'name' + description: | + Output only. The name of this group. The format is: projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique [GROUP_ID] that is generated automatically. + - !ruby/object:Api::Type::String + name: 'displayName' + description: | + A user-assigned name for this group, used only for display purposes. + - !ruby/object:Api::Type::String + name: 'parentName' + description: | + The name of the group's parent, if it has one. The format is: projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] For groups with no parent, parent_name is the empty string, "". + - !ruby/object:Api::Type::String + name: 'filter' + description: | + The filter used to determine which monitored resources belong to this group. + - !ruby/object:Api::Type::Boolean + name: 'isCluster' + description: | + If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters. + + + + + - !ruby/object:Api::Resource + name: ProjectGroup + base_url: '{{+name}}/groups' + self_link: '{{+name}}' + references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': + api: 'https://cloud.google.com/monitoring/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 description of a dynamic collection of monitored resources. Each group has a filter that is matched against monitored resources and their associated metadata. If a group's filter matches an available monitored resource, then that resource is a member of that group. Groups can contain any number of monitored resources, and each monitored resource can be a member of any number of groups.Groups can be nested in parent-child hierarchies. The parentName field identifies an optional parent for each group. If a group has a parent, then the only monitored resources available to be matched by the group's filter are the resources contained in the parent group. In other words, a group contains the monitored resources that match its filter and the filters of all the group's ancestors. A group without a parent can contain any monitored resource.For example, consider an infrastructure running a set of instances with two user-defined tags: "environment" and "role". A parent group has a filter, environment="production". A child of that parent group has a filter, role="transcoder". The parent group contains all instances in the production environment, regardless of their roles. The child group contains instances that have the transcoder role and are in the production environment.The monitored resources contained in a group can change at any moment, depending on what resources exist and what filters are associated with the group and its ancestors. + properties: + + - !ruby/object:Api::Type::String + name: 'name' + description: | + Output only. The name of this group. The format is: projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] When creating a group, this field is ignored and a new name is created consisting of the project specified in the call to CreateGroup and a unique [GROUP_ID] that is generated automatically. + - !ruby/object:Api::Type::String + name: 'displayName' + description: | + A user-assigned name for this group, used only for display purposes. + - !ruby/object:Api::Type::String + name: 'parentName' + description: | + The name of the group's parent, if it has one. The format is: projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] For groups with no parent, parent_name is the empty string, "". + - !ruby/object:Api::Type::String + name: 'filter' + description: | + The filter used to determine which monitored resources belong to this group. + - !ruby/object:Api::Type::Boolean + name: 'isCluster' + description: | + If true, the members of this group are considered to be a cluster. The system can perform additional analysis on groups that are clusters. + diff --git a/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group.erb b/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group.erb new file mode 100644 index 000000000..9213ef574 --- /dev/null +++ b/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group.erb @@ -0,0 +1,14 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> +<% project_group = grab_attributes(pwd)['project_group'] -%> +describe google_monitoring_project_group(name: <%= doc_generation ? "' #{project_group['name']}'":"project_group['name']" -%>) do + it { should exist } + its('name') { should cmp <%= doc_generation ? "'#{project_group['name']}'" : "project_group['name']" -%> } + its('display_name') { should cmp <%= doc_generation ? "'#{project_group['display_name']}'" : "project_group['display_name']" -%> } + its('parent_name') { should cmp <%= doc_generation ? "'#{project_group['parent_name']}'" : "project_group['parent_name']" -%> } + its('filter') { should cmp <%= doc_generation ? "'#{project_group['filter']}'" : "project_group['filter']" -%> } + +end + +describe google_monitoring_project_group(name: "does_not_exit") do + it { should_not exist } +end \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group_attributes.erb b/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group_attributes.erb new file mode 100644 index 000000000..b0d3e05ad --- /dev/null +++ b/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_group_attributes.erb @@ -0,0 +1,3 @@ +gcp_project_id = input(:gcp_project_id, value: '<%= external_attribute(pwd, 'gcp_project_id') -%>', description: 'The GCP project identifier.') + + project_group = input('project_group', value: <%= JSON.pretty_generate(grab_attributes(pwd)['project_group']) -%>, description: 'project_group description') \ No newline at end of file diff --git a/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_groups.erb b/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_groups.erb new file mode 100644 index 000000000..4c81f2b9f --- /dev/null +++ b/mmv1/templates/inspec/examples/google_monitoring_project_group/google_monitoring_project_groups.erb @@ -0,0 +1,5 @@ +<% gcp_project_id = "#{external_attribute(pwd, 'gcp_project_id', doc_generation)}" -%> + <% project_group = grab_attributes(pwd)['project_group'] -%> + describe google_monitoring_project_groups(name: <%= doc_generation ? "' #{project_group['name']}'":"project_group['name']" -%>) do + it { should exist } + end \ No newline at end of file diff --git a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml index dd7568fee..7f3de27d4 100644 --- a/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml +++ b/mmv1/templates/inspec/tests/integration/configuration/mm-attributes.yml @@ -1327,4 +1327,9 @@ batch: state_message : "value_statemessage" state_time : "value_statetime" creator : "value_creator" - operation : "value_operation" \ No newline at end of file + operation : "value_operation" +project_group: + name : "value_name" + display_name : "value_displayname" + parent_name : "value_parentname" + filter : "value_filter" \ No newline at end of file