forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the resource service connection map, and it's basic test, need …
…to evaluate
- Loading branch information
1 parent
5230861
commit 4240e1d
Showing
2 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
160 changes: 160 additions & 0 deletions
160
mmv1/products/networkconnectivity/ServiceConnectionMap.yaml
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,160 @@ | ||
# Copyright 2021 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the 'License'); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an 'AS IS' BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'ServiceConnectionMap' | ||
base_url: 'projects/{{project}}/locations/{{location}}/serviceConnectionMaps' | ||
create_url: 'projects/{{project}}/locations/{{location}}/serviceConnectionMaps?serviceConnectionMapsId={{name}}' | ||
self_link: 'projects/{{project}}/locations/{{location}}/serviceConnectionMaps/{{name}}' | ||
min_version: ga | ||
update_verb: :PATCH | ||
update_mask: true | ||
description: | ||
'The ServiceConnectionMap resource' | ||
references: !ruby/object:Api::Resource::ReferenceLinks | ||
api: 'https://cloud.google.com/secure-web-proxy/docs/reference/networkconnectivity/rest/v1/projects.locations.serviceConnectionMaps' | ||
guides: | ||
'About Service Connection Maps': 'https://cloud.google.com/vpc/docs/about-service-connection-policies#service-connection-map' | ||
async: !ruby/object:Api::OpAsync | ||
operation: !ruby/object:Api::OpAsync::Operation | ||
path: 'name' | ||
base_url: '{{op_id}}' | ||
wait_ms: 1000 | ||
timeouts: !ruby/object:Api::Timeouts | ||
insert_minutes: 30 | ||
update_minutes: 30 | ||
delete_minutes: 30 | ||
result: !ruby/object:Api::OpAsync::Result | ||
path: 'response' | ||
status: !ruby/object:Api::OpAsync::Status | ||
path: 'done' | ||
complete: true | ||
allowed: | ||
- true | ||
- false | ||
error: !ruby/object:Api::OpAsync::Error | ||
path: 'error' | ||
message: 'message' | ||
autogen_async: true | ||
import_format: | ||
['projects/{{project}}/locations/{{location}}/serviceConnectionMaps/{{name}}'] | ||
examples: | ||
- !ruby/object:Provider::Terraform::Examples | ||
min_version: ga | ||
name: 'network_connectivity_service_connection_maps_basic' | ||
primary_resource_id: 'default' | ||
vars: | ||
resource_name: 'my-service_connection_map' | ||
consumer_network_name: 'consumer-net' | ||
consumer_subnetwork_name: 'consumer-subnet' | ||
producer_network_name: 'producer-net' | ||
producer_subnetwork_name: 'producer-subnet' | ||
service_class_name: 'my-service-class' | ||
connection_policy_name: 'my-network-connectivity-policy' | ||
parameters: | ||
- !ruby/object:Api::Type::String | ||
name: 'name' | ||
required: true | ||
url_param_only: true | ||
immutable: true | ||
description: | | ||
The name of a ServiceConnectionMap. Format: projects/{project}/locations/{location}/serviceConnectionMaps/{service_connection_map} See: https://google.aip.dev/122#fields-representing-resource-names | ||
- !ruby/object:Api::Type::String | ||
name: 'location' | ||
description: | | ||
The location of the tls inspection policy. | ||
url_param_only: true | ||
properties: | ||
- !ruby/object:Api::Type::Time | ||
name: 'createTime' | ||
description: | | ||
The timestamp when the resource was created. | ||
output: true | ||
- !ruby/object:Api::Type::Time | ||
name: 'updateTime' | ||
description: | | ||
The timestamp when the resource was updated. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'description' | ||
description: | | ||
A description of this resource. | ||
- !ruby/object:Api::Type::String | ||
name: 'serviceClass' | ||
description: | | ||
The service class identifier this ServiceConnectionMap is for. The user of ServiceConnectionMap create API needs to have networkconnecitivty.serviceclasses.use iam permission for the service class. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'etag' | ||
description: | | ||
The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'serviceClassUri' | ||
description: | | ||
The service class uri this ServiceConnectionMap is for. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'token' | ||
description: | | ||
The token provided by the consumer. This token authenticates that the consumer can create a connecton within the specified project and network. | ||
- !ruby/object:Api::Type::NestedObject | ||
name: 'consumerPscConfigs' | ||
description: | | ||
The PSC configurations on consumer side. | ||
properties: | ||
- !ruby/object:Api::Type::NestedObject | ||
name: 'properties' | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'state' | ||
description: | | ||
Overall state of PSC Connections management for this consumer psc config. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'project' | ||
description: The consumer project where PSC connections are allowed to be created in. | ||
- !ruby/object:Api::Type::String | ||
name: 'network' | ||
description: | | ||
The resource path of the consumer network where PSC connections are allowed to be created in. Note, this network does not need be in the ConsumerPscConfig.project in the case of SharedVPC. Example: projects/{projectNumOrId}/global/networks/{networkId}. | ||
- !ruby/object:Api::Type::Boolean | ||
name: 'disableGlobalAccess' | ||
description: This is used in PSC consumer ForwardingRule to control whether the PSC endpoint can be accessed from another region. | ||
- !ruby/object:Api::Type::NestedObject | ||
name: 'producerPscConfigs' | ||
description: | | ||
The PSC configurations on producer side. | ||
properties: | ||
- !ruby/object:Api::Type::NestedObject | ||
name: 'properties' | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'serviceAttachmentUri' | ||
description: | | ||
The resource path of a service attachment. Example: projects/{projectNumOrId}/regions/{region}/serviceAttachments/{resourceId}. | ||
- !ruby/object:Api::Type::String | ||
name: 'infrastructure' | ||
output: true | ||
description: | | ||
The type of underlying resources used to create the connection. | ||
- !ruby/object:Api::Type::String | ||
name: 'consumerPscConnections' | ||
output: true | ||
description: | | ||
PSC connection details on consumer side. | ||
- !ruby/object:Api::Type::KeyValuePairs | ||
name: "labels" | ||
description: | | ||
User-defined labels. | ||
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. |
43 changes: 43 additions & 0 deletions
43
mmv1/templates/terraform/examples/network_connectivity_service_connection_maps_basic.tf.erb
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,43 @@ | ||
resource "google_compute_network" "consumer_net" { | ||
name = "<%= ctx[:vars]['consumer_network_name'] %>" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "consumer_subnet" { | ||
name = "<%= ctx[:vars]['consumer_subnetwork_name'] %>" | ||
ip_cidr_range = "10.0.0.0/16" | ||
region = "us-central1" | ||
network = google_compute_network.consumer_net.id | ||
} | ||
|
||
resource "google_compute_network" "producer_net" { | ||
name = "<%= ctx[:vars]['producer_network_name'] %>" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "producer_subnet" { | ||
name = "<%= ctx[:vars]['producer_subnetwork_name'] %>" | ||
ip_cidr_range = "10.0.0.0/16" | ||
region = "us-central1" | ||
network = google_compute_network.producer_net.id | ||
} | ||
|
||
resource "google_network_connectivity_service_class" "default"{ | ||
name = "<%= ctx[:vars]['service_class_name'] %>" | ||
location = "us-central1" | ||
description = "my-basic serviceClass" | ||
labels = { | ||
foo = "bar" | ||
} | ||
} | ||
|
||
resource "google_network_connectivity_service_connection_policy" "default" { | ||
name = "<%= ctx[:vars]['resource_name'] %>" | ||
location = "us-central1" | ||
service_class = google_network_connectivity_service_class.default.service_class | ||
network = google_compute_network.producer_net.id | ||
psc_config { | ||
subnetworks = [google_compute_subnetwork.producer_subnet.id] | ||
limit = 2 | ||
} | ||
} |