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.
Add new resource for Application for Apphub (GoogleCloudPlatform#10079)
* 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 <[email protected]>
- Loading branch information
1 parent
8373cea
commit 55a1fa8
Showing
7 changed files
with
468 additions
and
0 deletions.
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
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: "[email protected]" | ||
developer_name: "Bob" | ||
developer_email: "[email protected]" | ||
operator_name: "Charlie" | ||
operator_email: "[email protected]" | ||
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 |
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,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 |
7 changes: 7 additions & 0 deletions
7
mmv1/templates/terraform/examples/apphub_application_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,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
29
mmv1/templates/terraform/examples/apphub_application_full.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,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'] %>" | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.