-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically generated by magic modules for service: apigee and reso…
…urce: Organizations__envgroups__attachment. This commit includes the following changes: - Singular Resource - Plural Resource - Documentation updates - Terraform configuration - Integration tests Signed-off-by: Samir Anand <sam.sunny001@gmail.com>
- Loading branch information
1 parent
5d15ed4
commit 2888f5a
Showing
7 changed files
with
313 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
docs/resources/google_apigee_organization_envgroup_attachment.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: About the google_apigee_organization_envgroup_attachment resource | ||
platform: gcp | ||
--- | ||
|
||
## Syntax | ||
A `google_apigee_organization_envgroup_attachment` is used to test a Google OrganizationEnvgroupAttachment resource | ||
|
||
## Examples | ||
``` | ||
describe google_apigee_organization_envgroup_attachment(name: ' value_name') do | ||
it { should exist } | ||
its('created_at') { should cmp 'value_createdat' } | ||
its('environment') { should cmp 'value_environment' } | ||
its('environment_group_id') { should cmp 'value_environmentgroupid' } | ||
its('name') { should cmp 'value_name' } | ||
end | ||
describe google_apigee_organization_envgroup_attachment(name: "does_not_exit") do | ||
it { should_not exist } | ||
end | ||
``` | ||
|
||
## Properties | ||
Properties that can be accessed from the `google_apigee_organization_envgroup_attachment` resource: | ||
|
||
|
||
* `created_at`: Output only. The time at which the environment group attachment was created as milliseconds since epoch. | ||
|
||
* `environment`: Required. ID of the attached environment. | ||
|
||
* `environment_group_id`: Output only. ID of the environment group. | ||
|
||
* `name`: ID of the environment group attachment. | ||
|
||
|
||
## GCP Permissions | ||
|
||
Ensure the [Apigee API](https://console.cloud.google.com/apis/library/apigee.googleapis.com/) is enabled for the current project. |
31 changes: 31 additions & 0 deletions
31
docs/resources/google_apigee_organization_envgroup_attachments.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: About the google_apigee_organization_envgroup_attachments resource | ||
platform: gcp | ||
--- | ||
|
||
## Syntax | ||
A `google_apigee_organization_envgroup_attachments` is used to test a Google OrganizationEnvgroupAttachment resource | ||
|
||
## Examples | ||
``` | ||
describe google_apigee_organization_envgroup_attachments(parent: ' value_parent') do | ||
it { should exist } | ||
end | ||
``` | ||
|
||
## Properties | ||
Properties that can be accessed from the `google_apigee_organization_envgroup_attachments` resource: | ||
|
||
See [google_apigee_organization_envgroup_attachment.md](google_apigee_organization_envgroup_attachment.md) for more detailed information | ||
* `created_ats`: an array of `google_apigee_organization_envgroup_attachment` created_at | ||
* `environments`: an array of `google_apigee_organization_envgroup_attachment` environment | ||
* `environment_group_ids`: an array of `google_apigee_organization_envgroup_attachment` environment_group_id | ||
* `names`: an array of `google_apigee_organization_envgroup_attachment` name | ||
|
||
## 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 [Apigee API](https://console.cloud.google.com/apis/library/apigee.googleapis.com/) is enabled for the current project. |
61 changes: 61 additions & 0 deletions
61
libraries/google_apigee_organization_envgroup_attachment.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# frozen_string_literal: false | ||
|
||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in README.md and | ||
# CONTRIBUTING.md located at the root of this package. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
require 'gcp_backend' | ||
|
||
# A provider to manage Apigee resources. | ||
class ApigeeOrganizationEnvgroupAttachment < GcpResourceBase | ||
name 'google_apigee_organization_envgroup_attachment' | ||
desc 'OrganizationEnvgroupAttachment' | ||
supports platform: 'gcp' | ||
|
||
attr_reader :params | ||
attr_reader :created_at | ||
attr_reader :environment | ||
attr_reader :environment_group_id | ||
attr_reader :name | ||
|
||
def initialize(params) | ||
super(params.merge({ use_http_transport: true })) | ||
@params = params | ||
@fetched = @connection.fetch(product_url(params[:beta]), resource_base_url, params, 'Get') | ||
parse unless @fetched.nil? | ||
end | ||
|
||
def parse | ||
@created_at = @fetched['createdAt'] | ||
@environment = @fetched['environment'] | ||
@environment_group_id = @fetched['environmentGroupId'] | ||
@name = @fetched['name'] | ||
end | ||
|
||
def exists? | ||
!@fetched.nil? | ||
end | ||
|
||
def to_s | ||
"OrganizationEnvgroupAttachment #{@params[:name]}" | ||
end | ||
|
||
private | ||
|
||
def product_url(_ = nil) | ||
'https://apigee.googleapis.com/v1/' | ||
end | ||
|
||
def resource_base_url | ||
'{{name}}' | ||
end | ||
end |
85 changes: 85 additions & 0 deletions
85
libraries/google_apigee_organization_envgroup_attachments.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# frozen_string_literal: false | ||
|
||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in README.md and | ||
# CONTRIBUTING.md located at the root of this package. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
require 'gcp_backend' | ||
class ApigeeOrganizationEnvgroupAttachments < GcpResourceBase | ||
name 'google_apigee_organization_envgroup_attachments' | ||
desc 'OrganizationEnvgroupAttachment plural resource' | ||
supports platform: 'gcp' | ||
|
||
attr_reader :table | ||
|
||
filter_table_config = FilterTable.create | ||
|
||
filter_table_config.add(:created_ats, field: :created_at) | ||
filter_table_config.add(:environments, field: :environment) | ||
filter_table_config.add(:environment_group_ids, field: :environment_group_id) | ||
filter_table_config.add(:names, field: :name) | ||
|
||
filter_table_config.connect(self, :table) | ||
|
||
def initialize(params = {}) | ||
super(params.merge({ use_http_transport: true })) | ||
@params = params | ||
@table = fetch_wrapped_resource('organizationEnvgroupAttachments') | ||
end | ||
|
||
def fetch_wrapped_resource(wrap_path) | ||
# fetch_resource returns an array of responses (to handle pagination) | ||
result = @connection.fetch_all(product_url, resource_base_url, @params, 'Get') | ||
return if result.nil? | ||
|
||
# Conversion of string -> object hash to symbol -> object hash that InSpec needs | ||
converted = [] | ||
result.each do |response| | ||
next if response.nil? || !response.key?(wrap_path) | ||
response[wrap_path].each do |hash| | ||
hash_with_symbols = {} | ||
hash.each_key do |key| | ||
name, value = transform(key, hash) | ||
hash_with_symbols[name] = value | ||
end | ||
converted.push(hash_with_symbols) | ||
end | ||
end | ||
|
||
converted | ||
end | ||
|
||
def transform(key, value) | ||
return transformers[key].call(value) if transformers.key?(key) | ||
|
||
[key.to_sym, value] | ||
end | ||
|
||
def transformers | ||
{ | ||
'createdAt' => ->(obj) { return :created_at, obj['createdAt'] }, | ||
'environment' => ->(obj) { return :environment, obj['environment'] }, | ||
'environmentGroupId' => ->(obj) { return :environment_group_id, obj['environmentGroupId'] }, | ||
'name' => ->(obj) { return :name, obj['name'] }, | ||
} | ||
end | ||
|
||
private | ||
|
||
def product_url(_ = nil) | ||
'https://apigee.googleapis.com/v1/' | ||
end | ||
|
||
def resource_base_url | ||
'{{parent}}/attachments' | ||
end | ||
end |
42 changes: 42 additions & 0 deletions
42
test/integration/verify/controls/google_apigee_organization_envgroup_attachment.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in README.md and | ||
# CONTRIBUTING.md located at the root of this package. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
|
||
title 'Test GCP google_apigee_organization_envgroup_attachment resource.' | ||
|
||
gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') | ||
|
||
organization_envgroup_attachment = input('organization_envgroup_attachment', value: { | ||
"name": "value_name", | ||
"parent": "value_parent", | ||
"created_at": "value_createdat", | ||
"environment": "value_environment", | ||
"environment_group_id": "value_environmentgroupid" | ||
}, description: 'organization_envgroup_attachment description') | ||
control 'google_apigee_organization_envgroup_attachment-1.0' do | ||
impact 1.0 | ||
title 'google_apigee_organization_envgroup_attachment resource test' | ||
|
||
describe google_apigee_organization_envgroup_attachment(name: organization_envgroup_attachment['name']) do | ||
it { should exist } | ||
its('created_at') { should cmp organization_envgroup_attachment['created_at'] } | ||
its('environment') { should cmp organization_envgroup_attachment['environment'] } | ||
its('environment_group_id') { should cmp organization_envgroup_attachment['environment_group_id'] } | ||
its('name') { should cmp organization_envgroup_attachment['name'] } | ||
|
||
end | ||
|
||
describe google_apigee_organization_envgroup_attachment(name: "does_not_exit") do | ||
it { should_not exist } | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
test/integration/verify/controls/google_apigee_organization_envgroup_attachments.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
# | ||
# ---------------------------------------------------------------------------- | ||
# | ||
# This file is automatically generated by Magic Modules and manual | ||
# changes will be clobbered when the file is regenerated. | ||
# | ||
# Please read more about how to change this file in README.md and | ||
# CONTRIBUTING.md located at the root of this package. | ||
# | ||
# ---------------------------------------------------------------------------- | ||
|
||
title 'Test GCP google_apigee_organization_envgroup_attachments resource.' | ||
|
||
gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.') | ||
|
||
organization_envgroup_attachment = input('organization_envgroup_attachment', value: { | ||
"name": "value_name", | ||
"parent": "value_parent", | ||
"created_at": "value_createdat", | ||
"environment": "value_environment", | ||
"environment_group_id": "value_environmentgroupid" | ||
}, description: 'organization_envgroup_attachment description') | ||
control 'google_apigee_organization_envgroup_attachments-1.0' do | ||
impact 1.0 | ||
title 'google_apigee_organization_envgroup_attachments resource test' | ||
|
||
describe google_apigee_organization_envgroup_attachments(parent: organization_envgroup_attachment['parent']) do | ||
it { should exist } | ||
end | ||
end |