Skip to content

Commit

Permalink
go rewrite - firestore, gkebackup, gkehub, gkehub2, iam2, iambeta, ia…
Browse files Browse the repository at this point in the history
…mworkforcepool, iap (GoogleCloudPlatform#11221)
  • Loading branch information
c2thorn authored Jul 22, 2024
1 parent 4f0795e commit 59c6c29
Show file tree
Hide file tree
Showing 68 changed files with 6,562 additions and 43 deletions.
8 changes: 5 additions & 3 deletions mmv1/api/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,9 +1327,11 @@ func (r Resource) IamImportQualifiersForTest() string {
if param == "project" {
if i != len(params)-1 {
// If the last parameter is project then we want to create a new project to use for the test, so don't default from the environment
importQualifiers = append(importQualifiers, "envvar.GetTestProjectFromEnv()")
} else {
importQualifiers = append(importQualifiers, `context["project_id"]`)
if r.IamPolicy.TestProjectName == "" {
importQualifiers = append(importQualifiers, "envvar.GetTestProjectFromEnv()")
} else {
importQualifiers = append(importQualifiers, `context["project_id"]`)
}
}
} else if param == "zone" && r.IamPolicy.SubstituteZoneValue {
importQualifiers = append(importQualifiers, "envvar.GetTestZoneFromEnv()")
Expand Down
4 changes: 2 additions & 2 deletions mmv1/products/cloudrun/DomainMapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ properties:
name: 'annotations'
description: |-
Annotations is a key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
may be set by external tools to store and retrieve arbitrary metadata.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
**Note**: The Cloud Run API may add additional annotations that were not provided in your config.
If terraform plan shows a diff where a server-side annotation is added, you can add it to your config
Expand Down
8 changes: 4 additions & 4 deletions mmv1/products/cloudrun/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ properties:
name: 'annotations'
description: |-
Annotations is a key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
may be set by external tools to store and retrieve arbitrary metadata.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
**Note**: The Cloud Run API may add additional annotations that were not provided in your config.
If terraform plan shows a diff where a server-side annotation is added, you can add it to your config
Expand Down Expand Up @@ -1060,8 +1060,8 @@ properties:
name: 'annotations'
description: |-
Annotations is a key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
may be set by external tools to store and retrieve arbitrary metadata.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
**Note**: The Cloud Run API may add additional annotations that were not provided in your config.
If terraform plan shows a diff where a server-side annotation is added, you can add it to your config
Expand Down
4 changes: 2 additions & 2 deletions mmv1/products/cloudrun/go_DomainMapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ properties:
type: KeyValueAnnotations
description: |-
Annotations is a key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
may be set by external tools to store and retrieve arbitrary metadata.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
**Note**: The Cloud Run API may add additional annotations that were not provided in your config.
If terraform plan shows a diff where a server-side annotation is added, you can add it to your config
Expand Down
15 changes: 6 additions & 9 deletions mmv1/products/cloudrun/go_Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ properties:
type: KeyValuePairs
description: |-
Annotations is a key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
may be set by external tools to store and retrieve arbitrary metadata.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
**Note**: The Cloud Run API may add additional annotations that were not provided in your config.
If terraform plan shows a diff where a server-side annotation is added, you can add it to your config
Expand Down Expand Up @@ -741,11 +741,8 @@ properties:
type: Integer
description: |-
ContainerConcurrency specifies the maximum allowed in-flight (concurrent)
requests per container of the Revision. Values are:
- `0` thread-safe, the system should manage the max concurrency. This is
the default value.
- `1` not-thread-safe. Single concurrency
- `2-N` thread-safe, max concurrency of N
requests per container of the Revision. If not specified or 0, defaults to 80 when
requested CPU >= 1 and defaults to 1 when requested CPU < 1.
default_from_api: true
- name: 'timeoutSeconds'
type: Integer
Expand Down Expand Up @@ -1058,8 +1055,8 @@ properties:
type: KeyValueAnnotations
description: |-
Annotations is a key value map stored with a resource that
may be set by external tools to store and retrieve arbitrary metadata. More
info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
may be set by external tools to store and retrieve arbitrary metadata.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations
**Note**: The Cloud Run API may add additional annotations that were not provided in your config.
If terraform plan shows a diff where a server-side annotation is added, you can add it to your config
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/cloudrunv2/go_Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ properties:
type: Integer
description: |-
Sets the maximum number of requests that each serving instance can receive.
If not specified or 0, defaults to 80 when requested CPU >= 1 and defaults to 1 when requested CPU < 1.
default_from_api: true
- name: 'sessionAffinity'
type: Boolean
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/compute/go_Autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ properties:
key_description: |
A name for the schedule.
value_type:
name: scalingSchedule
type: NestedObject
properties:
- name: 'minRequiredReplicas'
Expand Down
33 changes: 29 additions & 4 deletions mmv1/products/compute/go_BackendService.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1250,19 +1250,44 @@ properties:
ClientTlsPolicy is a resource that specifies how a client should authenticate
connections to backends of a service. This resource itself does not affect
configuration unless it is attached to a backend service resource.
required: true
custom_expand: 'templates/terraform/custom_expand/go/resourceref_with_validation.go.tmpl'
resource: 'Region'
diff_suppress_func: 'tpgresource.ProjectNumberDiffSuppress'
resource: 'ClientTlsPolicy'
imports: 'name'
- name: 'subjectAltNames'
type: Array
description: |
A list of alternate names to verify the subject identity in the certificate.
If specified, the client will verify that the server certificate's subject
alt name matches one of the specified values.
required: true
item_type:
type: String
- name: 'awsV4Authentication'
type: NestedObject
description: |
The configuration needed to generate a signature for access to private storage buckets that support AWS's Signature Version 4 for authentication.
Allowed only for INTERNET_IP_PORT and INTERNET_FQDN_PORT NEG backends.
properties:
- name: 'accessKeyId'
type: String
description: |
The identifier of an access key used for s3 bucket authentication.
- name: 'accessKey'
type: String
description: |
The access key used for s3 bucket authentication.
Required for updating or creating a backend that uses AWS v4 signature authentication, but will not be returned as part of the configuration when queried with a REST API GET request.
ignore_read: true
sensitive: true
send_empty_value: true
- name: 'accessKeyVersion'
type: String
description: |
The optional version identifier for the access key. You can use this to keep track of different iterations of your access key.
- name: 'originRegion'
type: String
description: |
The name of the cloud region of your origin. This is a free-form field with the name of the region your cloud uses to host your origin.
For example, "us-east-1" for AWS or "us-ashburn-1" for OCI.
- name: 'sessionAffinity'
type: Enum
description: |
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/compute/go_NodeGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ properties:
key_description: |
The project ID.
value_type:
name: projectConfig
type: NestedObject
properties:
- name: 'projectId'
Expand Down
2 changes: 2 additions & 0 deletions mmv1/products/compute/go_PerInstanceConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ properties:
api_name: internalIPs
key_name: 'interface_name'
value_type:
name: internalIp
type: NestedObject
properties:
- name: 'autoDelete'
Expand Down Expand Up @@ -219,6 +220,7 @@ properties:
api_name: externalIPs
key_name: 'interface_name'
value_type:
name: externalIp
type: NestedObject
properties:
- name: 'autoDelete'
Expand Down
5 changes: 5 additions & 0 deletions mmv1/products/compute/go_PublicAdvertisedPrefix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ properties:
The IPv4 address range, in CIDR format, represented by this public
advertised prefix.
required: true
- name: 'sharedSecret'
type: String
description: |
Output Only. The shared secret to be used for reverse DNS verification.
output: true
1 change: 1 addition & 0 deletions mmv1/products/compute/go_RegionAutoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ properties:
key_description: |
A name for the schedule.
value_type:
name: scalingSchedule
type: NestedObject
properties:
- name: 'minRequiredReplicas'
Expand Down
2 changes: 2 additions & 0 deletions mmv1/products/compute/go_RegionPerInstanceConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ properties:
api_name: internalIPs
key_name: 'interface_name'
value_type:
name: internalIp
type: NestedObject
properties:
- name: 'autoDelete'
Expand Down Expand Up @@ -220,6 +221,7 @@ properties:
api_name: externalIPs
key_name: 'interface_name'
value_type:
name: externalIp
type: NestedObject
properties:
- name: 'autoDelete'
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/compute/go_Reservation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ properties:
key_description: |
The project id/number which is deleting or adding to the project list.
value_type:
name: projectConfig
type: NestedObject
properties:
- name: 'projectId'
Expand Down
1 change: 1 addition & 0 deletions mmv1/products/dialogflowcx/go_SecuritySettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ timeouts:
update_minutes: 40
delete_minutes: 20
custom_code:
post_create: 'templates/terraform/post_create/go/sleep.go.tmpl'
examples:
- name: 'dialogflowcx_security_settings_basic'
primary_resource_id: 'basic_security_settings'
Expand Down
123 changes: 123 additions & 0 deletions mmv1/products/firestore/go_BackupSchedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# 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.

# Warning: This is a temporary file, and should not be edited directly
---
name: 'BackupSchedule'
description: |
A backup schedule for a Cloud Firestore Database.
This resource is owned by the database it is backing up, and is deleted along with the database.
The actual backups are not though.
references:
guides:
'Official Documentation': 'https://cloud.google.com/firestore/docs/backups'
api: 'https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.backupSchedules'
docs:
warning: |
This resource creates a Firestore Backup Schedule on a project that already has
a Firestore database.
This resource is owned by the database it is backing up, and is deleted along
with the database. The actual backups are not though.
id_format: 'projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}'
base_url: 'projects/{{project}}/databases/{{database}}/backupSchedules'
self_link: 'projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}'
update_verb: 'PATCH'
update_mask: true
import_format:
- 'projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}'
- '{{project}}/{{database}}/{{name}}'
- '{{database}}/{{name}}'
timeouts:
insert_minutes: 20
update_minutes: 20
delete_minutes: 20
custom_code:
skip_sweeper: true
examples:
- name: 'firestore_backup_schedule_daily'
primary_resource_id: 'daily-backup'
vars:
database_id: 'database-id'
delete_protection_state: 'DELETE_PROTECTION_ENABLED'
test_env_vars:
project_id: 'PROJECT_NAME'
test_vars_overrides:
'delete_protection_state': '"DELETE_PROTECTION_DISABLED"'
- name: 'firestore_backup_schedule_weekly'
primary_resource_id: 'weekly-backup'
vars:
database_id: 'database-id'
delete_protection_state: 'DELETE_PROTECTION_ENABLED'
test_env_vars:
project_id: 'PROJECT_NAME'
test_vars_overrides:
'delete_protection_state': '"DELETE_PROTECTION_DISABLED"'
parameters:
- name: 'database'
type: String
description: |
The Firestore database id. Defaults to `"(default)"`.
url_param_only: true
immutable: true
default_value: "(default)"
properties:
- name: 'name'
type: String
description: |
The unique backup schedule identifier across all locations and databases for the given project. Format:
`projects/{{project}}/databases/{{database}}/backupSchedules/{{backupSchedule}}`
immutable: true
output: true
custom_flatten: 'templates/terraform/custom_flatten/go/name_from_self_link.tmpl'
- name: 'retention'
type: String
description: |
At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days.
A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
You can set this to a value up to 14 weeks.
required: true
- name: 'dailyRecurrence'
type: NestedObject
description: |
For a schedule that runs daily.
immutable: true
send_empty_value: true
allow_empty_object: true
exactly_one_of:
- 'daily_recurrence'
- 'weekly_recurrence'
properties:
[]
- name: 'weeklyRecurrence'
type: NestedObject
description: |
For a schedule that runs weekly on a specific day.
immutable: true
exactly_one_of:
- 'weekly_recurrence'
- 'daily_recurrence'
properties:
- name: 'day'
type: Enum
description: |
The day of week to run.
enum_values:
- 'DAY_OF_WEEK_UNSPECIFIED'
- 'MONDAY'
- 'TUESDAY'
- 'WEDNESDAY'
- 'THURSDAY'
- 'FRIDAY'
- 'SATURDAY'
- 'SUNDAY'
Loading

0 comments on commit 59c6c29

Please sign in to comment.