Skip to content

Commit 109b92c

Browse files
authored
serviceDirectory: convert all resources to GA (#15459)
1 parent 429abd0 commit 109b92c

14 files changed

+29
-47
lines changed

mmv1/products/servicedirectory/Endpoint.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
name: 'Endpoint'
1616
description: |
1717
An individual endpoint that provides a service.
18-
min_version: 'beta'
1918
references:
2019
guides:
2120
'Configuring an endpoint': 'https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_an_endpoint'
22-
api: 'https://cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces.services.endpoints'
21+
api: 'https://cloud.google.com/service-directory/docs/reference/rest/v1/projects.locations.namespaces.services.endpoints'
2322
docs:
2423
base_url: '{{name}}'
2524
self_link: '{{name}}'
@@ -34,18 +33,19 @@ timeouts:
3433
delete_minutes: 20
3534
custom_code:
3635
custom_import: 'templates/terraform/custom_import/service_directory_endpoint.go.tmpl'
36+
encoder: 'templates/terraform/encoders/service_directory_metadata_to_annotations.go.tmpl'
37+
decoder: 'templates/terraform/decoders/service_directory_metadata_to_annotations.go.tmpl'
38+
3739
exclude_sweeper: true
3840
examples:
3941
- name: 'service_directory_endpoint_basic'
4042
primary_resource_id: 'example'
41-
min_version: 'beta'
4243
vars:
4344
service_id: 'example-service'
4445
namespace_id: 'example-namespace'
4546
endpoint_id: 'example-endpoint'
4647
- name: 'service_directory_endpoint_with_network'
4748
primary_resource_id: 'example'
48-
min_version: 'beta'
4949
vars:
5050
service_id: 'example-service'
5151
namespace_id: 'example-namespace'
@@ -56,7 +56,6 @@ parameters:
5656
type: String
5757
description: |
5858
The resource name of the service that this endpoint provides.
59-
min_version: 'beta'
6059
url_param_only: true
6160
required: true
6261
immutable: true
@@ -66,7 +65,6 @@ parameters:
6665
description: |
6766
The Resource ID must be 1-63 characters long, including digits,
6867
lowercase letters or the hyphen character.
69-
min_version: 'beta'
7068
url_param_only: true
7169
required: true
7270
immutable: true
@@ -78,34 +76,31 @@ properties:
7876
description: |
7977
The resource name for the endpoint in the format
8078
`projects/*/locations/*/namespaces/*/services/*/endpoints/*`.
81-
min_version: 'beta'
8279
output: true
8380
- name: 'address'
8481
type: String
8582
description: |
8683
IPv4 or IPv6 address of the endpoint.
87-
min_version: 'beta'
8884
validation:
8985
function: 'verify.ValidateIpAddress'
9086
- name: 'port'
9187
type: Integer
9288
description: |
9389
Port that the endpoint is running on, must be in the
9490
range of [0, 65535]. If unspecified, the default is 0.
95-
min_version: 'beta'
9691
validation:
9792
function: 'validation.IntBetween(0, 65535)'
9893
- name: 'metadata'
9994
type: KeyValuePairs
95+
update_mask_fields:
96+
- 'annotations'
10097
description: |
10198
Metadata for the endpoint. This data can be consumed
10299
by service clients. The entire metadata dictionary may contain
103100
up to 512 characters, spread across all key-value pairs.
104101
Metadata that goes beyond any these limits will be rejected.
105-
min_version: 'beta'
106102
- name: 'network'
107103
type: String
108104
description: |
109105
The URL to the network, such as projects/PROJECT_NUMBER/locations/global/networks/NETWORK_NAME.
110-
min_version: 'beta'
111106
immutable: true

mmv1/products/servicedirectory/Namespace.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ name: 'Namespace'
1616
description: |
1717
A container for `services`. Namespaces allow administrators to group services
1818
together and define permissions for a collection of services.
19-
min_version: 'beta'
2019
references:
2120
guides:
2221
'Configuring a namespace': 'https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_a_namespace'
23-
api: 'https://cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces'
22+
api: 'https://cloud.google.com/service-directory/docs/reference/rest/v1/projects.locations.namespaces'
2423
docs:
2524
base_url: '{{name}}'
2625
self_link: '{{name}}'
@@ -44,17 +43,13 @@ exclude_sweeper: true
4443
examples:
4544
- name: 'service_directory_namespace_basic'
4645
primary_resource_id: 'example'
47-
min_version: 'beta'
4846
vars:
4947
namespace_id: 'example-namespace'
5048
parameters:
5149
- name: 'location'
5250
type: String
5351
description: |
5452
The location for the Namespace.
55-
A full list of valid locations can be found by running
56-
`gcloud beta service-directory locations list`.
57-
min_version: 'beta'
5853
url_param_only: true
5954
required: true
6055
immutable: true
@@ -64,7 +59,6 @@ parameters:
6459
description: |
6560
The Resource ID must be 1-63 characters long, including digits,
6661
lowercase letters or the hyphen character.
67-
min_version: 'beta'
6862
url_param_only: true
6963
required: true
7064
immutable: true
@@ -76,12 +70,10 @@ properties:
7670
description: |
7771
The resource name for the namespace
7872
in the format `projects/*/locations/*/namespaces/*`.
79-
min_version: 'beta'
8073
output: true
8174
- name: 'labels'
8275
type: KeyValueLabels
8376
description: |
8477
Resource labels associated with this Namespace. No more than 64 user
8578
labels can be associated with a given resource. Label keys and values can
8679
be no longer than 63 characters.
87-
min_version: 'beta'

mmv1/products/servicedirectory/Service.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
name: 'Service'
1616
description: |
1717
An individual service. A service contains a name and optional metadata.
18-
min_version: 'beta'
1918
references:
2019
guides:
2120
'Configuring a service': 'https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_a_service'
22-
api: 'https://cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces.services'
21+
api: 'https://cloud.google.com/service-directory/docs/reference/rest/v1/projects.locations.namespaces.services'
2322
docs:
2423
base_url: '{{name}}'
2524
self_link: '{{name}}'
@@ -39,11 +38,13 @@ iam_policy:
3938
parent_resource_attribute: 'name'
4039
custom_code:
4140
custom_import: 'templates/terraform/custom_import/service_directory_service.go.tmpl'
41+
encoder: 'templates/terraform/encoders/service_directory_metadata_to_annotations.go.tmpl'
42+
decoder: 'templates/terraform/decoders/service_directory_metadata_to_annotations.go.tmpl'
43+
4244
exclude_sweeper: true
4345
examples:
4446
- name: 'service_directory_service_basic'
4547
primary_resource_id: 'example'
46-
min_version: 'beta'
4748
vars:
4849
service_id: 'example-service'
4950
namespace_id: 'example-namespace'
@@ -52,7 +53,6 @@ parameters:
5253
type: String
5354
description: |
5455
The resource name of the namespace this service will belong to.
55-
min_version: 'beta'
5656
url_param_only: true
5757
required: true
5858
ignore_read: true
@@ -61,7 +61,6 @@ parameters:
6161
description: |
6262
The Resource ID must be 1-63 characters long, including digits,
6363
lowercase letters or the hyphen character.
64-
min_version: 'beta'
6564
url_param_only: true
6665
required: true
6766
immutable: true
@@ -73,13 +72,13 @@ properties:
7372
description: |
7473
The resource name for the service in the
7574
format `projects/*/locations/*/namespaces/*/services/*`.
76-
min_version: 'beta'
7775
output: true
7876
- name: 'metadata'
7977
type: KeyValuePairs
78+
update_mask_fields:
79+
- 'annotations'
8080
description: |
8181
Metadata for the service. This data can be consumed
8282
by service clients. The entire metadata dictionary may contain
8383
up to 2000 characters, spread across all key-value pairs.
8484
Metadata that goes beyond any these limits will be rejected.
85-
min_version: 'beta'

mmv1/products/servicedirectory/product.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: 'ServiceDirectory'
1616
display_name: 'Service Directory'
1717
versions:
18-
- name: 'beta'
19-
base_url: 'https://servicedirectory.googleapis.com/v1beta1/'
18+
- name: 'ga'
19+
base_url: 'https://servicedirectory.googleapis.com/v1/'
2020
scopes:
2121
- 'https://www.googleapis.com/auth/cloud-platform'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if _, ok := res["annotations"]; ok {
2+
res["metadata"] = res["annotations"].(map[string]interface{})
3+
delete(res, "annotations")
4+
}
5+
return res, nil
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
if obj["metadata"] == nil {
2+
return nil, nil
3+
}
4+
5+
obj["annotations"] = obj["metadata"].(map[string]string)
6+
delete(obj, "metadata")
7+
return obj, nil

mmv1/templates/terraform/examples/service_directory_endpoint_basic.tf.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" {
2-
provider = google-beta
32
namespace_id = "{{index $.Vars "namespace_id"}}"
43
location = "us-central1"
54
}
65

