Skip to content

Commit

Permalink
Add support for Beyondcorp AppConnector resource
Browse files Browse the repository at this point in the history
  • Loading branch information
palramanathan committed Nov 9, 2022
1 parent 2192aa3 commit dcd59a6
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 0 deletions.
130 changes: 130 additions & 0 deletions mmv1/products/beyondcorp/api.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Copyright 2022 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::Product
name: Beyondcorp
display_name: Google BeyondCorp
versions:
- !ruby/object:Api::Product::Version
name: ga
base_url: https://beyondcorp.googleapis.com/v1/
scopes:
- https://www.googleapis.com/auth/cloud-platform
apis_required:
- !ruby/object:Api::Product::ApiReference
name: Beyondcorp API
url: https://console.cloud.google.com/apis/library/beyondcorp.googleapis.com/
objects:
- !ruby/object:Api::Resource
name: 'AppConnector'
description: |
A BeyondCorp AppConnector resource represents an application facing component deployed proximal to
and with direct access to the application instances. It is used to establish connectivity between the
remote enterprise environment and GCP. It initiates connections to the applications and can proxy the
data from users over the connection.
min_version: ga
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Official Documentation': 'https://cloud.google.com/beyondcorp-enterprise/docs/enable-app-connector'
api: 'https://cloud.google.com/beyondcorp/docs/reference/rest#rest-resource:-v1.projects.locations.appconnectors'
base_url: projects/{{project}}/locations/{{region}}/appConnectors
self_link: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
create_url: projects/{{project}}/locations/{{region}}/appConnectors?app_connector_id={{name}}
delete_url: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
update_url: projects/{{project}}/locations/{{region}}/appConnectors/{{name}}
update_verb: :PATCH
update_mask: true
iam_policy: !ruby/object:Api::Resource::IamPolicy
parent_resource_attribute: name
method_name_separator: ':'
fetch_iam_policy_verb: :GET
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'
properties:
- !ruby/object:Api::Type::String
name: 'name'
required: true
input: true
description: |
ID of the AppConnector.
- !ruby/object:Api::Type::String
name: 'region'
description: |
The region of the AppConnector.
input: true
url_param_only: true
- !ruby/object:Api::Type::String
name: 'displayName'
description: |
An arbitrary user-provided name for the AppConnector.
- !ruby/object:Api::Type::KeyValuePairs
name: 'labels'
description: |
Resource labels to represent user provided metadata.
- !ruby/object:Api::Type::NestedObject
name: 'principalInfo'
description: |
Principal information about the Identity of the AppConnector.
required: true
properties:
- !ruby/object:Api::Type::NestedObject
name: 'serviceAccount'
description: |
ServiceAccount represents a GCP service account.
properties:
- !ruby/object:Api::Type::String
name: 'email'
description: |
Email address of the service account.
- !ruby/object:Api::Type::Time
name: 'createTime'
description: |
Timestamp when the resource was created.
output: true
- !ruby/object:Api::Type::Time
name: 'updateTime'
description: |
Timestamp when the resource was updated.
output: true
- !ruby/object:Api::Type::String
name: 'uid'
description: |
A unique identifier for the instance generated by the system.
output: true
- !ruby/object:Api::Type::Enum
name: 'state'
output: true
description: |
Represents the different states of a AppConnector.
values:
- :STATE_UNSPECIFIED
- :CREATING
- :CREATED
- :UPDATING
- :DELETING
- :DOWN
44 changes: 44 additions & 0 deletions mmv1/products/beyondcorp/terraform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2022 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:Provider::Terraform::Config
overrides: !ruby/object:Overrides::ResourceOverrides
AppConnector: !ruby/object:Overrides::Terraform::ResourceOverride
autogen_async: true
examples:
- !ruby/object:Provider::Terraform::Examples
name: "beyondcorp_app_connector_basic"
primary_resource_id: "app_connector"
primary_resource_name: "fmt.Sprintf(\"tf_test_my_app_connector%s\", context[\"random_suffix\"])"
vars:
app_connector_name: "my-app-connector"
account_id: "my-account"
- !ruby/object:Provider::Terraform::Examples
name: "beyondcorp_app_connector_full"
primary_resource_id: "app_connector"
primary_resource_name: "fmt.Sprintf(\"tf_test_my_app_connector%s\", context[\"random_suffix\"])"
region_override: "US"
vars:
app_connector_name: "my-app-connector"
account_id: "my-account"
display_name: "some display name"
properties:
name: !ruby/object:Overrides::Terraform::PropertyOverride
custom_expand: 'templates/terraform/custom_expand/shortname_to_url.go.erb'
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
# This is for copying files over
files: !ruby/object:Provider::Config::Files
# These files have templating (ERB) code that will be run.
# This is usually to add licensing info, autogeneration notices, etc.
compile:
<%= lines(indent(compile('provider/terraform/product~compile.yaml'), 4)) -%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "google_service_account" "service_account" {
account_id = "<%= ctx[:vars]['account_id'] %>"
display_name = "Test Service Account"
}

resource "google_beyondcorp_app_connector" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['app_connector_name'] %>"
principal_info {
service_account {
email = google_service_account.service_account.email
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "google_service_account" "service_account" {
account_id = "<%= ctx[:vars]['account_id'] %>"
display_name = "Test Service Account"
}

resource "google_beyondcorp_app_connector" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['app_connector_name'] %>"
region = "us-central1"
display_name = "<%= ctx[:vars]['display_name'] %>"
principal_info {
service_account {
email = google_service_account.service_account.email
}
}
labels = {
foo = "bar"
bar = "baz"
}
}

0 comments on commit dcd59a6

Please sign in to comment.