Skip to content

Commit

Permalink
rename resource name
Browse files Browse the repository at this point in the history
Signed-off-by: balasubramanian-s <[email protected]>
  • Loading branch information
balasubramanian-s committed Oct 17, 2024
1 parent 85f0c9f commit 3c821dc
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 96 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
+++

title = "google_monitoring_project_group Resource"
title = "google_monitoring_group Resource"
platform = "gcp"
draft = false
gh_repo = "inspec-gcp"


[menu.inspec]

title = "google_monitoring_project_group"
identifier = "inspec/resources/gcp/google_monitoring_project_group Resource"
title = "google_monitoring_group"
identifier = "inspec/resources/gcp/google_monitoring_group Resource"
parent = "inspec/resources/gcp"
+++

Use the `google_monitoring_project_group` InSpec audit resource to test the properties of a test a Google ProjectGroup.
Use the `google_monitoring_group` InSpec audit resource to test the properties of a test a Google Group.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_monitoring_project_group` is used to test a Google ProjectGroup resource
A `google_monitoring_group` is used to test a Google Group resource

## Examples
```
describe google_monitoring_project_group(name: ' value_name') do
describe google_monitoring_group(name: 'projects/*/groups/value_group_id') do
it { should exist }
its('name') { should cmp 'value_name' }
its('display_name') { should cmp 'value_displayname' }
its('parent_name') { should cmp 'value_parentname' }
its('filter') { should cmp 'value_filter' }
end
describe google_monitoring_project_group(name: "does_not_exit") do
describe google_monitoring_group(name: "does_not_exit") do
it { should_not exist }
end
```

## Parameters
Properties that can be accessed from the `google_monitoring_project_group` resource:
Properties that can be accessed from the `google_monitoring_group` resource:

## Properties
Properties that can be accessed from the `google_monitoring_project_group` resource:
Properties that can be accessed from the `google_monitoring_group` resource:


* `name`: 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.
Expand Down
59 changes: 59 additions & 0 deletions docs/resources/google_monitoring_groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
+++

title = "google_monitoring_groups Resource"
platform = "gcp"
draft = false
gh_repo = "inspec-gcp"


[menu.inspec]

title = "google_monitoring_groups"
identifier = "inspec/resources/gcp/google_monitoring_groups Resource"
parent = "inspec/resources/gcp"
+++

Use the `google_monitoring_groups` InSpec audit resource to test the properties of a test a Google Group.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `google_monitoring_groups` is used to test a Google Group resource

## Examples
```
describe google_monitoring_groups(name: 'value_name') do
it { should exist }
its('names') { should include 'value_name' }
its('display_names') { should include 'value_displayname' }
its('filters') { should include 'value_filter' }
end
```

## Parameters
Properties that can be accessed from the `google_monitoring_groups` resource:

See [google_monitoring_group.md](google_monitoring_group.md) for more detailed information
* `names`: an array of `google_monitoring_group` name
* `display_names`: an array of `google_monitoring_group` display_name
* `parent_names`: an array of `google_monitoring_group` parent_name
* `filters`: an array of `google_monitoring_group` filter
* `is_clusters`: an array of `google_monitoring_group` is_cluster
## Properties
Properties that can be accessed from the `google_monitoring_groups` resource:

See [google_monitoring_group.md](google_monitoring_group.md) for more detailed information
* `names`: an array of `google_monitoring_group` name
* `display_names`: an array of `google_monitoring_group` display_name
* `parent_names`: an array of `google_monitoring_group` parent_name
* `filters`: an array of `google_monitoring_group` filter
* `is_clusters`: an array of `google_monitoring_group` is_cluster

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
with `where` as a block or a method.

## GCP Permissions

Ensure the [Stackdriver Monitoring API](https://console.cloud.google.com/apis/library/monitoring.googleapis.com/) is enabled for the current project.
56 changes: 0 additions & 56 deletions docs/resources/google_monitoring_project_groups.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
require 'gcp_backend'

# A provider to manage Cloud (Stackdriver) Monitoring resources.
class MonitoringProjectGroup < GcpResourceBase
name 'google_monitoring_project_group'
desc 'ProjectGroup'
class MonitoringGroup < GcpResourceBase
name 'google_monitoring_group'
desc 'Group'
supports platform: 'gcp'

attr_reader :params
Expand Down Expand Up @@ -48,16 +48,16 @@ def exists?
end

def to_s
"ProjectGroup #{@params[:]}"
"Group #{@params[:name]}"
end

private

def product_url(_ = nil)
'https://monitoring.googleapis.com/'
'https://monitoring.googleapis.com/v3/'
end

def resource_base_url
'{{+name}}'
'{{name}}'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#
# ----------------------------------------------------------------------------
require 'gcp_backend'
class MonitoringProjectGroups < GcpResourceBase
name 'google_monitoring_project_groups'
desc 'ProjectGroup plural resource'
class MonitoringGroups < GcpResourceBase
name 'google_monitoring_groups'
desc 'Group plural resource'
supports platform: 'gcp'

attr_reader :table
Expand All @@ -34,7 +34,7 @@ class MonitoringProjectGroups < GcpResourceBase
def initialize(params = {})
super(params.merge({ use_http_transport: true }))
@params = params
@table = fetch_wrapped_resource('projectGroups')
@table = fetch_wrapped_resource('group')
end

def fetch_wrapped_resource(wrap_path)
Expand Down Expand Up @@ -78,10 +78,10 @@ def transformers
private

def product_url(_ = nil)
'https://monitoring.googleapis.com/'
'https://monitoring.googleapis.com/v3/'
end

def resource_base_url
'{{+name}}/groups'
'{{name}}/groups'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@
#
# ----------------------------------------------------------------------------

title 'Test GCP google_monitoring_project_group resource.'
title 'Test GCP google_monitoring_group resource.'

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')

project_group = input('project_group', value: {
group = input('group', value: {
"name": "value_name",
"display_name": "value_displayname",
"parent_name": "value_parentname",
"filter": "value_filter"
}, description: 'project_group description')
control 'google_monitoring_project_group-1.0' do
}, description: 'group description')
control 'google_monitoring_group-1.0' do
impact 1.0
title 'google_monitoring_project_group resource test'
title 'google_monitoring_group resource test'

describe google_monitoring_project_group(name: project_group['name']) do
describe google_monitoring_group(name: group['name']) do
it { should exist }
its('name') { should cmp project_group['name'] }
its('display_name') { should cmp project_group['display_name'] }
its('parent_name') { should cmp project_group['parent_name'] }
its('filter') { should cmp project_group['filter'] }
its('name') { should cmp group['name'] }
its('display_name') { should cmp group['display_name'] }
its('parent_name') { should cmp group['parent_name'] }
its('filter') { should cmp group['filter'] }

end

describe google_monitoring_project_group(name: "does_not_exit") do
describe google_monitoring_group(name: "does_not_exit") do
it { should_not exist }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
#
# ----------------------------------------------------------------------------

title 'Test GCP google_monitoring_project_groups resource.'
title 'Test GCP google_monitoring_groups resource.'

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')

project_group = input('project_group', value: {
group = input('group', value: {
"name": "value_name",
"display_name": "value_displayname",
"parent_name": "value_parentname",
"filter": "value_filter"
}, description: 'project_group description')
control 'google_monitoring_project_groups-1.0' do
}, description: 'group description')
control 'google_monitoring_groups-1.0' do
impact 1.0
title 'google_monitoring_project_groups resource test'
title 'google_monitoring_groups resource test'

describe google_monitoring_project_groups(name: project_group['name']) do
describe google_monitoring_groups(name: group['name']) do
it { should exist }
end
end

0 comments on commit 3c821dc

Please sign in to comment.