diff --git a/google/cloud/servicedirectory/v1/BUILD.bazel b/google/cloud/servicedirectory/v1/BUILD.bazel new file mode 100644 index 000000000..678d4ac1c --- /dev/null +++ b/google/cloud/servicedirectory/v1/BUILD.bazel @@ -0,0 +1,336 @@ +# This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * extra_protoc_file_parameters +# The complete list of preserved parameters can be found in the source code. + +############################################################################## +# Common +############################################################################## +load("@rules_proto//proto:defs.bzl", "proto_library") +load( + "@com_google_googleapis_imports//:imports.bzl", + "csharp_gapic_assembly_pkg", + "csharp_gapic_library", + "csharp_grpc_library", + "csharp_proto_library", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", + "go_test", + "java_gapic_assembly_gradle_pkg", + "java_gapic_library", + "java_gapic_test", + "java_grpc_library", + "java_proto_library", + "moved_proto_library", + "nodejs_gapic_assembly_pkg", + "nodejs_gapic_library", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_grpc_library", + "php_proto_library", + "proto_library_with_info", + "py_gapic_assembly_pkg", + "py_gapic_library", + "py_grpc_library", + "py_proto_library", + "ruby_gapic_assembly_pkg", + "ruby_gapic_library", + "ruby_grpc_library", + "ruby_proto_library", +) + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "servicedirectory_proto", + srcs = [ + "endpoint.proto", + "lookup_service.proto", + "namespace.proto", + "registration_service.proto", + "service.proto", + ], + deps = [ + "//google/api:annotations_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/api:resource_proto", + "//google/iam/v1:iam_policy_proto", + "//google/iam/v1:policy_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:field_mask_proto", + ], +) + +proto_library_with_info( + name = "servicedirectory_proto_with_info", + deps = [ + ":servicedirectory_proto", + "//google/cloud:common_resources_proto", + ], +) + +java_proto_library( + name = "servicedirectory_java_proto", + deps = [":servicedirectory_proto"], +) + +java_grpc_library( + name = "servicedirectory_java_grpc", + srcs = [":servicedirectory_proto"], + deps = [":servicedirectory_java_proto"], +) + +java_gapic_library( + name = "servicedirectory_java_gapic", + src = ":servicedirectory_proto_with_info", + gapic_yaml = "servicedirectory_gapic.yaml", + grpc_service_config = "servicedirectory_grpc_service_config.json", + package = "google.cloud.servicedirectory.v1", + service_yaml = "servicedirectory_v1.yaml", + test_deps = [ + ":servicedirectory_java_grpc", + "//google/iam/v1:iam_java_grpc", + ], + deps = [ + ":servicedirectory_java_proto", + "//google/iam/v1:iam_java_proto", + ], +) + +java_gapic_test( + name = "servicedirectory_java_gapic_test_suite", + test_classes = [ + "com.google.cloud.servicedirectory.v1.LookupServiceClientTest", + "com.google.cloud.servicedirectory.v1.RegistrationServiceClientTest", + ], + runtime_deps = [":servicedirectory_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-servicedirectory-v1-java", + deps = [ + ":servicedirectory_java_gapic", + ":servicedirectory_java_grpc", + ":servicedirectory_java_proto", + ":servicedirectory_proto", + ], +) + +go_proto_library( + name = "servicedirectory_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1", + protos = [":servicedirectory_proto"], + deps = [ + "//google/api:annotations_go_proto", + "//google/iam/v1:iam_go_proto", + ], +) + +go_gapic_library( + name = "servicedirectory_go_gapic", + srcs = [":servicedirectory_proto_with_info"], + grpc_service_config = "servicedirectory_grpc_service_config.json", + importpath = "cloud.google.com/go/servicedirectory/apiv1;servicedirectory", + service_yaml = "servicedirectory_v1.yaml", + deps = [ + ":servicedirectory_go_proto", + "//google/iam/v1:iam_go_proto", + ], +) + +go_test( + name = "servicedirectory_go_gapic_test", + srcs = [":servicedirectory_go_gapic_srcjar_test"], + embed = [":servicedirectory_go_gapic"], + importpath = "cloud.google.com/go/servicedirectory/apiv1", +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-servicedirectory-v1-go", + deps = [ + ":servicedirectory_go_gapic", + ":servicedirectory_go_gapic_srcjar-test.srcjar", + ":servicedirectory_go_proto", + ], +) + +moved_proto_library( + name = "servicedirectory_moved_proto", + srcs = [":servicedirectory_proto"], + deps = [ + "//google/api:annotations_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/api:resource_proto", + "//google/iam/v1:iam_policy_proto", + "//google/iam/v1:policy_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:field_mask_proto", + ], +) + +py_proto_library( + name = "servicedirectory_py_proto", + plugin = "@protoc_docs_plugin//:docs_plugin", + deps = [":servicedirectory_moved_proto"], +) + +py_grpc_library( + name = "servicedirectory_py_grpc", + srcs = [":servicedirectory_moved_proto"], + deps = [":servicedirectory_py_proto"], +) + +py_gapic_library( + name = "servicedirectory_py_gapic", + src = ":servicedirectory_proto_with_info", + gapic_yaml = "servicedirectory_gapic.yaml", + grpc_service_config = "servicedirectory_grpc_service_config.json", + package = "google.cloud.servicedirectory.v1", + service_yaml = "servicedirectory_v1.yaml", + deps = [ + ":servicedirectory_py_grpc", + ":servicedirectory_py_proto", + ], +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "servicedirectory-v1-py", + deps = [ + ":servicedirectory_py_gapic", + ":servicedirectory_py_grpc", + ":servicedirectory_py_proto", + ], +) + +php_proto_library( + name = "servicedirectory_php_proto", + deps = [":servicedirectory_proto"], +) + +php_grpc_library( + name = "servicedirectory_php_grpc", + srcs = [":servicedirectory_proto"], + deps = [":servicedirectory_php_proto"], +) + +php_gapic_library( + name = "servicedirectory_php_gapic", + src = ":servicedirectory_proto_with_info", + gapic_yaml = "servicedirectory_gapic.yaml", + grpc_service_config = "servicedirectory_grpc_service_config.json", + package = "google.cloud.servicedirectory.v1", + service_yaml = "servicedirectory_v1.yaml", + deps = [ + ":servicedirectory_php_grpc", + ":servicedirectory_php_proto", + ], +) + +# Open Source Packages +php_gapic_assembly_pkg( + name = "google-cloud-servicedirectory-v1-php", + deps = [ + ":servicedirectory_php_gapic", + ":servicedirectory_php_grpc", + ":servicedirectory_php_proto", + ], +) + +nodejs_gapic_library( + name = "servicedirectory_nodejs_gapic", + package_name = "@google-cloud/service-directory", + src = ":servicedirectory_proto_with_info", + grpc_service_config = "servicedirectory_grpc_service_config.json", + main_service = "ServiceDirectory", + package = "google.cloud.servicedirectory.v1", + service_yaml = "servicedirectory_v1.yaml", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "servicedirectory-v1-nodejs", + deps = [ + ":servicedirectory_nodejs_gapic", + ":servicedirectory_proto", + ], +) + +ruby_proto_library( + name = "servicedirectory_ruby_proto", + deps = [":servicedirectory_proto"], +) + +ruby_grpc_library( + name = "servicedirectory_ruby_grpc", + srcs = [":servicedirectory_proto"], + deps = [":servicedirectory_ruby_proto"], +) + +ruby_gapic_library( + name = "servicedirectory_ruby_gapic", + src = ":servicedirectory_proto_with_info", + gapic_yaml = "servicedirectory_gapic.yaml", + grpc_service_config = "servicedirectory_grpc_service_config.json", + package = "google.cloud.servicedirectory.v1", + service_yaml = "servicedirectory_v1.yaml", + deps = [ + ":servicedirectory_ruby_grpc", + ":servicedirectory_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-servicedirectory-v1-ruby", + deps = [ + ":servicedirectory_ruby_gapic", + ":servicedirectory_ruby_grpc", + ":servicedirectory_ruby_proto", + ], +) + +csharp_proto_library( + name = "servicedirectory_csharp_proto", + deps = [":servicedirectory_proto"], +) + +csharp_grpc_library( + name = "servicedirectory_csharp_grpc", + srcs = [":servicedirectory_proto"], + deps = [":servicedirectory_csharp_proto"], +) + +csharp_gapic_library( + name = "servicedirectory_csharp_gapic", + srcs = [":servicedirectory_proto_with_info"], + common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json", + grpc_service_config = "servicedirectory_grpc_service_config.json", + deps = [ + ":servicedirectory_csharp_grpc", + ":servicedirectory_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-servicedirectory-v1-csharp", + deps = [ + ":servicedirectory_csharp_gapic", + ":servicedirectory_csharp_grpc", + ":servicedirectory_csharp_proto", + ], +) diff --git a/google/cloud/servicedirectory/v1/endpoint.proto b/google/cloud/servicedirectory/v1/endpoint.proto new file mode 100644 index 000000000..1f8670067 --- /dev/null +++ b/google/cloud/servicedirectory/v1/endpoint.proto @@ -0,0 +1,75 @@ +// Copyright 2020 Google LLC +// +// 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. +syntax = "proto3"; + +package google.cloud.servicedirectory.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceDirectory.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1;servicedirectory"; +option java_multiple_files = true; +option java_outer_classname = "EndpointProto"; +option java_package = "com.google.cloud.servicedirectory.v1"; +option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1"; +option ruby_package = "Google::Cloud::ServiceDirectory::V1"; + +// An individual endpoint that provides a +// [service][google.cloud.servicedirectory.v1.Service]. The service must +// already exist to create an endpoint. +message Endpoint { + option (google.api.resource) = { + type: "servicedirectory.googleapis.com/Endpoint" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}/endpoints/{endpoint}" + }; + + // Immutable. The resource name for the endpoint in the format + // 'projects/*/locations/*/namespaces/*/services/*/endpoints/*'. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + // Optional. An IPv4 or IPv6 address. Service Directory will reject bad + // addresses like: + // "8.8.8" + // "8.8.8.8:53" + // "test:bad:address" + // "[::1]" + // "[::1]:8080" + // Limited to 45 characters. + string address = 2 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Service Directory will reject values outside of [0, 65535]. + int32 port = 3 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Annotations for the endpoint. This data can be consumed by + // service clients. Restrictions: + // - The entire annotations dictionary may contain up to 512 characters, + // spread accoss all key-value pairs. Annotations that goes beyond any + // these limits will be rejected. + // - Valid annotation keys have two segments: an optional prefix and name, + // separated by a slash (/). The name segment is required and must be 63 + // characters or less, beginning and ending with an alphanumeric character + // ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and + // alphanumerics between. The prefix is optional. If specified, the prefix + // must be a DNS subdomain: a series of DNS labels separated by dots (.), + // not longer than 253 characters in total, followed by a slash (/). + // Annotations that fails to meet these requirements will be rejected. + // - The '(*.)google.com/' and '(*.)googleapis.com/' prefixes are reserved + // for system annotations managed by Service Directory. If the user tries + // to write to these keyspaces, those entries will be silently ignored by + // the system. + // Note: This field is equivalent to the 'metadata' field in the v1beta1 API. + // They have the same syntax and read/write to the same location in Service + // Directory. + map annotations = 5 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/google/cloud/servicedirectory/v1/lookup_service.proto b/google/cloud/servicedirectory/v1/lookup_service.proto new file mode 100644 index 000000000..c51582b31 --- /dev/null +++ b/google/cloud/servicedirectory/v1/lookup_service.proto @@ -0,0 +1,93 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.servicedirectory.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/servicedirectory/v1/service.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceDirectory.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1;servicedirectory"; +option java_multiple_files = true; +option java_outer_classname = "LookupServiceProto"; +option java_package = "com.google.cloud.servicedirectory.v1"; +option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1"; +option ruby_package = "Google::Cloud::ServiceDirectory::V1"; + +// Service Directory API for looking up service data at runtime. +service LookupService { + option (google.api.default_host) = "servicedirectory.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Returns a [service][google.cloud.servicedirectory.v1.Service] and its + // associated endpoints. + // Resolving a service is not considered an active developer method. + rpc ResolveService(ResolveServiceRequest) returns (ResolveServiceResponse) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/namespaces/*/services/*}:resolve" + body: "*" + }; + } +} + +// The request message for +// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService]. +// Looks up a service by its name, returns the service and its endpoints. +message ResolveServiceRequest { + // Required. The name of the service to resolve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of endpoints to return. Defaults to 25. + // Maximum is 100. If a value less than one is specified, the Default is used. + // If a value greater than the Maximum is specified, the Maximum is used. + int32 max_endpoints = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter applied to the endpoints of the resolved service. + // + // General filter string syntax: + // () + // can be "name" or "metadata." for map field. + // can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS and is + // roughly the same as "=". + // must be the same data type as the field. + // can be "AND, OR, NOT". + // + // Examples of valid filters: + // * "metadata.owner" returns Endpoints that have a label with the + // key "owner", this is the same as "metadata:owner" + // * "metadata.protocol=gRPC" returns Endpoints that have key/value + // "protocol=gRPC" + // * "metadata.owner!=sd AND metadata.foo=bar" returns + // Endpoints that have "owner" field in metadata with a value that is not + // "sd" AND have the key/value foo=bar. + string endpoint_filter = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [LookupService.ResolveService][google.cloud.servicedirectory.v1.LookupService.ResolveService]. +message ResolveServiceResponse { + Service service = 1; +} diff --git a/google/cloud/servicedirectory/v1/namespace.proto b/google/cloud/servicedirectory/v1/namespace.proto new file mode 100644 index 000000000..bd7f81484 --- /dev/null +++ b/google/cloud/servicedirectory/v1/namespace.proto @@ -0,0 +1,49 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.servicedirectory.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceDirectory.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1;servicedirectory"; +option java_multiple_files = true; +option java_outer_classname = "NamespaceProto"; +option java_package = "com.google.cloud.servicedirectory.v1"; +option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1"; +option ruby_package = "Google::Cloud::ServiceDirectory::V1"; + +// A container for [services][google.cloud.servicedirectory.v1.Service]. +// Namespaces allow administrators to group services together and define +// permissions for a collection of services. +message Namespace { + option (google.api.resource) = { + type: "servicedirectory.googleapis.com/Namespace" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}" + }; + + // Immutable. The resource name for the namespace in the format + // 'projects/*/locations/*/namespaces/*'. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Resource labels associated with this Namespace. + // No more than 64 user labels can be associated with a given resource. Label + // keys and values can be no longer than 63 characters. + map labels = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/google/cloud/servicedirectory/v1/registration_service.proto b/google/cloud/servicedirectory/v1/registration_service.proto new file mode 100644 index 000000000..8c0a61a70 --- /dev/null +++ b/google/cloud/servicedirectory/v1/registration_service.proto @@ -0,0 +1,595 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.servicedirectory.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/servicedirectory/v1/endpoint.proto"; +import "google/cloud/servicedirectory/v1/namespace.proto"; +import "google/cloud/servicedirectory/v1/service.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceDirectory.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1;servicedirectory"; +option java_multiple_files = true; +option java_outer_classname = "RegistrationServiceProto"; +option java_package = "com.google.cloud.servicedirectory.v1"; +option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1"; +option ruby_package = "Google::Cloud::ServiceDirectory::V1"; + +// Service Directory API for registering services. It defines the following +// resource model: +// +// - The API has a collection of +// [Namespace][google.cloud.servicedirectory.v1.Namespace] +// resources, named `projects/*/locations/*/namespaces/*`. +// +// - Each Namespace has a collection of +// [Service][google.cloud.servicedirectory.v1.Service] resources, named +// `projects/*/locations/*/namespaces/*/services/*`. +// +// - Each Service has a collection of +// [Endpoint][google.cloud.servicedirectory.v1.Endpoint] +// resources, named +// `projects/*/locations/*/namespaces/*/services/*/endpoints/*`. +service RegistrationService { + option (google.api.default_host) = "servicedirectory.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a namespace, and returns the new Namespace. + rpc CreateNamespace(CreateNamespaceRequest) returns (Namespace) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/namespaces" + body: "namespace" + }; + option (google.api.method_signature) = "parent,namespace,namespace_id"; + } + + // Lists all namespaces. + rpc ListNamespaces(ListNamespacesRequest) returns (ListNamespacesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/namespaces" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a namespace. + rpc GetNamespace(GetNamespaceRequest) returns (Namespace) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/namespaces/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a namespace. + rpc UpdateNamespace(UpdateNamespaceRequest) returns (Namespace) { + option (google.api.http) = { + patch: "/v1/{namespace.name=projects/*/locations/*/namespaces/*}" + body: "namespace" + }; + option (google.api.method_signature) = "namespace,update_mask"; + } + + // Deletes a namespace. This also deletes all services and endpoints in + // the namespace. + rpc DeleteNamespace(DeleteNamespaceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/namespaces/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a service, and returns the new Service. + rpc CreateService(CreateServiceRequest) returns (Service) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/namespaces/*}/services" + body: "service" + }; + option (google.api.method_signature) = "parent,service,service_id"; + } + + // Lists all services belonging to a namespace. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/namespaces/*}/services" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a service. + rpc GetService(GetServiceRequest) returns (Service) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/namespaces/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a service. + rpc UpdateService(UpdateServiceRequest) returns (Service) { + option (google.api.http) = { + patch: "/v1/{service.name=projects/*/locations/*/namespaces/*/services/*}" + body: "service" + }; + option (google.api.method_signature) = "service,update_mask"; + } + + // Deletes a service. This also deletes all endpoints associated with + // the service. + rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/namespaces/*/services/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a endpoint, and returns the new Endpoint. + rpc CreateEndpoint(CreateEndpointRequest) returns (Endpoint) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/namespaces/*/services/*}/endpoints" + body: "endpoint" + }; + option (google.api.method_signature) = "parent,endpoint,endpoint_id"; + } + + // Lists all endpoints. + rpc ListEndpoints(ListEndpointsRequest) returns (ListEndpointsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/namespaces/*/services/*}/endpoints" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a endpoint. + rpc GetEndpoint(GetEndpointRequest) returns (Endpoint) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/namespaces/*/services/*/endpoints/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a endpoint. + rpc UpdateEndpoint(UpdateEndpointRequest) returns (Endpoint) { + option (google.api.http) = { + patch: "/v1/{endpoint.name=projects/*/locations/*/namespaces/*/services/*/endpoints/*}" + body: "endpoint" + }; + option (google.api.method_signature) = "endpoint,update_mask"; + } + + // Deletes a endpoint. + rpc DeleteEndpoint(DeleteEndpointRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/namespaces/*/services/*/endpoints/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the IAM Policy for a resource (namespace or service only). + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/namespaces/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/locations/*/namespaces/*/services/*}:getIamPolicy" + body: "*" + } + }; + } + + // Sets the IAM Policy for a resource (namespace or service only). + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/namespaces/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/locations/*/namespaces/*/services/*}:setIamPolicy" + body: "*" + } + }; + } + + // Tests IAM permissions for a resource (namespace or service only). + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/locations/*/namespaces/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/locations/*/namespaces/*/services/*}:testIamPermissions" + body: "*" + } + }; + } +} + +// The request message for +// [RegistrationService.CreateNamespace][google.cloud.servicedirectory.v1.RegistrationService.CreateNamespace]. +message CreateNamespaceRequest { + // Required. The resource name of the project and location the namespace + // will be created in. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The Resource ID must be 1-63 characters long, and comply with + // RFC1035. + // Specifically, the name must be 1-63 characters long and match the regular + // expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first + // character must be a lowercase letter, and all following characters must + // be a dash, lowercase letter, or digit, except the last character, which + // cannot be a dash. + string namespace_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A namespace with initial fields set. + Namespace namespace = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [RegistrationService.ListNamespaces][google.cloud.servicedirectory.v1.RegistrationService.ListNamespaces]. +message ListNamespacesRequest { + // Required. The resource name of the project and location whose namespaces + // we'd like to list. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. The maximum number of items to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous List request, + // if any. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to list result by. + // + // General filter string syntax: + // () + // can be "name", or "labels." for map field. + // can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS, and + // is roughly the same as "=". + // must be the same data type as field. + // can be "AND, OR, NOT". + // + // Examples of valid filters: + // * "labels.owner" returns Namespaces that have a label with the key "owner" + // this is the same as "labels:owner". + // * "labels.protocol=gRPC" returns Namespaces that have key/value + // "protocol=gRPC". + // * "name>projects/my-project/locations/us-east/namespaces/namespace-c" + // returns Namespaces that have name that is alphabetically later than the + // string, so "namespace-e" will be returned but "namespace-a" will not be. + // * "labels.owner!=sd AND labels.foo=bar" returns Namespaces that have + // "owner" in label key but value is not "sd" AND have key/value foo=bar. + // * "doesnotexist.foo=bar" returns an empty list. Note that Namespace doesn't + // have a field called "doesnotexist". Since the filter does not match any + // Namespaces, it returns no results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to list result by. + // + // General order by string syntax: + // () (,) + // allows values {"name"} + // ascending or descending order by . If this is left + // blank, "asc" is used. + // Note that an empty order_by string result in default order, which is order + // by name in ascending order. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [RegistrationService.ListNamespaces][google.cloud.servicedirectory.v1.RegistrationService.ListNamespaces]. +message ListNamespacesResponse { + // The list of namespaces. + repeated Namespace namespaces = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for +// [RegistrationService.GetNamespace][google.cloud.servicedirectory.v1.RegistrationService.GetNamespace]. +message GetNamespaceRequest { + // Required. The name of the namespace to retrieve. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Namespace" + } + ]; +} + +// The request message for +// [RegistrationService.UpdateNamespace][google.cloud.servicedirectory.v1.RegistrationService.UpdateNamespace]. +message UpdateNamespaceRequest { + // Required. The updated namespace. + Namespace namespace = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [RegistrationService.DeleteNamespace][google.cloud.servicedirectory.v1.RegistrationService.DeleteNamespace]. +message DeleteNamespaceRequest { + // Required. The name of the namespace to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Namespace" + } + ]; +} + +// The request message for +// [RegistrationService.CreateService][google.cloud.servicedirectory.v1.RegistrationService.CreateService]. +message CreateServiceRequest { + // Required. The resource name of the namespace this service will belong to. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Namespace" + } + ]; + + // Required. The Resource ID must be 1-63 characters long, and comply with + // RFC1035. + // Specifically, the name must be 1-63 characters long and match the regular + // expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first + // character must be a lowercase letter, and all following characters must + // be a dash, lowercase letter, or digit, except the last character, which + // cannot be a dash. + string service_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A service with initial fields set. + Service service = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [RegistrationService.ListServices][google.cloud.servicedirectory.v1.RegistrationService.ListServices]. +message ListServicesRequest { + // Required. The resource name of the namespace whose services we'd + // like to list. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Namespace" + } + ]; + + // Optional. The maximum number of items to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous List request, + // if any. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to list result by. + // + // General filter string syntax: + // () + // can be "name", or "metadata." for map field. + // can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS, and + // is roughly the same as "=". + // must be the same data type as field. + // can be "AND, OR, NOT". + // + // Examples of valid filters: + // * "metadata.owner" returns Services that have a label with the key "owner" + // this is the same as "metadata:owner". + // * "metadata.protocol=gRPC" returns Services that have key/value + // "protocol=gRPC". + // * "name>projects/my-project/locations/us-east/namespaces/my-namespace/services/service-c" + // returns Services that have name that is alphabetically later than the + // string, so "service-e" will be returned but "service-a" will not be. + // * "metadata.owner!=sd AND metadata.foo=bar" returns Services that have + // "owner" in label key but value is not "sd" AND have key/value foo=bar. + // * "doesnotexist.foo=bar" returns an empty list. Note that Service doesn't + // have a field called "doesnotexist". Since the filter does not match any + // Services, it returns no results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to list result by. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [RegistrationService.ListServices][google.cloud.servicedirectory.v1.RegistrationService.ListServices]. +message ListServicesResponse { + // The list of services. + repeated Service services = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for +// [RegistrationService.GetService][google.cloud.servicedirectory.v1.RegistrationService.GetService]. +// This should not be used for looking up a service. Insead, use the `resolve` +// method as it will contain all endpoints and associated metadata. +message GetServiceRequest { + // Required. The name of the service to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; +} + +// The request message for +// [RegistrationService.UpdateService][google.cloud.servicedirectory.v1.RegistrationService.UpdateService]. +message UpdateServiceRequest { + // Required. The updated service. + Service service = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [RegistrationService.DeleteService][google.cloud.servicedirectory.v1.RegistrationService.DeleteService]. +message DeleteServiceRequest { + // Required. The name of the service to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; +} + +// The request message for +// [RegistrationService.CreateEndpoint][google.cloud.servicedirectory.v1.RegistrationService.CreateEndpoint]. +message CreateEndpointRequest { + // Required. The resource name of the service that this endpoint provides. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; + + // Required. The Resource ID must be 1-63 characters long, and comply with + // RFC1035. + // Specifically, the name must be 1-63 characters long and match the regular + // expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?` which means the first + // character must be a lowercase letter, and all following characters must + // be a dash, lowercase letter, or digit, except the last character, which + // cannot be a dash. + string endpoint_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A endpoint with initial fields set. + Endpoint endpoint = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [RegistrationService.ListEndpoints][google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints]. +message ListEndpointsRequest { + // Required. The resource name of the service whose endpoints we'd like to + // list. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Service" + } + ]; + + // Optional. The maximum number of items to return. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous List request, + // if any. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The filter to list result by. + // + // General filter string syntax: + // () + // can be "name", "address", "port" or "metadata." for map field. + // can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS, and + // is roughly the same as "=". + // must be the same data type as field. + // can be "AND, OR, NOT". + // + // Examples of valid filters: + // * "metadata.owner" returns Endpoints that have a label with the key "owner" + // this is the same as "metadata:owner". + // * "metadata.protocol=gRPC" returns Endpoints that have key/value + // "protocol=gRPC". + // * "address=192.108.1.105" returns Endpoints that have this address. + // * "port>8080" returns Endpoints that have port number larger than 8080. + // * "name>projects/my-project/locations/us-east/namespaces/my-namespace/services/my-service/endpoints/endpoint-c" + // returns Endpoints that have name that is alphabetically later than the + // string, so "endpoint-e" will be returned but "endpoint-a" will not be. + // * "metadata.owner!=sd AND metadata.foo=bar" returns Endpoints that have + // "owner" in label key but value is not "sd" AND have key/value foo=bar. + // * "doesnotexist.foo=bar" returns an empty list. Note that Endpoint doesn't + // have a field called "doesnotexist". Since the filter does not match any + // Endpoints, it returns no results. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The order to list result by. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [RegistrationService.ListEndpoints][google.cloud.servicedirectory.v1.RegistrationService.ListEndpoints]. +message ListEndpointsResponse { + // The list of endpoints. + repeated Endpoint endpoints = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// The request message for +// [RegistrationService.GetEndpoint][google.cloud.servicedirectory.v1.RegistrationService.GetEndpoint]. +// This should not be used to lookup endpoints at runtime. Instead, use +// the `resolve` method. +message GetEndpointRequest { + // Required. The name of the endpoint to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Endpoint" + } + ]; +} + +// The request message for +// [RegistrationService.UpdateEndpoint][google.cloud.servicedirectory.v1.RegistrationService.UpdateEndpoint]. +message UpdateEndpointRequest { + // Required. The updated endpoint. + Endpoint endpoint = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of fields to be updated in this request. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [RegistrationService.DeleteEndpoint][google.cloud.servicedirectory.v1.RegistrationService.DeleteEndpoint]. +message DeleteEndpointRequest { + // Required. The name of the endpoint to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "servicedirectory.googleapis.com/Endpoint" + } + ]; +} diff --git a/google/cloud/servicedirectory/v1/service.proto b/google/cloud/servicedirectory/v1/service.proto new file mode 100644 index 000000000..81f60af82 --- /dev/null +++ b/google/cloud/servicedirectory/v1/service.proto @@ -0,0 +1,74 @@ +// Copyright 2020 Google LLC +// +// 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. + +syntax = "proto3"; + +package google.cloud.servicedirectory.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/servicedirectory/v1/endpoint.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.ServiceDirectory.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1;servicedirectory"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.servicedirectory.v1"; +option php_namespace = "Google\\Cloud\\ServiceDirectory\\V1"; +option ruby_package = "Google::Cloud::ServiceDirectory::V1"; + +// An individual service. A service contains a name and optional metadata. +// A service must exist before +// [endpoints][google.cloud.servicedirectory.v1.Endpoint] can be +// added to it. +message Service { + option (google.api.resource) = { + type: "servicedirectory.googleapis.com/Service" + pattern: "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}" + }; + + // Immutable. The resource name for the service in the format + // 'projects/*/locations/*/namespaces/*/services/*'. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Annotations for the service. This data can be consumed by service + // clients. + // Restrictions: + // - The entire annotations dictionary may contain up to 2000 characters, + // spread accoss all key-value pairs. Annotations that goes beyond any + // these limits will be rejected. + // - Valid annotation keys have two segments: an optional prefix and name, + // separated by a slash (/). The name segment is required and must be 63 + // characters or less, beginning and ending with an alphanumeric character + // ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and + // alphanumerics between. The prefix is optional. If specified, the prefix + // must be a DNS subdomain: a series of DNS labels separated by dots (.), + // not longer than 253 characters in total, followed by a slash (/). + // Annotations that fails to meet these requirements will be rejected. + // - The '(*.)google.com/' and '(*.)googleapis.com/' prefixes are reserved + // for system annotations managed by Service Directory. If the user tries + // to write to these keyspaces, those entries will be silently ignored by + // the system. + // Note: This field is equivalent to the 'metadata' field in the v1beta1 API. + // They have the same syntax and read/write to the same location in Service + // Directory. + map annotations = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Endpoints associated with this service. Returned on + // LookupService.Resolve. Control plane clients should use + // RegistrationService.ListEndpoints. + repeated Endpoint endpoints = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/google/cloud/servicedirectory/v1/servicedirectory_gapic.yaml b/google/cloud/servicedirectory/v1/servicedirectory_gapic.yaml new file mode 100644 index 000000000..640d10733 --- /dev/null +++ b/google/cloud/servicedirectory/v1/servicedirectory_gapic.yaml @@ -0,0 +1,18 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 2.0.0 +language_settings: + java: + package_name: com.google.cloud.servicedirectory.v1 + python: + package_name: google.cloud.servicedirectory_v1.gapic + go: + package_name: cloud.google.com/go/servicedirectory/apiv1 + csharp: + package_name: Google.Cloud.ServiceDirectory.V1 + ruby: + package_name: Google::Cloud::ServiceDirectory::V1 + php: + package_name: Google\Cloud\ServiceDirectory\V1 + nodejs: + package_name: servicedirectory.v1 + domain_layer_location: google-cloud diff --git a/google/cloud/servicedirectory/v1/servicedirectory_grpc_service_config.json b/google/cloud/servicedirectory/v1/servicedirectory_grpc_service_config.json new file mode 100644 index 000000000..32affec35 --- /dev/null +++ b/google/cloud/servicedirectory/v1/servicedirectory_grpc_service_config.json @@ -0,0 +1,26 @@ +{ + "methodConfig": [ + { + "name": [{ "service": "google.cloud.servicedirectory.v1.RegistrationService" }], + "timeout": "15s", + "retryPolicy": { + "maxAttempts": 5, + "initialBackoff": "1s", + "maxBackoff": "60s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": ["UNAVAILABLE", "UNKNOWN"] + } + }, + { + "name": [{ "service": "google.cloud.servicedirectory.v1.LookupService" }], + "timeout": "15s", + "retryPolicy": { + "maxAttempts": 5, + "initialBackoff": "1s", + "maxBackoff": "60s", + "backoffMultiplier": 1.3, + "retryableStatusCodes": ["UNAVAILABLE", "UNKNOWN"] + } + } + ] +} diff --git a/google/cloud/servicedirectory/v1/servicedirectory_v1.yaml b/google/cloud/servicedirectory/v1/servicedirectory_v1.yaml new file mode 100644 index 000000000..a7120e8dc --- /dev/null +++ b/google/cloud/servicedirectory/v1/servicedirectory_v1.yaml @@ -0,0 +1,24 @@ +type: google.api.Service +config_version: 3 +name: servicedirectory.googleapis.com +title: Service Directory API + +apis: +- name: google.cloud.servicedirectory.v1.LookupService +- name: google.cloud.servicedirectory.v1.RegistrationService + +documentation: + summary: |- + Service Directory is a platform for discovering, publishing, and connecting + services. + +authentication: + rules: + - selector: google.cloud.servicedirectory.v1.LookupService.ResolveService + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform + - selector: 'google.cloud.servicedirectory.v1.RegistrationService.*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform