Skip to content

Commit

Permalink
Adding support for Beyondcorp AppGateway resource
Browse files Browse the repository at this point in the history
  • Loading branch information
palramanathan committed Nov 10, 2022
1 parent f8172e6 commit fd081de
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 0 deletions.
122 changes: 122 additions & 0 deletions mmv1/products/beyondcorp/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,125 @@ objects:
- :UPDATING
- :DELETING
- :DOWN
- !ruby/object:Api::Resource
name: 'AppGateway'
description: |
A BeyondCorp AppGateway resource represents a BeyondCorp protected AppGateway to a remote application. It creates
all the necessary GCP components needed for creating a BeyondCorp protected AppGateway. Multiple connectors can be
authorised for a single AppGateway.
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.appgateways'
base_url: projects/{{project}}/locations/{{region}}/appGateways
self_link: projects/{{project}}/locations/{{region}}/appGateways/{{name}}
create_url: projects/{{project}}/locations/{{region}}/appGateways?app_gateway_id={{name}}
delete_url: projects/{{project}}/locations/{{region}}/appGateways/{{name}}
# 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
timeouts: !ruby/object:Api::Timeouts
insert_minutes: 20
delete_minutes: 20
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 AppGateway.
- !ruby/object:Api::Type::String
name: 'region'
description: |
The region of the AppGateway.
input: true
url_param_only: true
- !ruby/object:Api::Type::Enum
name: 'type'
description: |
The type of network connectivity used by the AppGateway.
values:
- :TYPE_UNSPECIFIED
- :TCP_PROXY
default_value: :TYPE_UNSPECIFIED
- !ruby/object:Api::Type::Enum
name: 'hostType'
description: |
The type of hosting used by the AppGateway.
values:
- :HOST_TYPE_UNSPECIFIED
- :GCP_REGIONAL_MIG
default_value: :HOST_TYPE_UNSPECIFIED
- !ruby/object:Api::Type::String
name: 'displayName'
description: |
An arbitrary user-provided name for the AppGateway.
- !ruby/object:Api::Type::KeyValuePairs
name: 'labels'
description: |
Resource labels to represent user provided metadata.
- !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 AppGateway.
values:
- :STATE_UNSPECIFIED
- :CREATING
- :CREATED
- :UPDATING
- :DELETING
- :DOWN
- !ruby/object:Api::Type::String
name: 'uri'
output: true
description: |
Server-defined URI for this resource.
- !ruby/object:Api::Type::NestedObject
name: 'allocatedConnections'
description: |
A list of connections allocated for the Gateway.
output: true
properties:
- !ruby/object:Api::Type::String
name: 'pscUri'
description: |
The PSC uri of an allocated connection.
- !ruby/object:Api::Type::Integer
name: 'ingressPort'
description: |
The ingress port of an allocated connection.
20 changes: 20 additions & 0 deletions mmv1/products/beyondcorp/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ overrides: !ruby/object:Overrides::ResourceOverrides
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'
AppGateway: !ruby/object:Overrides::Terraform::ResourceOverride
autogen_async: true
examples:
- !ruby/object:Provider::Terraform::Examples
name: "beyondcorp_app_gateway_basic"
primary_resource_id: "app_gateway"
primary_resource_name: "fmt.Sprintf(\"tf_test_my_app_gateway%s\", context[\"random_suffix\"])"
vars:
app_gateway_name: "my-app-gateway"
- !ruby/object:Provider::Terraform::Examples
name: "beyondcorp_app_gateway_full"
primary_resource_id: "app_gateway"
primary_resource_name: "fmt.Sprintf(\"tf_test_my_app_gateway%s\", context[\"random_suffix\"])"
vars:
app_gateway_name: "my-app-gateway"
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "google_beyondcorp_app_gateway" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['app_gateway_name'] %>"
type = "TCP_PROXY"
region = "us-central1"
host_type = "GCP_REGIONAL_MIG"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "google_beyondcorp_app_gateway" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['app_gateway_name'] %>"
type = "TCP_PROXY"
region = "us-central1"
display_name = "<%= ctx[:vars]['display_name'] %>"
labels = {
foo = "bar"
bar = "baz"
}
host_type = "GCP_REGIONAL_MIG"
}

0 comments on commit fd081de

Please sign in to comment.