Skip to content

Commit

Permalink
Add new resource for Application for Apphub (GoogleCloudPlatform#10079)
Browse files Browse the repository at this point in the history
* Add new resource for Application for Apphub

* Add new resource for Application for Apphub

* Enable Apphub API in test cases

* Fix precheck error

* Fix precheck error

* Resolve comments

* Fix lint error

* Fix examples

* Remove apphub from teamcity config

This causes PR build failures, I'll add it later

---------

Co-authored-by: Sam Levenick <slevenick@google.com>
  • Loading branch information
2 people authored and balanaguharsha committed May 2, 2024
1 parent c5178e1 commit 0d7f544
Show file tree
Hide file tree
Showing 7 changed files with 468 additions and 0 deletions.
189 changes: 189 additions & 0 deletions mmv1/products/apphub/Application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Copyright 2024 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
base_url: projects/{{project}}/locations/{{location}}/applications
create_url: projects/{{project}}/locations/{{location}}/applications?applicationId={{application_id}}
self_link: projects/{{project}}/locations/{{location}}/applications/{{application_id}}
id_format: projects/{{project}}/locations/{{location}}/applications/{{application_id}}
import_format:
- projects/{{project}}/locations/{{location}}/applications/{{application_id}}
name: Application
description: 'Application is a functional grouping of Services and Workloads that helps achieve a desired end-to-end business functionality.
Services and Workloads are owned by the Application.'
autogen_async: true
examples:
- !ruby/object:Provider::Terraform::Examples
name: "application_basic"
primary_resource_id: "example"
config_path: "templates/terraform/examples/apphub_application_basic.tf.erb"
vars:
application_id: "example-application"
- !ruby/object:Provider::Terraform::Examples
name: "application_full"
primary_resource_id: "example2"
config_path: "templates/terraform/examples/apphub_application_full.tf.erb"
vars:
application_id: "example-application"
display_name: "Application Full"
description: "Application for testing"
business_name: "Alice"
business_email: "alice@google.com"
developer_name: "Bob"
developer_email: "bob@google.com"
operator_name: "Charlie"
operator_email: "charlie@google.com"
properties:
- !ruby/object:Api::Type::String
name: name
output: true
description: "Identifier. The resource name of an Application. Format:\n\"projects/{host-project-id}/locations/{location}/applications/{application-id}\" "
- !ruby/object:Api::Type::String
name: displayName
description: 'Optional. User-defined name for the Application. '
- !ruby/object:Api::Type::String
name: description
description: 'Optional. User-defined description of an Application. '
- !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::Enum
name: type
description: 'Criticality type. '
required: true
values:
- :MISSION_CRITICAL
- :HIGH
- :MEDIUM
- :LOW
name: criticality
description: 'Criticality of the Application, Service, or Workload '
- !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::Enum
name: type
description: 'Environment type. '
required: true
values:
- :PRODUCTION
- :STAGING
- :TEST
- :DEVELOPMENT
name: environment
description: 'Environment of the Application, Service, or Workload '
- !ruby/object:Api::Type::Array
name: developerOwners
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: displayName
description: 'Optional. Contact''s name. '
- !ruby/object:Api::Type::String
name: email
required: true
description: 'Required. Email address of the contacts. '
description: 'Optional. Developer team that owns development and coding. '
- !ruby/object:Api::Type::Array
name: operatorOwners
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: displayName
description: 'Optional. Contact''s name. '
- !ruby/object:Api::Type::String
name: email
required: true
description: 'Required. Email address of the contacts. '
description: 'Optional. Operator team that ensures runtime and operations. '
- !ruby/object:Api::Type::Array
name: businessOwners
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: displayName
description: 'Optional. Contact''s name. '
- !ruby/object:Api::Type::String
name: email
required: true
description: 'Required. Email address of the contacts. '
description: 'Optional. Business team that ensures user needs are met and value
is delivered '
name: attributes
description: 'Consumer provided attributes. '
- !ruby/object:Api::Type::String
name: createTime
description: 'Output only. Create time. '
output: true
- !ruby/object:Api::Type::String
name: updateTime
description: 'Output only. Update time. '
output: true
- !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::Enum
name: type
description: "Required. Scope Type. \n Possible values:\nREGIONAL"
required: true
values:
- :REGIONAL
name: scope
description: 'Scope of an application. '
required: true
- !ruby/object:Api::Type::String
name: uid
description: 'Output only. A universally unique identifier (in UUID4 format) for
the `Application`. '
output: true
- !ruby/object:Api::Type::Enum
name: state
description: "Output only. Application state. \n Possible values:\n STATE_UNSPECIFIED\nCREATING\nACTIVE\nDELETING"
output: true
values:
- :STATE_UNSPECIFIED
- :CREATING
- :ACTIVE
- :DELETING
parameters:
- !ruby/object:Api::Type::String
name: location
description: 'Part of `parent`. See documentation of `projectsId`. '
url_param_only: true
required: true
immutable: true
- !ruby/object:Api::Type::String
name: applicationId
description: 'Required. The Application identifier. '
url_param_only: true
required: true
immutable: true
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
path: name
base_url: "{{op_id}}"
wait_ms: 1000
timeouts:
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
update_verb: :PATCH
update_mask: true
23 changes: 23 additions & 0 deletions mmv1/products/apphub/product.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 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: Apphub
display_name: App Hub
versions:
- !ruby/object:Api::Product::Version
name: ga
base_url: https://apphub.googleapis.com/v1/
scopes:
- https://www.googleapis.com/auth/cloud-platform
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "google_apphub_application" "<%= ctx[:primary_resource_id] %>" {
location = "us-east1"
application_id = "<%= ctx[:vars]['application_id'] %>"
scope {
type = "REGIONAL"
}
}
29 changes: 29 additions & 0 deletions mmv1/templates/terraform/examples/apphub_application_full.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
resource "google_apphub_application" "<%= ctx[:primary_resource_id] %>" {
location = "us-east1"
application_id = "<%= ctx[:vars]['application_id'] %>"
display_name = "<%= ctx[:vars]['display_name'] %>"
scope {
type = "REGIONAL"
}
description = "<%= ctx[:vars]['description'] %>"
attributes {
environment {
type = "STAGING"
}
criticality {
type = "MISSION_CRITICAL"
}
business_owners {
display_name = "<%= ctx[:vars]['business_name'] %>"
email = "<%= ctx[:vars]['business_email'] %>"
}
developer_owners {
display_name = "<%= ctx[:vars]['developer_name'] %>"
email = "<%= ctx[:vars]['developer_email'] %>"
}
operator_owners {
display_name = "<%= ctx[:vars]['operator_name'] %>"
email = "<%= ctx[:vars]['operator_email'] %>"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ var ServicesListBeta = mapOf(
"displayName" to "Appengine",
"path" to "./google-beta/services/appengine"
),
"apphub" to mapOf(
"name" to "apphub",
"displayName" to "Apphub",
"path" to "./google-beta/services/apphub"
),
"artifactregistry" to mapOf(
"name" to "artifactregistry",
"displayName" to "Artifactregistry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ var ServicesListGa = mapOf(
"displayName" to "Appengine",
"path" to "./google/services/appengine"
),
"apphub" to mapOf(
"name" to "apphub",
"displayName" to "Apphub",
"path" to "./google/services/apphub"
),
"artifactregistry" to mapOf(
"name" to "artifactregistry",
"displayName" to "Artifactregistry",
Expand Down
Loading

0 comments on commit 0d7f544

Please sign in to comment.