76
resource "google_service_directory_service" "{{$.PrimaryResourceId}}" {
8-
provider = google-beta
97
service_id = "{{index $.Vars "service_id"}}"
108
namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id
119
}
1210

1311
resource "google_service_directory_endpoint" "{{$.PrimaryResourceId}}" {
14-
provider = google-beta
1512
endpoint_id = "{{index $.Vars "endpoint_id"}}"
1613
service = google_service_directory_service.{{$.PrimaryResourceId}}.id
1714

mmv1/templates/terraform/examples/service_directory_endpoint_with_network.tf.tmpl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
data "google_project" "project" {
2-
provider = google-beta
32
}
43

54
resource "google_compute_network" "{{$.PrimaryResourceId}}" {
6-
provider = google-beta
75
name = "{{index $.Vars "network_name"}}"
86
}
97

108
resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" {
11-
provider = google-beta
129
namespace_id = "{{index $.Vars "namespace_id"}}"
1310
location = "us-central1"
1411
}
1512

1613
resource "google_service_directory_service" "{{$.PrimaryResourceId}}" {
17-
provider = google-beta
1814
service_id = "{{index $.Vars "service_id"}}"
1915
namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id
2016
}
2117

2218
resource "google_service_directory_endpoint" "{{$.PrimaryResourceId}}" {
23-
provider = google-beta
2419
endpoint_id = "{{index $.Vars "endpoint_id"}}"
2520
service = google_service_directory_service.{{$.PrimaryResourceId}}.id
2621

mmv1/templates/terraform/examples/service_directory_namespace_basic.tf.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" {
2-
provider = google-beta
32
namespace_id = "{{index $.Vars "namespace_id"}}"
43
location = "us-central1"
54

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
resource "google_service_directory_namespace" "{{$.PrimaryResourceId}}" {
2-
provider = google-beta
32
namespace_id = "{{index $.Vars "namespace_id"}}"
43
location = "us-central1"
54
}
65

76
resource "google_service_directory_service" "{{$.PrimaryResourceId}}" {
8-
provider = google-beta
97
service_id = "{{index $.Vars "service_id"}}"
108
namespace = google_service_directory_namespace.{{$.PrimaryResourceId}}.id
119

1210
metadata = {
1311
stage = "prod"
1412
region = "us-central1"
1513
}
16-
}
14+
}

0 commit comments

Comments
 (0)