From 5e1f1b722aa8dac079a371b8c91c95cf14a3347f Mon Sep 17 00:00:00 2001 From: summerji Date: Wed, 1 Jul 2020 10:25:05 -0700 Subject: [PATCH 1/6] build: add java test for quota project id --- .gitignore | 1 + google/api/BUILD.bazel | 671 ++++++++++++++++++ google/api/README.md | 5 + google/api/annotations.proto | 31 + google/api/auth.proto | 184 +++++ google/api/backend.proto | 127 ++++ google/api/billing.proto | 67 ++ google/api/client.proto | 100 +++ google/api/config_change.proto | 85 +++ google/api/consumer.proto | 82 +++ google/api/context.proto | 90 +++ google/api/control.proto | 33 + google/api/distribution.proto | 212 ++++++ google/api/documentation.proto | 157 ++++ google/api/endpoint.proto | 70 ++ google/api/expr/BUILD.bazel | 1 + google/api/expr/artman_cel.yaml | 37 + google/api/expr/cel.yaml | 61 ++ google/api/expr/v1alpha1/BUILD.bazel | 522 ++++++++++++++ google/api/expr/v1alpha1/cel.yaml | 69 ++ google/api/expr/v1alpha1/cel_gapic.yaml | 248 +++++++ google/api/expr/v1alpha1/cel_service.proto | 44 ++ google/api/expr/v1alpha1/checked.proto | 331 +++++++++ .../expr/v1alpha1/conformance_service.proto | 170 +++++ google/api/expr/v1alpha1/eval.proto | 119 ++++ google/api/expr/v1alpha1/explain.proto | 54 ++ google/api/expr/v1alpha1/syntax.proto | 328 +++++++++ google/api/expr/v1alpha1/value.proto | 116 +++ google/api/expr/v1beta1/BUILD.bazel | 91 +++ google/api/expr/v1beta1/decl.proto | 84 +++ google/api/expr/v1beta1/eval.proto | 125 ++++ google/api/expr/v1beta1/expr.proto | 265 +++++++ google/api/expr/v1beta1/source.proto | 62 ++ google/api/expr/v1beta1/value.proto | 114 +++ google/api/field_behavior.proto | 79 +++ google/api/http.proto | 376 ++++++++++ google/api/httpbody.proto | 78 ++ google/api/label.proto | 49 ++ google/api/launch_stage.proto | 67 ++ google/api/log.proto | 55 ++ google/api/logging.proto | 81 +++ google/api/metric.proto | 256 +++++++ google/api/monitored_resource.proto | 119 ++++ google/api/monitoring.proto | 91 +++ google/api/quota.proto | 187 +++++ google/api/resource.proto | 264 +++++++ google/api/service.proto | 176 +++++ google/api/serviceconfig.yaml | 24 + google/api/servicecontrol/BUILD.bazel | 0 google/api/servicecontrol/README.md | 126 ++++ .../api/servicecontrol/v1/check_error.proto | 133 ++++ .../api/servicecontrol/v1/distribution.proto | 158 +++++ google/api/servicecontrol/v1/log_entry.proto | 66 ++ .../api/servicecontrol/v1/metric_value.proto | 78 ++ google/api/servicecontrol/v1/operation.proto | 113 +++ .../servicecontrol/v1/quota_controller.proto | 206 ++++++ .../v1/service_controller.proto | 204 ++++++ google/api/servicemanagement/BUILD.bazel | 1 + google/api/servicemanagement/README.md | 102 +++ .../artman_servicemanagement_v1.yaml | 34 + .../servicemanagement_v1.yaml | 233 ++++++ google/api/servicemanagement/v1/BUILD.bazel | 383 ++++++++++ .../api/servicemanagement/v1/resources.proto | 299 ++++++++ .../v1/servicemanagement_gapic.yaml | 301 ++++++++ ...servicemanagement_grpc_service_config.json | 12 + .../servicemanagement/v1/servicemanager.proto | 503 +++++++++++++ google/api/source_info.proto | 32 + google/api/system_parameter.proto | 96 +++ google/api/usage.proto | 90 +++ google/cloud/common_resources.proto | 51 ++ google/iam/v1/BUILD.bazel | 99 +++ google/iam/v1/iam_gapic.yaml | 28 + google/iam/v1/iam_meta_api.yaml | 85 +++ google/iam/v1/iam_meta_api_gapic.yaml | 132 ++++ google/iam/v1/iam_policy.proto | 145 ++++ google/iam/v1/logging/BUILD.bazel | 62 ++ google/iam/v1/logging/audit_data.proto | 34 + google/iam/v1/options.proto | 41 ++ google/iam/v1/policy.proto | 240 +++++++ google/longrunning/BUILD.bazel | 114 +++ google/longrunning/README.md | 5 + google/longrunning/artman_longrunning.yaml | 31 + google/longrunning/longrunning.yaml | 72 ++ google/longrunning/longrunning_gapic.yaml | 100 +++ google/longrunning/operations.proto | 241 +++++++ google/rpc/BUILD.bazel | 109 +++ google/rpc/README.md | 5 + google/rpc/code.proto | 185 +++++ google/rpc/error_details.proto | 200 ++++++ google/rpc/rpc_publish.yaml | 28 + google/rpc/status.proto | 94 +++ google/type/BUILD.bazel | 235 ++++++ google/type/README.md | 16 + google/type/calendar_period.proto | 57 ++ google/type/color.proto | 170 +++++ google/type/date.proto | 50 ++ google/type/datetime.proto | 97 +++ google/type/dayofweek.proto | 51 ++ google/type/expr.proto | 51 ++ google/type/fraction.proto | 34 + google/type/latlng.proto | 38 + google/type/money.proto | 43 ++ google/type/month.proto | 66 ++ google/type/postal_address.proto | 135 ++++ google/type/quaternion.proto | 95 +++ google/type/timeofday.proto | 44 ++ google/type/type.yaml | 37 + .../com/google/api/showcase/ShowcaseTest.java | 84 +++ 108 files changed, 13232 insertions(+) create mode 100644 google/api/BUILD.bazel create mode 100644 google/api/README.md create mode 100644 google/api/annotations.proto create mode 100644 google/api/auth.proto create mode 100644 google/api/backend.proto create mode 100644 google/api/billing.proto create mode 100644 google/api/client.proto create mode 100644 google/api/config_change.proto create mode 100644 google/api/consumer.proto create mode 100644 google/api/context.proto create mode 100644 google/api/control.proto create mode 100644 google/api/distribution.proto create mode 100644 google/api/documentation.proto create mode 100644 google/api/endpoint.proto create mode 100644 google/api/expr/BUILD.bazel create mode 100644 google/api/expr/artman_cel.yaml create mode 100644 google/api/expr/cel.yaml create mode 100644 google/api/expr/v1alpha1/BUILD.bazel create mode 100644 google/api/expr/v1alpha1/cel.yaml create mode 100644 google/api/expr/v1alpha1/cel_gapic.yaml create mode 100644 google/api/expr/v1alpha1/cel_service.proto create mode 100644 google/api/expr/v1alpha1/checked.proto create mode 100644 google/api/expr/v1alpha1/conformance_service.proto create mode 100644 google/api/expr/v1alpha1/eval.proto create mode 100644 google/api/expr/v1alpha1/explain.proto create mode 100644 google/api/expr/v1alpha1/syntax.proto create mode 100644 google/api/expr/v1alpha1/value.proto create mode 100644 google/api/expr/v1beta1/BUILD.bazel create mode 100644 google/api/expr/v1beta1/decl.proto create mode 100644 google/api/expr/v1beta1/eval.proto create mode 100644 google/api/expr/v1beta1/expr.proto create mode 100644 google/api/expr/v1beta1/source.proto create mode 100644 google/api/expr/v1beta1/value.proto create mode 100644 google/api/field_behavior.proto create mode 100644 google/api/http.proto create mode 100644 google/api/httpbody.proto create mode 100644 google/api/label.proto create mode 100644 google/api/launch_stage.proto create mode 100644 google/api/log.proto create mode 100644 google/api/logging.proto create mode 100644 google/api/metric.proto create mode 100644 google/api/monitored_resource.proto create mode 100644 google/api/monitoring.proto create mode 100644 google/api/quota.proto create mode 100644 google/api/resource.proto create mode 100644 google/api/service.proto create mode 100644 google/api/serviceconfig.yaml create mode 100644 google/api/servicecontrol/BUILD.bazel create mode 100644 google/api/servicecontrol/README.md create mode 100644 google/api/servicecontrol/v1/check_error.proto create mode 100644 google/api/servicecontrol/v1/distribution.proto create mode 100644 google/api/servicecontrol/v1/log_entry.proto create mode 100644 google/api/servicecontrol/v1/metric_value.proto create mode 100644 google/api/servicecontrol/v1/operation.proto create mode 100644 google/api/servicecontrol/v1/quota_controller.proto create mode 100644 google/api/servicecontrol/v1/service_controller.proto create mode 100644 google/api/servicemanagement/BUILD.bazel create mode 100644 google/api/servicemanagement/README.md create mode 100644 google/api/servicemanagement/artman_servicemanagement_v1.yaml create mode 100644 google/api/servicemanagement/servicemanagement_v1.yaml create mode 100644 google/api/servicemanagement/v1/BUILD.bazel create mode 100644 google/api/servicemanagement/v1/resources.proto create mode 100644 google/api/servicemanagement/v1/servicemanagement_gapic.yaml create mode 100755 google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json create mode 100644 google/api/servicemanagement/v1/servicemanager.proto create mode 100644 google/api/source_info.proto create mode 100644 google/api/system_parameter.proto create mode 100644 google/api/usage.proto create mode 100644 google/cloud/common_resources.proto create mode 100644 google/iam/v1/BUILD.bazel create mode 100644 google/iam/v1/iam_gapic.yaml create mode 100644 google/iam/v1/iam_meta_api.yaml create mode 100644 google/iam/v1/iam_meta_api_gapic.yaml create mode 100644 google/iam/v1/iam_policy.proto create mode 100644 google/iam/v1/logging/BUILD.bazel create mode 100644 google/iam/v1/logging/audit_data.proto create mode 100644 google/iam/v1/options.proto create mode 100644 google/iam/v1/policy.proto create mode 100644 google/longrunning/BUILD.bazel create mode 100644 google/longrunning/README.md create mode 100644 google/longrunning/artman_longrunning.yaml create mode 100644 google/longrunning/longrunning.yaml create mode 100644 google/longrunning/longrunning_gapic.yaml create mode 100644 google/longrunning/operations.proto create mode 100644 google/rpc/BUILD.bazel create mode 100644 google/rpc/README.md create mode 100644 google/rpc/code.proto create mode 100644 google/rpc/error_details.proto create mode 100644 google/rpc/rpc_publish.yaml create mode 100644 google/rpc/status.proto create mode 100644 google/type/BUILD.bazel create mode 100644 google/type/README.md create mode 100644 google/type/calendar_period.proto create mode 100644 google/type/color.proto create mode 100644 google/type/date.proto create mode 100644 google/type/datetime.proto create mode 100644 google/type/dayofweek.proto create mode 100644 google/type/expr.proto create mode 100644 google/type/fraction.proto create mode 100644 google/type/latlng.proto create mode 100644 google/type/money.proto create mode 100644 google/type/month.proto create mode 100644 google/type/postal_address.proto create mode 100644 google/type/quaternion.proto create mode 100644 google/type/timeofday.proto create mode 100644 google/type/type.yaml diff --git a/.gitignore b/.gitignore index 8b51aa5f08..71f411366e 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ tmp *.iml *.ipr *.iws +.ijwb # Showcase src directories showcase-protos diff --git a/google/api/BUILD.bazel b/google/api/BUILD.bazel new file mode 100644 index 0000000000..ec6301030a --- /dev/null +++ b/google/api/BUILD.bazel @@ -0,0 +1,671 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +proto_library( + name = "annotations_proto", + srcs = ["annotations.proto"], + deps = [ + ":http_proto", + "@com_google_protobuf//:descriptor_proto", + ], +) + +proto_library( + name = "auth_proto", + srcs = ["auth.proto"], + deps = [":annotations_proto"], +) + +proto_library( + name = "backend_proto", + srcs = ["backend.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "billing_proto", + srcs = ["billing.proto"], + deps = [ + ":annotations_proto", + ":metric_proto", + ], +) + +proto_library( + name = "client_proto", + srcs = ["client.proto"], + deps = [ + "@com_google_protobuf//:descriptor_proto", + ], +) + +proto_library( + name = "config_change_proto", + srcs = ["config_change.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "consumer_proto", + srcs = ["consumer.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "context_proto", + srcs = ["context.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "control_proto", + srcs = ["control.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "distribution_proto", + srcs = ["distribution.proto"], + deps = [ + ":annotations_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library( + name = "documentation_proto", + srcs = ["documentation.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "endpoint_proto", + srcs = ["endpoint.proto"], + deps = [":annotations_proto"], +) + +proto_library( + name = "field_behavior_proto", + srcs = ["field_behavior.proto"], + deps = [ + "@com_google_protobuf//:descriptor_proto", + ], +) + +proto_library( + name = "http_proto", + srcs = ["http.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "httpbody_proto", + srcs = ["httpbody.proto"], + deps = ["@com_google_protobuf//:any_proto"], +) + +proto_library( + name = "label_proto", + srcs = ["label.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "launch_stage_proto", + srcs = ["launch_stage.proto"], +) + +proto_library( + name = "log_proto", + srcs = ["log.proto"], + deps = [":label_proto"], +) + +proto_library( + name = "logging_proto", + srcs = ["logging.proto"], + deps = [ + ":annotations_proto", + ":label_proto", + ], +) + +proto_library( + name = "metric_proto", + srcs = ["metric.proto"], + deps = [ + ":label_proto", + ":launch_stage_proto", + "@com_google_protobuf//:duration_proto", + ], +) + +proto_library( + name = "monitored_resource_proto", + srcs = ["monitored_resource.proto"], + deps = [ + ":label_proto", + ":launch_stage_proto", + "@com_google_protobuf//:struct_proto", + ], +) + +proto_library( + name = "monitoring_proto", + srcs = ["monitoring.proto"], + deps = [":annotations_proto"], +) + +proto_library( + name = "quota_proto", + srcs = ["quota.proto"], + deps = [":annotations_proto"], +) + +proto_library( + name = "resource_proto", + srcs = ["resource.proto"], + deps = [ + "@com_google_protobuf//:descriptor_proto", + ], +) + +proto_library( + name = "service_proto", + srcs = ["service.proto"], + deps = [ + ":annotations_proto", + ":auth_proto", + ":backend_proto", + ":billing_proto", + ":context_proto", + ":control_proto", + ":documentation_proto", + ":endpoint_proto", + ":http_proto", + ":label_proto", + ":log_proto", + ":logging_proto", + ":metric_proto", + ":monitored_resource_proto", + ":monitoring_proto", + ":quota_proto", + ":resource_proto", + ":source_info_proto", + ":system_parameter_proto", + ":usage_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:api_proto", + "@com_google_protobuf//:type_proto", + "@com_google_protobuf//:wrappers_proto", + ], +) + +proto_library( + name = "source_info_proto", + srcs = ["source_info.proto"], + deps = ["@com_google_protobuf//:any_proto"], +) + +proto_library( + name = "system_parameter_proto", + srcs = ["system_parameter.proto"], + visibility = ["//visibility:public"], +) + +proto_library( + name = "usage_proto", + srcs = ["usage.proto"], + deps = [":annotations_proto"], +) + +############################################################################## +# Java +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") + +java_proto_library( + name = "api_java_proto", + deps = [ + "annotations_proto", + "auth_proto", + "backend_proto", + "billing_proto", + "client_proto", + "config_change_proto", + "consumer_proto", + "context_proto", + "control_proto", + "distribution_proto", + "documentation_proto", + "endpoint_proto", + "field_behavior_proto", + "http_proto", + "httpbody_proto", + "label_proto", + "launch_stage_proto", + "log_proto", + "logging_proto", + "metric_proto", + "monitored_resource_proto", + "monitoring_proto", + "quota_proto", + "resource_proto", + "service_proto", + "source_info_proto", + "system_parameter_proto", + "usage_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library") + +go_proto_library( + name = "annotations_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/annotations", + protos = [ + ":annotations_proto", + ":http_proto", + ], +) + +go_proto_library( + name = "client_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations", + protos = [":client_proto"], +) + +go_proto_library( + name = "configchange_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/configchange", + protos = [":config_change_proto"], +) + +go_proto_library( + name = "distribution_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/distribution", + protos = [":distribution_proto"], +) + +go_proto_library( + name = "field_behavior_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations", + protos = [":field_behavior_proto"], +) + +go_proto_library( + name = "httpbody_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/httpbody", + protos = [":httpbody_proto"], +) + +go_proto_library( + name = "label_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/label", + protos = [":label_proto"], +) + +go_proto_library( + name = "api_go_proto", + importpath = "google.golang.org/genproto/googleapis/api", + protos = [ + ":launch_stage_proto", + ], + deps = [ + ":annotations_go_proto", + ], +) + +go_proto_library( + name = "metric_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/metric", + protos = [":metric_proto"], + deps = [ + ":api_go_proto", + ":label_go_proto", + ], +) + +go_proto_library( + name = "monitoredres_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/monitoredres", + protos = [":monitored_resource_proto"], + deps = [ + ":api_go_proto", + ":label_go_proto", + ], +) + +go_proto_library( + name = "resource_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations", + protos = [":resource_proto"], +) + +go_proto_library( + name = "serviceconfig_go_proto", + importpath = "google.golang.org/genproto/googleapis/api/serviceconfig", + protos = [ + ":auth_proto", + ":backend_proto", + ":billing_proto", + ":context_proto", + ":control_proto", + ":documentation_proto", + ":endpoint_proto", + ":log_proto", + ":logging_proto", + ":monitoring_proto", + ":quota_proto", + ":service_proto", + ":source_info_proto", + ":system_parameter_proto", + ":usage_proto", + ], + deps = [ + ":annotations_go_proto", + ":api_go_proto", + ":label_go_proto", + ":metric_go_proto", + ":monitoredres_go_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library") + +cc_proto_library( + name = "annotations_cc_proto", + deps = [":annotations_proto"], +) + +cc_proto_library( + name = "auth_cc_proto", + deps = [":auth_proto"], +) + +cc_proto_library( + name = "backend_cc_proto", + deps = [":backend_proto"], +) + +cc_proto_library( + name = "billing_cc_proto", + deps = [":billing_proto"], +) + +cc_proto_library( + name = "client_cc_proto", + deps = [":client_proto"], +) + +cc_proto_library( + name = "config_change_cc_proto", + deps = [":config_change_proto"], +) + +cc_proto_library( + name = "consumer_cc_proto", + deps = [":consumer_proto"], +) + +cc_proto_library( + name = "context_cc_proto", + deps = [":context_proto"], +) + +cc_proto_library( + name = "control_cc_proto", + deps = [":control_proto"], +) + +cc_proto_library( + name = "distribution_cc_proto", + deps = [":distribution_proto"], +) + +cc_proto_library( + name = "documentation_cc_proto", + deps = [":documentation_proto"], +) + +cc_proto_library( + name = "endpoint_cc_proto", + deps = [":endpoint_proto"], +) + +cc_proto_library( + name = "field_behavior_cc_proto", + deps = [":field_behavior_proto"], +) + +cc_proto_library( + name = "http_cc_proto", + deps = [":http_proto"], +) + +cc_proto_library( + name = "httpbody_cc_proto", + deps = [":httpbody_proto"], +) + +cc_proto_library( + name = "label_cc_proto", + deps = [":label_proto"], +) + +cc_proto_library( + name = "launch_stage_cc_proto", + deps = [":launch_stage_proto"], +) + +cc_proto_library( + name = "log_cc_proto", + deps = [":log_proto"], +) + +cc_proto_library( + name = "logging_cc_proto", + deps = [":logging_proto"], +) + +cc_proto_library( + name = "metric_cc_proto", + deps = [":metric_proto"], +) + +cc_proto_library( + name = "monitored_resource_cc_proto", + deps = [":monitored_resource_proto"], +) + +cc_proto_library( + name = "monitoring_cc_proto", + deps = ["monitoring_proto"], +) + +cc_proto_library( + name = "quota_cc_proto", + deps = ["quota_proto"], +) + +cc_proto_library( + name = "resource_cc_proto", + deps = [":resource_proto"], +) + +cc_proto_library( + name = "service_cc_proto", + deps = [":service_proto"], +) + +cc_proto_library( + name = "source_info_cc_proto", + deps = [":source_info_proto"], +) + +cc_proto_library( + name = "system_parameter_cc_proto", + deps = [":system_parameter_proto"], +) + +cc_proto_library( + name = "usage_cc_proto", + deps = [":usage_proto"], +) + +############################################################################## +# Python +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library") + +py_proto_library( + name = "annotations_py_proto", + deps = [":annotations_proto"], +) + +py_proto_library( + name = "auth_py_proto", + deps = [":auth_proto"], +) + +py_proto_library( + name = "backend_py_proto", + deps = [":backend_proto"], +) + +py_proto_library( + name = "billing_py_proto", + deps = [":billing_proto"], +) + +py_proto_library( + name = "client_py_proto", + deps = [":client_proto"], +) + +py_proto_library( + name = "config_change_py_proto", + deps = [":config_change_proto"], +) + +py_proto_library( + name = "consumer_py_proto", + deps = [":consumer_proto"], +) + +py_proto_library( + name = "context_py_proto", + deps = [":context_proto"], +) + +py_proto_library( + name = "control_py_proto", + deps = [":control_proto"], +) + +py_proto_library( + name = "distribution_py_proto", + deps = [":distribution_proto"], +) + +py_proto_library( + name = "documentation_py_proto", + deps = [":documentation_proto"], +) + +py_proto_library( + name = "endpoint_py_proto", + deps = [":endpoint_proto"], +) + +py_proto_library( + name = "field_behavior_py_proto", + deps = [":field_behavior_proto"], +) + +py_proto_library( + name = "http_py_proto", + deps = [":http_proto"], +) + +py_proto_library( + name = "httpbody_py_proto", + deps = [":httpbody_proto"], +) + +py_proto_library( + name = "label_py_proto", + deps = [":label_proto"], +) + +py_proto_library( + name = "launch_stage_py_proto", + deps = [":launch_stage_proto"], +) + +py_proto_library( + name = "log_py_proto", + deps = [":log_proto"], +) + +py_proto_library( + name = "logging_py_proto", + deps = [":logging_proto"], +) + +py_proto_library( + name = "metric_py_proto", + deps = [":metric_proto"], +) + +py_proto_library( + name = "monitored_resource_py_proto", + deps = [":monitored_resource_proto"], +) + +py_proto_library( + name = "monitoring_py_proto", + deps = ["monitoring_proto"], +) + +py_proto_library( + name = "quota_py_proto", + deps = ["quota_proto"], +) + +py_proto_library( + name = "resource_py_proto", + deps = [":resource_proto"], +) + +py_proto_library( + name = "service_py_proto", + deps = [":service_proto"], +) + +py_proto_library( + name = "source_info_py_proto", + deps = [":source_info_proto"], +) + +py_proto_library( + name = "system_parameter_py_proto", + deps = [":system_parameter_proto"], +) + +py_proto_library( + name = "usage_py_proto", + deps = [":usage_proto"], +) diff --git a/google/api/README.md b/google/api/README.md new file mode 100644 index 0000000000..eafe588022 --- /dev/null +++ b/google/api/README.md @@ -0,0 +1,5 @@ +This folder contains the schema of the configuration model for the API services +platform. + +**Note**: Protos under this directory are in Alpha status, and therefore are +subject to breaking changes. diff --git a/google/api/annotations.proto b/google/api/annotations.proto new file mode 100644 index 0000000000..85c361b47f --- /dev/null +++ b/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2015, 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. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/google/api/auth.proto b/google/api/auth.proto new file mode 100644 index 0000000000..7c5d61666d --- /dev/null +++ b/google/api/auth.proto @@ -0,0 +1,184 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "AuthProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Authentication` defines the authentication configuration for an API. +// +// Example for an API targeted for external use: +// +// name: calendar.googleapis.com +// authentication: +// providers: +// - id: google_calendar_auth +// jwks_uri: https://www.googleapis.com/oauth2/v1/certs +// issuer: https://securetoken.google.com +// rules: +// - selector: "*" +// requirements: +// provider_id: google_calendar_auth +message Authentication { + // A list of authentication rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated AuthenticationRule rules = 3; + + // Defines a set of authentication providers that a service supports. + repeated AuthProvider providers = 4; +} + +// Authentication rules for the service. +// +// By default, if a method has any authentication requirements, every request +// must include a valid credential matching one of the requirements. +// It's an error to include more than one kind of credential in a single +// request. +// +// If a method doesn't have any auth requirements, request credentials will be +// ignored. +message AuthenticationRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // The requirements for OAuth credentials. + OAuthRequirements oauth = 2; + + // If true, the service accepts API keys without any other credential. + bool allow_without_credential = 5; + + // Requirements for additional authentication providers. + repeated AuthRequirement requirements = 7; +} + +// Configuration for an authentication provider, including support for +// [JSON Web Token +// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). +message AuthProvider { + // The unique identifier of the auth provider. It will be referred to by + // `AuthRequirement.provider_id`. + // + // Example: "bookstore_auth". + string id = 1; + + // Identifies the principal that issued the JWT. See + // https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 + // Usually a URL or an email address. + // + // Example: https://securetoken.google.com + // Example: 1234567-compute@developer.gserviceaccount.com + string issuer = 2; + + // URL of the provider's public key set to validate signature of the JWT. See + // [OpenID + // Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). + // Optional if the key set document: + // - can be retrieved from + // [OpenID + // Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html of + // the issuer. + // - can be inferred from the email domain of the issuer (e.g. a Google + // service account). + // + // Example: https://www.googleapis.com/oauth2/v1/certs + string jwks_uri = 3; + + // The list of JWT + // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + // that are allowed to access. A JWT containing any of these audiences will + // be accepted. When this setting is absent, only JWTs with audience + // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + // will be accepted. For example, if no audiences are in the setting, + // LibraryService API will only accept JWTs with the following audience + // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + // + // Example: + // + // audiences: bookstore_android.apps.googleusercontent.com, + // bookstore_web.apps.googleusercontent.com + string audiences = 4; + + // Redirect URL if JWT token is required but not present or is expired. + // Implement authorizationUrl of securityDefinitions in OpenAPI spec. + string authorization_url = 5; +} + +// OAuth scopes are a way to define data and permissions on data. For example, +// there are scopes defined for "Read-only access to Google Calendar" and +// "Access to Cloud Platform". Users can consent to a scope for an application, +// giving it permission to access that data on their behalf. +// +// OAuth scope specifications should be fairly coarse grained; a user will need +// to see and understand the text description of what your scope means. +// +// In most cases: use one or at most two OAuth scopes for an entire family of +// products. If your product has multiple APIs, you should probably be sharing +// the OAuth scope across all of those APIs. +// +// When you need finer grained OAuth consent screens: talk with your product +// management about how developers will use them in practice. +// +// Please note that even though each of the canonical scopes is enough for a +// request to be accepted and passed to the backend, a request can still fail +// due to the backend requiring additional scopes or permissions. +message OAuthRequirements { + // The list of publicly documented OAuth scopes that are allowed access. An + // OAuth token containing any of these scopes will be accepted. + // + // Example: + // + // canonical_scopes: https://www.googleapis.com/auth/calendar, + // https://www.googleapis.com/auth/calendar.read + string canonical_scopes = 1; +} + +// User-defined authentication requirements, including support for +// [JSON Web Token +// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). +message AuthRequirement { + // [id][google.api.AuthProvider.id] from authentication provider. + // + // Example: + // + // provider_id: bookstore_auth + string provider_id = 1; + + // NOTE: This will be deprecated soon, once AuthProvider.audiences is + // implemented and accepted in all the runtime components. + // + // The list of JWT + // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). + // that are allowed to access. A JWT containing any of these audiences will + // be accepted. When this setting is absent, only JWTs with audience + // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" + // will be accepted. For example, if no audiences are in the setting, + // LibraryService API will only accept JWTs with the following audience + // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". + // + // Example: + // + // audiences: bookstore_android.apps.googleusercontent.com, + // bookstore_web.apps.googleusercontent.com + string audiences = 2; +} diff --git a/google/api/backend.proto b/google/api/backend.proto new file mode 100644 index 0000000000..26a16ef41d --- /dev/null +++ b/google/api/backend.proto @@ -0,0 +1,127 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "BackendProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Backend` defines the backend configuration for a service. +message Backend { + // A list of API backend rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated BackendRule rules = 1; +} + +// A backend rule provides configuration for an individual API element. +message BackendRule { + // Path Translation specifies how to combine the backend address with the + // request path in order to produce the appropriate forwarding URL for the + // request. + // + // Path Translation is applicable only to HTTP-based backends. Backends which + // do not accept requests over HTTP/HTTPS should leave `path_translation` + // unspecified. + enum PathTranslation { + PATH_TRANSLATION_UNSPECIFIED = 0; + + // Use the backend address as-is, with no modification to the path. If the + // URL pattern contains variables, the variable names and values will be + // appended to the query string. If a query string parameter and a URL + // pattern variable have the same name, this may result in duplicate keys in + // the query string. + // + // # Examples + // + // Given the following operation config: + // + // Method path: /api/company/{cid}/user/{uid} + // Backend address: https://example.cloudfunctions.net/getUser + // + // Requests to the following request paths will call the backend at the + // translated path: + // + // Request path: /api/company/widgetworks/user/johndoe + // Translated: + // https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe + // + // Request path: /api/company/widgetworks/user/johndoe?timezone=EST + // Translated: + // https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe + CONSTANT_ADDRESS = 1; + + // The request path will be appended to the backend address. + // + // # Examples + // + // Given the following operation config: + // + // Method path: /api/company/{cid}/user/{uid} + // Backend address: https://example.appspot.com + // + // Requests to the following request paths will call the backend at the + // translated path: + // + // Request path: /api/company/widgetworks/user/johndoe + // Translated: + // https://example.appspot.com/api/company/widgetworks/user/johndoe + // + // Request path: /api/company/widgetworks/user/johndoe?timezone=EST + // Translated: + // https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST + APPEND_PATH_TO_ADDRESS = 2; + } + + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // The address of the API backend. + string address = 2; + + // The number of seconds to wait for a response from a request. The default + // deadline for gRPC is infinite (no deadline) and HTTP requests is 5 seconds. + double deadline = 3; + + // Minimum deadline in seconds needed for this method. Calls having deadline + // value lower than this will be rejected. + double min_deadline = 4; + + // The number of seconds to wait for the completion of a long running + // operation. The default is no deadline. + double operation_deadline = 5; + + PathTranslation path_translation = 6; + + // Authentication settings used by the backend. + // + // These are typically used to provide service management functionality to + // a backend served on a publicly-routable URL. The `authentication` + // details should match the authentication behavior used by the backend. + // + // For example, specifying `jwt_audience` implies that the backend expects + // authentication via a JWT. + oneof authentication { + // The JWT audience is used when generating a JWT id token for the backend. + string jwt_audience = 7; + } +} diff --git a/google/api/billing.proto b/google/api/billing.proto new file mode 100644 index 0000000000..87c11e7ff3 --- /dev/null +++ b/google/api/billing.proto @@ -0,0 +1,67 @@ +// Copyright 2019 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.api; + +import "google/api/metric.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "BillingProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Billing related configuration of the service. +// +// The following example shows how to configure monitored resources and metrics +// for billing: +// +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. +// metrics: +// - name: library.googleapis.com/book/borrowed_count +// metric_kind: DELTA +// value_type: INT64 +// billing: +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/borrowed_count +message Billing { + // Configuration of a specific billing destination (Currently only support + // bill against consumer project). + message BillingDestination { + // The monitored resource type. The type must be defined in + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 1; + + // Names of the metrics to report to this billing destination. + // Each name must be defined in [Service.metrics][google.api.Service.metrics] section. + repeated string metrics = 2; + } + + // Billing configurations for sending metrics to the consumer project. + // There can be multiple consumer destinations per service, each one must have + // a different monitored resource type. A metric can be used in at most + // one consumer destination. + repeated BillingDestination consumer_destinations = 8; +} diff --git a/google/api/client.proto b/google/api/client.proto new file mode 100644 index 0000000000..56f8664aa9 --- /dev/null +++ b/google/api/client.proto @@ -0,0 +1,100 @@ +// Copyright 2019 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.api; + +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "ClientProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // A definition of a client library method signature. + // + // In client libraries, each proto RPC corresponds to one or more methods + // which the end user is able to call, and calls the underlying RPC. + // Normally, this method receives a single argument (a struct or instance + // corresponding to the RPC request object). Defining this field will + // add one or more overloads providing flattened or simpler method signatures + // in some languages. + // + // The fields on the method signature are provided as a comma-separated + // string. + // + // For example, the proto RPC and annotation: + // + // rpc CreateSubscription(CreateSubscriptionRequest) + // returns (Subscription) { + // option (google.api.method_signature) = "name,topic"; + // } + // + // Would add the following Java overload (in addition to the method accepting + // the request object): + // + // public final Subscription createSubscription(String name, String topic) + // + // The following backwards-compatibility guidelines apply: + // + // * Adding this annotation to an unannotated method is backwards + // compatible. + // * Adding this annotation to a method which already has existing + // method signature annotations is backwards compatible if and only if + // the new method signature annotation is last in the sequence. + // * Modifying or removing an existing method signature annotation is + // a breaking change. + // * Re-ordering existing method signature annotations is a breaking + // change. + repeated string method_signature = 1051; +} + +extend google.protobuf.ServiceOptions { + // The hostname for this service. + // This should be specified with no prefix or protocol. + // + // Example: + // + // service Foo { + // option (google.api.default_host) = "foo.googleapi.com"; + // ... + // } + string default_host = 1049; + + // OAuth scopes needed for the client. + // + // Example: + // + // service Foo { + // option (google.api.oauth_scopes) = \ + // "https://www.googleapis.com/auth/cloud-platform"; + // ... + // } + // + // If there is more than one scope, use a comma-separated string: + // + // Example: + // + // service Foo { + // option (google.api.oauth_scopes) = \ + // "https://www.googleapis.com/auth/cloud-platform," + // "https://www.googleapis.com/auth/monitoring"; + // ... + // } + string oauth_scopes = 1050; +} diff --git a/google/api/config_change.proto b/google/api/config_change.proto new file mode 100644 index 0000000000..c36764a5ac --- /dev/null +++ b/google/api/config_change.proto @@ -0,0 +1,85 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/configchange;configchange"; +option java_multiple_files = true; +option java_outer_classname = "ConfigChangeProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Output generated from semantically comparing two versions of a service +// configuration. +// +// Includes detailed information about a field that have changed with +// applicable advice about potential consequences for the change, such as +// backwards-incompatibility. +message ConfigChange { + // Object hierarchy path to the change, with levels separated by a '.' + // character. For repeated fields, an applicable unique identifier field is + // used for the index (usually selector, name, or id). For maps, the term + // 'key' is used. If the field has no unique identifier, the numeric index + // is used. + // Examples: + // - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction + // - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value + // - logging.producer_destinations[0] + string element = 1; + + // Value of the changed object in the old Service configuration, + // in JSON format. This field will not be populated if ChangeType == ADDED. + string old_value = 2; + + // Value of the changed object in the new Service configuration, + // in JSON format. This field will not be populated if ChangeType == REMOVED. + string new_value = 3; + + // The type for this change, either ADDED, REMOVED, or MODIFIED. + ChangeType change_type = 4; + + // Collection of advice provided for this change, useful for determining the + // possible impact of this change. + repeated Advice advices = 5; +} + +// Generated advice about this change, used for providing more +// information about how a change will affect the existing service. +message Advice { + // Useful description for why this advice was applied and what actions should + // be taken to mitigate any implied risks. + string description = 2; +} + +// Classifies set of possible modifications to an object in the service +// configuration. +enum ChangeType { + // No value was provided. + CHANGE_TYPE_UNSPECIFIED = 0; + + // The changed object exists in the 'new' service configuration, but not + // in the 'old' service configuration. + ADDED = 1; + + // The changed object exists in the 'old' service configuration, but not + // in the 'new' service configuration. + REMOVED = 2; + + // The changed object exists in both service configurations, but its value + // is different. + MODIFIED = 3; +} diff --git a/google/api/consumer.proto b/google/api/consumer.proto new file mode 100644 index 0000000000..0facc2eb1e --- /dev/null +++ b/google/api/consumer.proto @@ -0,0 +1,82 @@ +// Copyright 2016 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. + +syntax = "proto3"; + +package google.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ConsumerProto"; +option java_package = "com.google.api"; + +// A descriptor for defining project properties for a service. One service may +// have many consumer projects, and the service may want to behave differently +// depending on some properties on the project. For example, a project may be +// associated with a school, or a business, or a government agency, a business +// type property on the project may affect how a service responds to the client. +// This descriptor defines which properties are allowed to be set on a project. +// +// Example: +// +// project_properties: +// properties: +// - name: NO_WATERMARK +// type: BOOL +// description: Allows usage of the API without watermarks. +// - name: EXTENDED_TILE_CACHE_PERIOD +// type: INT64 +message ProjectProperties { + // List of per consumer project-specific properties. + repeated Property properties = 1; +} + +// Defines project properties. +// +// API services can define properties that can be assigned to consumer projects +// so that backends can perform response customization without having to make +// additional calls or maintain additional storage. For example, Maps API +// defines properties that controls map tile cache period, or whether to embed a +// watermark in a result. +// +// These values can be set via API producer console. Only API providers can +// define and set these properties. +message Property { + // Supported data type of the property values + enum PropertyType { + // The type is unspecified, and will result in an error. + UNSPECIFIED = 0; + + // The type is `int64`. + INT64 = 1; + + // The type is `bool`. + BOOL = 2; + + // The type is `string`. + STRING = 3; + + // The type is 'double'. + DOUBLE = 4; + } + + // The name of the property (a.k.a key). + string name = 1; + + // The type of this property. + PropertyType type = 2; + + // The description of the property + string description = 3; +} diff --git a/google/api/context.proto b/google/api/context.proto new file mode 100644 index 0000000000..2d330f6f2a --- /dev/null +++ b/google/api/context.proto @@ -0,0 +1,90 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ContextProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Context` defines which contexts an API requests. +// +// Example: +// +// context: +// rules: +// - selector: "*" +// requested: +// - google.rpc.context.ProjectContext +// - google.rpc.context.OriginContext +// +// The above specifies that all methods in the API request +// `google.rpc.context.ProjectContext` and +// `google.rpc.context.OriginContext`. +// +// Available context types are defined in package +// `google.rpc.context`. +// +// This also provides mechanism to whitelist any protobuf message extension that +// can be sent in grpc metadata using “x-goog-ext--bin” and +// “x-goog-ext--jspb” format. For example, list any service +// specific protobuf types that can appear in grpc metadata as follows in your +// yaml file: +// +// Example: +// +// context: +// rules: +// - selector: "google.example.library.v1.LibraryService.CreateBook" +// allowed_request_extensions: +// - google.foo.v1.NewExtension +// allowed_response_extensions: +// - google.foo.v1.NewExtension +// +// You can also specify extension ID instead of fully qualified extension name +// here. +message Context { + // A list of RPC context rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated ContextRule rules = 1; +} + +// A context rule provides information about the context for an individual API +// element. +message ContextRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // A list of full type names of requested contexts. + repeated string requested = 2; + + // A list of full type names of provided contexts. + repeated string provided = 3; + + // A list of full type names or extension IDs of extensions allowed in grpc + // side channel from client to backend. + repeated string allowed_request_extensions = 4; + + // A list of full type names or extension IDs of extensions allowed in grpc + // side channel from backend to client. + repeated string allowed_response_extensions = 5; +} diff --git a/google/api/control.proto b/google/api/control.proto new file mode 100644 index 0000000000..e769f97830 --- /dev/null +++ b/google/api/control.proto @@ -0,0 +1,33 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ControlProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Selects and configures the service controller used by the service. The +// service controller handles features like abuse, quota, billing, logging, +// monitoring, etc. +message Control { + // The service control environment to use. If empty, no control plane + // feature (like quota and billing) will be enabled. + string environment = 1; +} diff --git a/google/api/distribution.proto b/google/api/distribution.proto new file mode 100644 index 0000000000..ee45d9dcd7 --- /dev/null +++ b/google/api/distribution.proto @@ -0,0 +1,212 @@ +// Copyright 2019 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.api; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution"; +option java_multiple_files = true; +option java_outer_classname = "DistributionProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Distribution` contains summary statistics for a population of values. It +// optionally contains a histogram representing the distribution of those values +// across a set of buckets. +// +// The summary statistics are the count, mean, sum of the squared deviation from +// the mean, the minimum, and the maximum of the set of population of values. +// The histogram is based on a sequence of buckets and gives a count of values +// that fall into each bucket. The boundaries of the buckets are given either +// explicitly or by formulas for buckets of fixed or exponentially increasing +// widths. +// +// Although it is not forbidden, it is generally a bad idea to include +// non-finite values (infinities or NaNs) in the population of values, as this +// will render the `mean` and `sum_of_squared_deviation` fields meaningless. +message Distribution { + // The range of the population values. + message Range { + // The minimum of the population values. + double min = 1; + + // The maximum of the population values. + double max = 2; + } + + // `BucketOptions` describes the bucket boundaries used to create a histogram + // for the distribution. The buckets can be in a linear sequence, an + // exponential sequence, or each bucket can be specified explicitly. + // `BucketOptions` does not include the number of values in each bucket. + // + // A bucket has an inclusive lower bound and exclusive upper bound for the + // values that are counted for that bucket. The upper bound of a bucket must + // be strictly greater than the lower bound. The sequence of N buckets for a + // distribution consists of an underflow bucket (number 0), zero or more + // finite buckets (number 1 through N - 2) and an overflow bucket (number N - + // 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the + // same as the upper bound of bucket i - 1. The buckets span the whole range + // of finite values: lower bound of the underflow bucket is -infinity and the + // upper bound of the overflow bucket is +infinity. The finite buckets are + // so-called because both bounds are finite. + message BucketOptions { + // Specifies a linear sequence of buckets that all have the same width + // (except overflow and underflow). Each bucket represents a constant + // absolute uncertainty on the specific value in the bucket. + // + // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the + // following boundaries: + // + // Upper bound (0 <= i < N-1): offset + (width * i). + // Lower bound (1 <= i < N): offset + (width * (i - 1)). + message Linear { + // Must be greater than 0. + int32 num_finite_buckets = 1; + + // Must be greater than 0. + double width = 2; + + // Lower bound of the first bucket. + double offset = 3; + } + + // Specifies an exponential sequence of buckets that have a width that is + // proportional to the value of the lower bound. Each bucket represents a + // constant relative uncertainty on a specific value in the bucket. + // + // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the + // following boundaries: + // + // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). + // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). + message Exponential { + // Must be greater than 0. + int32 num_finite_buckets = 1; + + // Must be greater than 1. + double growth_factor = 2; + + // Must be greater than 0. + double scale = 3; + } + + // Specifies a set of buckets with arbitrary widths. + // + // There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following + // boundaries: + // + // Upper bound (0 <= i < N-1): bounds[i] + // Lower bound (1 <= i < N); bounds[i - 1] + // + // The `bounds` field must contain at least one element. If `bounds` has + // only one element, then there are no finite buckets, and that single + // element is the common boundary of the overflow and underflow buckets. + message Explicit { + // The values must be monotonically increasing. + repeated double bounds = 1; + } + + // Exactly one of these three fields must be set. + oneof options { + // The linear bucket. + Linear linear_buckets = 1; + + // The exponential buckets. + Exponential exponential_buckets = 2; + + // The explicit buckets. + Explicit explicit_buckets = 3; + } + } + + // Exemplars are example points that may be used to annotate aggregated + // distribution values. They are metadata that gives information about a + // particular value added to a Distribution bucket, such as a trace ID that + // was active when a value was added. They may contain further information, + // such as a example values and timestamps, origin, etc. + message Exemplar { + // Value of the exemplar point. This value determines to which bucket the + // exemplar belongs. + double value = 1; + + // The observation (sampling) time of the above value. + google.protobuf.Timestamp timestamp = 2; + + // Contextual information about the example value. Examples are: + // + // Trace: type.googleapis.com/google.monitoring.v3.SpanContext + // + // Literal string: type.googleapis.com/google.protobuf.StringValue + // + // Labels dropped during aggregation: + // type.googleapis.com/google.monitoring.v3.DroppedLabels + // + // There may be only a single attachment of any given message type in a + // single exemplar, and this is enforced by the system. + repeated google.protobuf.Any attachments = 3; + } + + // The number of values in the population. Must be non-negative. This value + // must equal the sum of the values in `bucket_counts` if a histogram is + // provided. + int64 count = 1; + + // The arithmetic mean of the values in the population. If `count` is zero + // then this field must be zero. + double mean = 2; + + // The sum of squared deviations from the mean of the values in the + // population. For values x_i this is: + // + // Sum[i=1..n]((x_i - mean)^2) + // + // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + // describes Welford's method for accumulating this sum in one pass. + // + // If `count` is zero then this field must be zero. + double sum_of_squared_deviation = 3; + + // If specified, contains the range of the population values. The field + // must not be present if the `count` is zero. + Range range = 4; + + // Defines the histogram bucket boundaries. If the distribution does not + // contain a histogram, then omit this field. + BucketOptions bucket_options = 6; + + // The number of values in each bucket of the histogram, as described in + // `bucket_options`. If the distribution does not have a histogram, then omit + // this field. If there is a histogram, then the sum of the values in + // `bucket_counts` must equal the value in the `count` field of the + // distribution. + // + // If present, `bucket_counts` should contain N values, where N is the number + // of buckets specified in `bucket_options`. If you supply fewer than N + // values, the remaining values are assumed to be 0. + // + // The order of the values in `bucket_counts` follows the bucket numbering + // schemes described for the three bucket types. The first value must be the + // count for the underflow bucket (number 0). The next N-2 values are the + // counts for the finite buckets (number 1 through N-2). The N'th value in + // `bucket_counts` is the count for the overflow bucket (number N-1). + repeated int64 bucket_counts = 7; + + // Must be in increasing order of `value` field. + repeated Exemplar exemplars = 10; +} diff --git a/google/api/documentation.proto b/google/api/documentation.proto new file mode 100644 index 0000000000..74cbf67e99 --- /dev/null +++ b/google/api/documentation.proto @@ -0,0 +1,157 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "DocumentationProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Documentation` provides the information for describing a service. +// +// Example: +//
documentation:
+//   summary: >
+//     The Google Calendar API gives access
+//     to most calendar features.
+//   pages:
+//   - name: Overview
+//     content: (== include google/foo/overview.md ==)
+//   - name: Tutorial
+//     content: (== include google/foo/tutorial.md ==)
+//     subpages;
+//     - name: Java
+//       content: (== include google/foo/tutorial_java.md ==)
+//   rules:
+//   - selector: google.calendar.Calendar.Get
+//     description: >
+//       ...
+//   - selector: google.calendar.Calendar.Put
+//     description: >
+//       ...
+// 
+// Documentation is provided in markdown syntax. In addition to +// standard markdown features, definition lists, tables and fenced +// code blocks are supported. Section headers can be provided and are +// interpreted relative to the section nesting of the context where +// a documentation fragment is embedded. +// +// Documentation from the IDL is merged with documentation defined +// via the config at normalization time, where documentation provided +// by config rules overrides IDL provided. +// +// A number of constructs specific to the API platform are supported +// in documentation text. +// +// In order to reference a proto element, the following +// notation can be used: +//
[fully.qualified.proto.name][]
+// To override the display text used for the link, this can be used: +//
[display text][fully.qualified.proto.name]
+// Text can be excluded from doc using the following notation: +//
(-- internal comment --)
+// +// A few directives are available in documentation. Note that +// directives must appear on a single line to be properly +// identified. The `include` directive includes a markdown file from +// an external source: +//
(== include path/to/file ==)
+// The `resource_for` directive marks a message to be the resource of +// a collection in REST view. If it is not specified, tools attempt +// to infer the resource from the operations in a collection: +//
(== resource_for v1.shelves.books ==)
+// The directive `suppress_warning` does not directly affect documentation +// and is documented together with service config validation. +message Documentation { + // A short summary of what the service does. Can only be provided by + // plain text. + string summary = 1; + + // The top level pages for the documentation set. + repeated Page pages = 5; + + // A list of documentation rules that apply to individual API elements. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated DocumentationRule rules = 3; + + // The URL to the root of documentation. + string documentation_root_url = 4; + + // Declares a single overview page. For example: + //
documentation:
+  //   summary: ...
+  //   overview: (== include overview.md ==)
+  // 
+ // This is a shortcut for the following declaration (using pages style): + //
documentation:
+  //   summary: ...
+  //   pages:
+  //   - name: Overview
+  //     content: (== include overview.md ==)
+  // 
+ // Note: you cannot specify both `overview` field and `pages` field. + string overview = 2; +} + +// A documentation rule provides information about individual API elements. +message DocumentationRule { + // The selector is a comma-separated list of patterns. Each pattern is a + // qualified name of the element which may end in "*", indicating a wildcard. + // Wildcards are only allowed at the end and for a whole component of the + // qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A + // wildcard will match one or more components. To specify a default for all + // applicable elements, the whole pattern "*" is used. + string selector = 1; + + // Description of the selected API(s). + string description = 2; + + // Deprecation description of the selected element(s). It can be provided if + // an element is marked as `deprecated`. + string deprecation_description = 3; +} + +// Represents a documentation page. A page can contain subpages to represent +// nested documentation set structure. +message Page { + // The name of the page. It will be used as an identity of the page to + // generate URI of the page, text of the link to this page in navigation, + // etc. The full page name (start from the root page name to this page + // concatenated with `.`) can be used as reference to the page in your + // documentation. For example: + //
pages:
+  // - name: Tutorial
+  //   content: (== include tutorial.md ==)
+  //   subpages:
+  //   - name: Java
+  //     content: (== include tutorial_java.md ==)
+  // 
+ // You can reference `Java` page using Markdown reference link syntax: + // `[Java][Tutorial.Java]`. + string name = 1; + + // The Markdown content of the page. You can use (== include {path} + // ==) to include content from a Markdown file. + string content = 2; + + // Subpages of this page. The order of subpages specified here will be + // honored in the generated docset. + repeated Page subpages = 3; +} diff --git a/google/api/endpoint.proto b/google/api/endpoint.proto new file mode 100644 index 0000000000..2077334d24 --- /dev/null +++ b/google/api/endpoint.proto @@ -0,0 +1,70 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "EndpointProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Endpoint` describes a network endpoint that serves a set of APIs. +// A service may expose any number of endpoints, and all endpoints share the +// same service configuration, such as quota configuration and monitoring +// configuration. +// +// Example service configuration: +// +// name: library-example.googleapis.com +// endpoints: +// # Below entry makes 'google.example.library.v1.Library' +// # API be served from endpoint address library-example.googleapis.com. +// # It also allows HTTP OPTIONS calls to be passed to the backend, for +// # it to decide whether the subsequent cross-origin request is +// # allowed to proceed. +// - name: library-example.googleapis.com +// allow_cors: true +message Endpoint { + // The canonical name of this endpoint. + string name = 1; + + // DEPRECATED: This field is no longer supported. Instead of using aliases, + // please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended + // aliases. + // + // Additional names that this endpoint will be hosted on. + repeated string aliases = 2 [deprecated = true]; + + // The list of features enabled on this endpoint. + repeated string features = 4; + + // The specification of an Internet routable address of API frontend that will + // handle requests to this [API + // Endpoint](https://cloud.google.com/apis/design/glossary). It should be + // either a valid IPv4 address or a fully-qualified domain name. For example, + // "8.8.8.8" or "myservice.appspot.com". + string target = 101; + + // Allowing + // [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka + // cross-domain traffic, would allow the backends served from this endpoint to + // receive and respond to HTTP OPTIONS requests. The response will be used by + // the browser to determine whether the subsequent cross-origin request is + // allowed to proceed. + bool allow_cors = 5; +} diff --git a/google/api/expr/BUILD.bazel b/google/api/expr/BUILD.bazel new file mode 100644 index 0000000000..a87c57fece --- /dev/null +++ b/google/api/expr/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.yaml"])) diff --git a/google/api/expr/artman_cel.yaml b/google/api/expr/artman_cel.yaml new file mode 100644 index 0000000000..89d2d28b2f --- /dev/null +++ b/google/api/expr/artman_cel.yaml @@ -0,0 +1,37 @@ +# This file is auto-generated based on service config and could be +# incorrect. The API producer can manually edit it. Remove all the FIXMEs +# before sending this file out for review. +common: + api_name: cel + api_version: v1alpha1 + organization_name: google-cloud + proto_deps: + - name: google-common-protos + src_proto_paths: + - v1alpha1 + service_yaml: cel.yaml + gapic_yaml: v1alpha1/cel_gapic.yaml +artifacts: +- name: gapic_config + type: GAPIC_CONFIG +- name: java_gapic + type: GAPIC + language: JAVA +- name: python_gapic + type: GAPIC + language: PYTHON +- name: nodejs_gapic + type: GAPIC + language: NODEJS +- name: php_gapic + type: GAPIC + language: PHP +- name: go_gapic + type: GAPIC + language: GO +- name: ruby_gapic + type: GAPIC + language: RUBY +- name: csharp_gapic + type: GAPIC + language: CSHARP diff --git a/google/api/expr/cel.yaml b/google/api/expr/cel.yaml new file mode 100644 index 0000000000..bbe7fbde17 --- /dev/null +++ b/google/api/expr/cel.yaml @@ -0,0 +1,61 @@ +type: google.api.Service +config_version: 3 +name: cel.googleapis.com +title: Common Expression Language + +apis: +- name: google.api.expr.v1alpha1.ConformanceService +- name: google.api.expr.v1alpha1.CelService + +documentation: + summary: Defines common types for the Common Expression Language. + overview: |- + # Common Expression Language + + The Common Expression Language (CEL) implements common semantics for + expression evaluation, enabling different applications to more easily + interoperate. + + Key Applications + + * Security policy: organization have complex infrastructure and need + common tooling to reason about the system as a whole * Protocols: + expressions are a useful data type and require interoperability across + programming languages and platforms. + + + + Guiding philosophy: + + 1. Keep it small & fast. * CEL evaluates in linear time, is mutation + free, and not Turing-complete. This limitation is a feature of the language + design, which allows the implementation to evaluate orders of magnitude + faster than equivalently sandboxed JavaScript. 2. Make it extensible. * + CEL is designed to be embedded in applications, and allows for extensibility + via its context which allows for functions and data to be provided by the + software that embeds it. 3. Developer-friendly * The language is + approachable to developers. The initial spec was based on the experience of + developing Firebase Rules and usability testing many prior iterations. * + The library itself and accompanying toolings should be easy to adopt by + teams that seek to integrate CEL into their platforms. + + The required components of a system that supports CEL are: + + * The textual representation of an expression as written by a developer. + It is of similar syntax of expressions in C/C++/Java/JavaScript * A binary + representation of an expression. It is an abstract syntax tree (AST). * A + compiler library that converts the textual representation to the binary + representation. This can be done ahead of time (in the control plane) or + just before evaluation (in the data plane). * A context containing one or + more typed variables, often protobuf messages. Most use-case will use + attribute_context.proto * An evaluator library that takes the binary + format in the context and produces a result, usually a Boolean. + + Example of boolean conditions and object construction: + + ``` c // Condition account.balance >= transaction.withdrawal || + (account.overdraftProtection && account.overdraftLimit >= + transaction.withdrawal - account.balance) + + // Object construction common.GeoPoint{ latitude: 10.0, longitude: -5.5 } + ``` diff --git a/google/api/expr/v1alpha1/BUILD.bazel b/google/api/expr/v1alpha1/BUILD.bazel new file mode 100644 index 0000000000..95e41dee39 --- /dev/null +++ b/google/api/expr/v1alpha1/BUILD.bazel @@ -0,0 +1,522 @@ +# This file was automatically generated by BuildFileGenerator + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "expr_proto", + srcs = [ + "cel_service.proto", + "checked.proto", + "conformance_service.proto", + "eval.proto", + "explain.proto", + "syntax.proto", + "value.proto", + ], + deps = [ + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/rpc:status_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library_with_info( + name = "expr_proto_with_info", + deps = [ + ":expr_proto", + "//google/cloud:common_resources_proto", + ], +) + +proto_library( + name = "cel_service_proto", + srcs = ["cel_service.proto"], + deps = [ + ":conformance_service_proto", + ], +) + +proto_library( + name = "checked_proto", + srcs = ["checked.proto"], + deps = [ + ":syntax_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:struct_proto", + ], +) + +proto_library( + name = "conformance_service_proto", + srcs = ["conformance_service.proto"], + deps = [ + ":checked_proto", + ":eval_proto", + ":syntax_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/rpc:status_proto", + ], +) + +proto_library( + name = "eval_proto", + srcs = ["eval.proto"], + deps = [ + ":value_proto", + "//google/rpc:status_proto", + ], +) + +proto_library( + name = "explain_proto", + srcs = ["explain.proto"], + deps = [ + ":value_proto", + ], +) + +proto_library( + name = "syntax_proto", + srcs = ["syntax.proto"], + deps = [ + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library( + name = "value_proto", + srcs = ["value.proto"], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:struct_proto", + ], +) + +############################################################################## +# Java +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "java_gapic_assembly_gradle_pkg", + "java_gapic_library", + "java_gapic_test", + "java_grpc_library", + "java_proto_library", +) + +java_proto_library( + name = "expr_java_proto", + deps = [":expr_proto"], +) + +java_grpc_library( + name = "expr_java_grpc", + srcs = [":expr_proto"], + deps = [":expr_java_proto"], +) + +java_gapic_library( + name = "expr_java_gapic", + src = ":expr_proto_with_info", + gapic_yaml = "cel_gapic.yaml", + package = "google.api.expr.v1alpha1", + service_yaml = "//google/api/expr:cel.yaml", + test_deps = [":expr_java_grpc"], + deps = [ + ":expr_java_proto", + ], +) + +java_gapic_test( + name = "expr_java_gapic_test_suite", + test_classes = [ + "com.google.cloud.api.expr.v1alpha1.CelServiceClientTest", + "com.google.cloud.api.expr.v1alpha1.ConformanceServiceClientTest", + ], + runtime_deps = [":expr_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-api-expr-v1alpha1-java", + deps = [ + ":expr_java_gapic", + ":expr_java_grpc", + ":expr_java_proto", + ":expr_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", + "go_test", +) + +go_proto_library( + name = "expr_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1", + protos = [":expr_proto"], + deps = [ + "//google/api:annotations_go_proto", + "//google/rpc:status_go_proto", + ], +) + +go_gapic_library( + name = "expr_go_gapic", + src = ":expr_proto_with_info", + gapic_yaml = "cel_gapic.yaml", + importpath = "cloud.google.com/go/expr/apiv1alpha1", + package = "google.api.expr.v1alpha1", + service_yaml = "//google/api/expr:cel.yaml", + deps = [ + ":expr_go_proto", + ], +) + +go_test( + name = "expr_go_gapic_test", + srcs = [":expr_go_gapic_srcjar_test"], + embed = [":expr_go_gapic"], + importpath = "cloud.google.com/go/expr/apiv1alpha1", +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-api-expr-v1alpha1-go", + deps = [ + ":expr_go_gapic", + ":expr_go_gapic_srcjar-smoke-test.srcjar", + ":expr_go_gapic_srcjar-test.srcjar", + ":expr_go_proto", + ], +) + +############################################################################## +# Python +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "moved_proto_library", + "py_gapic_assembly_pkg", + "py_gapic_library", + "py_grpc_library", + "py_proto_library", +) + +moved_proto_library( + name = "expr_moved_proto", + srcs = [":expr_proto"], + deps = [ + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/rpc:status_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +py_proto_library( + name = "expr_py_proto", + plugin = "@protoc_docs_plugin//:docs_plugin", + deps = [":expr_moved_proto"], +) + +py_grpc_library( + name = "expr_py_grpc", + srcs = [":expr_moved_proto"], + deps = [":expr_py_proto"], +) + +py_gapic_library( + name = "expr_py_gapic", + src = ":expr_proto_with_info", + gapic_yaml = "cel_gapic.yaml", + package = "google.api.expr.v1alpha1", + service_yaml = "//google/api/expr:cel.yaml", + deps = [ + ":expr_py_grpc", + ":expr_py_proto", + ], +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "api-expr-v1alpha1-py", + deps = [ + ":expr_py_gapic", + ":expr_py_grpc", + ":expr_py_proto", + ], +) + +py_proto_library( + name = "checked_py_proto", + deps = [":checked_proto"], +) + +py_proto_library( + name = "eval_py_proto", + deps = [":eval_proto"], +) + +py_proto_library( + name = "explain_py_proto", + deps = [":explain_proto"], +) + +py_proto_library( + name = "syntax_py_proto", + deps = [":syntax_proto"], +) + +py_proto_library( + name = "value_py_proto", + deps = [":value_proto"], +) + +############################################################################## +# PHP +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_grpc_library", + "php_proto_library", +) + +php_proto_library( + name = "expr_php_proto", + deps = [":expr_proto"], +) + +php_grpc_library( + name = "expr_php_grpc", + srcs = [":expr_proto"], + deps = [":expr_php_proto"], +) + +# To support PHP option (google.api.http) must be specified for all RPCs in +# the service. + +#php_gapic_library( +# name = "expr_php_gapic", +# src = ":expr_proto_with_info", +# gapic_yaml = "cel_gapic.yaml", +# package = "google.api.expr.v1alpha1", +# service_yaml = "//google/api/expr:cel.yaml", +# deps = [ +# ":expr_php_grpc", +# ":expr_php_proto", +# ], +#) + +## Open Source Packages +#php_gapic_assembly_pkg( +# name = "google-cloud-api-expr-v1alpha1-php", +# deps = [ +# ":expr_php_gapic", +# ":expr_php_grpc", +# ":expr_php_proto", +# ], +#) + +############################################################################## +# Node.js +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "nodejs_gapic_assembly_pkg", + "nodejs_gapic_library", +) + +nodejs_gapic_library( + name = "expr_nodejs_gapic", + src = ":expr_proto_with_info", + gapic_yaml = "cel_gapic.yaml", + package = "google.api.expr.v1alpha1", + service_yaml = "//google/api/expr:cel.yaml", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "api-expr-v1alpha1-nodejs", + deps = [ + ":expr_nodejs_gapic", + ":expr_proto", + ], +) + +############################################################################## +# Ruby +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "ruby_gapic_assembly_pkg", + "ruby_gapic_library", + "ruby_grpc_library", + "ruby_proto_library", +) + +ruby_proto_library( + name = "expr_ruby_proto", + deps = [":expr_proto"], +) + +ruby_grpc_library( + name = "expr_ruby_grpc", + srcs = [":expr_proto"], + deps = [":expr_ruby_proto"], +) + +ruby_gapic_library( + name = "expr_ruby_gapic", + src = ":expr_proto_with_info", + gapic_yaml = "cel_gapic.yaml", + package = "google.api.expr.v1alpha1", + service_yaml = "//google/api/expr:cel.yaml", + deps = [ + ":expr_ruby_grpc", + ":expr_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-api-expr-v1alpha1-ruby", + deps = [ + ":expr_ruby_gapic", + ":expr_ruby_grpc", + ":expr_ruby_proto", + ], +) + +############################################################################## +# C# +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "csharp_gapic_assembly_pkg", + "csharp_gapic_library", + "csharp_grpc_library", + "csharp_proto_library", +) + +csharp_proto_library( + name = "expr_csharp_proto", + deps = [":expr_proto"], +) + +csharp_grpc_library( + name = "expr_csharp_grpc", + srcs = [":expr_proto"], + deps = [":expr_csharp_proto"], +) + +csharp_gapic_library( + name = "expr_csharp_gapic", + src = ":expr_proto_with_info", + gapic_yaml = "cel_gapic.yaml", + package = "google.api.expr.v1alpha1", + service_yaml = "//google/api/expr:cel.yaml", + deps = [ + ":expr_csharp_grpc", + ":expr_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-api-expr-v1alpha1-csharp", + deps = [ + ":expr_csharp_gapic", + ":expr_csharp_grpc", + ":expr_csharp_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_grpc_library", + "cc_proto_library", +) + +cc_proto_library( + name = "cel_service_cc_proto", + deps = [":cel_service_proto"], +) + +cc_grpc_library( + name = "cel_service_cc_grpc", + srcs = [":cel_service_proto"], + generate_mocks = True, + grpc_only = True, + deps = [":cel_service_cc_proto"], +) + +cc_proto_library( + name = "checked_cc_proto", + deps = [":checked_proto"], +) + +cc_proto_library( + name = "conformance_service_cc_proto", + deps = [":conformance_service_proto"], +) + +cc_grpc_library( + name = "conformance_service_cc_grpc", + srcs = [":conformance_service_proto"], + generate_mocks = True, + grpc_only = True, + deps = [":conformance_service_cc_proto"], +) + +cc_proto_library( + name = "eval_cc_proto", + deps = [":eval_proto"], +) + +cc_proto_library( + name = "explain_cc_proto", + deps = [":explain_proto"], +) + +cc_proto_library( + name = "syntax_cc_proto", + deps = [":syntax_proto"], +) + +cc_proto_library( + name = "value_cc_proto", + deps = [":value_proto"], +) \ No newline at end of file diff --git a/google/api/expr/v1alpha1/cel.yaml b/google/api/expr/v1alpha1/cel.yaml new file mode 100644 index 0000000000..2f79c16de1 --- /dev/null +++ b/google/api/expr/v1alpha1/cel.yaml @@ -0,0 +1,69 @@ +type: google.api.Service +config_version: 3 +name: cel.googleapis.com +title: Common Expression Language + +apis: +- name: google.api.expr.v1alpha1.ConformanceService + +documentation: + summary: Defines common types for the Common Expression Language. + overview: |- + # Common Expression Language + + The Common Expression Language (CEL) implements common semantics for + expression evaluation, enabling different applications to more easily + interoperate. + + Key Applications + + * Security policy: organization have complex infrastructure and need + common tooling to reason about the system as a whole * Protocols: + expressions are a useful data type and require interoperability across + programming languages and platforms. + + + Guiding philosophy: + + 1. Keep it small & fast. + * CEL evaluates in linear time, is mutation free, and not + Turing-complete. This limitation is a feature of the language + design, which allows the implementation to evaluate orders of + magnitude faster than equivalently sandboxed JavaScript. 2. Make + it extensible. + * CEL is designed to be embedded in applications, and allows for + extensibility via its context which allows for functions and data + to be provided by the software that embeds it. 3. + Developer-friendly + * The language is approachable to developers. The initial spec was + based on the experience of developing Firebase Rules and usability + testing many prior iterations. * The library itself and + accompanying toolings should be easy to adopt by teams that seek + to integrate CEL into their platforms. + + The required components of a system that supports CEL are: + + * The textual representation of an expression as written by a developer. + It is of similar syntax of expressions in C/C++/Java/JavaScript * A + binary representation of an expression. It is an abstract syntax tree + (AST). + * A compiler library that converts the textual representation to the + binary representation. This can be done ahead of time (in the control + plane) or just before evaluation (in the data plane). * A context + containing one or more typed variables, often protobuf messages. Most + use-case will use attribute_context.proto + * An evaluator library that takes the binary format in the context and + produces a result, usually a Boolean. + + Example of boolean conditions and object construction: + + ``` c + // Condition + account.balance >= transaction.withdrawal + || (account.overdraftProtection + && account.overdraftLimit >= transaction.withdrawal - + account.balance) + + // Object construction + common.GeoPoint{ latitude: 10.0, longitude: -5.5 } + ``` diff --git a/google/api/expr/v1alpha1/cel_gapic.yaml b/google/api/expr/v1alpha1/cel_gapic.yaml new file mode 100644 index 0000000000..d2213fc7e6 --- /dev/null +++ b/google/api/expr/v1alpha1/cel_gapic.yaml @@ -0,0 +1,248 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +# The settings of generated code in a specific language. +language_settings: + java: + package_name: com.google.cloud.api.expr.v1alpha1 + python: + package_name: google.cloud.api.expr_v1alpha1.gapic + go: + package_name: cloud.google.com/go/expr/apiv1alpha1 + csharp: + package_name: Google.Api.Expr.V1alpha1 + ruby: + package_name: Google::Cloud::Api::Expr::V1alpha1 + php: + package_name: Google\Cloud\Api\Expr\V1alpha1 + nodejs: + package_name: expr.v1alpha1 +# A list of API interface configurations. +interfaces: + # The fully qualified name of the API interface. +- name: google.api.expr.v1alpha1.CelService + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: [] + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # resource_name_treatment - An enum that specifies how to treat the resource + # name formats defined in the field_name_patterns and + # response_field_name_patterns fields. + # UNSET: default value + # NONE: the collection configs will not be used by the generated code. + # VALIDATE: string fields will be validated by the client against the + # specified resource name formats. + # STATIC_TYPES: the client will use generated types for resource names. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: Parse + flattening: + groups: + - parameters: + - cel_source + required_fields: + - cel_source + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: Check + flattening: + groups: + - parameters: + - parsed_expr + required_fields: + - parsed_expr + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: Eval + flattening: + groups: + - parameters: + required_fields: + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + # The fully qualified name of the API interface. +- name: google.api.expr.v1alpha1.ConformanceService + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: [] + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # resource_name_treatment - An enum that specifies how to treat the resource + # name formats defined in the field_name_patterns and + # response_field_name_patterns fields. + # UNSET: default value + # NONE: the collection configs will not be used by the generated code. + # VALIDATE: string fields will be validated by the client against the + # specified resource name formats. + # STATIC_TYPES: the client will use generated types for resource names. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: Parse + flattening: + groups: + - parameters: + - cel_source + required_fields: + - cel_source + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: Check + flattening: + groups: + - parameters: + - parsed_expr + required_fields: + - parsed_expr + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: Eval + flattening: + groups: + - parameters: + required_fields: + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/google/api/expr/v1alpha1/cel_service.proto b/google/api/expr/v1alpha1/cel_service.proto new file mode 100644 index 0000000000..0bf649ff58 --- /dev/null +++ b/google/api/expr/v1alpha1/cel_service.proto @@ -0,0 +1,44 @@ +// Copyright 2018 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.api.expr.v1alpha1; + +import "google/api/expr/v1alpha1/conformance_service.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "CelServiceProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// Access a CEL implementation from another process or machine. +// A CEL implementation is decomposed as a parser, a static checker, +// and an evaluator. Every CEL implementation is expected to provide +// a server for this API. The API will be used for conformance testing, +// utilities, and execution as a service. +service CelService { + // Transforms CEL source text into a parsed representation. + rpc Parse(ParseRequest) returns (ParseResponse) {} + + // Runs static checks on a parsed CEL representation and return + // an annotated representation, or a set of issues. + rpc Check(CheckRequest) returns (CheckResponse) {} + + // Evaluates a parsed or annotation CEL representation given + // values of external bindings. + rpc Eval(EvalRequest) returns (EvalResponse) {} +} diff --git a/google/api/expr/v1alpha1/checked.proto b/google/api/expr/v1alpha1/checked.proto new file mode 100644 index 0000000000..0a7e3c546a --- /dev/null +++ b/google/api/expr/v1alpha1/checked.proto @@ -0,0 +1,331 @@ +// Copyright 2019 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.api.expr.v1alpha1; + +import "google/api/expr/v1alpha1/syntax.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "DeclProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// Protos for representing CEL declarations and typed checked expressions. + +// A CEL expression which has been successfully type checked. +message CheckedExpr { + // A map from expression ids to resolved references. + // + // The following entries are in this table: + // + // - An Ident or Select expression is represented here if it resolves to a + // declaration. For instance, if `a.b.c` is represented by + // `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, + // while `c` is a field selection, then the reference is attached to the + // nested select expression (but not to the id or or the outer select). + // In turn, if `a` resolves to a declaration and `b.c` are field selections, + // the reference is attached to the ident expression. + // - Every Call expression has an entry here, identifying the function being + // called. + // - Every CreateStruct expression for a message has an entry, identifying + // the message. + map reference_map = 2; + + // A map from expression ids to types. + // + // Every expression node which has a type different than DYN has a mapping + // here. If an expression has type DYN, it is omitted from this map to save + // space. + map type_map = 3; + + // The source info derived from input that generated the parsed `expr` and + // any optimizations made during the type-checking pass. + SourceInfo source_info = 5; + + // The checked expression. Semantically equivalent to the parsed `expr`, but + // may have structural differences. + Expr expr = 4; +} + +// Represents a CEL type. +message Type { + // List type with typed elements, e.g. `list`. + message ListType { + // The element type. + Type elem_type = 1; + } + + // Map type with parameterized key and value types, e.g. `map`. + message MapType { + // The type of the key. + Type key_type = 1; + + // The type of the value. + Type value_type = 2; + } + + // Function type with result and arg types. + message FunctionType { + // Result type of the function. + Type result_type = 1; + + // Argument types of the function. + repeated Type arg_types = 2; + } + + // Application defined abstract type. + message AbstractType { + // The fully qualified name of this abstract type. + string name = 1; + + // Parameter types for this abstract type. + repeated Type parameter_types = 2; + } + + // CEL primitive types. + enum PrimitiveType { + // Unspecified type. + PRIMITIVE_TYPE_UNSPECIFIED = 0; + + // Boolean type. + BOOL = 1; + + // Int64 type. + // + // Proto-based integer values are widened to int64. + INT64 = 2; + + // Uint64 type. + // + // Proto-based unsigned integer values are widened to uint64. + UINT64 = 3; + + // Double type. + // + // Proto-based float values are widened to double values. + DOUBLE = 4; + + // String type. + STRING = 5; + + // Bytes type. + BYTES = 6; + } + + // Well-known protobuf types treated with first-class support in CEL. + enum WellKnownType { + // Unspecified type. + WELL_KNOWN_TYPE_UNSPECIFIED = 0; + + // Well-known protobuf.Any type. + // + // Any types are a polymorphic message type. During type-checking they are + // treated like `DYN` types, but at runtime they are resolved to a specific + // message type specified at evaluation time. + ANY = 1; + + // Well-known protobuf.Timestamp type, internally referenced as `timestamp`. + TIMESTAMP = 2; + + // Well-known protobuf.Duration type, internally referenced as `duration`. + DURATION = 3; + } + + // The kind of type. + oneof type_kind { + // Dynamic type. + google.protobuf.Empty dyn = 1; + + // Null value. + google.protobuf.NullValue null = 2; + + // Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`. + PrimitiveType primitive = 3; + + // Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`. + PrimitiveType wrapper = 4; + + // Well-known protobuf type such as `google.protobuf.Timestamp`. + WellKnownType well_known = 5; + + // Parameterized list with elements of `list_type`, e.g. `list`. + ListType list_type = 6; + + // Parameterized map with typed keys and values. + MapType map_type = 7; + + // Function type. + FunctionType function = 8; + + // Protocol buffer message type. + // + // The `message_type` string specifies the qualified message type name. For + // example, `google.plus.Profile`. + string message_type = 9; + + // Type param type. + // + // The `type_param` string specifies the type parameter name, e.g. `list` + // would be a `list_type` whose element type was a `type_param` type + // named `E`. + string type_param = 10; + + // Type type. + // + // The `type` value specifies the target type. e.g. int is type with a + // target type of `Primitive.INT`. + Type type = 11; + + // Error type. + // + // During type-checking if an expression is an error, its type is propagated + // as the `ERROR` type. This permits the type-checker to discover other + // errors present in the expression. + google.protobuf.Empty error = 12; + + // Abstract, application defined type. + AbstractType abstract_type = 14; + } +} + +// Represents a declaration of a named value or function. +// +// A declaration is part of the contract between the expression, the agent +// evaluating that expression, and the caller requesting evaluation. +message Decl { + // Identifier declaration which specifies its type and optional `Expr` value. + // + // An identifier without a value is a declaration that must be provided at + // evaluation time. An identifier with a value should resolve to a constant, + // but may be used in conjunction with other identifiers bound at evaluation + // time. + message IdentDecl { + // Required. The type of the identifier. + Type type = 1; + + // The constant value of the identifier. If not specified, the identifier + // must be supplied at evaluation time. + Constant value = 2; + + // Documentation string for the identifier. + string doc = 3; + } + + // Function declaration specifies one or more overloads which indicate the + // function's parameter types and return type, and may optionally specify a + // function definition in terms of CEL expressions. + // + // Functions have no observable side-effects (there may be side-effects like + // logging which are not observable from CEL). + message FunctionDecl { + // An overload indicates a function's parameter types and return type, and + // may optionally include a function body described in terms of [Expr][google.api.expr.v1alpha1.Expr] + // values. + // + // Functions overloads are declared in either a function or method + // call-style. For methods, the `params[0]` is the expected type of the + // target receiver. + // + // Overloads must have non-overlapping argument types after erasure of all + // parameterized type variables (similar as type erasure in Java). + message Overload { + // Required. Globally unique overload name of the function which reflects + // the function name and argument types. + // + // This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that + // was resolved for the function `name`. + string overload_id = 1; + + // List of function parameter [Type][google.api.expr.v1alpha1.Type] values. + // + // Param types are disjoint after generic type parameters have been + // replaced with the type `DYN`. Since the `DYN` type is compatible with + // any other type, this means that if `A` is a type parameter, the + // function types `int` and `int` are not disjoint. Likewise, + // `map` is not disjoint from `map`. + // + // When the `result_type` of a function is a generic type param, the + // type param name also appears as the `type` of on at least one params. + repeated Type params = 2; + + // The type param names associated with the function declaration. + // + // For example, `function ex(K key, map map) : V` would yield + // the type params of `K, V`. + repeated string type_params = 3; + + // Required. The result type of the function. For example, the operator + // `string.isEmpty()` would have `result_type` of `kind: BOOL`. + Type result_type = 4; + + // Whether the function is to be used in a method call-style `x.f(...)` + // of a function call-style `f(x, ...)`. + // + // For methods, the first parameter declaration, `params[0]` is the + // expected type of the target receiver. + bool is_instance_function = 5; + + // Documentation string for the overload. + string doc = 6; + } + + // Required. List of function overloads, must contain at least one overload. + repeated Overload overloads = 1; + } + + // The fully qualified name of the declaration. + // + // Declarations are organized in containers and this represents the full path + // to the declaration in its container, as in `google.api.expr.Decl`. + // + // Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not + // have a name depending on whether the overload is function declaration or a + // function definition containing a result [Expr][google.api.expr.v1alpha1.Expr]. + string name = 1; + + // Required. The declaration kind. + oneof decl_kind { + // Identifier declaration. + IdentDecl ident = 2; + + // Function declaration. + FunctionDecl function = 3; + } +} + +// Describes a resolved reference to a declaration. +message Reference { + // The fully qualified name of the declaration. + string name = 1; + + // For references to functions, this is a list of `Overload.overload_id` + // values which match according to typing rules. + // + // If the list has more than one element, overload resolution among the + // presented candidates must happen at runtime because of dynamic types. The + // type checker attempts to narrow down this list as much as possible. + // + // Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. + repeated string overload_id = 3; + + // For references to constants, this may contain the value of the + // constant if known at compile time. + Constant value = 4; +} diff --git a/google/api/expr/v1alpha1/conformance_service.proto b/google/api/expr/v1alpha1/conformance_service.proto new file mode 100644 index 0000000000..e0d5286be1 --- /dev/null +++ b/google/api/expr/v1alpha1/conformance_service.proto @@ -0,0 +1,170 @@ +// Copyright 2019 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.api.expr.v1alpha1; + +import "google/api/client.proto"; +import "google/api/expr/v1alpha1/checked.proto"; +import "google/api/expr/v1alpha1/eval.proto"; +import "google/api/expr/v1alpha1/syntax.proto"; +import "google/api/field_behavior.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "ConformanceServiceProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// Access a CEL implementation from another process or machine. +// A CEL implementation is decomposed as a parser, a static checker, +// and an evaluator. Every CEL implementation is expected to provide +// a server for this API. The API will be used for conformance testing +// and other utilities. +service ConformanceService { + option (google.api.default_host) = "cel.googleapis.com"; + + // Transforms CEL source text into a parsed representation. + rpc Parse(ParseRequest) returns (ParseResponse) { + option (google.api.method_signature) = "cel_source"; + } + + // Runs static checks on a parsed CEL representation and return + // an annotated representation, or a set of issues. + rpc Check(CheckRequest) returns (CheckResponse) { + option (google.api.method_signature) = "parsed_expr"; + } + + // Evaluates a parsed or annotation CEL representation given + // values of external bindings. + rpc Eval(EvalRequest) returns (EvalResponse) { + } +} + +// Request message for the Parse method. +message ParseRequest { + // Required. Source text in CEL syntax. + string cel_source = 1 [(google.api.field_behavior) = REQUIRED]; + + // Tag for version of CEL syntax, for future use. + string syntax_version = 2; + + // File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo]. + string source_location = 3; + + // Prevent macro expansion. See "Macros" in Language Defiinition. + bool disable_macros = 4; +} + +// Response message for the Parse method. +message ParseResponse { + // The parsed representation, or unset if parsing failed. + ParsedExpr parsed_expr = 1; + + // Any number of issues with [StatusDetails][] as the details. + repeated google.rpc.Status issues = 2; +} + +// Request message for the Check method. +message CheckRequest { + // Required. The parsed representation of the CEL program. + ParsedExpr parsed_expr = 1 [(google.api.field_behavior) = REQUIRED]; + + // Declarations of types for external variables and functions. + // Required if program uses external variables or functions + // not in the default environment. + repeated Decl type_env = 2; + + // The protocol buffer context. See "Name Resolution" in the + // Language Definition. + string container = 3; + + // If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default), + // add declarations for the standard definitions to the type environment. See + // "Standard Definitions" in the Language Definition. + bool no_std_env = 4; +} + +// Response message for the Check method. +message CheckResponse { + // The annotated representation, or unset if checking failed. + CheckedExpr checked_expr = 1; + + // Any number of issues with [StatusDetails][] as the details. + repeated google.rpc.Status issues = 2; +} + +// Request message for the Eval method. +message EvalRequest { + // Required. Either the parsed or annotated representation of the CEL program. + oneof expr_kind { + // Evaluate based on the parsed representation. + ParsedExpr parsed_expr = 1; + + // Evaluate based on the checked representation. + CheckedExpr checked_expr = 2; + } + + // Bindings for the external variables. The types SHOULD be compatible + // with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + map bindings = 3; + + // SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. + string container = 4; +} + +// Response message for the Eval method. +message EvalResponse { + // The execution result, or unset if execution couldn't start. + ExprValue result = 1; + + // Any number of issues with [StatusDetails][] as the details. + // Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue]. + // Nevertheless, we'll allow out-of-band issues to be raised, + // which also makes the replies more regular. + repeated google.rpc.Status issues = 2; +} + +// Warnings or errors in service execution are represented by +// [google.rpc.Status][google.rpc.Status] messages, with the following message +// in the details field. +message IssueDetails { + // Severities of issues. + enum Severity { + // An unspecified severity. + SEVERITY_UNSPECIFIED = 0; + + // Deprecation issue for statements and method that may no longer be + // supported or maintained. + DEPRECATION = 1; + + // Warnings such as: unused variables. + WARNING = 2; + + // Errors such as: unmatched curly braces or variable redefinition. + ERROR = 3; + } + + // The severity of the issue. + Severity severity = 1; + + // Position in the source, if known. + SourcePosition position = 2; + + // Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown. + int64 id = 3; +} diff --git a/google/api/expr/v1alpha1/eval.proto b/google/api/expr/v1alpha1/eval.proto new file mode 100644 index 0000000000..2187427d86 --- /dev/null +++ b/google/api/expr/v1alpha1/eval.proto @@ -0,0 +1,119 @@ +// Copyright 2019 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.api.expr.v1alpha1; + +import "google/api/expr/v1alpha1/value.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "EvalProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// The state of an evaluation. +// +// Can represent an inital, partial, or completed state of evaluation. +message EvalState { + // A single evalution result. + message Result { + // The id of the expression this result if for. + int64 expr = 1; + + // The index in `values` of the resulting value. + int64 value = 2; + } + + // The unique values referenced in this message. + repeated ExprValue values = 1; + + // An ordered list of results. + // + // Tracks the flow of evaluation through the expression. + // May be sparse. + repeated Result results = 3; +} + +// The value of an evaluated expression. +message ExprValue { + // An expression can resolve to a value, error or unknown. + oneof kind { + // A concrete value. + Value value = 1; + + // The set of errors in the critical path of evalution. + // + // Only errors in the critical path are included. For example, + // `( || true) && ` will only result in ``, + // while ` || ` will result in both `` and + // ``. + // + // Errors cause by the presence of other errors are not included in the + // set. For example `.foo`, `foo()`, and ` + 1` will + // only result in ``. + // + // Multiple errors *might* be included when evaluation could result + // in different errors. For example ` + ` and + // `foo(, )` may result in ``, `` or both. + // The exact subset of errors included for this case is unspecified and + // depends on the implementation details of the evaluator. + ErrorSet error = 2; + + // The set of unknowns in the critical path of evaluation. + // + // Unknown behaves identically to Error with regards to propagation. + // Specifically, only unknowns in the critical path are included, unknowns + // caused by the presence of other unknowns are not included, and multiple + // unknowns *might* be included included when evaluation could result in + // different unknowns. For example: + // + // ( || true) && -> + // || -> + // .foo -> + // foo() -> + // + -> or + // + // Unknown takes precidence over Error in cases where a `Value` can short + // circuit the result: + // + // || -> + // && -> + // + // Errors take precidence in all other cases: + // + // + -> + // foo(, ) -> + UnknownSet unknown = 3; + } +} + +// A set of errors. +// +// The errors included depend on the context. See `ExprValue.error`. +message ErrorSet { + // The errors in the set. + repeated google.rpc.Status errors = 1; +} + +// A set of expressions for which the value is unknown. +// +// The unknowns included depend on the context. See `ExprValue.unknown`. +message UnknownSet { + // The ids of the expressions with unknown values. + repeated int64 exprs = 1; +} diff --git a/google/api/expr/v1alpha1/explain.proto b/google/api/expr/v1alpha1/explain.proto new file mode 100644 index 0000000000..56f8440577 --- /dev/null +++ b/google/api/expr/v1alpha1/explain.proto @@ -0,0 +1,54 @@ +// Copyright 2019 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.api.expr.v1alpha1; + +import "google/api/expr/v1alpha1/value.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "ExplainProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// Values of intermediate expressions produced when evaluating expression. +// Deprecated, use `EvalState` instead. +message Explain { + option deprecated = true; + + // ID and value index of one step. + message ExprStep { + // ID of corresponding Expr node. + int64 id = 1; + + // Index of the value in the values list. + int32 value_index = 2; + } + + // All of the observed values. + // + // The field value_index is an index in the values list. + // Separating values from steps is needed to remove redundant values. + repeated Value values = 1; + + // List of steps. + // + // Repeated evaluations of the same expression generate new ExprStep + // instances. The order of such ExprStep instances matches the order of + // elements returned by Comprehension.iter_range. + repeated ExprStep expr_steps = 2; +} diff --git a/google/api/expr/v1alpha1/syntax.proto b/google/api/expr/v1alpha1/syntax.proto new file mode 100644 index 0000000000..59bc26918d --- /dev/null +++ b/google/api/expr/v1alpha1/syntax.proto @@ -0,0 +1,328 @@ +// Copyright 2019 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.api.expr.v1alpha1; + +import "google/protobuf/duration.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "SyntaxProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// A representation of the abstract syntax of the Common Expression Language. + +// An expression together with source information as returned by the parser. +message ParsedExpr { + // The parsed expression. + Expr expr = 2; + + // The source info derived from input that generated the parsed `expr`. + SourceInfo source_info = 3; +} + +// An abstract representation of a common expression. +// +// Expressions are abstractly represented as a collection of identifiers, +// select statements, function calls, literals, and comprehensions. All +// operators with the exception of the '.' operator are modelled as function +// calls. This makes it easy to represent new operators into the existing AST. +// +// All references within expressions must resolve to a [Decl][google.api.expr.v1alpha1.Decl] provided at +// type-check for an expression to be valid. A reference may either be a bare +// identifier `name` or a qualified identifier `google.api.name`. References +// may either refer to a value or a function declaration. +// +// For example, the expression `google.api.name.startsWith('expr')` references +// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and +// the function declaration `startsWith`. +message Expr { + // An identifier expression. e.g. `request`. + message Ident { + // Required. Holds a single, unqualified identifier, possibly preceded by a + // '.'. + // + // Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. + string name = 1; + } + + // A field selection expression. e.g. `request.auth`. + message Select { + // Required. The target of the selection expression. + // + // For example, in the select expression `request.auth`, the `request` + // portion of the expression is the `operand`. + Expr operand = 1; + + // Required. The name of the field to select. + // + // For example, in the select expression `request.auth`, the `auth` portion + // of the expression would be the `field`. + string field = 2; + + // Whether the select is to be interpreted as a field presence test. + // + // This results from the macro `has(request.auth)`. + bool test_only = 3; + } + + // A call expression, including calls to predefined functions and operators. + // + // For example, `value == 10`, `size(map_value)`. + message Call { + // The target of an method call-style expression. For example, `x` in + // `x.f()`. + Expr target = 1; + + // Required. The name of the function or method being called. + string function = 2; + + // The arguments. + repeated Expr args = 3; + } + + // A list creation expression. + // + // Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g. + // `dyn([1, 'hello', 2.0])` + message CreateList { + // The elements part of the list. + repeated Expr elements = 1; + } + + // A map or message creation expression. + // + // Maps are constructed as `{'key_name': 'value'}`. Message construction is + // similar, but prefixed with a type name and composed of field ids: + // `types.MyType{field_id: 'value'}`. + message CreateStruct { + // Represents an entry. + message Entry { + // Required. An id assigned to this node by the parser which is unique + // in a given expression tree. This is used to associate type + // information and other attributes to the node. + int64 id = 1; + + // The `Entry` key kinds. + oneof key_kind { + // The field key for a message creator statement. + string field_key = 2; + + // The key expression for a map creation statement. + Expr map_key = 3; + } + + // Required. The value assigned to the key. + Expr value = 4; + } + + // The type name of the message to be created, empty when creating map + // literals. + string message_name = 1; + + // The entries in the creation expression. + repeated Entry entries = 2; + } + + // A comprehension expression applied to a list or map. + // + // Comprehensions are not part of the core syntax, but enabled with macros. + // A macro matches a specific call signature within a parsed AST and replaces + // the call with an alternate AST block. Macro expansion happens at parse + // time. + // + // The following macros are supported within CEL: + // + // Aggregate type macros may be applied to all elements in a list or all keys + // in a map: + // + // * `all`, `exists`, `exists_one` - test a predicate expression against + // the inputs and return `true` if the predicate is satisfied for all, + // any, or only one value `list.all(x, x < 10)`. + // * `filter` - test a predicate expression against the inputs and return + // the subset of elements which satisfy the predicate: + // `payments.filter(p, p > 1000)`. + // * `map` - apply an expression to all elements in the input and return the + // output aggregate type: `[1, 2, 3].map(i, i * i)`. + // + // The `has(m.x)` macro tests whether the property `x` is present in struct + // `m`. The semantics of this macro depend on the type of `m`. For proto2 + // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the + // macro tests whether the property is set to its default. For map and struct + // types, the macro tests whether the property `x` is defined on `m`. + message Comprehension { + // The name of the iteration variable. + string iter_var = 1; + + // The range over which var iterates. + Expr iter_range = 2; + + // The name of the variable used for accumulation of the result. + string accu_var = 3; + + // The initial value of the accumulator. + Expr accu_init = 4; + + // An expression which can contain iter_var and accu_var. + // + // Returns false when the result has been computed and may be used as + // a hint to short-circuit the remainder of the comprehension. + Expr loop_condition = 5; + + // An expression which can contain iter_var and accu_var. + // + // Computes the next value of accu_var. + Expr loop_step = 6; + + // An expression which can contain accu_var. + // + // Computes the result. + Expr result = 7; + } + + // Required. An id assigned to this node by the parser which is unique in a + // given expression tree. This is used to associate type information and other + // attributes to a node in the parse tree. + int64 id = 2; + + // Required. Variants of expressions. + oneof expr_kind { + // A literal expression. + Constant const_expr = 3; + + // An identifier expression. + Ident ident_expr = 4; + + // A field selection expression, e.g. `request.auth`. + Select select_expr = 5; + + // A call expression, including calls to predefined functions and operators. + Call call_expr = 6; + + // A list creation expression. + CreateList list_expr = 7; + + // A map or message creation expression. + CreateStruct struct_expr = 8; + + // A comprehension expression. + Comprehension comprehension_expr = 9; + } +} + +// Represents a primitive literal. +// +// Named 'Constant' here for backwards compatibility. +// +// This is similar as the primitives supported in the well-known type +// `google.protobuf.Value`, but richer so it can represent CEL's full range of +// primitives. +// +// Lists and structs are not included as constants as these aggregate types may +// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require evaluation and are thus not constant. +// +// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`, +// `true`, `null`. +message Constant { + // Required. The valid constant kinds. + oneof constant_kind { + // null value. + google.protobuf.NullValue null_value = 1; + + // boolean value. + bool bool_value = 2; + + // int64 value. + int64 int64_value = 3; + + // uint64 value. + uint64 uint64_value = 4; + + // double value. + double double_value = 5; + + // string value. + string string_value = 6; + + // bytes value. + bytes bytes_value = 7; + + // protobuf.Duration value. + // + // Deprecated: duration is no longer considered a builtin cel type. + google.protobuf.Duration duration_value = 8 [deprecated = true]; + + // protobuf.Timestamp value. + // + // Deprecated: timestamp is no longer considered a builtin cel type. + google.protobuf.Timestamp timestamp_value = 9 [deprecated = true]; + } +} + +// Source information collected at parse time. +message SourceInfo { + // The syntax version of the source, e.g. `cel1`. + string syntax_version = 1; + + // The location name. All position information attached to an expression is + // relative to this location. + // + // The location could be a file, UI element, or similar. For example, + // `acme/app/AnvilPolicy.cel`. + string location = 2; + + // Monotonically increasing list of character offsets where newlines appear. + // + // The line number of a given position is the index `i` where for a given + // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + // column may be derivd from `id_positions[id] - line_offsets[i]`. + repeated int32 line_offsets = 3; + + // A map from the parse node id (e.g. `Expr.id`) to the character offset + // within source. + map positions = 4; + + // A map from the parse node id where a macro replacement was made to the + // call `Expr` that resulted in a macro expansion. + // + // For example, `has(value.field)` is a function call that is replaced by a + // `test_only` field selection in the AST. Likewise, the call + // `list.exists(e, e > 10)` translates to a comprehension expression. The key + // in the map corresponds to the expression id of the expanded macro, and the + // value is the call `Expr` that was replaced. + map macro_calls = 5; +} + +// A specific position in source. +message SourcePosition { + // The soucre location name (e.g. file name). + string location = 1; + + // The character offset. + int32 offset = 2; + + // The 1-based index of the starting line in the source text + // where the issue occurs, or 0 if unknown. + int32 line = 3; + + // The 0-based index of the starting position within the line of source text + // where the issue occurs. Only meaningful if line is nonzero. + int32 column = 4; +} diff --git a/google/api/expr/v1alpha1/value.proto b/google/api/expr/v1alpha1/value.proto new file mode 100644 index 0000000000..a6ba38767e --- /dev/null +++ b/google/api/expr/v1alpha1/value.proto @@ -0,0 +1,116 @@ +// Copyright 2019 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.api.expr.v1alpha1; + +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; +option java_multiple_files = true; +option java_outer_classname = "ValueProto"; +option java_package = "com.google.api.expr.v1alpha1"; + +// Contains representations for CEL runtime values. + +// Represents a CEL value. +// +// This is similar to `google.protobuf.Value`, but can represent CEL's full +// range of values. +message Value { + // Required. The valid kinds of values. + oneof kind { + // Null value. + google.protobuf.NullValue null_value = 1; + + // Boolean value. + bool bool_value = 2; + + // Signed integer value. + int64 int64_value = 3; + + // Unsigned integer value. + uint64 uint64_value = 4; + + // Floating point value. + double double_value = 5; + + // UTF-8 string value. + string string_value = 6; + + // Byte string value. + bytes bytes_value = 7; + + // An enum value. + EnumValue enum_value = 9; + + // The proto message backing an object value. + google.protobuf.Any object_value = 10; + + // Map value. + MapValue map_value = 11; + + // List value. + ListValue list_value = 12; + + // Type value. + string type_value = 15; + } +} + +// An enum value. +message EnumValue { + // The fully qualified name of the enum type. + string type = 1; + + // The value of the enum. + int32 value = 2; +} + +// A list. +// +// Wrapped in a message so 'not set' and empty can be differentiated, which is +// required for use in a 'oneof'. +message ListValue { + // The ordered values in the list. + repeated Value values = 1; +} + +// A map. +// +// Wrapped in a message so 'not set' and empty can be differentiated, which is +// required for use in a 'oneof'. +message MapValue { + // An entry in the map. + message Entry { + // The key. + // + // Must be unique with in the map. + // Currently only boolean, int, uint, and string values can be keys. + Value key = 1; + + // The value. + Value value = 2; + } + + // The set of map entries. + // + // CEL has fewer restrictions on keys, so a protobuf map represenation + // cannot be used. + repeated Entry entries = 1; +} diff --git a/google/api/expr/v1beta1/BUILD.bazel b/google/api/expr/v1beta1/BUILD.bazel new file mode 100644 index 0000000000..819e1364a3 --- /dev/null +++ b/google/api/expr/v1beta1/BUILD.bazel @@ -0,0 +1,91 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "decl_proto", + srcs = ["decl.proto"], + deps = [ + ":expr_proto", + ], +) + +proto_library( + name = "eval_proto", + srcs = ["eval.proto"], + deps = [ + ":value_proto", + "//google/rpc:status_proto", + ], +) + +proto_library( + name = "expr_proto", + srcs = ["expr.proto"], + deps = [ + ":source_proto", + "@com_google_protobuf//:struct_proto", + ], +) + +proto_library( + name = "source_proto", + srcs = ["source.proto"], +) + +proto_library( + name = "value_proto", + srcs = ["value.proto"], + deps = [ + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:struct_proto", + ], +) + +proto_library( + name = "cel_proto", + deps = [ + ":decl_proto", + ":eval_proto", + ":expr_proto", + ":source_proto", + ":value_proto", + "//google/rpc:status_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:struct_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_proto_library", +) + +cc_proto_library( + name = "decl_cc_proto", + deps = [":decl_proto"], +) + +cc_proto_library( + name = "eval_cc_proto", + deps = [":eval_proto"], +) + +cc_proto_library( + name = "expr_cc_proto", + deps = [":expr_proto"], +) + +cc_proto_library( + name = "source_cc_proto", + deps = [":source_proto"], +) + +cc_proto_library( + name = "value_cc_proto", + deps = [":value_proto"], +) diff --git a/google/api/expr/v1beta1/decl.proto b/google/api/expr/v1beta1/decl.proto new file mode 100644 index 0000000000..d3d748b4e4 --- /dev/null +++ b/google/api/expr/v1beta1/decl.proto @@ -0,0 +1,84 @@ +// Copyright 2019 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.api.expr.v1beta1; + +import "google/api/expr/v1beta1/expr.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; +option java_multiple_files = true; +option java_outer_classname = "DeclProto"; +option java_package = "com.google.api.expr.v1beta1"; + +// A declaration. +message Decl { + // The id of the declaration. + int32 id = 1; + + // The name of the declaration. + string name = 2; + + // The documentation string for the declaration. + string doc = 3; + + // The kind of declaration. + oneof kind { + // An identifier declaration. + IdentDecl ident = 4; + + // A function declaration. + FunctionDecl function = 5; + } +} + +// The declared type of a variable. +// +// Extends runtime type values with extra information used for type checking +// and dispatching. +message DeclType { + // The expression id of the declared type, if applicable. + int32 id = 1; + + // The type name, e.g. 'int', 'my.type.Type' or 'T' + string type = 2; + + // An ordered list of type parameters, e.g. ``. + // Only applies to a subset of types, e.g. `map`, `list`. + repeated DeclType type_params = 4; +} + +// An identifier declaration. +message IdentDecl { + // Optional type of the identifier. + DeclType type = 3; + + // Optional value of the identifier. + Expr value = 4; +} + +// A function declaration. +message FunctionDecl { + // The function arguments. + repeated IdentDecl args = 1; + + // Optional declared return type. + DeclType return_type = 2; + + // If the first argument of the function is the receiver. + bool receiver_function = 3; +} diff --git a/google/api/expr/v1beta1/eval.proto b/google/api/expr/v1beta1/eval.proto new file mode 100644 index 0000000000..0c6c4d98e4 --- /dev/null +++ b/google/api/expr/v1beta1/eval.proto @@ -0,0 +1,125 @@ +// Copyright 2019 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.api.expr.v1beta1; + +import "google/api/expr/v1beta1/value.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; +option java_multiple_files = true; +option java_outer_classname = "EvalProto"; +option java_package = "com.google.api.expr.v1beta1"; + +// The state of an evaluation. +// +// Can represent an initial, partial, or completed state of evaluation. +message EvalState { + // A single evaluation result. + message Result { + // The expression this result is for. + IdRef expr = 1; + + // The index in `values` of the resulting value. + int32 value = 2; + } + + // The unique values referenced in this message. + repeated ExprValue values = 1; + + // An ordered list of results. + // + // Tracks the flow of evaluation through the expression. + // May be sparse. + repeated Result results = 3; +} + +// The value of an evaluated expression. +message ExprValue { + // An expression can resolve to a value, error or unknown. + oneof kind { + // A concrete value. + Value value = 1; + + // The set of errors in the critical path of evalution. + // + // Only errors in the critical path are included. For example, + // `( || true) && ` will only result in ``, + // while ` || ` will result in both `` and + // ``. + // + // Errors cause by the presence of other errors are not included in the + // set. For example `.foo`, `foo()`, and ` + 1` will + // only result in ``. + // + // Multiple errors *might* be included when evaluation could result + // in different errors. For example ` + ` and + // `foo(, )` may result in ``, `` or both. + // The exact subset of errors included for this case is unspecified and + // depends on the implementation details of the evaluator. + ErrorSet error = 2; + + // The set of unknowns in the critical path of evaluation. + // + // Unknown behaves identically to Error with regards to propagation. + // Specifically, only unknowns in the critical path are included, unknowns + // caused by the presence of other unknowns are not included, and multiple + // unknowns *might* be included included when evaluation could result in + // different unknowns. For example: + // + // ( || true) && -> + // || -> + // .foo -> + // foo() -> + // + -> or + // + // Unknown takes precidence over Error in cases where a `Value` can short + // circuit the result: + // + // || -> + // && -> + // + // Errors take precidence in all other cases: + // + // + -> + // foo(, ) -> + UnknownSet unknown = 3; + } +} + +// A set of errors. +// +// The errors included depend on the context. See `ExprValue.error`. +message ErrorSet { + // The errors in the set. + repeated google.rpc.Status errors = 1; +} + +// A set of expressions for which the value is unknown. +// +// The unknowns included depend on the context. See `ExprValue.unknown`. +message UnknownSet { + // The ids of the expressions with unknown values. + repeated IdRef exprs = 1; +} + +// A reference to an expression id. +message IdRef { + // The expression id. + int32 id = 1; +} diff --git a/google/api/expr/v1beta1/expr.proto b/google/api/expr/v1beta1/expr.proto new file mode 100644 index 0000000000..77249bafc5 --- /dev/null +++ b/google/api/expr/v1beta1/expr.proto @@ -0,0 +1,265 @@ +// Copyright 2019 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.api.expr.v1beta1; + +import "google/api/expr/v1beta1/source.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; +option java_multiple_files = true; +option java_outer_classname = "ExprProto"; +option java_package = "com.google.api.expr.v1beta1"; + +// An expression together with source information as returned by the parser. +message ParsedExpr { + // The parsed expression. + Expr expr = 2; + + // The source info derived from input that generated the parsed `expr`. + SourceInfo source_info = 3; + + // The syntax version of the source, e.g. `cel1`. + string syntax_version = 4; +} + +// An abstract representation of a common expression. +// +// Expressions are abstractly represented as a collection of identifiers, +// select statements, function calls, literals, and comprehensions. All +// operators with the exception of the '.' operator are modelled as function +// calls. This makes it easy to represent new operators into the existing AST. +// +// All references within expressions must resolve to a [Decl][google.api.expr.v1beta1.Decl] provided at +// type-check for an expression to be valid. A reference may either be a bare +// identifier `name` or a qualified identifier `google.api.name`. References +// may either refer to a value or a function declaration. +// +// For example, the expression `google.api.name.startsWith('expr')` references +// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression, and +// the function declaration `startsWith`. +message Expr { + // An identifier expression. e.g. `request`. + message Ident { + // Required. Holds a single, unqualified identifier, possibly preceded by a + // '.'. + // + // Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression. + string name = 1; + } + + // A field selection expression. e.g. `request.auth`. + message Select { + // Required. The target of the selection expression. + // + // For example, in the select expression `request.auth`, the `request` + // portion of the expression is the `operand`. + Expr operand = 1; + + // Required. The name of the field to select. + // + // For example, in the select expression `request.auth`, the `auth` portion + // of the expression would be the `field`. + string field = 2; + + // Whether the select is to be interpreted as a field presence test. + // + // This results from the macro `has(request.auth)`. + bool test_only = 3; + } + + // A call expression, including calls to predefined functions and operators. + // + // For example, `value == 10`, `size(map_value)`. + message Call { + // The target of an method call-style expression. For example, `x` in + // `x.f()`. + Expr target = 1; + + // Required. The name of the function or method being called. + string function = 2; + + // The arguments. + repeated Expr args = 3; + } + + // A list creation expression. + // + // Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g. + // `dyn([1, 'hello', 2.0])` + message CreateList { + // The elements part of the list. + repeated Expr elements = 1; + } + + // A map or message creation expression. + // + // Maps are constructed as `{'key_name': 'value'}`. Message construction is + // similar, but prefixed with a type name and composed of field ids: + // `types.MyType{field_id: 'value'}`. + message CreateStruct { + // Represents an entry. + message Entry { + // Required. An id assigned to this node by the parser which is unique + // in a given expression tree. This is used to associate type + // information and other attributes to the node. + int32 id = 1; + + // The `Entry` key kinds. + oneof key_kind { + // The field key for a message creator statement. + string field_key = 2; + + // The key expression for a map creation statement. + Expr map_key = 3; + } + + // Required. The value assigned to the key. + Expr value = 4; + } + + // The type name of the message to be created, empty when creating map + // literals. + string type = 1; + + // The entries in the creation expression. + repeated Entry entries = 2; + } + + // A comprehension expression applied to a list or map. + // + // Comprehensions are not part of the core syntax, but enabled with macros. + // A macro matches a specific call signature within a parsed AST and replaces + // the call with an alternate AST block. Macro expansion happens at parse + // time. + // + // The following macros are supported within CEL: + // + // Aggregate type macros may be applied to all elements in a list or all keys + // in a map: + // + // * `all`, `exists`, `exists_one` - test a predicate expression against + // the inputs and return `true` if the predicate is satisfied for all, + // any, or only one value `list.all(x, x < 10)`. + // * `filter` - test a predicate expression against the inputs and return + // the subset of elements which satisfy the predicate: + // `payments.filter(p, p > 1000)`. + // * `map` - apply an expression to all elements in the input and return the + // output aggregate type: `[1, 2, 3].map(i, i * i)`. + // + // The `has(m.x)` macro tests whether the property `x` is present in struct + // `m`. The semantics of this macro depend on the type of `m`. For proto2 + // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the + // macro tests whether the property is set to its default. For map and struct + // types, the macro tests whether the property `x` is defined on `m`. + message Comprehension { + // The name of the iteration variable. + string iter_var = 1; + + // The range over which var iterates. + Expr iter_range = 2; + + // The name of the variable used for accumulation of the result. + string accu_var = 3; + + // The initial value of the accumulator. + Expr accu_init = 4; + + // An expression which can contain iter_var and accu_var. + // + // Returns false when the result has been computed and may be used as + // a hint to short-circuit the remainder of the comprehension. + Expr loop_condition = 5; + + // An expression which can contain iter_var and accu_var. + // + // Computes the next value of accu_var. + Expr loop_step = 6; + + // An expression which can contain accu_var. + // + // Computes the result. + Expr result = 7; + } + + // Required. An id assigned to this node by the parser which is unique in a + // given expression tree. This is used to associate type information and other + // attributes to a node in the parse tree. + int32 id = 2; + + // Required. Variants of expressions. + oneof expr_kind { + // A literal expression. + Literal literal_expr = 3; + + // An identifier expression. + Ident ident_expr = 4; + + // A field selection expression, e.g. `request.auth`. + Select select_expr = 5; + + // A call expression, including calls to predefined functions and operators. + Call call_expr = 6; + + // A list creation expression. + CreateList list_expr = 7; + + // A map or object creation expression. + CreateStruct struct_expr = 8; + + // A comprehension expression. + Comprehension comprehension_expr = 9; + } +} + +// Represents a primitive literal. +// +// This is similar to the primitives supported in the well-known type +// `google.protobuf.Value`, but richer so it can represent CEL's full range of +// primitives. +// +// Lists and structs are not included as constants as these aggregate types may +// contain [Expr][google.api.expr.v1beta1.Expr] elements which require evaluation and are thus not constant. +// +// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`, +// `true`, `null`. +message Literal { + // Required. The valid constant kinds. + oneof constant_kind { + // null value. + google.protobuf.NullValue null_value = 1; + + // boolean value. + bool bool_value = 2; + + // int64 value. + int64 int64_value = 3; + + // uint64 value. + uint64 uint64_value = 4; + + // double value. + double double_value = 5; + + // string value. + string string_value = 6; + + // bytes value. + bytes bytes_value = 7; + } +} diff --git a/google/api/expr/v1beta1/source.proto b/google/api/expr/v1beta1/source.proto new file mode 100644 index 0000000000..78bb0a064c --- /dev/null +++ b/google/api/expr/v1beta1/source.proto @@ -0,0 +1,62 @@ +// Copyright 2019 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.api.expr.v1beta1; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; +option java_multiple_files = true; +option java_outer_classname = "SourceProto"; +option java_package = "com.google.api.expr.v1beta1"; + +// Source information collected at parse time. +message SourceInfo { + // The location name. All position information attached to an expression is + // relative to this location. + // + // The location could be a file, UI element, or similar. For example, + // `acme/app/AnvilPolicy.cel`. + string location = 2; + + // Monotonically increasing list of character offsets where newlines appear. + // + // The line number of a given position is the index `i` where for a given + // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The + // column may be derivd from `id_positions[id] - line_offsets[i]`. + repeated int32 line_offsets = 3; + + // A map from the parse node id (e.g. `Expr.id`) to the character offset + // within source. + map positions = 4; +} + +// A specific position in source. +message SourcePosition { + // The soucre location name (e.g. file name). + string location = 1; + + // The character offset. + int32 offset = 2; + + // The 1-based index of the starting line in the source text + // where the issue occurs, or 0 if unknown. + int32 line = 3; + + // The 0-based index of the starting position within the line of source text + // where the issue occurs. Only meaningful if line is nonzer.. + int32 column = 4; +} diff --git a/google/api/expr/v1beta1/value.proto b/google/api/expr/v1beta1/value.proto new file mode 100644 index 0000000000..0978228dcd --- /dev/null +++ b/google/api/expr/v1beta1/value.proto @@ -0,0 +1,114 @@ +// Copyright 2019 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.api.expr.v1beta1; + +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; +option java_multiple_files = true; +option java_outer_classname = "ValueProto"; +option java_package = "com.google.api.expr.v1beta1"; + +// Represents a CEL value. +// +// This is similar to `google.protobuf.Value`, but can represent CEL's full +// range of values. +message Value { + // Required. The valid kinds of values. + oneof kind { + // Null value. + google.protobuf.NullValue null_value = 1; + + // Boolean value. + bool bool_value = 2; + + // Signed integer value. + int64 int64_value = 3; + + // Unsigned integer value. + uint64 uint64_value = 4; + + // Floating point value. + double double_value = 5; + + // UTF-8 string value. + string string_value = 6; + + // Byte string value. + bytes bytes_value = 7; + + // An enum value. + EnumValue enum_value = 9; + + // The proto message backing an object value. + google.protobuf.Any object_value = 10; + + // Map value. + MapValue map_value = 11; + + // List value. + ListValue list_value = 12; + + // A Type value represented by the fully qualified name of the type. + string type_value = 15; + } +} + +// An enum value. +message EnumValue { + // The fully qualified name of the enum type. + string type = 1; + + // The value of the enum. + int32 value = 2; +} + +// A list. +// +// Wrapped in a message so 'not set' and empty can be differentiated, which is +// required for use in a 'oneof'. +message ListValue { + // The ordered values in the list. + repeated Value values = 1; +} + +// A map. +// +// Wrapped in a message so 'not set' and empty can be differentiated, which is +// required for use in a 'oneof'. +message MapValue { + // An entry in the map. + message Entry { + // The key. + // + // Must be unique with in the map. + // Currently only boolean, int, uint, and string values can be keys. + Value key = 1; + + // The value. + Value value = 2; + } + + // The set of map entries. + // + // CEL has fewer restrictions on keys, so a protobuf map represenation + // cannot be used. + repeated Entry entries = 1; +} diff --git a/google/api/field_behavior.proto b/google/api/field_behavior.proto new file mode 100644 index 0000000000..eb7f78ef1d --- /dev/null +++ b/google/api/field_behavior.proto @@ -0,0 +1,79 @@ +// Copyright 2019 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.api; + +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "FieldBehaviorProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.FieldOptions { + // A designation of a specific field behavior (required, output only, etc.) + // in protobuf messages. + // + // Examples: + // + // string name = 1 [(google.api.field_behavior) = REQUIRED]; + // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + // google.protobuf.Duration ttl = 1 + // [(google.api.field_behavior) = INPUT_ONLY]; + // google.protobuf.Timestamp expire_time = 1 + // [(google.api.field_behavior) = OUTPUT_ONLY, + // (google.api.field_behavior) = IMMUTABLE]; + repeated google.api.FieldBehavior field_behavior = 1052; +} + +// An indicator of the behavior of a given field (for example, that a field +// is required in requests, or given as output but ignored as input). +// This **does not** change the behavior in protocol buffers itself; it only +// denotes the behavior and may affect how API tooling handles the field. +// +// Note: This enum **may** receive new values in the future. +enum FieldBehavior { + // Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0; + + // Specifically denotes a field as optional. + // While all fields in protocol buffers are optional, this may be specified + // for emphasis if appropriate. + OPTIONAL = 1; + + // Denotes a field as required. + // This indicates that the field **must** be provided as part of the request, + // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2; + + // Denotes a field as output only. + // This indicates that the field is provided in responses, but including the + // field in a request does nothing (the server *must* ignore it and + // *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3; + + // Denotes a field as input only. + // This indicates that the field is provided in requests, and the + // corresponding field is not included in output. + INPUT_ONLY = 4; + + // Denotes a field as immutable. + // This indicates that the field may be set once in a request to create a + // resource, but may not be changed thereafter. + IMMUTABLE = 5; +} diff --git a/google/api/http.proto b/google/api/http.proto new file mode 100644 index 0000000000..b2977f5147 --- /dev/null +++ b/google/api/http.proto @@ -0,0 +1,376 @@ +// Copyright 2019 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.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; + + // When set to true, URL path parameters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; +} + +// # gRPC Transcoding +// +// gRPC Transcoding is a feature for mapping between a gRPC method and one or +// more HTTP REST endpoints. It allows developers to build a single API service +// that supports both gRPC APIs and REST APIs. Many systems, including [Google +// APIs](https://github.com/googleapis/googleapis), +// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC +// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), +// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature +// and use it for large scale production services. +// +// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +// how different portions of the gRPC request message are mapped to the URL +// path, URL query parameters, and HTTP request body. It also controls how the +// gRPC response message is mapped to the HTTP response body. `HttpRule` is +// typically specified as an `google.api.http` annotation on the gRPC method. +// +// Each mapping specifies a URL path template and an HTTP method. The path +// template may refer to one or more fields in the gRPC request message, as long +// as each field is a non-repeated field with a primitive (non-message) type. +// The path template controls how fields of the request message are mapped to +// the URL path. +// +// Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/{name=messages/*}" +// }; +// } +// } +// message GetMessageRequest { +// string name = 1; // Mapped to URL path. +// } +// message Message { +// string text = 1; // The resource content. +// } +// +// This enables an HTTP REST to gRPC mapping as below: +// +// HTTP | gRPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` +// +// Any fields in the request message which are not bound by the path template +// automatically become HTTP query parameters if there is no HTTP request body. +// For example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get:"/v1/messages/{message_id}" +// }; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // Mapped to URL path. +// int64 revision = 2; // Mapped to URL query parameter `revision`. +// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +// } +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | gRPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | +// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: +// "foo"))` +// +// Note that fields which are mapped to URL query parameters must have a +// primitive type or a repeated primitive type or a non-repeated message type. +// In the case of a repeated type, the parameter can be repeated in the URL +// as `...?param=A¶m=B`. In the case of a message type, each field of the +// message is mapped to a separate parameter, such as +// `...?foo.a=A&foo.b=B&foo.c=C`. +// +// For HTTP methods that allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | gRPC +// -----|----- +// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +// "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// patch: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | gRPC +// -----|----- +// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +// "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice when +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// This enables the following two alternative HTTP JSON to RPC mappings: +// +// HTTP | gRPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: +// "123456")` +// +// ## Rules for HTTP mapping +// +// 1. Leaf request fields (recursive expansion nested messages in the request +// message) are classified into three categories: +// - Fields referred by the path template. They are passed via the URL path. +// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP +// request body. +// - All other fields are passed via the URL query parameters, and the +// parameter name is the field path in the request message. A repeated +// field can be represented as multiple query parameters under the same +// name. +// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields +// are passed via URL path and HTTP request body. +// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all +// fields are passed via URL path and URL query parameters. +// +// ### Path template syntax +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single URL path segment. The syntax `**` matches +// zero or more URL path segments, which must be the last part of the URL path +// except the `Verb`. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +// contains any reserved character, such characters should be percent-encoded +// before the matching. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path on the client +// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The +// server side does the reverse decoding. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{var}`. +// +// If a variable contains multiple path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path on the +// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. +// The server side does the reverse decoding, except "%2F" and "%2f" are left +// unchanged. Such variables show up in the +// [Discovery +// Document](https://developers.google.com/discovery/v1/reference/apis) as +// `{+var}`. +// +// ## Using gRPC API Service Configuration +// +// gRPC API Service Configuration (service config) is a configuration language +// for configuring a gRPC service to become a user-facing product. The +// service config is simply the YAML representation of the `google.api.Service` +// proto message. +// +// As an alternative to annotating your proto file, you can configure gRPC +// transcoding in your service config YAML files. You do this by specifying a +// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +// effect as the proto annotation. This can be particularly useful if you +// have a proto that is reused in multiple services. Note that any transcoding +// specified in the service config will override any matching transcoding +// configuration in the proto. +// +// Example: +// +// http: +// rules: +// # Selects a gRPC method and applies HttpRule to it. +// - selector: example.v1.Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// ## Special notes +// +// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +// proto to JSON conversion must follow the [proto3 +// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). +// +// While the single segment variable follows the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String +// Expansion, the multi segment variable **does not** follow RFC 6570 Section +// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +// for multi segment variables. +// +// The path variables **must not** refer to any repeated or mapped field, +// because client libraries are not capable of handling such variable expansion. +// +// The path variables **must not** capture the leading "/" character. The reason +// is that the most common use case "{var}" does not capture the leading "/" +// character. For consistency, all path variables must share the same behavior. +// +// Repeated message fields must not be mapped to URL query parameters, because +// no client library can support such complicated mapping. +// +// If an API needs to use a JSON array for request or response body, it can map +// the request or response body to a repeated field. However, some gRPC +// Transcoding implementations may not support this feature. +message HttpRule { + // Selects a method to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Maps to HTTP GET. Used for listing and getting information about + // resources. + string get = 2; + + // Maps to HTTP PUT. Used for replacing a resource. + string put = 3; + + // Maps to HTTP POST. Used for creating a resource or performing an action. + string post = 4; + + // Maps to HTTP DELETE. Used for deleting a resource. + string delete = 5; + + // Maps to HTTP PATCH. Used for updating a resource. + string patch = 6; + + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP request + // body, or `*` for mapping all request fields not captured by the path + // pattern to the HTTP body, or omitted for not having any HTTP request body. + // + // NOTE: the referred field must be present at the top-level of the request + // message type. + string body = 7; + + // Optional. The name of the response field whose value is mapped to the HTTP + // response body. When omitted, the entire response message will be used + // as the HTTP response body. + // + // NOTE: The referred field must be present at the top-level of the response + // message type. + string response_body = 12; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/google/api/httpbody.proto b/google/api/httpbody.proto new file mode 100644 index 0000000000..45c1e76b1d --- /dev/null +++ b/google/api/httpbody.proto @@ -0,0 +1,78 @@ +// Copyright 2019 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.api; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; +option java_multiple_files = true; +option java_outer_classname = "HttpBodyProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns +// (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +message HttpBody { + // The HTTP Content-Type header value specifying the content type of the body. + string content_type = 1; + + // The HTTP request/response body as raw binary. + bytes data = 2; + + // Application specific response metadata. Must be set in the first response + // for streaming APIs. + repeated google.protobuf.Any extensions = 3; +} diff --git a/google/api/label.proto b/google/api/label.proto new file mode 100644 index 0000000000..668efd1c6b --- /dev/null +++ b/google/api/label.proto @@ -0,0 +1,49 @@ +// Copyright 2019 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.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/label;label"; +option java_multiple_files = true; +option java_outer_classname = "LabelProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// A description of a label. +message LabelDescriptor { + // Value types that can be used as label values. + enum ValueType { + // A variable-length string. This is the default. + STRING = 0; + + // Boolean; true or false. + BOOL = 1; + + // A 64-bit signed integer. + INT64 = 2; + } + + // The label key. + string key = 1; + + // The type of data that can be assigned to the label. + ValueType value_type = 2; + + // A human-readable description for the label. + string description = 3; +} diff --git a/google/api/launch_stage.proto b/google/api/launch_stage.proto new file mode 100644 index 0000000000..55fd914242 --- /dev/null +++ b/google/api/launch_stage.proto @@ -0,0 +1,67 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api;api"; +option java_multiple_files = true; +option java_outer_classname = "LaunchStageProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// The launch stage as defined by [Google Cloud Platform +// Launch Stages](http://cloud.google.com/terms/launch-stages). +enum LaunchStage { + // Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0; + + // Early Access features are limited to a closed group of testers. To use + // these features, you must sign up in advance and sign a Trusted Tester + // agreement (which includes confidentiality provisions). These features may + // be unstable, changed in backward-incompatible ways, and are not + // guaranteed to be released. + EARLY_ACCESS = 1; + + // Alpha is a limited availability test for releases before they are cleared + // for widespread use. By Alpha, all significant design issues are resolved + // and we are in the process of verifying functionality. Alpha customers + // need to apply for access, agree to applicable terms, and have their + // projects whitelisted. Alpha releases don’t have to be feature complete, + // no SLAs are provided, and there are no technical support obligations, but + // they will be far enough along that customers can actually use them in + // test environments or for limited-use tests -- just like they would in + // normal production cases. + ALPHA = 2; + + // Beta is the point at which we are ready to open a release for any + // customer to use. There are no SLA or technical support obligations in a + // Beta release. Products will be complete from a feature perspective, but + // may have some open outstanding issues. Beta releases are suitable for + // limited production use cases. + BETA = 3; + + // GA features are open to all developers and are considered stable and + // fully qualified for production use. + GA = 4; + + // Deprecated features are scheduled to be shut down and removed. For more + // information, see the “Deprecation Policy” section of our [Terms of + // Service](https://cloud.google.com/terms/) + // and the [Google Cloud Platform Subject to the Deprecation + // Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5; +} diff --git a/google/api/log.proto b/google/api/log.proto new file mode 100644 index 0000000000..1125e1fe30 --- /dev/null +++ b/google/api/log.proto @@ -0,0 +1,55 @@ +// Copyright 2019 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.api; + +import "google/api/label.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "LogProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// A description of a log type. Example in YAML format: +// +// - name: library.googleapis.com/activity_history +// description: The history of borrowing and returning library items. +// display_name: Activity +// labels: +// - key: /customer_id +// description: Identifier of a library customer +message LogDescriptor { + // The name of the log. It must be less than 512 characters long and can + // include the following characters: upper- and lower-case alphanumeric + // characters [A-Za-z0-9], and punctuation characters including + // slash, underscore, hyphen, period [/_-.]. + string name = 1; + + // The set of labels that are available to describe a specific log entry. + // Runtime requests that contain labels not specified here are + // considered invalid. + repeated LabelDescriptor labels = 2; + + // A human-readable description of this log. This information appears in + // the documentation and can contain details. + string description = 3; + + // The human-readable name for this log. This information appears on + // the user interface and should be concise. + string display_name = 4; +} diff --git a/google/api/logging.proto b/google/api/logging.proto new file mode 100644 index 0000000000..9090b2a1cd --- /dev/null +++ b/google/api/logging.proto @@ -0,0 +1,81 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "LoggingProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Logging configuration of the service. +// +// The following example shows how to configure logs to be sent to the +// producer and consumer projects. In the example, the `activity_history` +// log is sent to both the producer and consumer projects, whereas the +// `purchase_history` log is only sent to the producer project. +// +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. +// logs: +// - name: activity_history +// labels: +// - key: /customer_id +// - name: purchase_history +// logging: +// producer_destinations: +// - monitored_resource: library.googleapis.com/branch +// logs: +// - activity_history +// - purchase_history +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// logs: +// - activity_history +message Logging { + // Configuration of a specific logging destination (the producer project + // or the consumer project). + message LoggingDestination { + // The monitored resource type. The type must be defined in the + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 3; + + // Names of the logs to be sent to this destination. Each name must + // be defined in the [Service.logs][google.api.Service.logs] section. If the log name is + // not a domain scoped name, it will be automatically prefixed with + // the service name followed by "/". + repeated string logs = 1; + } + + // Logging configurations for sending logs to the producer project. + // There can be multiple producer destinations, each one must have a + // different monitored resource type. A log can be used in at most + // one producer destination. + repeated LoggingDestination producer_destinations = 1; + + // Logging configurations for sending logs to the consumer project. + // There can be multiple consumer destinations, each one must have a + // different monitored resource type. A log can be used in at most + // one consumer destination. + repeated LoggingDestination consumer_destinations = 2; +} diff --git a/google/api/metric.proto b/google/api/metric.proto new file mode 100644 index 0000000000..78c3826b6c --- /dev/null +++ b/google/api/metric.proto @@ -0,0 +1,256 @@ +// Copyright 2019 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.api; + +import "google/api/label.proto"; +import "google/api/launch_stage.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/metric;metric"; +option java_multiple_files = true; +option java_outer_classname = "MetricProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Defines a metric type and its schema. Once a metric descriptor is created, +// deleting or altering it stops data collection and makes the metric type's +// existing data unusable. +message MetricDescriptor { + // Additional annotations that can be used to guide the usage of a metric. + message MetricDescriptorMetadata { + // Deprecated. Please use the MetricDescriptor.launch_stage instead. + // The launch stage of the metric definition. + LaunchStage launch_stage = 1 [deprecated = true]; + + // The sampling period of metric data points. For metrics which are written + // periodically, consecutive data points are stored at this time interval, + // excluding data loss due to errors. Metrics with a higher granularity have + // a smaller sampling period. + google.protobuf.Duration sample_period = 2; + + // The delay of data points caused by ingestion. Data points older than this + // age are guaranteed to be ingested and available to be read, excluding + // data loss due to errors. + google.protobuf.Duration ingest_delay = 3; + } + + // The kind of measurement. It describes how the data is reported. + enum MetricKind { + // Do not use this default value. + METRIC_KIND_UNSPECIFIED = 0; + + // An instantaneous measurement of a value. + GAUGE = 1; + + // The change in a value during a time interval. + DELTA = 2; + + // A value accumulated over a time interval. Cumulative + // measurements in a time series should have the same start time + // and increasing end times, until an event resets the cumulative + // value to zero and sets a new start time for the following + // points. + CUMULATIVE = 3; + } + + // The value type of a metric. + enum ValueType { + // Do not use this default value. + VALUE_TYPE_UNSPECIFIED = 0; + + // The value is a boolean. + // This value type can be used only if the metric kind is `GAUGE`. + BOOL = 1; + + // The value is a signed 64-bit integer. + INT64 = 2; + + // The value is a double precision floating point number. + DOUBLE = 3; + + // The value is a text string. + // This value type can be used only if the metric kind is `GAUGE`. + STRING = 4; + + // The value is a [`Distribution`][google.api.Distribution]. + DISTRIBUTION = 5; + + // The value is money. + MONEY = 6; + } + + // The resource name of the metric descriptor. + string name = 1; + + // The metric type, including its DNS name prefix. The type is not + // URL-encoded. All user-defined metric types have the DNS name + // `custom.googleapis.com` or `external.googleapis.com`. Metric types should + // use a natural hierarchical grouping. For example: + // + // "custom.googleapis.com/invoice/paid/amount" + // "external.googleapis.com/prometheus/up" + // "appengine.googleapis.com/http/server/response_latencies" + string type = 8; + + // The set of labels that can be used to describe a specific + // instance of this metric type. For example, the + // `appengine.googleapis.com/http/server/response_latencies` metric + // type has a label for the HTTP response code, `response_code`, so + // you can look at latencies for successful responses or just + // for responses that failed. + repeated LabelDescriptor labels = 2; + + // Whether the metric records instantaneous values, changes to a value, etc. + // Some combinations of `metric_kind` and `value_type` might not be supported. + MetricKind metric_kind = 3; + + // Whether the measurement is an integer, a floating-point number, etc. + // Some combinations of `metric_kind` and `value_type` might not be supported. + ValueType value_type = 4; + + // The units in which the metric value is reported. It is only applicable + // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` + // defines the representation of the stored metric values. + // + // Different systems may scale the values to be more easily displayed (so a + // value of `0.02KBy` _might_ be displayed as `20By`, and a value of + // `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is + // `KBy`, then the value of the metric is always in thousands of bytes, no + // matter how it may be displayed.. + // + // If you want a custom metric to record the exact number of CPU-seconds used + // by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is + // `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 + // CPU-seconds, then the value is written as `12005`. + // + // Alternatively, if you want a custome metric to record data in a more + // granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is + // `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), + // or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). + // + // The supported units are a subset of [The Unified Code for Units of + // Measure](http://unitsofmeasure.org/ucum.html) standard: + // + // **Basic units (UNIT)** + // + // * `bit` bit + // * `By` byte + // * `s` second + // * `min` minute + // * `h` hour + // * `d` day + // + // **Prefixes (PREFIX)** + // + // * `k` kilo (10^3) + // * `M` mega (10^6) + // * `G` giga (10^9) + // * `T` tera (10^12) + // * `P` peta (10^15) + // * `E` exa (10^18) + // * `Z` zetta (10^21) + // * `Y` yotta (10^24) + + // * `m` milli (10^-3) + // * `u` micro (10^-6) + // * `n` nano (10^-9) + // * `p` pico (10^-12) + // * `f` femto (10^-15) + // * `a` atto (10^-18) + // * `z` zepto (10^-21) + // * `y` yocto (10^-24) + + // * `Ki` kibi (2^10) + // * `Mi` mebi (2^20) + // * `Gi` gibi (2^30) + // * `Ti` tebi (2^40) + // * `Pi` pebi (2^50) + // + // **Grammar** + // + // The grammar also includes these connectors: + // + // * `/` division or ratio (as an infix operator). For examples, + // `kBy/{email}` or `MiBy/10ms` (although you should almost never + // have `/s` in a metric `unit`; rates should always be computed at + // query time from the underlying cumulative or delta value). + // * `.` multiplication or composition (as an infix operator). For + // examples, `GBy.d` or `k{watt}.h`. + // + // The grammar for a unit is as follows: + // + // Expression = Component { "." Component } { "/" Component } ; + // + // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] + // | Annotation + // | "1" + // ; + // + // Annotation = "{" NAME "}" ; + // + // Notes: + // + // * `Annotation` is just a comment if it follows a `UNIT`. If the annotation + // is used alone, then the unit is equivalent to `1`. For examples, + // `{request}/s == 1/s`, `By{transmitted}/s == By/s`. + // * `NAME` is a sequence of non-blank printable ASCII characters not + // containing `{` or `}`. + // * `1` represents a unitary [dimensionless + // unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such + // as in `1/s`. It is typically used when none of the basic units are + // appropriate. For example, "new users per day" can be represented as + // `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new + // users). Alternatively, "thousands of page views per day" would be + // represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric + // value of `5.3` would mean "5300 page views per day"). + // * `%` represents dimensionless value of 1/100, and annotates values giving + // a percentage (so the metric values are typically in the range of 0..100, + // and a metric value `3` means "3 percent"). + // * `10^2.%` indicates a metric contains a ratio, typically in the range + // 0..1, that will be multiplied by 100 and displayed as a percentage + // (so a metric value `0.03` means "3 percent"). + // + string unit = 5; + + // A detailed description of the metric, which can be used in documentation. + string description = 6; + + // A concise name for the metric, which can be displayed in user interfaces. + // Use sentence case without an ending period, for example "Request count". + // This field is optional but it is recommended to be set for any metrics + // associated with user-visible concepts, such as Quota. + string display_name = 7; + + // Optional. Metadata which can be used to guide usage of the metric. + MetricDescriptorMetadata metadata = 10; + + // Optional. The launch stage of the metric definition. + LaunchStage launch_stage = 12; +} + +// A specific metric, identified by specifying values for all of the +// labels of a [`MetricDescriptor`][google.api.MetricDescriptor]. +message Metric { + // An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. + // For example, `custom.googleapis.com/invoice/paid/amount`. + string type = 3; + + // The set of label values that uniquely identify this metric. All + // labels listed in the `MetricDescriptor` must be assigned values. + map labels = 2; +} diff --git a/google/api/monitored_resource.proto b/google/api/monitored_resource.proto new file mode 100644 index 0000000000..2c94902a29 --- /dev/null +++ b/google/api/monitored_resource.proto @@ -0,0 +1,119 @@ +// Copyright 2019 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.api; + +import "google/api/label.proto"; +import "google/api/launch_stage.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres"; +option java_multiple_files = true; +option java_outer_classname = "MonitoredResourceProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a +// type name and a set of labels. For example, the monitored resource +// descriptor for Google Compute Engine VM instances has a type of +// `"gce_instance"` and specifies the use of the labels `"instance_id"` and +// `"zone"` to identify particular VM instances. +// +// Different APIs can support different monitored resource types. APIs generally +// provide a `list` method that returns the monitored resource descriptors used +// by the API. +message MonitoredResourceDescriptor { + // Optional. The resource name of the monitored resource descriptor: + // `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where + // {type} is the value of the `type` field in this object and + // {project_id} is a project ID that provides API-specific context for + // accessing the type. APIs that do not use project information can use the + // resource name format `"monitoredResourceDescriptors/{type}"`. + string name = 5; + + // Required. The monitored resource type. For example, the type + // `"cloudsql_database"` represents databases in Google Cloud SQL. + // The maximum length of this value is 256 characters. + string type = 1; + + // Optional. A concise name for the monitored resource type that might be + // displayed in user interfaces. It should be a Title Cased Noun Phrase, + // without any article or other determiners. For example, + // `"Google Cloud SQL Database"`. + string display_name = 2; + + // Optional. A detailed description of the monitored resource type that might + // be used in documentation. + string description = 3; + + // Required. A set of labels used to describe instances of this monitored + // resource type. For example, an individual Google Cloud SQL database is + // identified by values for the labels `"database_id"` and `"zone"`. + repeated LabelDescriptor labels = 4; + + // Optional. The launch stage of the monitored resource definition. + LaunchStage launch_stage = 7; +} + +// An object representing a resource that can be used for monitoring, logging, +// billing, or other purposes. Examples include virtual machine instances, +// databases, and storage devices such as disks. The `type` field identifies a +// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's +// schema. Information in the `labels` field identifies the actual resource and +// its attributes according to the schema. For example, a particular Compute +// Engine VM instance could be represented by the following object, because the +// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels +// `"instance_id"` and `"zone"`: +// +// { "type": "gce_instance", +// "labels": { "instance_id": "12345678901234", +// "zone": "us-central1-a" }} +message MonitoredResource { + // Required. The monitored resource type. This field must match + // the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For + // example, the type of a Compute Engine VM instance is `gce_instance`. + string type = 1; + + // Required. Values for all of the labels listed in the associated monitored + // resource descriptor. For example, Compute Engine VM instances use the + // labels `"project_id"`, `"instance_id"`, and `"zone"`. + map labels = 2; +} + +// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object. +// [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to +// uniquely identify a monitored resource instance. There is some other useful +// auxiliary metadata. Monitoring and Logging use an ingestion +// pipeline to extract metadata for cloud resources of all types, and store +// the metadata in this message. +message MonitoredResourceMetadata { + // Output only. Values for predefined system metadata labels. + // System labels are a kind of metadata extracted by Google, including + // "machine_image", "vpc", "subnet_id", + // "security_group", "name", etc. + // System label values can be only strings, Boolean values, or a list of + // strings. For example: + // + // { "name": "my-test-instance", + // "security_group": ["a", "b", "c"], + // "spot_instance": false } + google.protobuf.Struct system_labels = 1; + + // Output only. A map of user-defined metadata labels. + map user_labels = 2; +} diff --git a/google/api/monitoring.proto b/google/api/monitoring.proto new file mode 100644 index 0000000000..07e962d1ba --- /dev/null +++ b/google/api/monitoring.proto @@ -0,0 +1,91 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "MonitoringProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Monitoring configuration of the service. +// +// The example below shows how to configure monitored resources and metrics +// for monitoring. In the example, a monitored resource and two metrics are +// defined. The `library.googleapis.com/book/returned_count` metric is sent +// to both producer and consumer projects, whereas the +// `library.googleapis.com/book/overdue_count` metric is only sent to the +// consumer project. +// +// monitored_resources: +// - type: library.googleapis.com/branch +// labels: +// - key: /city +// description: The city where the library branch is located in. +// - key: /name +// description: The name of the branch. +// metrics: +// - name: library.googleapis.com/book/returned_count +// metric_kind: DELTA +// value_type: INT64 +// labels: +// - key: /customer_id +// - name: library.googleapis.com/book/overdue_count +// metric_kind: GAUGE +// value_type: INT64 +// labels: +// - key: /customer_id +// monitoring: +// producer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/returned_count +// consumer_destinations: +// - monitored_resource: library.googleapis.com/branch +// metrics: +// - library.googleapis.com/book/returned_count +// - library.googleapis.com/book/overdue_count +message Monitoring { + // Configuration of a specific monitoring destination (the producer project + // or the consumer project). + message MonitoringDestination { + // The monitored resource type. The type must be defined in + // [Service.monitored_resources][google.api.Service.monitored_resources] section. + string monitored_resource = 1; + + // Types of the metrics to report to this monitoring destination. + // Each type must be defined in [Service.metrics][google.api.Service.metrics] section. + repeated string metrics = 2; + } + + // Monitoring configurations for sending metrics to the producer project. + // There can be multiple producer destinations. A monitored resouce type may + // appear in multiple monitoring destinations if different aggregations are + // needed for different sets of metrics associated with that monitored + // resource type. A monitored resource and metric pair may only be used once + // in the Monitoring configuration. + repeated MonitoringDestination producer_destinations = 1; + + // Monitoring configurations for sending metrics to the consumer project. + // There can be multiple consumer destinations. A monitored resouce type may + // appear in multiple monitoring destinations if different aggregations are + // needed for different sets of metrics associated with that monitored + // resource type. A monitored resource and metric pair may only be used once + // in the Monitoring configuration. + repeated MonitoringDestination consumer_destinations = 2; +} diff --git a/google/api/quota.proto b/google/api/quota.proto new file mode 100644 index 0000000000..2e6e52b66d --- /dev/null +++ b/google/api/quota.proto @@ -0,0 +1,187 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "QuotaProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Quota configuration helps to achieve fairness and budgeting in service +// usage. +// +// The metric based quota configuration works this way: +// - The service configuration defines a set of metrics. +// - For API calls, the quota.metric_rules maps methods to metrics with +// corresponding costs. +// - The quota.limits defines limits on the metrics, which will be used for +// quota checks at runtime. +// +// An example quota configuration in yaml format: +// +// quota: +// limits: +// +// - name: apiWriteQpsPerProject +// metric: library.googleapis.com/write_calls +// unit: "1/min/{project}" # rate limit for consumer projects +// values: +// STANDARD: 10000 +// +// +// # The metric rules bind all methods to the read_calls metric, +// # except for the UpdateBook and DeleteBook methods. These two methods +// # are mapped to the write_calls metric, with the UpdateBook method +// # consuming at twice rate as the DeleteBook method. +// metric_rules: +// - selector: "*" +// metric_costs: +// library.googleapis.com/read_calls: 1 +// - selector: google.example.library.v1.LibraryService.UpdateBook +// metric_costs: +// library.googleapis.com/write_calls: 2 +// - selector: google.example.library.v1.LibraryService.DeleteBook +// metric_costs: +// library.googleapis.com/write_calls: 1 +// +// Corresponding Metric definition: +// +// metrics: +// - name: library.googleapis.com/read_calls +// display_name: Read requests +// metric_kind: DELTA +// value_type: INT64 +// +// - name: library.googleapis.com/write_calls +// display_name: Write requests +// metric_kind: DELTA +// value_type: INT64 +// +// +message Quota { + // List of `QuotaLimit` definitions for the service. + repeated QuotaLimit limits = 3; + + // List of `MetricRule` definitions, each one mapping a selected method to one + // or more metrics. + repeated MetricRule metric_rules = 4; +} + +// Bind API methods to metrics. Binding a method to a metric causes that +// metric's configured quota behaviors to apply to the method call. +message MetricRule { + // Selects the methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Metrics to update when the selected methods are called, and the associated + // cost applied to each metric. + // + // The key of the map is the metric name, and the values are the amount + // increased for the metric against which the quota limits are defined. + // The value must not be negative. + map metric_costs = 2; +} + +// `QuotaLimit` defines a specific limit that applies over a specified duration +// for a limit type. There can be at most one limit for a duration and limit +// type combination defined within a `QuotaGroup`. +message QuotaLimit { + // Name of the quota limit. + // + // The name must be provided, and it must be unique within the service. The + // name can only include alphanumeric characters as well as '-'. + // + // The maximum length of the limit name is 64 characters. + string name = 6; + + // Optional. User-visible, extended description for this quota limit. + // Should be used only when more context is needed to understand this limit + // than provided by the limit's display name (see: `display_name`). + string description = 2; + + // Default number of tokens that can be consumed during the specified + // duration. This is the number of tokens assigned when a client + // application developer activates the service for his/her project. + // + // Specifying a value of 0 will block all requests. This can be used if you + // are provisioning quota to selected consumers and blocking others. + // Similarly, a value of -1 will indicate an unlimited quota. No other + // negative values are allowed. + // + // Used by group-based quotas only. + int64 default_limit = 3; + + // Maximum number of tokens that can be consumed during the specified + // duration. Client application developers can override the default limit up + // to this maximum. If specified, this value cannot be set to a value less + // than the default limit. If not specified, it is set to the default limit. + // + // To allow clients to apply overrides with no upper bound, set this to -1, + // indicating unlimited maximum quota. + // + // Used by group-based quotas only. + int64 max_limit = 4; + + // Free tier value displayed in the Developers Console for this limit. + // The free tier is the number of tokens that will be subtracted from the + // billed amount when billing is enabled. + // This field can only be set on a limit with duration "1d", in a billable + // group; it is invalid on any other limit. If this field is not set, it + // defaults to 0, indicating that there is no free tier for this service. + // + // Used by group-based quotas only. + int64 free_tier = 7; + + // Duration of this limit in textual notation. Example: "100s", "24h", "1d". + // For duration longer than a day, only multiple of days is supported. We + // support only "100s" and "1d" for now. Additional support will be added in + // the future. "0" indicates indefinite duration. + // + // Used by group-based quotas only. + string duration = 5; + + // The name of the metric this quota limit applies to. The quota limits with + // the same metric will be checked together during runtime. The metric must be + // defined within the service config. + string metric = 8; + + // Specify the unit of the quota limit. It uses the same syntax as + // [Metric.unit][]. The supported unit kinds are determined by the quota + // backend system. + // + // Here are some examples: + // * "1/min/{project}" for quota per minute per project. + // + // Note: the order of unit components is insignificant. + // The "1" at the beginning is required to follow the metric unit syntax. + string unit = 9; + + // Tiered limit values. You must specify this as a key:value pair, with an + // integer value that is the maximum number of requests allowed for the + // specified unit. Currently only STANDARD is supported. + map values = 10; + + // User-visible display name for this limit. + // Optional. If not set, the UI will provide a default display name based on + // the quota configuration. This field can be used to override the default + // display name generated from the configuration. + string display_name = 12; +} diff --git a/google/api/resource.proto b/google/api/resource.proto new file mode 100644 index 0000000000..fdb7001ad6 --- /dev/null +++ b/google/api/resource.proto @@ -0,0 +1,264 @@ +// Copyright 2019 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.api; + +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "ResourceProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.FieldOptions { + // An annotation that describes a resource reference, see + // [ResourceReference][]. + google.api.ResourceReference resource_reference = 1055; +} + +extend google.protobuf.FileOptions { + // An annotation that describes a resource definition without a corresponding + // message; see [ResourceDescriptor][]. + repeated google.api.ResourceDescriptor resource_definition = 1053; +} + +extend google.protobuf.MessageOptions { + // An annotation that describes a resource definition, see + // [ResourceDescriptor][]. + google.api.ResourceDescriptor resource = 1053; +} + +// A simple descriptor of a resource type. +// +// ResourceDescriptor annotates a resource message (either by means of a +// protobuf annotation or use in the service config), and associates the +// resource's schema, the resource type, and the pattern of the resource name. +// +// Example: +// +// message Topic { +// // Indicates this message defines a resource schema. +// // Declares the resource type in the format of {service}/{kind}. +// // For Kubernetes resources, the format is {api group}/{kind}. +// option (google.api.resource) = { +// type: "pubsub.googleapis.com/Topic" +// name_descriptor: { +// pattern: "projects/{project}/topics/{topic}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// } +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: "pubsub.googleapis.com/Topic" +// name_descriptor: +// - pattern: "projects/{project}/topics/{topic}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// +// Sometimes, resources have multiple patterns, typically because they can +// live under multiple parents. +// +// Example: +// +// message LogEntry { +// option (google.api.resource) = { +// type: "logging.googleapis.com/LogEntry" +// name_descriptor: { +// pattern: "projects/{project}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// } +// name_descriptor: { +// pattern: "folders/{folder}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +// parent_name_extractor: "folders/{folder}" +// } +// name_descriptor: { +// pattern: "organizations/{organization}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Organization" +// parent_name_extractor: "organizations/{organization}" +// } +// name_descriptor: { +// pattern: "billingAccounts/{billing_account}/logs/{log}" +// parent_type: "billing.googleapis.com/BillingAccount" +// parent_name_extractor: "billingAccounts/{billing_account}" +// } +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: 'logging.googleapis.com/LogEntry' +// name_descriptor: +// - pattern: "projects/{project}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// parent_name_extractor: "projects/{project}" +// - pattern: "folders/{folder}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +// parent_name_extractor: "folders/{folder}" +// - pattern: "organizations/{organization}/logs/{log}" +// parent_type: "cloudresourcemanager.googleapis.com/Organization" +// parent_name_extractor: "organizations/{organization}" +// - pattern: "billingAccounts/{billing_account}/logs/{log}" +// parent_type: "billing.googleapis.com/BillingAccount" +// parent_name_extractor: "billingAccounts/{billing_account}" +// +// For flexible resources, the resource name doesn't contain parent names, but +// the resource itself has parents for policy evaluation. +// +// Example: +// +// message Shelf { +// option (google.api.resource) = { +// type: "library.googleapis.com/Shelf" +// name_descriptor: { +// pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// } +// name_descriptor: { +// pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +// } +// }; +// } +// +// The ResourceDescriptor Yaml config will look like: +// +// resources: +// - type: 'library.googleapis.com/Shelf' +// name_descriptor: +// - pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Project" +// - pattern: "shelves/{shelf}" +// parent_type: "cloudresourcemanager.googleapis.com/Folder" +message ResourceDescriptor { + // A description of the historical or future-looking state of the + // resource pattern. + enum History { + // The "unset" value. + HISTORY_UNSPECIFIED = 0; + + // The resource originally had one pattern and launched as such, and + // additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1; + + // The resource has one pattern, but the API owner expects to add more + // later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + // that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2; + } + + // The resource type. It must be in the format of + // {service_name}/{resource_type_kind}. The `resource_type_kind` must be + // singular and must not include version numbers. + // + // Example: `storage.googleapis.com/Bucket` + // + // The value of the resource_type_kind must follow the regular expression + // /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + // should use PascalCase (UpperCamelCase). The maximum number of + // characters allowed for the `resource_type_kind` is 100. + string type = 1; + + // Optional. The relative resource name pattern associated with this resource + // type. The DNS prefix of the full resource name shouldn't be specified here. + // + // The path pattern must follow the syntax, which aligns with HTTP binding + // syntax: + // + // Template = Segment { "/" Segment } ; + // Segment = LITERAL | Variable ; + // Variable = "{" LITERAL "}" ; + // + // Examples: + // + // - "projects/{project}/topics/{topic}" + // - "projects/{project}/knowledgeBases/{knowledge_base}" + // + // The components in braces correspond to the IDs for each resource in the + // hierarchy. It is expected that, if multiple patterns are provided, + // the same component name (e.g. "project") refers to IDs of the same + // type of resource. + repeated string pattern = 2; + + // Optional. The field on the resource that designates the resource name + // field. If omitted, this is assumed to be "name". + string name_field = 3; + + // Optional. The historical or future-looking state of the resource pattern. + // + // Example: + // + // // The InspectTemplate message originally only supported resource + // // names with organization, and project was added later. + // message InspectTemplate { + // option (google.api.resource) = { + // type: "dlp.googleapis.com/InspectTemplate" + // pattern: + // "organizations/{organization}/inspectTemplates/{inspect_template}" + // pattern: "projects/{project}/inspectTemplates/{inspect_template}" + // history: ORIGINALLY_SINGLE_PATTERN + // }; + // } + History history = 4; + + // The plural name used in the resource name, such as 'projects' for + // the name of 'projects/{project}'. It is the same concept of the `plural` + // field in k8s CRD spec + // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + string plural = 5; + + // The same concept of the `singular` field in k8s CRD spec + // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + // Such as "project" for the `resourcemanager.googleapis.com/Project` type. + string singular = 6; +} + +// Defines a proto annotation that describes a string field that refers to +// an API resource. +message ResourceReference { + // The resource type that the annotated field references. + // + // Example: + // + // message Subscription { + // string topic = 2 [(google.api.resource_reference) = { + // type: "pubsub.googleapis.com/Topic" + // }]; + // } + string type = 1; + + // The resource type of a child collection that the annotated field + // references. This is useful for annotating the `parent` field that + // doesn't have a fixed resource type. + // + // Example: + // + // message ListLogEntriesRequest { + // string parent = 1 [(google.api.resource_reference) = { + // child_type: "logging.googleapis.com/LogEntry" + // }; + // } + string child_type = 2; +} diff --git a/google/api/service.proto b/google/api/service.proto new file mode 100644 index 0000000000..c29eb5c899 --- /dev/null +++ b/google/api/service.proto @@ -0,0 +1,176 @@ +// Copyright 2019 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.api; + +import "google/api/auth.proto"; +import "google/api/backend.proto"; +import "google/api/billing.proto"; +import "google/api/context.proto"; +import "google/api/control.proto"; +import "google/api/documentation.proto"; +import "google/api/endpoint.proto"; +import "google/api/http.proto"; +import "google/api/label.proto"; +import "google/api/log.proto"; +import "google/api/logging.proto"; +import "google/api/metric.proto"; +import "google/api/monitored_resource.proto"; +import "google/api/monitoring.proto"; +import "google/api/quota.proto"; +import "google/api/resource.proto"; +import "google/api/source_info.proto"; +import "google/api/system_parameter.proto"; +import "google/api/usage.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/api.proto"; +import "google/protobuf/type.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// `Service` is the root object of Google service configuration schema. It +// describes basic information about a service, such as the name and the +// title, and delegates other aspects to sub-sections. Each sub-section is +// either a proto message or a repeated proto message that configures a +// specific aspect, such as auth. See each proto message definition for details. +// +// Example: +// +// type: google.api.Service +// config_version: 3 +// name: calendar.googleapis.com +// title: Google Calendar API +// apis: +// - name: google.calendar.v3.Calendar +// authentication: +// providers: +// - id: google_calendar_auth +// jwks_uri: https://www.googleapis.com/oauth2/v1/certs +// issuer: https://securetoken.google.com +// rules: +// - selector: "*" +// requirements: +// provider_id: google_calendar_auth +message Service { + // The semantic version of the service configuration. The config version + // affects the interpretation of the service configuration. For example, + // certain features are enabled by default for certain config versions. + // The latest config version is `3`. + google.protobuf.UInt32Value config_version = 20; + + // The service name, which is a DNS-like logical identifier for the + // service, such as `calendar.googleapis.com`. The service name + // typically goes through DNS verification to make sure the owner + // of the service also owns the DNS name. + string name = 1; + + // A unique ID for a specific instance of this message, typically assigned + // by the client for tracking purpose. If empty, the server may choose to + // generate one instead. Must be no longer than 60 characters. + string id = 33; + + // The product title for this service. + string title = 2; + + // The Google project that owns this service. + string producer_project_id = 22; + + // A list of API interfaces exported by this service. Only the `name` field + // of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration + // author, as the remaining fields will be derived from the IDL during the + // normalization process. It is an error to specify an API interface here + // which cannot be resolved against the associated IDL files. + repeated google.protobuf.Api apis = 3; + + // A list of all proto message types included in this API service. + // Types referenced directly or indirectly by the `apis` are + // automatically included. Messages which are not referenced but + // shall be included, such as types used by the `google.protobuf.Any` type, + // should be listed here by name. Example: + // + // types: + // - name: google.protobuf.Int32 + repeated google.protobuf.Type types = 4; + + // A list of all enum types included in this API service. Enums + // referenced directly or indirectly by the `apis` are automatically + // included. Enums which are not referenced but shall be included + // should be listed here by name. Example: + // + // enums: + // - name: google.someapi.v1.SomeEnum + repeated google.protobuf.Enum enums = 5; + + // Additional API documentation. + Documentation documentation = 6; + + // API backend configuration. + Backend backend = 8; + + // HTTP configuration. + Http http = 9; + + // Quota configuration. + Quota quota = 10; + + // Auth configuration. + Authentication authentication = 11; + + // Context configuration. + Context context = 12; + + // Configuration controlling usage of this service. + Usage usage = 15; + + // Configuration for network endpoints. If this is empty, then an endpoint + // with the same name as the service is automatically generated to service all + // defined APIs. + repeated Endpoint endpoints = 18; + + // Configuration for the service control plane. + Control control = 21; + + // Defines the logs used by this service. + repeated LogDescriptor logs = 23; + + // Defines the metrics used by this service. + repeated MetricDescriptor metrics = 24; + + // Defines the monitored resources used by this service. This is required + // by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. + repeated MonitoredResourceDescriptor monitored_resources = 25; + + // Billing configuration. + Billing billing = 26; + + // Logging configuration. + Logging logging = 27; + + // Monitoring configuration. + Monitoring monitoring = 28; + + // System parameter configuration. + SystemParameters system_parameters = 29; + + // Output only. The source information for this configuration if available. + SourceInfo source_info = 37; +} diff --git a/google/api/serviceconfig.yaml b/google/api/serviceconfig.yaml new file mode 100644 index 0000000000..6d883d4282 --- /dev/null +++ b/google/api/serviceconfig.yaml @@ -0,0 +1,24 @@ +type: google.api.Service +config_version: 1 +name: serviceconfig.googleapis.com +title: Service Config API + +types: +- name: google.api.ConfigChange +- name: google.api.Distribution +- name: google.api.DocumentationRule +- name: google.api.HttpBody +- name: google.api.LabelDescriptor +- name: google.api.Metric +- name: google.api.MonitoredResource +- name: google.api.MonitoredResourceDescriptor +- name: google.api.MonitoredResourceMetadata +- name: google.api.ResourceDescriptor +- name: google.api.ResourceReference +- name: google.api.Service + +enums: +- name: google.api.FieldBehavior + +documentation: + summary: Lets you define and config your API service. diff --git a/google/api/servicecontrol/BUILD.bazel b/google/api/servicecontrol/BUILD.bazel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/google/api/servicecontrol/README.md b/google/api/servicecontrol/README.md new file mode 100644 index 0000000000..3d9590ee02 --- /dev/null +++ b/google/api/servicecontrol/README.md @@ -0,0 +1,126 @@ +Google Service Control provides control plane functionality to managed services, +such as logging, monitoring, and status checks. This page provides an overview +of what it does and how it works. + +## Why use Service Control? + +When you develop a cloud service, you typically start with the business +requirements and the architecture design, then proceed with API definition +and implementation. Before you put your service into production, you +need to deal with many control plane issues: + +* How to control access to your service. +* How to send logging and monitoring data to both consumers and producers. +* How to create and manage dashboards to visualize this data. +* How to automatically scale the control plane components with your service. + +Service Control is a mature and feature-rich control plane provider +that addresses these needs with high efficiency, high scalability, +and high availability. It provides a simple public API that can be accessed +from anywhere using JSON REST and gRPC clients, so when you move your service +from on-premise to a cloud provider, or from one cloud provider to another, +you don't need to change the control plane provider. + +Services built using Google Cloud Endpoints already take advantage of +Service Control. Cloud Endpoints sends logging and monitoring data +through Google Service Control for every request arriving at its +proxy. If you need to report any additional logging and monitoring data for +your Cloud Endpoints service, you can call the Service Control API directly +from your service. + +The Service Control API definition is open sourced and available on +[GitHub](https://github.com/googleapis/googleapis/tree/master/google/api/servicecontrol). +By changing the DNS name, you can easily use alternative implementations of +the Service Control API. + +## Architecture + +Google Service Control works with a set of *managed services* and their +*operations* (activities), *checks* whether an operation is allowed to proceed, +and *reports* completed operations. Behind the scenes, it leverages other +Google Cloud services, such as +[Google Service Management](/service-management), +[Stackdriver Logging](/logging), and [Stackdriver Monitoring](/monitoring), +while hiding their complexity from service producers. It enables service +producers to send telemetry data to their consumers. It uses caching, +batching, aggregation, and retries to deliver higher performance and +availability than the individual backend systems it encapsulates. + +
+
+ The overall architecture of a service that uses Google Service Control. +
+
Figure 1: Using Google Service Control.
+
+ +The Service Control API provides two methods: + +* [`services.check`](/service-control/reference/rest/v1/services/check), used for: + * Ensuring valid consumer status + * Validating API keys +* [`services.report`](/service-control/reference/rest/v1/services/report), used for: + * Sending logs to Stackdriver Logging + * Sending metrics to Stackdriver Monitoring + +We’ll look at these in more detail in the rest of this overview. + +## Managed services + +A [managed service](/service-management/reference/rest/v1/services) is +a network service managed by +[Google Service Management](/service-management). Each managed service has a +unique name, such as `example.googleapis.com`, which must be a valid +fully-qualified DNS name, as per RFC 1035. + +For example: + +* Google Cloud Pub/Sub (`pubsub.googleapis.com`) +* Google Cloud Vision (`vision.googleapis.com`) +* Google Cloud Bigtable (`bigtable.googleapis.com`) +* Google Cloud Datastore (`datastore.googleapis.com`) + +Google Service Management manages the lifecycle of each service’s +configuration, which is used to customize Google Service Control's behavior. +Service configurations are also used by Google Cloud Console +for displaying APIs and their settings, enabling/disabling APIs, and more. + +## Operations + +Google Service Control uses the generic concept of an *operation* +to represent the +activities of a managed service, such as API calls and resource usage. Each +operation is associated with a managed service and a specific service +consumer, and has a set of properties that describe the operation, such as +the API method name and resource usage amount. For more information, see the +[Operation definition](/service-control/rest/v1/Operation). + +## Check + +The [`services.check`](/service-control/reference/rest/v1/services/check) +method determines whether an operation should be allowed to proceed +for a managed service. + +For example: + +* Check if the consumer is still active. +* Check if the consumer has enabled the service. +* Check if the API key is still valid. + +By performing multiple checks within a single method call, it provides +better performance, higher reliability, and reduced development cost to +service producers compared to checking with multiple backend systems. + +## Report + +The [`services.report`](/service-control/reference/rest/v1/services/report) +method reports completed operations for +a managed service to backend systems, such as logging and monitoring. The +reported data can be seen in Google API Console and Google Cloud Console, +and retrieved with appropriate APIs, such as the Stackdriver Logging and +Stackdriver Monitoring APIs. + +## Next steps + +* Read our [Getting Started guide](/service-control/getting-started) to find out + how to set up and use the Google Service Control API. diff --git a/google/api/servicecontrol/v1/check_error.proto b/google/api/servicecontrol/v1/check_error.proto new file mode 100644 index 0000000000..de3969d2f2 --- /dev/null +++ b/google/api/servicecontrol/v1/check_error.proto @@ -0,0 +1,133 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "CheckErrorProto"; +option java_package = "com.google.api.servicecontrol.v1"; + +// Defines the errors to be returned in +// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors]. +message CheckError { + // Error codes for Check responses. + enum Code { + // This is never used in `CheckResponse`. + ERROR_CODE_UNSPECIFIED = 0; + + // The consumer's project id, network container, or resource container was + // not found. Same as [google.rpc.Code.NOT_FOUND][]. + NOT_FOUND = 5; + + // The consumer doesn't have access to the specified resource. + // Same as [google.rpc.Code.PERMISSION_DENIED][]. + PERMISSION_DENIED = 7; + + // Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][]. + RESOURCE_EXHAUSTED = 8; + + // The consumer has been flagged as an abuser. + ABUSER_DETECTED = 103; + + // The consumer hasn't activated the service. + SERVICE_NOT_ACTIVATED = 104; + + // The consumer cannot access the service because billing is disabled. + BILLING_DISABLED = 107; + + // The consumer's project has been marked as deleted (soft deletion). + PROJECT_DELETED = 108; + + // The consumer's project number or id does not represent a valid project. + PROJECT_INVALID = 114; + + // The IP address of the consumer is invalid for the specific consumer + // project. + IP_ADDRESS_BLOCKED = 109; + + // The referer address of the consumer request is invalid for the specific + // consumer project. + REFERER_BLOCKED = 110; + + // The client application of the consumer request is invalid for the + // specific consumer project. + CLIENT_APP_BLOCKED = 111; + + // The API targeted by this request is invalid for the specified consumer + // project. + API_TARGET_BLOCKED = 122; + + // The consumer's API key is invalid. + API_KEY_INVALID = 105; + + // The consumer's API Key has expired. + API_KEY_EXPIRED = 112; + + // The consumer's API Key was not found in config record. + API_KEY_NOT_FOUND = 113; + + // Request is not allowed as per security policies defined in Org Policy. + SECURITY_POLICY_VIOLATED = 121; + + // The credential in the request can not be verified. + INVALID_CREDENTIAL = 123; + + // Request is not allowed as per location policies defined in Org Policy. + LOCATION_POLICY_VIOLATED = 124; + + // The input consumer info does not represent a valid consumer folder or + // organization. + CONSUMER_INVALID = 125; + + // NOTE: By convention, all *_UNAVAILABLE codes are required to be in the + // 300 - 399 range. + + // NOTE: Unless there are very special business requirements, service + // producer should ignore the following errors. These errors should not + // cause the rejection of client requests. + + // The backend server for looking up project id/number is unavailable. + NAMESPACE_LOOKUP_UNAVAILABLE = 300; + + // The backend server for checking service status is unavailable. + SERVICE_STATUS_UNAVAILABLE = 301; + + // The backend server for checking billing status is unavailable. + BILLING_STATUS_UNAVAILABLE = 302; + + // The backend server for checking quota limits is unavailable. + QUOTA_CHECK_UNAVAILABLE = 303; + + // Cloud Resource Manager backend server is unavailable. + CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE = 305; + + // Backend server for evaluating security policy is unavailable. + SECURITY_POLICY_BACKEND_UNAVAILABLE = 306; + + // Backend server for evaluating location policy is unavailable. + LOCATION_POLICY_BACKEND_UNAVAILABLE = 307; + } + + // The error code. + Code code = 1; + + // Free-form text providing details on the error cause of the error. + string detail = 2; +} diff --git a/google/api/servicecontrol/v1/distribution.proto b/google/api/servicecontrol/v1/distribution.proto new file mode 100644 index 0000000000..40b89f5ba6 --- /dev/null +++ b/google/api/servicecontrol/v1/distribution.proto @@ -0,0 +1,158 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "DistributionProto"; +option java_package = "com.google.api.servicecontrol.v1"; + +// Distribution represents a frequency distribution of double-valued sample +// points. It contains the size of the population of sample points plus +// additional optional information: +// +// - the arithmetic mean of the samples +// - the minimum and maximum of the samples +// - the sum-squared-deviation of the samples, used to compute variance +// - a histogram of the values of the sample points +message Distribution { + // Describing buckets with constant width. + message LinearBuckets { + // The number of finite buckets. With the underflow and overflow buckets, + // the total number of buckets is `num_finite_buckets` + 2. + // See comments on `bucket_options` for details. + int32 num_finite_buckets = 1; + + // The i'th linear bucket covers the interval + // [offset + (i-1) * width, offset + i * width) + // where i ranges from 1 to num_finite_buckets, inclusive. + // Must be strictly positive. + double width = 2; + + // The i'th linear bucket covers the interval + // [offset + (i-1) * width, offset + i * width) + // where i ranges from 1 to num_finite_buckets, inclusive. + double offset = 3; + } + + // Describing buckets with exponentially growing width. + message ExponentialBuckets { + // The number of finite buckets. With the underflow and overflow buckets, + // the total number of buckets is `num_finite_buckets` + 2. + // See comments on `bucket_options` for details. + int32 num_finite_buckets = 1; + + // The i'th exponential bucket covers the interval + // [scale * growth_factor^(i-1), scale * growth_factor^i) + // where i ranges from 1 to num_finite_buckets inclusive. + // Must be larger than 1.0. + double growth_factor = 2; + + // The i'th exponential bucket covers the interval + // [scale * growth_factor^(i-1), scale * growth_factor^i) + // where i ranges from 1 to num_finite_buckets inclusive. + // Must be > 0. + double scale = 3; + } + + // Describing buckets with arbitrary user-provided width. + message ExplicitBuckets { + // 'bound' is a list of strictly increasing boundaries between + // buckets. Note that a list of length N-1 defines N buckets because + // of fenceposting. See comments on `bucket_options` for details. + // + // The i'th finite bucket covers the interval + // [bound[i-1], bound[i]) + // where i ranges from 1 to bound_size() - 1. Note that there are no + // finite buckets at all if 'bound' only contains a single element; in + // that special case the single bound defines the boundary between the + // underflow and overflow buckets. + // + // bucket number lower bound upper bound + // i == 0 (underflow) -inf bound[i] + // 0 < i < bound_size() bound[i-1] bound[i] + // i == bound_size() (overflow) bound[i-1] +inf + repeated double bounds = 1; + } + + // The total number of samples in the distribution. Must be >= 0. + int64 count = 1; + + // The arithmetic mean of the samples in the distribution. If `count` is + // zero then this field must be zero. + double mean = 2; + + // The minimum of the population of values. Ignored if `count` is zero. + double minimum = 3; + + // The maximum of the population of values. Ignored if `count` is zero. + double maximum = 4; + + // The sum of squared deviations from the mean: + // Sum[i=1..count]((x_i - mean)^2) + // where each x_i is a sample values. If `count` is zero then this field + // must be zero, otherwise validation of the request fails. + double sum_of_squared_deviation = 5; + + // The number of samples in each histogram bucket. `bucket_counts` are + // optional. If present, they must sum to the `count` value. + // + // The buckets are defined below in `bucket_option`. There are N buckets. + // `bucket_counts[0]` is the number of samples in the underflow bucket. + // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples + // in each of the finite buckets. And `bucket_counts[N] is the number + // of samples in the overflow bucket. See the comments of `bucket_option` + // below for more details. + // + // Any suffix of trailing zeros may be omitted. + repeated int64 bucket_counts = 6; + + // Defines the buckets in the histogram. `bucket_option` and `bucket_counts` + // must be both set, or both unset. + // + // Buckets are numbered in the range of [0, N], with a total of N+1 buckets. + // There must be at least two buckets (a single-bucket histogram gives + // no information that isn't already provided by `count`). + // + // The first bucket is the underflow bucket which has a lower bound + // of -inf. The last bucket is the overflow bucket which has an + // upper bound of +inf. All other buckets (if any) are called "finite" + // buckets because they have finite lower and upper bounds. As described + // below, there are three ways to define the finite buckets. + // + // (1) Buckets with constant width. + // (2) Buckets with exponentially growing widths. + // (3) Buckets with arbitrary user-provided widths. + // + // In all cases, the buckets cover the entire real number line (-inf, + // +inf). Bucket upper bounds are exclusive and lower bounds are + // inclusive. The upper bound of the underflow bucket is equal to the + // lower bound of the smallest finite bucket; the lower bound of the + // overflow bucket is equal to the upper bound of the largest finite + // bucket. + oneof bucket_option { + // Buckets with constant width. + LinearBuckets linear_buckets = 7; + + // Buckets with exponentially growing width. + ExponentialBuckets exponential_buckets = 8; + + // Buckets with arbitrary user-provided width. + ExplicitBuckets explicit_buckets = 9; + } +} diff --git a/google/api/servicecontrol/v1/log_entry.proto b/google/api/servicecontrol/v1/log_entry.proto new file mode 100644 index 0000000000..50b0fc4686 --- /dev/null +++ b/google/api/servicecontrol/v1/log_entry.proto @@ -0,0 +1,66 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/logging/type/log_severity.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "LogEntryProto"; +option java_package = "com.google.api.servicecontrol.v1"; + +// An individual log entry. +message LogEntry { + // Required. The log to which this log entry belongs. Examples: `"syslog"`, + // `"book_log"`. + string name = 10; + + // The time the event described by the log entry occurred. If + // omitted, defaults to operation start time. + google.protobuf.Timestamp timestamp = 11; + + // The severity of the log entry. The default value is + // `LogSeverity.DEFAULT`. + google.logging.type.LogSeverity severity = 12; + + // A unique ID for the log entry used for deduplication. If omitted, + // the implementation will generate one based on operation_id. + string insert_id = 4; + + // A set of user-defined (key, value) data that provides additional + // information about the log entry. + map labels = 13; + + // The log entry payload, which can be one of multiple types. + oneof payload { + // The log entry payload, represented as a protocol buffer that is + // expressed as a JSON object. The only accepted type currently is + // [AuditLog][google.cloud.audit.AuditLog]. + google.protobuf.Any proto_payload = 2; + + // The log entry payload, represented as a Unicode string (UTF-8). + string text_payload = 3; + + // The log entry payload, represented as a structure that + // is expressed as a JSON object. + google.protobuf.Struct struct_payload = 6; + } +} diff --git a/google/api/servicecontrol/v1/metric_value.proto b/google/api/servicecontrol/v1/metric_value.proto new file mode 100644 index 0000000000..9a62ff6989 --- /dev/null +++ b/google/api/servicecontrol/v1/metric_value.proto @@ -0,0 +1,78 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/distribution.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/money.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "MetricValueSetProto"; +option java_package = "com.google.api.servicecontrol.v1"; + +// Represents a single metric value. +message MetricValue { + // The labels describing the metric value. + // See comments on + // [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] + // for the overriding relationship. + map labels = 1; + + // The start of the time period over which this metric value's measurement + // applies. The time period has different semantics for different metric + // types (cumulative, delta, and gauge). See the metric definition + // documentation in the service configuration for details. + google.protobuf.Timestamp start_time = 2; + + // The end of the time period over which this metric value's measurement + // applies. + google.protobuf.Timestamp end_time = 3; + + // The value. The type of value used in the request must + // agree with the metric definition in the service configuration, otherwise + // the MetricValue is rejected. + oneof value { + // A boolean value. + bool bool_value = 4; + + // A signed 64-bit integer value. + int64 int64_value = 5; + + // A double precision floating point value. + double double_value = 6; + + // A text string value. + string string_value = 7; + + // A distribution value. + Distribution distribution_value = 8; + } +} + +// Represents a set of metric values in the same metric. +// Each metric value in the set should have a unique combination of start time, +// end time, and label values. +message MetricValueSet { + // The metric name defined in the service configuration. + string metric_name = 1; + + // The values in this metric. + repeated MetricValue metric_values = 2; +} diff --git a/google/api/servicecontrol/v1/operation.proto b/google/api/servicecontrol/v1/operation.proto new file mode 100644 index 0000000000..301f3575c7 --- /dev/null +++ b/google/api/servicecontrol/v1/operation.proto @@ -0,0 +1,113 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/log_entry.proto"; +import "google/api/servicecontrol/v1/metric_value.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "OperationProto"; +option java_package = "com.google.api.servicecontrol.v1"; + +// Represents information regarding an operation. +message Operation { + // Defines the importance of the data contained in the operation. + enum Importance { + // The API implementation may cache and aggregate the data. + // The data may be lost when rare and unexpected system failures occur. + LOW = 0; + + // The API implementation doesn't cache and aggregate the data. + // If the method returns successfully, it's guaranteed that the data has + // been persisted in durable storage. + HIGH = 1; + } + + // Identity of the operation. This must be unique within the scope of the + // service that generated the operation. If the service calls + // Check() and Report() on the same operation, the two calls should carry + // the same id. + // + // UUID version 4 is recommended, though not required. + // In scenarios where an operation is computed from existing information + // and an idempotent id is desirable for deduplication purpose, UUID version 5 + // is recommended. See RFC 4122 for details. + string operation_id = 1; + + // Fully qualified name of the operation. Reserved for future use. + string operation_name = 2; + + // Identity of the consumer who is using the service. + // This field should be filled in for the operations initiated by a + // consumer, but not for service-initiated operations that are + // not related to a specific consumer. + // + // This can be in one of the following formats: + // project:, + // project_number:, + // api_key:. + string consumer_id = 3; + + // Required. Start time of the operation. + google.protobuf.Timestamp start_time = 4; + + // End time of the operation. + // Required when the operation is used in + // [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report], + // but optional when the operation is used in + // [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check]. + google.protobuf.Timestamp end_time = 5; + + // Labels describing the operation. Only the following labels are allowed: + // + // - Labels describing monitored resources as defined in + // the service configuration. + // - Default labels of metric values. When specified, labels defined in the + // metric value override these default. + // - The following labels defined by Google Cloud Platform: + // - `cloud.googleapis.com/location` describing the location where the + // operation happened, + // - `servicecontrol.googleapis.com/user_agent` describing the user agent + // of the API request, + // - `servicecontrol.googleapis.com/service_agent` describing the service + // used to handle the API request (e.g. ESP), + // - `servicecontrol.googleapis.com/platform` describing the platform + // where the API is served (e.g. GAE, GCE, GKE). + map labels = 6; + + // Represents information about this operation. Each MetricValueSet + // corresponds to a metric defined in the service configuration. + // The data type used in the MetricValueSet must agree with + // the data type specified in the metric definition. + // + // Within a single operation, it is not allowed to have more than one + // MetricValue instances that have the same metric names and identical + // label value combinations. If a request has such duplicated MetricValue + // instances, the entire request is rejected with + // an invalid argument error. + repeated MetricValueSet metric_value_sets = 7; + + // Represents information to be logged. + repeated LogEntry log_entries = 8; + + // DO NOT USE. This is an experimental field. + Importance importance = 11; +} diff --git a/google/api/servicecontrol/v1/quota_controller.proto b/google/api/servicecontrol/v1/quota_controller.proto new file mode 100644 index 0000000000..808a735451 --- /dev/null +++ b/google/api/servicecontrol/v1/quota_controller.proto @@ -0,0 +1,206 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/metric_value.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "QuotaControllerProto"; +option java_package = "com.google.api.servicecontrol.v1"; + +// [Google Quota Control API](/service-control/overview) +// +// Allows clients to allocate and release quota against a [managed +// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). +service QuotaController { + // Attempts to allocate quota for the specified consumer. It should be called + // before the operation is executed. + // + // This method requires the `servicemanagement.services.quota` + // permission on the specified service. For more information, see + // [Cloud IAM](https://cloud.google.com/iam). + // + // **NOTE:** The client **must** fail-open on server errors `INTERNAL`, + // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system + // reliability, the server may inject these errors to prohibit any hard + // dependency on the quota functionality. + rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) { + option (google.api.http) = { + post: "/v1/services/{service_name}:allocateQuota" + body: "*" + }; + } +} + +// Request message for the AllocateQuota method. +message AllocateQuotaRequest { + // Name of the service as specified in the service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See [google.api.Service][google.api.Service] for the definition of a + // service name. + string service_name = 1; + + // Operation that describes the quota allocation. + QuotaOperation allocate_operation = 2; + + // Specifies which version of service configuration should be used to process + // the request. If unspecified or no matching version can be found, the latest + // one will be used. + string service_config_id = 4; +} + +// Represents information regarding a quota operation. +message QuotaOperation { + // Supported quota modes. + enum QuotaMode { + // Guard against implicit default. Must not be used. + UNSPECIFIED = 0; + + // For AllocateQuota request, allocates quota for the amount specified in + // the service configuration or specified using the quota metrics. If the + // amount is higher than the available quota, allocation error will be + // returned and no quota will be allocated. + NORMAL = 1; + + // The operation allocates quota for the amount specified in the service + // configuration or specified using the quota metrics. If the amount is + // higher than the available quota, request does not fail but all available + // quota will be allocated. + BEST_EFFORT = 2; + + // For AllocateQuota request, only checks if there is enough quota + // available and does not change the available quota. No lock is placed on + // the available quota either. + CHECK_ONLY = 3; + } + + // Identity of the operation. This is expected to be unique within the scope + // of the service that generated the operation, and guarantees idempotency in + // case of retries. + // + // UUID version 4 is recommended, though not required. In scenarios where an + // operation is computed from existing information and an idempotent id is + // desirable for deduplication purpose, UUID version 5 is recommended. See + // RFC 4122 for details. + string operation_id = 1; + + // Fully qualified name of the API method for which this quota operation is + // requested. This name is used for matching quota rules or metric rules and + // billing status rules defined in service configuration. This field is not + // required if the quota operation is performed on non-API resources. + // + // Example of an RPC method name: + // google.example.library.v1.LibraryService.CreateShelf + string method_name = 2; + + // Identity of the consumer for whom this quota operation is being performed. + // + // This can be in one of the following formats: + // project:, + // project_number:, + // api_key:. + string consumer_id = 3; + + // Labels describing the operation. + map labels = 4; + + // Represents information about this operation. Each MetricValueSet + // corresponds to a metric defined in the service configuration. + // The data type used in the MetricValueSet must agree with + // the data type specified in the metric definition. + // + // Within a single operation, it is not allowed to have more than one + // MetricValue instances that have the same metric names and identical + // label value combinations. If a request has such duplicated MetricValue + // instances, the entire request is rejected with + // an invalid argument error. + repeated MetricValueSet quota_metrics = 5; + + // Quota mode for this operation. + QuotaMode quota_mode = 6; +} + +// Response message for the AllocateQuota method. +message AllocateQuotaResponse { + // The same operation_id value used in the AllocateQuotaRequest. Used for + // logging and diagnostics purposes. + string operation_id = 1; + + // Indicates the decision of the allocate. + repeated QuotaError allocate_errors = 2; + + // Quota metrics to indicate the result of allocation. Depending on the + // request, one or more of the following metrics will be included: + // + // 1. Per quota group or per quota metric incremental usage will be specified + // using the following delta metric : + // "serviceruntime.googleapis.com/api/consumer/quota_used_count" + // + // 2. The quota limit reached condition will be specified using the following + // boolean metric : + // "serviceruntime.googleapis.com/quota/exceeded" + repeated MetricValueSet quota_metrics = 3; + + // ID of the actual config used to process the request. + string service_config_id = 4; +} + +// Represents error information for +// [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation]. +message QuotaError { + // Error codes related to project config validations are deprecated since the + // quota controller methods do not perform these validations. Instead services + // have to call the Check method, without quota_properties field, to perform + // these validations before calling the quota controller methods. These + // methods check only for project deletion to be wipe out compliant. + enum Code { + // This is never used. + UNSPECIFIED = 0; + + // Quota allocation failed. + // Same as [google.rpc.Code.RESOURCE_EXHAUSTED][]. + RESOURCE_EXHAUSTED = 8; + + // Consumer cannot access the service because the service requires active + // billing. + BILLING_NOT_ACTIVE = 107; + + // Consumer's project has been marked as deleted (soft deletion). + PROJECT_DELETED = 108; + + // Specified API key is invalid. + API_KEY_INVALID = 105; + + // Specified API Key has expired. + API_KEY_EXPIRED = 112; + } + + // Error code. + Code code = 1; + + // Subject to whom this error applies. See the specific enum for more details + // on this field. For example, "clientip:" or + // "project:". + string subject = 2; + + // Free-form text that provides details on the cause of the error. + string description = 3; +} diff --git a/google/api/servicecontrol/v1/service_controller.proto b/google/api/servicecontrol/v1/service_controller.proto new file mode 100644 index 0000000000..38f53ca065 --- /dev/null +++ b/google/api/servicecontrol/v1/service_controller.proto @@ -0,0 +1,204 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.api.servicecontrol.v1; + +import "google/api/annotations.proto"; +import "google/api/servicecontrol/v1/check_error.proto"; +import "google/api/servicecontrol/v1/operation.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; +option java_multiple_files = true; +option java_outer_classname = "ServiceControllerProto"; +option java_package = "com.google.api.servicecontrol.v1"; +option objc_class_prefix = "GASC"; + +// [Google Service Control API](/service-control/overview) +// +// Lets clients check and report operations against a [managed +// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). +service ServiceController { + // Checks an operation with Google Service Control to decide whether + // the given operation should proceed. It should be called before the + // operation is executed. + // + // If feasible, the client should cache the check results and reuse them for + // 60 seconds. In case of server errors, the client can rely on the cached + // results for longer time. + // + // NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the + // size limit of 64KB. + // + // This method requires the `servicemanagement.services.check` permission + // on the specified service. For more information, see + // [Google Cloud IAM](https://cloud.google.com/iam). + rpc Check(CheckRequest) returns (CheckResponse) { + option (google.api.http) = { + post: "/v1/services/{service_name}:check" + body: "*" + }; + } + + // Reports operation results to Google Service Control, such as logs and + // metrics. It should be called after an operation is completed. + // + // If feasible, the client should aggregate reporting data for up to 5 + // seconds to reduce API traffic. Limiting aggregation to 5 seconds is to + // reduce data loss during client crashes. Clients should carefully choose + // the aggregation time window to avoid data loss risk more than 0.01% + // for business and compliance reasons. + // + // NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has + // the size limit of 1MB. + // + // This method requires the `servicemanagement.services.report` permission + // on the specified service. For more information, see + // [Google Cloud IAM](https://cloud.google.com/iam). + rpc Report(ReportRequest) returns (ReportResponse) { + option (google.api.http) = { + post: "/v1/services/{service_name}:report" + body: "*" + }; + } +} + +// Request message for the Check method. +message CheckRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // The operation to be checked. + Operation operation = 2; + + // Specifies which version of service configuration should be used to process + // the request. + // + // If unspecified or no matching version can be found, the + // latest one will be used. + string service_config_id = 4; +} + +// Response message for the Check method. +message CheckResponse { + message CheckInfo { + // Consumer info of this check. + ConsumerInfo consumer_info = 2; + } + + // `ConsumerInfo` provides information about the consumer project. + message ConsumerInfo { + // The Google cloud project number, e.g. 1234567890. A value of 0 indicates + // no project number is found. + int64 project_number = 1; + } + + // The same operation_id value used in the + // [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging + // and diagnostics purposes. + string operation_id = 1; + + // The current service rollout id used to process the request. + string service_rollout_id = 11; + + // Indicate the decision of the check. + // + // If no check errors are present, the service should process the operation. + // Otherwise the service should use the list of errors to determine the + // appropriate action. + repeated CheckError check_errors = 2; + + // The actual config id used to process the request. + string service_config_id = 5; + + // Feedback data returned from the server during processing a Check request. + CheckInfo check_info = 6; +} + +// Request message for the Report method. +message ReportRequest { + // The service name as specified in its service configuration. For example, + // `"pubsub.googleapis.com"`. + // + // See + // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) + // for the definition of a service name. + string service_name = 1; + + // Operations to be reported. + // + // Typically the service should report one operation per request. + // Putting multiple operations into a single request is allowed, but should + // be used only when multiple operations are natually available at the time + // of the report. + // + // If multiple operations are in a single request, the total request size + // should be no larger than 1MB. See + // [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] + // for partial failure behavior. + repeated Operation operations = 2; + + // Specifies which version of service config should be used to process the + // request. + // + // If unspecified or no matching version can be found, the + // latest one will be used. + string service_config_id = 3; +} + +// Response message for the Report method. +message ReportResponse { + // Represents the processing error of one + // [Operation][google.api.servicecontrol.v1.Operation] in the request. + message ReportError { + // The + // [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id] + // value from the request. + string operation_id = 1; + + // Details of the error when processing the + // [Operation][google.api.servicecontrol.v1.Operation]. + google.rpc.Status status = 2; + } + + // Partial failures, one for each `Operation` in the request that failed + // processing. There are three possible combinations of the RPC status: + // + // 1. The combination of a successful RPC status and an empty `report_errors` + // list indicates a complete success where all `Operations` in the + // request are processed successfully. + // 2. The combination of a successful RPC status and a non-empty + // `report_errors` list indicates a partial success where some + // `Operations` in the request succeeded. Each + // `Operation` that failed processing has a corresponding item + // in this list. + // 3. A failed RPC status indicates a general non-deterministic failure. + // When this happens, it's impossible to know which of the + // 'Operations' in the request succeeded or failed. + repeated ReportError report_errors = 1; + + // The actual config id used to process the request. + string service_config_id = 2; + + // The current service rollout id used to process the request. + string service_rollout_id = 4; +} diff --git a/google/api/servicemanagement/BUILD.bazel b/google/api/servicemanagement/BUILD.bazel new file mode 100644 index 0000000000..1e5b8c2afa --- /dev/null +++ b/google/api/servicemanagement/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.yaml"])) \ No newline at end of file diff --git a/google/api/servicemanagement/README.md b/google/api/servicemanagement/README.md new file mode 100644 index 0000000000..e3e36df498 --- /dev/null +++ b/google/api/servicemanagement/README.md @@ -0,0 +1,102 @@ +Google Service Management manages a set of *services*. Service +Management allows *service producers* to +publish their services on Google Cloud Platform so that they can be discovered +and used by *service consumers*. It also handles the tasks of tracking +service lifecycle and programming various backend systems -- such as +[Stackdriver Logging](https://cloud.google.com/stackdriver), +[Stackdriver Monitoring](https://cloud.google.com/stackdriver) -- to support +the managed services. + +If you are a service producer, you can use the Google Service Management API +and [Google Cloud SDK (gcloud)](/sdk) to publish and manage your services. +Each managed service has a service configuration which declares various aspects +of the service such as its API surface, along with parameters to configure the +supporting backend +systems, such as logging and monitoring. If you build your service using +[Google Cloud Endpoints](https://cloud.google.com/endpoints/), the service +configuration will be handled automatically. + +If you are a service consumer and want to use a managed service, you can use the +Google Service Management API or [Google Cloud Console](https://console.cloud.google.com) +to activate the +service for your [Google developer project](https://developers.google.com/console/help/new/), +then start using its APIs and functions. + +## Managed services + +REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}`
+REST schema is defined [here](/service-management/reference/rest/v1/services). + +A managed service refers to a network service managed by +Service Management. Each managed service has a unique name, such as +`example.googleapis.com`, which must be a valid fully-qualified DNS name, as per +RFC 1035. + +A managed service typically provides some REST APIs and/or other +functions to their service consumers, such as mobile apps or cloud services. + +Service producers can use methods, such as +[services.create](/service-management/reference/rest/v1/services/create), +[services.delete](/service-management/reference/rest/v1/services/delete), +[services.undelete](/service-management/reference/rest/v1/services/undelete), +to manipulate their managed services. + +## Service producers + +A service producer is the Google developer project responsible for publishing +and maintaining a managed service. Each managed service is owned by exactly one +service producer. + +## Service consumers + +A service consumer is a Google developer project that has enabled and can +invoke APIs on a managed service. A managed service can have many service +consumers. + +## Service configuration + +REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}/configs/{config_id}`
+REST schema is defined [here](/service-management/reference/rest/v1/services.configs). + +Each managed service is described by a service configuration which covers a wide +range of features, including its name, title, RPC API definitions, +REST API definitions, documentation, authentication, and more. + +To change the configuration of a managed service, the service producer needs to +publish an updated service configuration to Service Management. +Service Management keeps a history of published +service configurations, making it possible to easily retrace how a service's +configuration evolved over time. Service configurations can be published using +the +[services.configs.create](/service-management/reference/rest/v1/services.configs/create) +or [services.configs.submit](/service-management/reference/rest/v1/services.configs/submit) +methods. + +Alternatively, `services.configs.submit` allows publishing an +[OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification, formerly +known as the Swagger Specification, which is automatically converted to a +corresponding service configuration. + +## Service rollout + +REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}/rollouts/{rollout-id}`
+REST schema is defined [here](/service-management/reference/rest/v1/services.rollouts). + +A `Rollout` defines how Google Service Management should deploy service +configurations to backend systems and how the configurations take effect at +runtime. It lets service producers specify multiple service configuration +versions to be deployed together, and a strategy that indicates how they +should be used. + +Updating a managed service's configuration can be dangerous, as a configuration +error can lead to a service outage. To mitigate risks, Service Management +supports gradual rollout of service configuration changes. This feature gives +service producers time to identity potential issues and rollback service +configuration changes in case of errors, thus minimizing the customer +impact of bad configurations. For example, you could specify that 5% of traffic +uses configuration 1, while the remaining 95% uses configuration 2. + +Service Management keeps a history of rollouts so that service +producers can undo to previous configuration versions. You can rollback a configuration +by initiating a new `Rollout` that clones a previously submitted +rollout record. \ No newline at end of file diff --git a/google/api/servicemanagement/artman_servicemanagement_v1.yaml b/google/api/servicemanagement/artman_servicemanagement_v1.yaml new file mode 100644 index 0000000000..cfb5fce219 --- /dev/null +++ b/google/api/servicemanagement/artman_servicemanagement_v1.yaml @@ -0,0 +1,34 @@ +common: + api_name: servicemanagement + api_version: v1 + organization_name: google-cloud + proto_deps: + - name: google-common-protos + src_proto_paths: + - v1 + service_yaml: servicemanagement_v1.yaml + gapic_yaml: v1/servicemanagement_gapic.yaml +artifacts: +- name: gapic_config + type: GAPIC_CONFIG +- name: java_gapic + type: GAPIC + language: JAVA +- name: python_gapic + type: GAPIC + language: PYTHON +- name: nodejs_gapic + type: GAPIC + language: NODEJS +- name: php_gapic + type: GAPIC + language: PHP +- name: go_gapic + type: GAPIC + language: GO +- name: ruby_gapic + type: GAPIC + language: RUBY +- name: csharp_gapic + type: GAPIC + language: CSHARP diff --git a/google/api/servicemanagement/servicemanagement_v1.yaml b/google/api/servicemanagement/servicemanagement_v1.yaml new file mode 100644 index 0000000000..b23a788f86 --- /dev/null +++ b/google/api/servicemanagement/servicemanagement_v1.yaml @@ -0,0 +1,233 @@ +type: google.api.Service +config_version: 2 +name: servicemanagement.googleapis.com +title: Google Service Management API + +apis: +- name: google.api.servicemanagement.v1.ServiceManager + +types: +- name: google.api.servicemanagement.v1.ConfigSource +- name: google.api.servicemanagement.v1.ConfigRef +- name: google.api.servicemanagement.v1.OperationMetadata +- name: google.api.servicemanagement.v1.Rollout +- name: google.api.servicemanagement.v1.SubmitConfigSourceResponse +- name: google.api.servicemanagement.v1.UndeleteServiceResponse + +documentation: + summary: |- + Google Service Management allows service producers to publish their services + on Google Cloud Platform so that they can be discovered and used by service + consumers. + overview: |- + Google Service Management manages a set of *services*. Service Management + allows *service producers* to publish their services on Google Cloud + Platform so that they can be discovered and used by *service consumers*. It + also handles the tasks of tracking service lifecycle and programming various + backend systems -- such as [Stackdriver + Logging](https://cloud.google.com/stackdriver), [Stackdriver + Monitoring](https://cloud.google.com/stackdriver) -- to support the managed + services. + + If you are a service producer, you can use the Google Service Management API + and [Google Cloud SDK (gcloud)](/sdk) to publish and manage your services. + Each managed service has a service configuration which declares various + aspects of the service such as its API surface, along with parameters to + configure the supporting backend systems, such as logging and monitoring. If + you build your service using [Google Cloud + Endpoints](https://cloud.google.com/endpoints/), the service configuration + will be handled automatically. + + If you are a service consumer and want to use a managed service, you can use + the Google Service Management API or [Google Cloud + Console](https://console.cloud.google.com) to activate the service for your + [Google developer project](https://developers.google.com/console/help/new/), + then start using its APIs and functions. + + ## Managed services + + REST URL: + `https://servicemanagement.googleapis.com/v1/services/{service-name}`
+ REST schema is defined + [here](/service-management/reference/rest/v1/services). + + A managed service refers to a network service managed by Service Management. + Each managed service has a unique name, such as `example.googleapis.com`, + which must be a valid fully-qualified DNS name, as per RFC 1035. + + A managed service typically provides some REST APIs and/or other functions + to their service consumers, such as mobile apps or cloud services. + + Service producers can use methods, such as + [services.create](/service-management/reference/rest/v1/services/create), + [services.delete](/service-management/reference/rest/v1/services/delete), + [services.undelete](/service-management/reference/rest/v1/services/undelete), + to manipulate their managed services. + + ## Service producers + + A service producer is the Google developer project responsible for + publishing and maintaining a managed service. Each managed service is owned + by exactly one service producer. + + ## Service consumers + + A service consumer is a Google developer project that has enabled and can + invoke APIs on a managed service. A managed service can have many service + consumers. + + ## Service configuration + + REST URL: + `https://servicemanagement.googleapis.com/v1/services/{service-name}/configs/{config_id}` +
REST schema is defined + [here](/service-management/reference/rest/v1/services.configs). + + Each managed service is described by a service configuration which covers a + wide range of features, including its name, title, RPC API definitions, REST + API definitions, documentation, authentication, and more. + + To change the configuration of a managed service, the service producer needs + to publish an updated service configuration to Service Management. Service + Management keeps a history of published service configurations, making it + possible to easily retrace how a service's configuration evolved over time. + Service configurations can be published using the + [services.configs.create](/service-management/reference/rest/v1/services.configs/create) + or + [services.configs.submit](/service-management/reference/rest/v1/services.configs/submit) + methods. + + Alternatively, `services.configs.submit` allows publishing an + [OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification, + formerly known as the Swagger Specification, which is automatically + converted to a corresponding service configuration. + + ## Service rollout + + REST URL: + `https://servicemanagement.googleapis.com/v1/services/{service-name}/rollouts/{rollout-id}` +
REST schema is defined + [here](/service-management/reference/rest/v1/services.rollouts). + + A `Rollout` defines how Google Service Management should deploy service + configurations to backend systems and how the configurations take effect at + runtime. It lets service producers specify multiple service configuration + versions to be deployed together, and a strategy that indicates how they + should be used. + + Updating a managed service's configuration can be dangerous, as a + configuration error can lead to a service outage. To mitigate risks, Service + Management supports gradual rollout of service configuration changes. This + feature gives service producers time to identity potential issues and + rollback service configuration changes in case of errors, thus minimizing + the customer impact of bad configurations. For example, you could specify + that 5% of traffic uses configuration 1, while the remaining 95% uses + configuration 2. + + Service Management keeps a history of rollouts so that service producers can + undo to previous configuration versions. You can rollback a configuration by + initiating a new `Rollout` that clones a previously submitted rollout + record. + rules: + - selector: google.longrunning.Operations.ListOperations + description: Lists service operations that match the specified filter in the request. + +backend: + rules: + - selector: google.longrunning.Operations.ListOperations + deadline: 10.0 + - selector: google.longrunning.Operations.GetOperation + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.ListServices + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.GetService + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.CreateService + deadline: 20.0 + - selector: google.api.servicemanagement.v1.ServiceManager.DeleteService + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.UndeleteService + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.ListServiceConfigs + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.GetServiceConfig + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.CreateServiceConfig + deadline: 20.0 + - selector: google.api.servicemanagement.v1.ServiceManager.SubmitConfigSource + deadline: 20.0 + - selector: google.api.servicemanagement.v1.ServiceManager.ListServiceRollouts + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.GetServiceRollout + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.GenerateConfigReport + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.EnableService + deadline: 10.0 + - selector: google.api.servicemanagement.v1.ServiceManager.DisableService + deadline: 10.0 + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + deadline: 10.0 + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + deadline: 10.0 + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + deadline: 10.0 + +http: + rules: + - selector: google.longrunning.Operations.ListOperations + get: /v1/operations + + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + post: '/v1/{resource=services/*}:setIamPolicy' + body: '*' + additional_bindings: + - post: '/v1/{resource=services/*/consumers/*}:setIamPolicy' + body: '*' + + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + post: '/v1/{resource=services/*}:getIamPolicy' + body: '*' + additional_bindings: + - post: '/v1/{resource=services/*/consumers/*}:getIamPolicy' + body: '*' + + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + post: '/v1/{resource=services/*}:testIamPermissions' + body: '*' + additional_bindings: + - post: '/v1/{resource=services/*/consumers/*}:testIamPermissions' + body: '*' + + +authentication: + rules: + - selector: '*' + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/service.management + - selector: |- + google.api.servicemanagement.v1.ServiceManager.GetService, + google.api.servicemanagement.v1.ServiceManager.GetServiceConfig, + google.api.servicemanagement.v1.ServiceManager.GetServiceRollout, + google.api.servicemanagement.v1.ServiceManager.ListServiceConfigs, + google.api.servicemanagement.v1.ServiceManager.ListServiceRollouts, + google.api.servicemanagement.v1.ServiceManager.ListServices + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/service.management, + https://www.googleapis.com/auth/service.management.readonly + - selector: |- + google.iam.v1.IAMPolicy.GetIamPolicy, + google.iam.v1.IAMPolicy.TestIamPermissions + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-platform, + https://www.googleapis.com/auth/cloud-platform.read-only, + https://www.googleapis.com/auth/service.management, + https://www.googleapis.com/auth/service.management.readonly diff --git a/google/api/servicemanagement/v1/BUILD.bazel b/google/api/servicemanagement/v1/BUILD.bazel new file mode 100644 index 0000000000..359d9f19a9 --- /dev/null +++ b/google/api/servicemanagement/v1/BUILD.bazel @@ -0,0 +1,383 @@ +# This file was automatically generated by BuildFileGenerator + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "servicemanagement_proto", + srcs = [ + "resources.proto", + "servicemanager.proto", + ], + deps = [ + "//google/api:annotations_proto", + "//google/api:config_change_proto", + "//google/api:metric_proto", + "//google/api:service_proto", + "//google/longrunning:operations_proto", + "//google/rpc:status_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:field_mask_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +proto_library_with_info( + name = "servicemanagement_proto_with_info", + deps = [ + ":servicemanagement_proto", + "//google/cloud:common_resources_proto", + ], +) + +############################################################################## +# Java +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "java_gapic_assembly_gradle_pkg", + "java_gapic_library", + "java_gapic_test", + "java_grpc_library", + "java_proto_library", +) + +java_proto_library( + name = "servicemanagement_java_proto", + deps = [":servicemanagement_proto"], +) + +java_grpc_library( + name = "servicemanagement_java_grpc", + srcs = [":servicemanagement_proto"], + deps = [":servicemanagement_java_proto"], +) + +java_gapic_library( + name = "servicemanagement_java_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + test_deps = [ + ":servicemanagement_java_grpc" + ], + deps = [ + ":servicemanagement_java_proto", + "//google/api:api_java_proto", + ], +) + +java_gapic_test( + name = "servicemanagement_java_gapic_test_suite", + test_classes = [ + "com.google.cloud.api.servicemanagement.v1.ServiceManagerClientTest", + ], + runtime_deps = [":servicemanagement_java_gapic_test"], +) + +# Open Source Packages +java_gapic_assembly_gradle_pkg( + name = "google-cloud-api-servicemanagement-v1-java", + deps = [ + ":servicemanagement_java_gapic", + ":servicemanagement_java_grpc", + ":servicemanagement_java_proto", + ":servicemanagement_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", + "go_test", +) + +go_proto_library( + name = "servicemanagement_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/api/servicemanagement/v1", + protos = [":servicemanagement_proto"], + deps = [ + "//google/api:annotations_go_proto", + "//google/api:configchange_go_proto", + "//google/api:metric_go_proto", + "//google/api:serviceconfig_go_proto", + "//google/longrunning:longrunning_go_proto", + "//google/rpc:status_go_proto", + ], +) + +go_gapic_library( + name = "servicemanagement_go_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + importpath = "cloud.google.com/go/api/servicemanagement/apiv1", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + deps = [ + ":servicemanagement_go_proto", + "//google/api:serviceconfig_go_proto", + "//google/longrunning:longrunning_go_gapic", + "//google/longrunning:longrunning_go_proto", + "@com_google_cloud_go//longrunning:go_default_library", + "@io_bazel_rules_go//proto/wkt:any_go_proto", + "@io_bazel_rules_go//proto/wkt:struct_go_proto", + ], +) + +go_test( + name = "servicemanagement_go_gapic_test", + srcs = [":servicemanagement_go_gapic_srcjar_test"], + embed = [":servicemanagement_go_gapic"], + importpath = "cloud.google.com/go/api/servicemanagement/apiv1", +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-api-servicemanagement-v1-go", + deps = [ + ":servicemanagement_go_gapic", + ":servicemanagement_go_gapic_srcjar-smoke-test.srcjar", + ":servicemanagement_go_gapic_srcjar-test.srcjar", + ":servicemanagement_go_proto", + ], +) + +############################################################################## +# Python +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "moved_proto_library", + "py_gapic_assembly_pkg", + "py_gapic_library", + "py_grpc_library", + "py_proto_library", +) + +moved_proto_library( + name = "servicemanagement_moved_proto", + srcs = [":servicemanagement_proto"], + deps = [ + "//google/api:annotations_proto", + "//google/api:config_change_proto", + "//google/api:metric_proto", + "//google/api:service_proto", + "//google/longrunning:operations_proto", + "//google/rpc:status_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:field_mask_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + ], +) + +py_proto_library( + name = "servicemanagement_py_proto", + plugin = "@protoc_docs_plugin//:docs_plugin", + deps = [":servicemanagement_moved_proto"], +) + +py_grpc_library( + name = "servicemanagement_py_grpc", + srcs = [":servicemanagement_moved_proto"], + deps = [":servicemanagement_py_proto"], +) + +py_gapic_library( + name = "servicemanagement_py_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + deps = [ + ":servicemanagement_py_grpc", + ":servicemanagement_py_proto", + ], +) + +# Open Source Packages +py_gapic_assembly_pkg( + name = "api-servicemanagement-v1-py", + deps = [ + ":servicemanagement_py_gapic", + ":servicemanagement_py_grpc", + ":servicemanagement_py_proto", + ], +) + +############################################################################## +# PHP +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "php_gapic_assembly_pkg", + "php_gapic_library", + "php_grpc_library", + "php_proto_library", +) + +php_proto_library( + name = "servicemanagement_php_proto", + deps = [":servicemanagement_proto"], +) + +php_grpc_library( + name = "servicemanagement_php_grpc", + srcs = [":servicemanagement_proto"], + deps = [":servicemanagement_php_proto"], +) + +php_gapic_library( + name = "servicemanagement_php_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + deps = [ + ":servicemanagement_php_grpc", + ":servicemanagement_php_proto", + ], +) + +# Open Source Packages +php_gapic_assembly_pkg( + name = "google-cloud-api-servicemanagement-v1-php", + deps = [ + ":servicemanagement_php_gapic", + ":servicemanagement_php_grpc", + ":servicemanagement_php_proto", + ], +) + +############################################################################## +# Node.js +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "nodejs_gapic_assembly_pkg", + "nodejs_gapic_library", +) + +nodejs_gapic_library( + name = "servicemanagement_nodejs_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + deps = [], +) + +nodejs_gapic_assembly_pkg( + name = "api-servicemanagement-v1-nodejs", + deps = [ + ":servicemanagement_nodejs_gapic", + ":servicemanagement_proto", + ], +) + +############################################################################## +# Ruby +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "ruby_gapic_assembly_pkg", + "ruby_gapic_library", + "ruby_grpc_library", + "ruby_proto_library", +) + +ruby_proto_library( + name = "servicemanagement_ruby_proto", + deps = [":servicemanagement_proto"], +) + +ruby_grpc_library( + name = "servicemanagement_ruby_grpc", + srcs = [":servicemanagement_proto"], + deps = [":servicemanagement_ruby_proto"], +) + +ruby_gapic_library( + name = "servicemanagement_ruby_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + deps = [ + ":servicemanagement_ruby_grpc", + ":servicemanagement_ruby_proto", + ], +) + +# Open Source Packages +ruby_gapic_assembly_pkg( + name = "google-cloud-api-servicemanagement-v1-ruby", + deps = [ + ":servicemanagement_ruby_gapic", + ":servicemanagement_ruby_grpc", + ":servicemanagement_ruby_proto", + ], +) + +############################################################################## +# C# +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "csharp_gapic_assembly_pkg", + "csharp_gapic_library", + "csharp_grpc_library", + "csharp_proto_library", +) + +csharp_proto_library( + name = "servicemanagement_csharp_proto", + deps = [":servicemanagement_proto"], +) + +csharp_grpc_library( + name = "servicemanagement_csharp_grpc", + srcs = [":servicemanagement_proto"], + deps = [":servicemanagement_csharp_proto"], +) + +csharp_gapic_library( + name = "servicemanagement_csharp_gapic", + src = ":servicemanagement_proto_with_info", + gapic_yaml = "servicemanagement_gapic.yaml", + package = "google.api.servicemanagement.v1", + service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", + deps = [ + ":servicemanagement_csharp_grpc", + ":servicemanagement_csharp_proto", + ], +) + +# Open Source Packages +csharp_gapic_assembly_pkg( + name = "google-cloud-api-servicemanagement-v1-csharp", + deps = [ + ":servicemanagement_csharp_gapic", + ":servicemanagement_csharp_grpc", + ":servicemanagement_csharp_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +# Put your C++ rules here diff --git a/google/api/servicemanagement/v1/resources.proto b/google/api/servicemanagement/v1/resources.proto new file mode 100644 index 0000000000..1c924849cb --- /dev/null +++ b/google/api/servicemanagement/v1/resources.proto @@ -0,0 +1,299 @@ +// Copyright 2018 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. + +syntax = "proto3"; + +package google.api.servicemanagement.v1; + +import "google/api/annotations.proto"; +import "google/api/config_change.proto"; +import "google/api/metric.proto"; +import "google/api/service.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ServiceManagement.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicemanagement/v1;servicemanagement"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.api.servicemanagement.v1"; +option objc_class_prefix = "GASM"; +option php_namespace = "Google\\Cloud\\ServiceManagement\\V1"; + +// The full representation of a Service that is managed by +// Google Service Management. +message ManagedService { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. + string service_name = 2; + + // ID of the project that produces and owns this service. + string producer_project_id = 3; +} + +// The metadata associated with a long running operation resource. +message OperationMetadata { + // Represents the status of one operation step. + message Step { + // The short description of the step. + string description = 2; + + // The status code. + Status status = 4; + } + + // Code describes the status of the operation (or one of its steps). + enum Status { + // Unspecifed code. + STATUS_UNSPECIFIED = 0; + + // The operation or step has completed without errors. + DONE = 1; + + // The operation or step has not started yet. + NOT_STARTED = 2; + + // The operation or step is in progress. + IN_PROGRESS = 3; + + // The operation or step has completed with errors. If the operation is + // rollbackable, the rollback completed with errors too. + FAILED = 4; + + // The operation or step has completed with cancellation. + CANCELLED = 5; + } + + // The full name of the resources that this operation is directly + // associated with. + repeated string resource_names = 1; + + // Detailed status information for each step. The order is undetermined. + repeated Step steps = 2; + + // Percentage of completion of this operation, ranging from 0 to 100. + int32 progress_percentage = 3; + + // The start time of the operation. + google.protobuf.Timestamp start_time = 4; +} + +// Represents a diagnostic message (error or warning) +message Diagnostic { + // The kind of diagnostic information possible. + enum Kind { + // Warnings and errors + WARNING = 0; + + // Only errors + ERROR = 1; + } + + // File name and line number of the error or warning. + string location = 1; + + // The kind of diagnostic information provided. + Kind kind = 2; + + // Message describing the error or warning. + string message = 3; +} + +// Represents a source file which is used to generate the service configuration +// defined by `google.api.Service`. +message ConfigSource { + // A unique ID for a specific instance of this message, typically assigned + // by the client for tracking purpose. If empty, the server may choose to + // generate one instead. + string id = 5; + + // Set of source configuration files that are used to generate a service + // configuration (`google.api.Service`). + repeated ConfigFile files = 2; +} + +// Generic specification of a source configuration file +message ConfigFile { + enum FileType { + // Unknown file type. + FILE_TYPE_UNSPECIFIED = 0; + + // YAML-specification of service. + SERVICE_CONFIG_YAML = 1; + + // OpenAPI specification, serialized in JSON. + OPEN_API_JSON = 2; + + // OpenAPI specification, serialized in YAML. + OPEN_API_YAML = 3; + + // FileDescriptorSet, generated by protoc. + // + // To generate, use protoc with imports and source info included. + // For an example test.proto file, the following command would put the value + // in a new file named out.pb. + // + // $protoc --include_imports --include_source_info test.proto -o out.pb + FILE_DESCRIPTOR_SET_PROTO = 4; + + // Uncompiled Proto file. Used for storage and display purposes only, + // currently server-side compilation is not supported. Should match the + // inputs to 'protoc' command used to generated FILE_DESCRIPTOR_SET_PROTO. A + // file of this type can only be included if at least one file of type + // FILE_DESCRIPTOR_SET_PROTO is included. + PROTO_FILE = 6; + } + + // The file name of the configuration file (full or relative path). + string file_path = 1; + + // The bytes that constitute the file. + bytes file_contents = 3; + + // The type of configuration file this represents. + FileType file_type = 4; +} + +// Represents a service configuration with its name and id. +message ConfigRef { + // Resource name of a service config. It must have the following + // format: "services/{service name}/configs/{config id}". + string name = 1; +} + +// Change report associated with a particular service configuration. +// +// It contains a list of ConfigChanges based on the comparison between +// two service configurations. +message ChangeReport { + // List of changes between two service configurations. + // The changes will be alphabetically sorted based on the identifier + // of each change. + // A ConfigChange identifier is a dot separated path to the configuration. + // Example: visibility.rules[selector='LibraryService.CreateBook'].restriction + repeated google.api.ConfigChange config_changes = 1; +} + +// A rollout resource that defines how service configuration versions are pushed +// to control plane systems. Typically, you create a new version of the +// service config, and then create a Rollout to push the service config. +message Rollout { + // Strategy that specifies how clients of Google Service Controller want to + // send traffic to use different config versions. This is generally + // used by API proxy to split traffic based on your configured precentage for + // each config version. + // + // One example of how to gradually rollout a new service configuration using + // this + // strategy: + // Day 1 + // + // Rollout { + // id: "example.googleapis.com/rollout_20160206" + // traffic_percent_strategy { + // percentages: { + // "example.googleapis.com/20160201": 70.00 + // "example.googleapis.com/20160206": 30.00 + // } + // } + // } + // + // Day 2 + // + // Rollout { + // id: "example.googleapis.com/rollout_20160207" + // traffic_percent_strategy: { + // percentages: { + // "example.googleapis.com/20160206": 100.00 + // } + // } + // } + message TrafficPercentStrategy { + // Maps service configuration IDs to their corresponding traffic percentage. + // Key is the service configuration ID, Value is the traffic percentage + // which must be greater than 0.0 and the sum must equal to 100.0. + map percentages = 1; + } + + // Strategy used to delete a service. This strategy is a placeholder only + // used by the system generated rollout to delete a service. + message DeleteServiceStrategy {} + + // Status of a Rollout. + enum RolloutStatus { + // No status specified. + ROLLOUT_STATUS_UNSPECIFIED = 0; + + // The Rollout is in progress. + IN_PROGRESS = 1; + + // The Rollout has completed successfully. + SUCCESS = 2; + + // The Rollout has been cancelled. This can happen if you have overlapping + // Rollout pushes, and the previous ones will be cancelled. + CANCELLED = 3; + + // The Rollout has failed and the rollback attempt has failed too. + FAILED = 4; + + // The Rollout has not started yet and is pending for execution. + PENDING = 5; + + // The Rollout has failed and rolled back to the previous successful + // Rollout. + FAILED_ROLLED_BACK = 6; + } + + // Optional unique identifier of this Rollout. Only lower case letters, digits + // and '-' are allowed. + // + // If not specified by client, the server will generate one. The generated id + // will have the form of , where "date" is the create + // date in ISO 8601 format. "revision number" is a monotonically increasing + // positive number that is reset every day for each service. + // An example of the generated rollout_id is '2016-02-16r1' + string rollout_id = 1; + + // Creation time of the rollout. Readonly. + google.protobuf.Timestamp create_time = 2; + + // The user who created the Rollout. Readonly. + string created_by = 3; + + // The status of this rollout. Readonly. In case of a failed rollout, + // the system will automatically rollback to the current Rollout + // version. Readonly. + RolloutStatus status = 4; + + // Strategy that defines which versions of service configurations should be + // pushed + // and how they should be used at runtime. + oneof strategy { + // Google Service Control selects service configurations based on + // traffic percentage. + TrafficPercentStrategy traffic_percent_strategy = 5; + + // The strategy associated with a rollout to delete a `ManagedService`. + // Readonly. + DeleteServiceStrategy delete_service_strategy = 200; + } + + // The name of the service associated with this Rollout. + string service_name = 8; +} diff --git a/google/api/servicemanagement/v1/servicemanagement_gapic.yaml b/google/api/servicemanagement/v1/servicemanagement_gapic.yaml new file mode 100644 index 0000000000..0cca80e290 --- /dev/null +++ b/google/api/servicemanagement/v1/servicemanagement_gapic.yaml @@ -0,0 +1,301 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +# The settings of generated code in a specific language. +language_settings: + java: + package_name: com.google.cloud.api.servicemanagement.v1 + python: + package_name: google.cloud.api.servicemanagement_v1.gapic + go: + package_name: cloud.google.com/go/api/servicemanagement/apiv1 + csharp: + package_name: Google.Api.Servicemanagement.V1 + ruby: + package_name: Google::Cloud::Api::Servicemanagement::V1 + php: + package_name: Google\Cloud\Api\Servicemanagement\V1 + nodejs: + package_name: servicemanagement.v1 +# A list of API interface configurations. +interfaces: + # The fully qualified name of the API interface. +- name: google.api.servicemanagement.v1.ServiceManager + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + smoke_test: + method: ListServices + init_fields: + - producer_project_id=$PROJECT_ID + collections: [] + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # resource_name_treatment - An enum that specifies how to treat the resource + # name formats defined in the field_name_patterns and + # response_field_name_patterns fields. + # UNSET: default value + # NONE: the collection configs will not be used by the generated code. + # VALIDATE: string fields will be validated by the client against the + # specified resource name formats. + # STATIC_TYPES: the client will use generated types for resource names. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: ListServices + flattening: + groups: + - parameters: + - producer_project_id + - consumer_id + required_fields: + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: services + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: GetService + flattening: + groups: + - parameters: + - service_name + required_fields: + - service_name + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: CreateService + flattening: + groups: + - parameters: + - service + required_fields: + - service + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 20000 + - name: DeleteService + flattening: + groups: + - parameters: + - service_name + required_fields: + - service_name + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: UndeleteService + flattening: + groups: + - parameters: + - service_name + required_fields: + - service_name + retry_codes_name: non_idempotent + retry_params_name: default + # REVIEW: Could this operation take a long time? + timeout_millis: 60000 + - name: ListServiceConfigs + flattening: + groups: + - parameters: + - service_name + required_fields: + - service_name + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: service_configs + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: GetServiceConfig + flattening: + groups: + - parameters: + - service_name + - config_id + - view + required_fields: + - service_name + - config_id + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: CreateServiceConfig + flattening: + groups: + - parameters: + - service_name + - service_config + required_fields: + - service_name + - service_config + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 20000 + - name: SubmitConfigSource + flattening: + groups: + - parameters: + - service_name + - config_source + - validate_only + required_fields: + - service_name + - config_source + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 10000 + - name: ListServiceRollouts + flattening: + groups: + - parameters: + - service_name + - filter + required_fields: + - service_name + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: rollouts + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: GetServiceRollout + flattening: + groups: + - parameters: + - service_name + - rollout_id + required_fields: + - service_name + - rollout_id + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: CreateServiceRollout + flattening: + groups: + - parameters: + - service_name + - rollout + required_fields: + - service_name + - rollout + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 10000 + - name: GenerateConfigReport + flattening: + groups: + - parameters: + - new_config + - old_config + required_fields: + - new_config + - old_config + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 10000 + - name: EnableService + flattening: + groups: + - parameters: + - service_name + - consumer_id + required_fields: + - service_name + - consumer_id + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 + - name: DisableService + flattening: + groups: + - parameters: + - service_name + - consumer_id + required_fields: + - service_name + - consumer_id + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 10000 diff --git a/google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json b/google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json new file mode 100755 index 0000000000..e2ec9d59e9 --- /dev/null +++ b/google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json @@ -0,0 +1,12 @@ +{ + "methodConfig": [ + { + "name": [ + { + "service": "google.api.servicemanagement.v1.ServiceManager" + } + ], + "timeout": "10s" + } + ] +} diff --git a/google/api/servicemanagement/v1/servicemanager.proto b/google/api/servicemanagement/v1/servicemanager.proto new file mode 100644 index 0000000000..02d506665d --- /dev/null +++ b/google/api/servicemanagement/v1/servicemanager.proto @@ -0,0 +1,503 @@ +// Copyright 2018 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. + +syntax = "proto3"; + +package google.api.servicemanagement.v1; + +import "google/api/annotations.proto"; +import "google/api/service.proto"; +import "google/api/servicemanagement/v1/resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ServiceManagement.V1"; +option go_package = "google.golang.org/genproto/googleapis/api/servicemanagement/v1;servicemanagement"; +option java_multiple_files = true; +option java_outer_classname = "ServiceManagerProto"; +option java_package = "com.google.api.servicemanagement.v1"; +option objc_class_prefix = "GASM"; +option php_namespace = "Google\\Cloud\\ServiceManagement\\V1"; + +// [Google Service Management API](/service-management/overview) +service ServiceManager { + // Lists managed services. + // + // Returns all public services. For authenticated users, also returns all + // services the calling user has "servicemanagement.services.get" permission + // for. + // + // **BETA:** If the caller specifies the `consumer_id`, it returns only the + // services enabled on the consumer. The `consumer_id` must have the format + // of "project:{PROJECT-ID}". + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1/services" + }; + } + + // Gets a managed service. Authentication is required unless the service is + // public. + rpc GetService(GetServiceRequest) returns (ManagedService) { + option (google.api.http) = { + get: "/v1/services/{service_name}" + }; + } + + // Creates a new managed service. + // Please note one producer project can own no more than 20 services. + // + // Operation + rpc CreateService(CreateServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/services" + body: "service" + }; + } + + // Deletes a managed service. This method will change the service to the + // `Soft-Delete` state for 30 days. Within this period, service producers may + // call + // [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService] + // to restore the service. After 30 days, the service will be permanently + // deleted. + // + // Operation + rpc DeleteService(DeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/services/{service_name}" + }; + } + + // Revives a previously deleted managed service. The method restores the + // service using the configuration at the time the service was deleted. + // The target service must exist and must have been deleted within the + // last 30 days. + // + // Operation + rpc UndeleteService(UndeleteServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/services/{service_name}:undelete" + }; + } + + // Lists the history of the service configuration for a managed service, + // from the newest to the oldest. + rpc ListServiceConfigs(ListServiceConfigsRequest) + returns (ListServiceConfigsResponse) { + option (google.api.http) = { + get: "/v1/services/{service_name}/configs" + }; + } + + // Gets a service configuration (version) for a managed service. + rpc GetServiceConfig(GetServiceConfigRequest) returns (google.api.Service) { + option (google.api.http) = { + get: "/v1/services/{service_name}/configs/{config_id}" + additional_bindings { get: "/v1/services/{service_name}/config" } + }; + } + + // Creates a new service configuration (version) for a managed service. + // This method only stores the service configuration. To roll out the service + // configuration to backend systems please call + // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. + // + // Only the 100 most recent service configurations and ones referenced by + // existing rollouts are kept for each service. The rest will be deleted + // eventually. + rpc CreateServiceConfig(CreateServiceConfigRequest) + returns (google.api.Service) { + option (google.api.http) = { + post: "/v1/services/{service_name}/configs" + body: "service_config" + }; + } + + // Creates a new service configuration (version) for a managed service based + // on + // user-supplied configuration source files (for example: OpenAPI + // Specification). This method stores the source configurations as well as the + // generated service configuration. To rollout the service configuration to + // other services, + // please call + // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. + // + // Only the 100 most recent configuration sources and ones referenced by + // existing service configurtions are kept for each service. The rest will be + // deleted eventually. + // + // Operation + rpc SubmitConfigSource(SubmitConfigSourceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/services/{service_name}/configs:submit" + body: "*" + }; + } + + // Lists the history of the service configuration rollouts for a managed + // service, from the newest to the oldest. + rpc ListServiceRollouts(ListServiceRolloutsRequest) + returns (ListServiceRolloutsResponse) { + option (google.api.http) = { + get: "/v1/services/{service_name}/rollouts" + }; + } + + // Gets a service configuration + // [rollout][google.api.servicemanagement.v1.Rollout]. + rpc GetServiceRollout(GetServiceRolloutRequest) returns (Rollout) { + option (google.api.http) = { + get: "/v1/services/{service_name}/rollouts/{rollout_id}" + }; + } + + // Creates a new service configuration rollout. Based on rollout, the + // Google Service Management will roll out the service configurations to + // different backend services. For example, the logging configuration will be + // pushed to Google Cloud Logging. + // + // Please note that any previous pending and running Rollouts and associated + // Operations will be automatically cancelled so that the latest Rollout will + // not be blocked by previous Rollouts. + // + // Only the 100 most recent (in any state) and the last 10 successful (if not + // already part of the set of 100 most recent) rollouts are kept for each + // service. The rest will be deleted eventually. + // + // Operation + rpc CreateServiceRollout(CreateServiceRolloutRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/services/{service_name}/rollouts" + body: "rollout" + }; + } + + // Generates and returns a report (errors, warnings and changes from + // existing configurations) associated with + // GenerateConfigReportRequest.new_value + // + // If GenerateConfigReportRequest.old_value is specified, + // GenerateConfigReportRequest will contain a single ChangeReport based on the + // comparison between GenerateConfigReportRequest.new_value and + // GenerateConfigReportRequest.old_value. + // If GenerateConfigReportRequest.old_value is not specified, this method + // will compare GenerateConfigReportRequest.new_value with the last pushed + // service configuration. + rpc GenerateConfigReport(GenerateConfigReportRequest) + returns (GenerateConfigReportResponse) { + option (google.api.http) = { + post: "/v1/services:generateConfigReport" + body: "*" + }; + } + + // Enables a [service][google.api.servicemanagement.v1.ManagedService] for a + // project, so it can be used for the project. See [Cloud Auth + // Guide](https://cloud.google.com/docs/authentication) for more information. + // + // Operation + rpc EnableService(EnableServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/services/{service_name}:enable" + body: "*" + }; + } + + // Disables a [service][google.api.servicemanagement.v1.ManagedService] for a + // project, so it can no longer be be used for the project. It prevents + // accidental usage that may cause unexpected billing charges or security + // leaks. + // + // Operation + rpc DisableService(DisableServiceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/services/{service_name}:disable" + body: "*" + }; + } +} + +// Request message for `ListServices` method. +message ListServicesRequest { + // Include services produced by the specified project. + string producer_project_id = 1; + + // Requested size of the next page of data. + int32 page_size = 5; + + // Token identifying which result to start with; returned by a previous list + // call. + string page_token = 6; + + // Include services consumed by the specified consumer. + // + // The Google Service Management implementation accepts the following + // forms: + // - project: + string consumer_id = 7; +} + +// Response message for `ListServices` method. +message ListServicesResponse { + // The returned services will only have the name field set. + repeated ManagedService services = 1; + + // Token that can be passed to `ListServices` to resume a paginated query. + string next_page_token = 2; +} + +// Request message for `GetService` method. +message GetServiceRequest { + // The name of the service. See the `ServiceManager` overview for naming + // requirements. For example: `example.googleapis.com`. + string service_name = 1; +} + +// Request message for CreateService method. +message CreateServiceRequest { + // Initial values for the service resource. + ManagedService service = 1; +} + +// Request message for DeleteService method. +message DeleteServiceRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; +} + +// Request message for UndeleteService method. +message UndeleteServiceRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; +} + +// Response message for UndeleteService method. +message UndeleteServiceResponse { + // Revived service resource. + ManagedService service = 1; +} + +// Request message for GetServiceConfig method. +message GetServiceConfigRequest { + enum ConfigView { + // Server response includes all fields except SourceInfo. + BASIC = 0; + + // Server response includes all fields including SourceInfo. + // SourceFiles are of type 'google.api.servicemanagement.v1.ConfigFile' + // and are only available for configs created using the + // SubmitConfigSource method. + FULL = 1; + } + + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The id of the service configuration resource. + string config_id = 2; + + // Specifies which parts of the Service Config should be returned in the + // response. + ConfigView view = 3; +} + +// Request message for ListServiceConfigs method. +message ListServiceConfigsRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The token of the page to retrieve. + string page_token = 2; + + // The max number of items to include in the response list. + int32 page_size = 3; +} + +// Response message for ListServiceConfigs method. +message ListServiceConfigsResponse { + // The list of service configuration resources. + repeated google.api.Service service_configs = 1; + + // The token of the next page of results. + string next_page_token = 2; +} + +// Request message for CreateServiceConfig method. +message CreateServiceConfigRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The service configuration resource. + google.api.Service service_config = 2; +} + +// Request message for SubmitConfigSource method. +message SubmitConfigSourceRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The source configuration for the service. + ConfigSource config_source = 2; + + // Optional. If set, this will result in the generation of a + // `google.api.Service` configuration based on the `ConfigSource` provided, + // but the generated config and the sources will NOT be persisted. + bool validate_only = 3; +} + +// Response message for SubmitConfigSource method. +message SubmitConfigSourceResponse { + // The generated service configuration. + google.api.Service service_config = 1; +} + +// Request message for 'CreateServiceRollout' +message CreateServiceRolloutRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The rollout resource. The `service_name` field is output only. + Rollout rollout = 2; +} + +// Request message for 'ListServiceRollouts' +message ListServiceRolloutsRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The token of the page to retrieve. + string page_token = 2; + + // The max number of items to include in the response list. + int32 page_size = 3; + + // Use `filter` to return subset of rollouts. + // The following filters are supported: + // -- To limit the results to only those in + // [status](google.api.servicemanagement.v1.RolloutStatus) 'SUCCESS', + // use filter='status=SUCCESS' + // -- To limit the results to those in + // [status](google.api.servicemanagement.v1.RolloutStatus) 'CANCELLED' + // or 'FAILED', use filter='status=CANCELLED OR status=FAILED' + string filter = 4; +} + +// Response message for ListServiceRollouts method. +message ListServiceRolloutsResponse { + // The list of rollout resources. + repeated Rollout rollouts = 1; + + // The token of the next page of results. + string next_page_token = 2; +} + +// Request message for GetServiceRollout method. +message GetServiceRolloutRequest { + // The name of the service. See the [overview](/service-management/overview) + // for naming requirements. For example: `example.googleapis.com`. + string service_name = 1; + + // The id of the rollout resource. + string rollout_id = 2; +} + +// Request message for EnableService method. +message EnableServiceRequest { + // Name of the service to enable. Specifying an unknown service name will + // cause the request to fail. + string service_name = 1; + + // The identity of consumer resource which service enablement will be + // applied to. + // + // The Google Service Management implementation accepts the following + // forms: + // - "project:" + // + // Note: this is made compatible with + // google.api.servicecontrol.v1.Operation.consumer_id. + string consumer_id = 2; +} + +// Request message for DisableService method. +message DisableServiceRequest { + // Name of the service to disable. Specifying an unknown service name + // will cause the request to fail. + string service_name = 1; + + // The identity of consumer resource which service disablement will be + // applied to. + // + // The Google Service Management implementation accepts the following + // forms: + // - "project:" + // + // Note: this is made compatible with + // google.api.servicecontrol.v1.Operation.consumer_id. + string consumer_id = 2; +} + +// Request message for GenerateConfigReport method. +message GenerateConfigReportRequest { + // Service configuration for which we want to generate the report. + // For this version of API, the supported types are + // [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef], + // [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource], + // and [google.api.Service][google.api.Service] + google.protobuf.Any new_config = 1; + + // Service configuration against which the comparison will be done. + // For this version of API, the supported types are + // [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef], + // [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource], + // and [google.api.Service][google.api.Service] + google.protobuf.Any old_config = 2; +} + +// Response message for GenerateConfigReport method. +message GenerateConfigReportResponse { + // Name of the service this report belongs to. + string service_name = 1; + + // ID of the service configuration this report belongs to. + string id = 2; + + // list of ChangeReport, each corresponding to comparison between two + // service configurations. + repeated ChangeReport change_reports = 3; + + // Errors / Linter warnings associated with the service definition this + // report + // belongs to. + repeated Diagnostic diagnostics = 4; +} diff --git a/google/api/source_info.proto b/google/api/source_info.proto new file mode 100644 index 0000000000..5954143ded --- /dev/null +++ b/google/api/source_info.proto @@ -0,0 +1,32 @@ +// Copyright 2019 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.api; + +import "google/protobuf/any.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "SourceInfoProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Source information used to create a Service Config +message SourceInfo { + // All files used during config generation. + repeated google.protobuf.Any source_files = 1; +} diff --git a/google/api/system_parameter.proto b/google/api/system_parameter.proto new file mode 100644 index 0000000000..740a5538b4 --- /dev/null +++ b/google/api/system_parameter.proto @@ -0,0 +1,96 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "SystemParameterProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// ### System parameter configuration +// +// A system parameter is a special kind of parameter defined by the API +// system, not by an individual API. It is typically mapped to an HTTP header +// and/or a URL query parameter. This configuration specifies which methods +// change the names of the system parameters. +message SystemParameters { + // Define system parameters. + // + // The parameters defined here will override the default parameters + // implemented by the system. If this field is missing from the service + // config, default system parameters will be used. Default system parameters + // and names is implementation-dependent. + // + // Example: define api key for all methods + // + // system_parameters + // rules: + // - selector: "*" + // parameters: + // - name: api_key + // url_query_parameter: api_key + // + // + // Example: define 2 api key names for a specific method. + // + // system_parameters + // rules: + // - selector: "/ListShelves" + // parameters: + // - name: api_key + // http_header: Api-Key1 + // - name: api_key + // http_header: Api-Key2 + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated SystemParameterRule rules = 1; +} + +// Define a system parameter rule mapping system parameter definitions to +// methods. +message SystemParameterRule { + // Selects the methods to which this rule applies. Use '*' to indicate all + // methods in all APIs. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Define parameters. Multiple names may be defined for a parameter. + // For a given method call, only one of them should be used. If multiple + // names are used the behavior is implementation-dependent. + // If none of the specified names are present the behavior is + // parameter-dependent. + repeated SystemParameter parameters = 2; +} + +// Define a parameter's name and location. The parameter may be passed as either +// an HTTP header or a URL query parameter, and if both are passed the behavior +// is implementation-dependent. +message SystemParameter { + // Define the name of the parameter, such as "api_key" . It is case sensitive. + string name = 1; + + // Define the HTTP header name to use for the parameter. It is case + // insensitive. + string http_header = 2; + + // Define the URL query parameter name to use for the parameter. It is case + // sensitive. + string url_query_parameter = 3; +} diff --git a/google/api/usage.proto b/google/api/usage.proto new file mode 100644 index 0000000000..6ab4e408cd --- /dev/null +++ b/google/api/usage.proto @@ -0,0 +1,90 @@ +// Copyright 2019 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.api; + +option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; +option java_multiple_files = true; +option java_outer_classname = "UsageProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Configuration controlling usage of a service. +message Usage { + // Requirements that must be satisfied before a consumer project can use the + // service. Each requirement is of the form /; + // for example 'serviceusage.googleapis.com/billing-enabled'. + repeated string requirements = 1; + + // A list of usage rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated UsageRule rules = 6; + + // The full resource name of a channel used for sending notifications to the + // service producer. + // + // Google Service Management currently only supports + // [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification + // channel. To use Google Cloud Pub/Sub as the channel, this must be the name + // of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format + // documented in https://cloud.google.com/pubsub/docs/overview. + string producer_notification_channel = 7; +} + +// Usage configuration rules for the service. +// +// NOTE: Under development. +// +// +// Use this rule to configure unregistered calls for the service. Unregistered +// calls are calls that do not contain consumer project identity. +// (Example: calls that do not contain an API key). +// By default, API methods do not allow unregistered calls, and each method call +// must be identified by a consumer project identity. Use this rule to +// allow/disallow unregistered calls. +// +// Example of an API that wants to allow unregistered calls for entire service. +// +// usage: +// rules: +// - selector: "*" +// allow_unregistered_calls: true +// +// Example of a method that wants to allow unregistered calls. +// +// usage: +// rules: +// - selector: "google.example.library.v1.LibraryService.CreateBook" +// allow_unregistered_calls: true +message UsageRule { + // Selects the methods to which this rule applies. Use '*' to indicate all + // methods in all APIs. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // If true, the selected method allows unregistered calls, e.g. calls + // that don't identify any user or application. + bool allow_unregistered_calls = 2; + + // If true, the selected method should skip service control and the control + // plane features, such as quota and billing, will not be available. + // This flag is used by Google Cloud Endpoints to bypass checks for internal + // methods, such as service health check methods. + bool skip_service_control = 3; +} diff --git a/google/cloud/common_resources.proto b/google/cloud/common_resources.proto new file mode 100644 index 0000000000..50cfeda77f --- /dev/null +++ b/google/cloud/common_resources.proto @@ -0,0 +1,51 @@ +// Copyright 2019 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. + +// This file contains stub messages for common resources in GCP. +// It is not intended to be directly generated, and is instead used by +// other tooling to be able to match common resource patterns. +syntax = "proto3"; + +package google.cloud; + +import "google/api/resource.proto"; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Project" + pattern: "projects/{project}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Organization" + pattern: "organizations/{organization}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Folder" + pattern: "folders/{folder}" +}; + + +option (google.api.resource_definition) = { + type: "cloudbilling.googleapis.com/BillingAccount" + pattern: "billingAccounts/{billing_account}" +}; + +option (google.api.resource_definition) = { + type: "locations.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; \ No newline at end of file diff --git a/google/iam/v1/BUILD.bazel b/google/iam/v1/BUILD.bazel new file mode 100644 index 0000000000..f8991d206a --- /dev/null +++ b/google/iam/v1/BUILD.bazel @@ -0,0 +1,99 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "iam_policy_proto", + srcs = ["iam_policy.proto"], + deps = [ + ":options_proto", + ":policy_proto", + "//google/api:annotations_proto", + "//google/api:client_proto", + "//google/api:field_behavior_proto", + "//google/api:resource_proto", + ], +) + +proto_library( + name = "policy_proto", + srcs = ["policy.proto"], + deps = [ + "//google/api:annotations_proto", + "//google/type:expr_proto", + ], +) + +proto_library( + name = "options_proto", + srcs = ["options.proto"], + deps = [ + "//google/api:annotations_proto", + ], +) + +proto_library_with_info( + name = "iam_proto_with_info", + deps = [ + ":iam_policy_proto", + ":options_proto", + ":policy_proto", + ], +) + +############################################################################## +# Java +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "java_grpc_library", "java_proto_library") + +java_proto_library( + name = "iam_java_proto", + deps = [ + ":iam_policy_proto", + ":policy_proto", + ":options_proto", + ], +) + +java_grpc_library( + name = "iam_java_grpc", + srcs = [":iam_policy_proto"], + deps = [":iam_java_proto"], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_proto_library", +) + +go_proto_library( + name = "iam_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/iam/v1", + protos = [ + ":iam_policy_proto", + ":options_proto", + ":policy_proto", + ], + deps = [ + "//google/api:annotations_go_proto", + "//google/type:expr_go_proto", + ], +) + +go_gapic_assembly_pkg( + name = "gapi-cloud-iam-v1-go", + deps = [ + ":iam_go_proto", + ], +) diff --git a/google/iam/v1/iam_gapic.yaml b/google/iam/v1/iam_gapic.yaml new file mode 100644 index 0000000000..e2d0a674f9 --- /dev/null +++ b/google/iam/v1/iam_gapic.yaml @@ -0,0 +1,28 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.cloud.iam.v1 + python: + package_name: google.cloud.iam_v1.gapic + go: + package_name: cloud.google.com/go/iam/apiv1 + csharp: + package_name: Google.Iam.V1 + ruby: + package_name: Google::Cloud::Iam::V1 + php: + package_name: Google\Cloud\Iam\V1 + nodejs: + package_name: iam.core.v1 + domain_layer_location: google-cloud +resource_name_generation: +- message_name: SetIamPolicyRequest + field_entity_map: + resource: "*" +- message_name: GetIamPolicyRequest + field_entity_map: + resource: "*" +- message_name: TestIamPermissionsRequest + field_entity_map: + resource: "*" diff --git a/google/iam/v1/iam_meta_api.yaml b/google/iam/v1/iam_meta_api.yaml new file mode 100644 index 0000000000..9398567908 --- /dev/null +++ b/google/iam/v1/iam_meta_api.yaml @@ -0,0 +1,85 @@ +type: google.api.Service +config_version: 2 +name: iam-meta-api.googleapis.com +title: IAM Meta API + +apis: +- name: google.iam.v1.IAMPolicy + +types: +- name: google.iam.v1.PolicyDelta + +documentation: + summary: Manages access control for Google Cloud Platform resources. + overview: |- + # Google Identity and Access Management (IAM) API + + Documentation of the access control API that will be implemented by all + 1st party services provided by the Google Cloud Platform (like Cloud + Storage, Compute Engine, App Engine). + + Any implementation of an API that offers access control features + will implement the google.iam.v1.IAMPolicy interface. + + ## Data model + + Access control is applied when a principal (user or service account), + takes some action on a resource exposed by a service. Resources, + identified by + URI-like names, are the unit of access control specification. It is up to + the service implementations to choose what granularity of access control + to support and what set of actions (permissions) to support for the + resources + they provide. For example one database service may allow access control to + be specified only at the Table level, whereas another might allow access + control to also be specified at the Column level. + + This is intentionally not a CRUD style API because access control policies + are created and deleted implicitly with the resources to which they are + attached. + + ## Policy + + A `Policy` consists of a list of bindings. A `Binding` binds a set of + members to a role, where the members can include user accounts, user + groups, user + domains, and service accounts. A role is a named set of permissions, + defined by the IAM system. The definition of a role is outside the + policy. + + A permission check involves determining the roles that include the + specified permission, and then determining if the principal specified by + the check is a member of a binding to at least one of these roles. The + membership check is recursive when a group is bound to a role. + rules: + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + description: |- + Gets the access control policy for a resource. Returns an empty policy + if the resource exists and does not have a policy set. + + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + description: |- + Sets the access control policy on the specified resource. Replaces + any existing policy. + + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + description: |- + Returns permissions that a caller has on the specified resource. If the + resource does not exist, this will return an empty set of + permissions, not a NOT_FOUND error. + + Note: This operation is designed to be used for building + permission-aware UIs and command-line tools, not for authorization + checking. This operation may "fail open" without warning. + +http: + rules: + - selector: google.iam.v1.IAMPolicy.GetIamPolicy + post: '/v1/{resource=**}:getIamPolicy' + body: '*' + - selector: google.iam.v1.IAMPolicy.SetIamPolicy + post: '/v1/{resource=**}:setIamPolicy' + body: '*' + - selector: google.iam.v1.IAMPolicy.TestIamPermissions + post: '/v1/{resource=**}:testIamPermissions' + body: '*' diff --git a/google/iam/v1/iam_meta_api_gapic.yaml b/google/iam/v1/iam_meta_api_gapic.yaml new file mode 100644 index 0000000000..5c4c833395 --- /dev/null +++ b/google/iam/v1/iam_meta_api_gapic.yaml @@ -0,0 +1,132 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +# The settings of generated code in a specific language. +language_settings: + java: + package_name: com.google.cloud.iam.v1 + python: + package_name: google.cloud.iam_v1.gapic + go: + package_name: cloud.google.com/go/iam/apiv1 + csharp: + package_name: Google.Iam.V1 + ruby: + package_name: Google::Cloud::Iam::V1 + php: + package_name: Google\Cloud\Iam\V1 + nodejs: + package_name: iam.v1 +# A list of API interface configurations. +interfaces: +# The fully qualified name of the API interface. +- name: google.iam.v1.IAMPolicy + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: [] + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - DEADLINE_EXCEEDED + - UNAVAILABLE + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: SetIamPolicy + flattening: + groups: + - parameters: + - resource + - policy + required_fields: + - resource + - policy + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: GetIamPolicy + flattening: + groups: + - parameters: + - resource + - options + required_fields: + - resource + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 + - name: TestIamPermissions + flattening: + groups: + - parameters: + - resource + - permissions + required_fields: + - resource + - permissions + retry_codes_name: non_idempotent + retry_params_name: default + timeout_millis: 60000 diff --git a/google/iam/v1/iam_policy.proto b/google/iam/v1/iam_policy.proto new file mode 100644 index 0000000000..7072854e4c --- /dev/null +++ b/google/iam/v1/iam_policy.proto @@ -0,0 +1,145 @@ +// Copyright 2019 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.iam.v1; + +import "google/iam/v1/options.proto"; +import "google/iam/v1/policy.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.V1"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; +option java_multiple_files = true; +option java_outer_classname = "IamPolicyProto"; +option java_package = "com.google.iam.v1"; +option php_namespace = "Google\\Cloud\\Iam\\V1"; + +// ## API Overview +// +// Manages Identity and Access Management (IAM) policies. +// +// Any implementation of an API that offers access control features +// implements the google.iam.v1.IAMPolicy interface. +// +// ## Data model +// +// Access control is applied when a principal (user or service account), takes +// some action on a resource exposed by a service. Resources, identified by +// URI-like names, are the unit of access control specification. Service +// implementations can choose the granularity of access control and the +// supported permissions for their resources. +// For example one database service may allow access control to be +// specified only at the Table level, whereas another might allow access control +// to also be specified at the Column level. +// +// ## Policy Structure +// +// See google.iam.v1.Policy +// +// This is intentionally not a CRUD style API because access control policies +// are created and deleted implicitly with the resources to which they are +// attached. +service IAMPolicy { + option (google.api.default_host) = "iam-meta-api.googleapis.com"; + + // Sets the access control policy on the specified resource. Replaces any + // existing policy. + rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) { + option (google.api.http) = { + post: "/v1/{resource=**}:setIamPolicy" + body: "*" + }; + } + + // Gets the access control policy for a resource. + // Returns an empty policy if the resource exists and does not have a policy + // set. + rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) { + option (google.api.http) = { + post: "/v1/{resource=**}:getIamPolicy" + body: "*" + }; + } + + // Returns permissions that a caller has on the specified resource. + // If the resource does not exist, this will return an empty set of + // permissions, not a NOT_FOUND error. + // + // Note: This operation is designed to be used for building permission-aware + // UIs and command-line tools, not for authorization checking. This operation + // may "fail open" without warning. + rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=**}:testIamPermissions" + body: "*" + }; + } +} + +// Request message for `SetIamPolicy` method. +message SetIamPolicyRequest { + // REQUIRED: The resource for which the policy is being specified. + // See the operation documentation for the appropriate value for this field. + string resource = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "*"]; + + // REQUIRED: The complete policy to be applied to the `resource`. The size of + // the policy is limited to a few 10s of KB. An empty policy is a + // valid policy but certain Cloud Platform services (such as Projects) + // might reject them. + Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `GetIamPolicy` method. +message GetIamPolicyRequest { + // REQUIRED: The resource for which the policy is being requested. + // See the operation documentation for the appropriate value for this field. + string resource = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "*"]; + + // OPTIONAL: A `GetPolicyOptions` object for specifying options to + // `GetIamPolicy`. This field is only used by Cloud IAM. + GetPolicyOptions options = 2; +} + +// Request message for `TestIamPermissions` method. +message TestIamPermissionsRequest { + // REQUIRED: The resource for which the policy detail is being requested. + // See the operation documentation for the appropriate value for this field. + string resource = 1[ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference).type = "*"]; + + // The set of permissions to check for the `resource`. Permissions with + // wildcards (such as '*' or 'storage.*') are not allowed. For more + // information see + // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for `TestIamPermissions` method. +message TestIamPermissionsResponse { + // A subset of `TestPermissionsRequest.permissions` that the caller is + // allowed. + repeated string permissions = 1; +} diff --git a/google/iam/v1/logging/BUILD.bazel b/google/iam/v1/logging/BUILD.bazel new file mode 100644 index 0000000000..cf95b5c37f --- /dev/null +++ b/google/iam/v1/logging/BUILD.bazel @@ -0,0 +1,62 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "audit_data_proto", + srcs = [ + "audit_data.proto", + ], + deps = [ + "//google/api:annotations_proto", + "//google/iam/v1:policy_proto", + ], +) + +proto_library_with_info( + name = "logging_proto_with_info", + deps = [":audit_data_proto"], +) + +############################################################################## +# Java +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") + +java_proto_library( + name = "logging_java_proto", + deps = [":audit_data_proto"], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_proto_library", +) + +go_proto_library( + name = "logging_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/iam/v1/logging", + protos = [":audit_data_proto"], + deps = [ + "//google/api:annotations_go_proto", + "//google/iam/v1:iam_go_proto", + ], +) + +go_gapic_assembly_pkg( + name = "gapi-cloud-iam-admin-go", + deps = [ + ":logging_go_proto", + ], +) diff --git a/google/iam/v1/logging/audit_data.proto b/google/iam/v1/logging/audit_data.proto new file mode 100644 index 0000000000..dfe441ba66 --- /dev/null +++ b/google/iam/v1/logging/audit_data.proto @@ -0,0 +1,34 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.iam.v1.logging; + +import "google/api/annotations.proto"; +import "google/iam/v1/policy.proto"; + +option csharp_namespace = "Google.Cloud.Iam.V1.Logging"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1/logging;logging"; +option java_multiple_files = true; +option java_outer_classname = "AuditDataProto"; +option java_package = "com.google.iam.v1.logging"; + +// Audit log information specific to Cloud IAM. This message is serialized +// as an `Any` type in the `ServiceData` message of an +// `AuditLog` message. +message AuditData { + // Policy delta between the original policy and the newly set policy. + google.iam.v1.PolicyDelta policy_delta = 2; +} diff --git a/google/iam/v1/options.proto b/google/iam/v1/options.proto new file mode 100644 index 0000000000..a4e17e588d --- /dev/null +++ b/google/iam/v1/options.proto @@ -0,0 +1,41 @@ +// Copyright 2019 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.iam.v1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.V1"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; +option java_multiple_files = true; +option java_outer_classname = "OptionsProto"; +option java_package = "com.google.iam.v1"; +option php_namespace = "Google\\Cloud\\Iam\\V1"; + +// Encapsulates settings provided to GetIamPolicy. +message GetPolicyOptions { + // Optional. The policy format version to be returned. + // + // Valid values are 0, 1, and 3. Requests specifying an invalid value will be + // rejected. + // + // Requests for policies with any conditional bindings must specify version 3. + // Policies without any conditional bindings may specify any valid value or + // leave the field unset. + int32 requested_policy_version = 1; +} diff --git a/google/iam/v1/policy.proto b/google/iam/v1/policy.proto new file mode 100644 index 0000000000..e3aba47e8e --- /dev/null +++ b/google/iam/v1/policy.proto @@ -0,0 +1,240 @@ +// Copyright 2019 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.iam.v1; + +import "google/type/expr.proto"; +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Iam.V1"; +option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; +option java_multiple_files = true; +option java_outer_classname = "PolicyProto"; +option java_package = "com.google.iam.v1"; +option php_namespace = "Google\\Cloud\\Iam\\V1"; + +// Defines an Identity and Access Management (IAM) policy. It is used to +// specify access control policies for Cloud Platform resources. +// +// +// A `Policy` is a collection of `bindings`. A `binding` binds one or more +// `members` to a single `role`. Members can be user accounts, service accounts, +// Google groups, and domains (such as G Suite). A `role` is a named list of +// permissions (defined by IAM or configured by users). A `binding` can +// optionally specify a `condition`, which is a logic expression that further +// constrains the role binding based on attributes about the request and/or +// target resource. +// +// **JSON Example** +// +// { +// "bindings": [ +// { +// "role": "roles/resourcemanager.organizationAdmin", +// "members": [ +// "user:mike@example.com", +// "group:admins@example.com", +// "domain:google.com", +// "serviceAccount:my-project-id@appspot.gserviceaccount.com" +// ] +// }, +// { +// "role": "roles/resourcemanager.organizationViewer", +// "members": ["user:eve@example.com"], +// "condition": { +// "title": "expirable access", +// "description": "Does not grant access after Sep 2020", +// "expression": "request.time < +// timestamp('2020-10-01T00:00:00.000Z')", +// } +// } +// ] +// } +// +// **YAML Example** +// +// bindings: +// - members: +// - user:mike@example.com +// - group:admins@example.com +// - domain:google.com +// - serviceAccount:my-project-id@appspot.gserviceaccount.com +// role: roles/resourcemanager.organizationAdmin +// - members: +// - user:eve@example.com +// role: roles/resourcemanager.organizationViewer +// condition: +// title: expirable access +// description: Does not grant access after Sep 2020 +// expression: request.time < timestamp('2020-10-01T00:00:00.000Z') +// +// For a description of IAM and its features, see the +// [IAM developer's guide](https://cloud.google.com/iam/docs). +message Policy { + // Specifies the format of the policy. + // + // Valid values are 0, 1, and 3. Requests specifying an invalid value will be + // rejected. + // + // Operations affecting conditional bindings must specify version 3. This can + // be either setting a conditional policy, modifying a conditional binding, + // or removing a binding (conditional or unconditional) from the stored + // conditional policy. + // Operations on non-conditional policies may specify any valid value or + // leave the field unset. + // + // If no etag is provided in the call to `setIamPolicy`, version compliance + // checks against the stored policy is skipped. + int32 version = 1; + + // Associates a list of `members` to a `role`. Optionally may specify a + // `condition` that determines when binding is in effect. + // `bindings` with no members will result in an error. + repeated Binding bindings = 4; + + // `etag` is used for optimistic concurrency control as a way to help + // prevent simultaneous updates of a policy from overwriting each other. + // It is strongly suggested that systems make use of the `etag` in the + // read-modify-write cycle to perform policy updates in order to avoid race + // conditions: An `etag` is returned in the response to `getIamPolicy`, and + // systems are expected to put that etag in the request to `setIamPolicy` to + // ensure that their change will be applied to the same version of the policy. + // + // If no `etag` is provided in the call to `setIamPolicy`, then the existing + // policy is overwritten. Due to blind-set semantics of an etag-less policy, + // 'setIamPolicy' will not fail even if the incoming policy version does not + // meet the requirements for modifying the stored policy. + bytes etag = 3; +} + +// Associates `members` with a `role`. +message Binding { + // Role that is assigned to `members`. + // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + string role = 1; + + // Specifies the identities requesting access for a Cloud Platform resource. + // `members` can have the following values: + // + // * `allUsers`: A special identifier that represents anyone who is + // on the internet; with or without a Google account. + // + // * `allAuthenticatedUsers`: A special identifier that represents anyone + // who is authenticated with a Google account or a service account. + // + // * `user:{emailid}`: An email address that represents a specific Google + // account. For example, `alice@example.com` . + // + // + // * `serviceAccount:{emailid}`: An email address that represents a service + // account. For example, `my-other-app@appspot.gserviceaccount.com`. + // + // * `group:{emailid}`: An email address that represents a Google group. + // For example, `admins@example.com`. + // + // + // * `domain:{domain}`: The G Suite domain (primary) that represents all the + // users of that domain. For example, `google.com` or `example.com`. + // + // + repeated string members = 2; + + // The condition that is associated with this binding. + // NOTE: An unsatisfied condition will not allow user access via current + // binding. Different bindings, including their conditions, are examined + // independently. + google.type.Expr condition = 3; +} + +// The difference delta between two policies. +message PolicyDelta { + // The delta for Bindings between two policies. + repeated BindingDelta binding_deltas = 1; + + // The delta for AuditConfigs between two policies. + repeated AuditConfigDelta audit_config_deltas = 2; +} + +// One delta entry for Binding. Each individual change (only one member in each +// entry) to a binding will be a separate entry. +message BindingDelta { + // The type of action performed on a Binding in a policy. + enum Action { + // Unspecified. + ACTION_UNSPECIFIED = 0; + + // Addition of a Binding. + ADD = 1; + + // Removal of a Binding. + REMOVE = 2; + } + + // The action that was performed on a Binding. + // Required + Action action = 1; + + // Role that is assigned to `members`. + // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. + // Required + string role = 2; + + // A single identity requesting access for a Cloud Platform resource. + // Follows the same format of Binding.members. + // Required + string member = 3; + + // The condition that is associated with this binding. + google.type.Expr condition = 4; +} + +// One delta entry for AuditConfig. Each individual change (only one +// exempted_member in each entry) to a AuditConfig will be a separate entry. +message AuditConfigDelta { + // The type of action performed on an audit configuration in a policy. + enum Action { + // Unspecified. + ACTION_UNSPECIFIED = 0; + + // Addition of an audit configuration. + ADD = 1; + + // Removal of an audit configuration. + REMOVE = 2; + } + + // The action that was performed on an audit configuration in a policy. + // Required + Action action = 1; + + // Specifies a service that was configured for Cloud Audit Logging. + // For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. + // `allServices` is a special value that covers all services. + // Required + string service = 2; + + // A single identity that is exempted from "data access" audit + // logging for the `service` specified above. + // Follows the same format of Binding.members. + string exempted_member = 3; + + // Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always + // enabled, and cannot be configured. + // Required + string log_type = 4; +} diff --git a/google/longrunning/BUILD.bazel b/google/longrunning/BUILD.bazel new file mode 100644 index 0000000000..f23ea9ae9f --- /dev/null +++ b/google/longrunning/BUILD.bazel @@ -0,0 +1,114 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") + +proto_library( + name = "operations_proto", + srcs = ["operations.proto"], + deps = [ + "//google/api:annotations_proto", + "//google/rpc:status_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:empty_proto", + ], +) + +proto_library_with_info( + name = "longrunning_proto_with_info", + deps = [":operations_proto"], +) + +############################################################################## +# Java +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "java_grpc_library", "java_proto_library") + +java_proto_library( + name = "longrunning_java_proto", + deps = [":operations_proto"], +) + +java_grpc_library( + name = "longrunning_java_grpc", + srcs = [":operations_proto"], + deps = [":longrunning_java_proto"], +) + +############################################################################## +# Go +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "go_gapic_assembly_pkg", + "go_gapic_library", + "go_proto_library", + "go_test", +) + +go_proto_library( + name = "longrunning_go_proto", + compilers = ["@io_bazel_rules_go//proto:go_grpc"], + importpath = "google.golang.org/genproto/googleapis/longrunning", + protos = [":operations_proto"], + visibility = ["//visibility:public"], + deps = [ + "//google/api:annotations_go_proto", + "//google/rpc:status_go_proto", + ], +) + +go_gapic_library( + name = "longrunning_go_gapic", + src = ":longrunning_proto_with_info", + gapic_yaml = "longrunning_gapic.yaml", + importpath = "cloud.google.com/go/longrunning/autogen", + service_yaml = "//google/longrunning:longrunning.yaml", + deps = [":longrunning_go_proto"], +) + +go_test( + name = "longrunning_go_gapic_test", + srcs = [":longrunning_go_gapic_srcjar_test"], + embed = [":longrunning_go_gapic"], + importpath = "cloud.google.com/go/longrunning/autogen", +) + +# Open Source Packages +go_gapic_assembly_pkg( + name = "gapi-cloud-longrunning-go", + deps = [ + ":longrunning_go_gapic", + ":longrunning_go_gapic_srcjar-smoke-test.srcjar", + ":longrunning_go_gapic_srcjar-test.srcjar", + ":longrunning_go_proto", + ], +) + +############################################################################## +# C++ +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_grpc_library", + "cc_proto_library", +) + +cc_proto_library( + name = "longrunning_cc_proto", + deps = [":operations_proto"], +) + +cc_grpc_library( + name = "longrunning_cc_grpc", + srcs = [":operations_proto"], + grpc_only = True, + deps = [":longrunning_cc_proto"], +) diff --git a/google/longrunning/README.md b/google/longrunning/README.md new file mode 100644 index 0000000000..905642277f --- /dev/null +++ b/google/longrunning/README.md @@ -0,0 +1,5 @@ +# Google Long Running Operations API + +This package contains the definition of an abstract interface that +manages long running operations with API services. See +[google.longrunning.Operations][] for details. \ No newline at end of file diff --git a/google/longrunning/artman_longrunning.yaml b/google/longrunning/artman_longrunning.yaml new file mode 100644 index 0000000000..ddda18b02a --- /dev/null +++ b/google/longrunning/artman_longrunning.yaml @@ -0,0 +1,31 @@ +common: + api_name: longrunning + api_version: v1 + organization_name: google + service_yaml: longrunning.yaml + gapic_yaml: longrunning_gapic.yaml + src_proto_paths: + - . + proto_deps: + - name: google-common-protos +artifacts: +- name: java_gapic + type: GAPIC_ONLY + language: JAVA +- name: php_gapic + type: GAPIC + language: PHP +- name: ruby_gapic + type: GAPIC + language: RUBY +- name: go_gapic + type: GAPIC + language: GO +- name: csharp_gapic + type: GAPIC + language: CSHARP +- name: nodejs_gapic + type: GAPIC + language: NODEJS +- name: gapic_config + type: GAPIC_CONFIG diff --git a/google/longrunning/longrunning.yaml b/google/longrunning/longrunning.yaml new file mode 100644 index 0000000000..ff8fccf062 --- /dev/null +++ b/google/longrunning/longrunning.yaml @@ -0,0 +1,72 @@ +type: google.api.Service +config_version: 1 +name: longrunning.googleapis.com +title: Long Running Operations API + +apis: + - name: google.longrunning.Operations + +types: + - name: google.longrunning.OperationInfo + +documentation: + overview: |- + # Long Running Operation API + + This package contains the definition of Long Running Operation (LRO) + interface. It is a standard interface that API services can implement for + managing asynchronous operations. + + ## What are Long Running Operations? + + A Long Running Operation (LRO) is a way of representing an action that may + take a significant amount of time to complete. For example, an API call that + starts exporting a large amount of data could take quite a while to complete + and is therefore best represented as an LRO. A common rule of thumb is to + think of LROs as "API promises" that represent the result of some on-going + action. + + ## Using LROs + + If an API method could potentially take long time to finish, the method + should return a long running operation instead of a direct response. This + means that even if there are situations where the response could be + immediate, the API should still return an LRO -- it just may be already + marked as completed. For example, if a data export operation is called on an + empty resource, the operation itself may be possible to execute immediately, + and would result in an already completed LRO. + + Additionally, the operation should be managed using the LRO interface, which + allows clients to poll the operation for status updates or cancel it + entirely. + + Finally, an LRO represents an action and as a result, the operation is not + created directly. Instead, the operation comes into existence as a + side-effect of the action it represents. For example, an RPC called + `ExportData` would create and return an LRO. This means that there should + never be an RPC called `CreateOperation`. + + This also means that any permissions on the operation would be based on + action it represents. Any immediate side effects of starting the operation + must be visible in the service as soon as the LRO is returned. For example, + if an LRO is returned when creating a resource, that resource should be + visible in the API immediately, but be in a non-final state until the LRO is + completed. + + ## LROs versus Jobs + + A job is a common design pattern often used in data processing that tends to + be used to represent some contained piece of work that would be stored, + re-run, and modified over time. Jobs also typically interact with multiple + resources and are created, deleted, and updated directly as independent + resources. + + Jobs can also offer support for more complex actions such as pausing and + resuming an individual job, where each action could return an LRO as a + response. + + In general, if an action may take a while but it represents a single piece + of work, it's best to represent the response as an LRO. If the action is + something more complex (for example, it involves lots of resources and can't + be created as a byproduct of a single action), it may make more sense to + represent it as a job. diff --git a/google/longrunning/longrunning_gapic.yaml b/google/longrunning/longrunning_gapic.yaml new file mode 100644 index 0000000000..acd110f63f --- /dev/null +++ b/google/longrunning/longrunning_gapic.yaml @@ -0,0 +1,100 @@ +type: com.google.api.codegen.ConfigProto +config_schema_version: 1.0.0 +language_settings: + java: + package_name: com.google.longrunning + python: + package_name: google.longrunning.gapic + go: + package_name: cloud.google.com/go/longrunning/autogen + domain_layer_location: cloud.google.com/go/longrunning + csharp: + package_name: Google.LongRunning + ruby: + package_name: Google::Longrunning + php: + package_name: Google\ApiCore\LongRunning + nodejs: + package_name: longrunning +interfaces: +- name: google.longrunning.Operations + required_constructor_params: + - service_address + - scopes + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 90000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 90000 + total_timeout_millis: 600000 + methods: + - name: GetOperation + flattening: + groups: + - parameters: + - name + required_fields: + - name + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: ListOperations + flattening: + groups: + - parameters: + - name + - filter + required_fields: + - name + - filter + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: operations + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: CancelOperation + flattening: + groups: + - parameters: + - name + required_fields: + - name + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: DeleteOperation + flattening: + groups: + - parameters: + - name + required_fields: + - name + retry_codes_name: idempotent + retry_params_name: default + timeout_millis: 60000 + - name: WaitOperation + surface_treatments: + - include_languages: + - go + - java + - csharp + - ruby + - nodejs + - python + - php + visibility: DISABLED diff --git a/google/longrunning/operations.proto b/google/longrunning/operations.proto new file mode 100644 index 0000000000..90778e03e1 --- /dev/null +++ b/google/longrunning/operations.proto @@ -0,0 +1,241 @@ +// Copyright 2019 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.longrunning; + +import "google/api/annotations.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/rpc/status.proto"; +import "google/protobuf/descriptor.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.LongRunning"; +option go_package = "google.golang.org/genproto/googleapis/longrunning;longrunning"; +option java_multiple_files = true; +option java_outer_classname = "OperationsProto"; +option java_package = "com.google.longrunning"; +option php_namespace = "Google\\LongRunning"; + +extend google.protobuf.MethodOptions { + // Additional information regarding long-running operations. + // In particular, this specifies the types that are returned from + // long-running operations. + // + // Required for methods that return `google.longrunning.Operation`; invalid + // otherwise. + google.longrunning.OperationInfo operation_info = 1049; +} + +// Manages long-running operations with an API service. +// +// When an API method normally takes long time to complete, it can be designed +// to return [Operation][google.longrunning.Operation] to the client, and the client can use this +// interface to receive the real response asynchronously by polling the +// operation resource, or pass the operation resource to another API (such as +// Google Cloud Pub/Sub API) to receive the response. Any API service that +// returns long-running operations should implement the `Operations` interface +// so developers can have a consistent client experience. +service Operations { + // Lists operations that match the specified filter in the request. If the + // server doesn't support this method, it returns `UNIMPLEMENTED`. + // + // NOTE: the `name` binding allows API services to override the binding + // to use different resource name schemes, such as `users/*/operations`. To + // override the binding, API services can add a binding such as + // `"/v1/{name=users/*}/operations"` to their service configuration. + // For backwards compatibility, the default name includes the operations + // collection id, however overriding users must ensure the name binding + // is the parent resource, without the operations collection id. + rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { + option (google.api.http) = { + get: "/v1/{name=operations}" + }; + } + + // Gets the latest state of a long-running operation. Clients can use this + // method to poll the operation result at intervals as recommended by the API + // service. + rpc GetOperation(GetOperationRequest) returns (Operation) { + option (google.api.http) = { + get: "/v1/{name=operations/**}" + }; + } + + // Deletes a long-running operation. This method indicates that the client is + // no longer interested in the operation result. It does not cancel the + // operation. If the server doesn't support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. + rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=operations/**}" + }; + } + + // Starts asynchronous cancellation on a long-running operation. The server + // makes a best effort to cancel the operation, but success is not + // guaranteed. If the server doesn't support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. Clients can use + // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + // other methods to check whether the cancellation succeeded or whether the + // operation completed despite cancellation. On successful cancellation, + // the operation is not deleted; instead, it becomes an operation with + // an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{name=operations/**}:cancel" + body: "*" + }; + } + + // Waits for the specified long-running operation until it is done or reaches + // at most a specified timeout, returning the latest state. If the operation + // is already done, the latest state is immediately returned. If the timeout + // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + // timeout is used. If the server does not support this method, it returns + // `google.rpc.Code.UNIMPLEMENTED`. + // Note that this method is on a best-effort basis. It may return the latest + // state before the specified timeout (including immediately), meaning even an + // immediate response is no guarantee that the operation is done. + rpc WaitOperation(WaitOperationRequest) returns (Operation) { + } +} + +// This resource represents a long-running operation that is the result of a +// network API call. +message Operation { + // The server-assigned name, which is only unique within the same service that + // originally returns it. If you use the default HTTP mapping, the + // `name` should have the format of `operations/some/unique/name`. + string name = 1; + + // Service-specific metadata associated with the operation. It typically + // contains progress information and common metadata such as create time. + // Some services might not provide such metadata. Any method that returns a + // long-running operation should document the metadata type, if any. + google.protobuf.Any metadata = 2; + + // If the value is `false`, it means the operation is still in progress. + // If `true`, the operation is completed, and either `error` or `response` is + // available. + bool done = 3; + + // The operation result, which can be either an `error` or a valid `response`. + // If `done` == `false`, neither `error` nor `response` is set. + // If `done` == `true`, exactly one of `error` or `response` is set. + oneof result { + // The error result of the operation in case of failure or cancellation. + google.rpc.Status error = 4; + + // The normal response of the operation in case of success. If the original + // method returns no data on success, such as `Delete`, the response is + // `google.protobuf.Empty`. If the original method is standard + // `Get`/`Create`/`Update`, the response should be the resource. For other + // methods, the response should have the type `XxxResponse`, where `Xxx` + // is the original method name. For example, if the original method name + // is `TakeSnapshot()`, the inferred response type is + // `TakeSnapshotResponse`. + google.protobuf.Any response = 5; + } +} + +// The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation]. +message GetOperationRequest { + // The name of the operation resource. + string name = 1; +} + +// The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +message ListOperationsRequest { + // The name of the operation's parent resource. + string name = 4; + + // The standard list filter. + string filter = 1; + + // The standard list page size. + int32 page_size = 2; + + // The standard list page token. + string page_token = 3; +} + +// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. +message ListOperationsResponse { + // A list of operations that matches the specified filter in the request. + repeated Operation operations = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]. +message CancelOperationRequest { + // The name of the operation resource to be cancelled. + string name = 1; +} + +// The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation]. +message DeleteOperationRequest { + // The name of the operation resource to be deleted. + string name = 1; +} + +// The request message for [Operations.WaitOperation][google.longrunning.Operations.WaitOperation]. +message WaitOperationRequest { + // The name of the operation resource to wait on. + string name = 1; + + // The maximum duration to wait before timing out. If left blank, the wait + // will be at most the time permitted by the underlying HTTP/RPC protocol. + // If RPC context deadline is also specified, the shorter one will be used. + google.protobuf.Duration timeout = 2; +} + +// A message representing the message types used by a long-running operation. +// +// Example: +// +// rpc LongRunningRecognize(LongRunningRecognizeRequest) +// returns (google.longrunning.Operation) { +// option (google.longrunning.operation_info) = { +// response_type: "LongRunningRecognizeResponse" +// metadata_type: "LongRunningRecognizeMetadata" +// }; +// } +message OperationInfo { + // Required. The message name of the primary return type for this + // long-running operation. + // This type will be used to deserialize the LRO's response. + // + // If the response is in a different package from the rpc, a fully-qualified + // message name must be used (e.g. `google.protobuf.Struct`). + // + // Note: Altering this value constitutes a breaking change. + string response_type = 1; + + // Required. The message name of the metadata type for this long-running + // operation. + // + // If the response is in a different package from the rpc, a fully-qualified + // message name must be used (e.g. `google.protobuf.Struct`). + // + // Note: Altering this value constitutes a breaking change. + string metadata_type = 2; +} diff --git a/google/rpc/BUILD.bazel b/google/rpc/BUILD.bazel new file mode 100644 index 0000000000..645f329f35 --- /dev/null +++ b/google/rpc/BUILD.bazel @@ -0,0 +1,109 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +proto_library( + name = "code_proto", + srcs = ["code.proto"], + deps = [], +) + +proto_library( + name = "error_details_proto", + srcs = ["error_details.proto"], + deps = [ + "@com_google_protobuf//:duration_proto", + ], +) + +proto_library( + name = "status_proto", + srcs = ["status.proto"], + deps = [ + "@com_google_protobuf//:any_proto", + ], +) + +############################################################################## +# Java +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") + +java_proto_library( + name = "rpc_java_proto", + deps = [ + ":code_proto", + ":error_details_proto", + ":status_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library") + +go_proto_library( + name = "code_go_proto", + importpath = "google.golang.org/genproto/googleapis/rpc/code", + protos = [":code_proto"], +) + +go_proto_library( + name = "errdetails_go_proto", + importpath = "google.golang.org/genproto/googleapis/rpc/errdetails", + protos = [":error_details_proto"], +) + +go_proto_library( + name = "status_go_proto", + importpath = "google.golang.org/genproto/googleapis/rpc/status", + protos = [":status_proto"], +) + +############################################################################## +# C++ +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_proto_library", +) + +cc_proto_library( + name = "code_cc_proto", + deps = [":code_proto"], +) + +cc_proto_library( + name = "error_details_cc_proto", + deps = [":error_details_proto"], +) + +cc_proto_library( + name = "status_cc_proto", + deps = [":status_proto"], +) + +############################################################################## +# Python +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library") + +py_proto_library( + name = "code_py_proto", + deps = [":code_proto"], +) + +py_proto_library( + name = "error_details_py_proto", + deps = [":error_details_proto"], +) + +py_proto_library( + name = "status_py_proto", + deps = [":status_proto"], +) diff --git a/google/rpc/README.md b/google/rpc/README.md new file mode 100644 index 0000000000..164bc80987 --- /dev/null +++ b/google/rpc/README.md @@ -0,0 +1,5 @@ +# Google RPC + +This package contains type definitions for general RPC systems. While +[gRPC](https://github.com/grpc) is using these definitions, they +are not designed specifically to support gRPC. diff --git a/google/rpc/code.proto b/google/rpc/code.proto new file mode 100644 index 0000000000..142e28d30f --- /dev/null +++ b/google/rpc/code.proto @@ -0,0 +1,185 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.rpc; + +option go_package = "google.golang.org/genproto/googleapis/rpc/code;code"; +option java_multiple_files = true; +option java_outer_classname = "CodeProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The canonical error codes for Google APIs. +// +// +// Sometimes multiple error codes may apply. Services should return +// the most specific error code that applies. For example, prefer +// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. +// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. +enum Code { + // Not an error; returned on success + // + // HTTP Mapping: 200 OK + OK = 0; + + // The operation was cancelled, typically by the caller. + // + // HTTP Mapping: 499 Client Closed Request + CANCELLED = 1; + + // Unknown error. For example, this error may be returned when + // a `Status` value received from another address space belongs to + // an error space that is not known in this address space. Also + // errors raised by APIs that do not return enough error information + // may be converted to this error. + // + // HTTP Mapping: 500 Internal Server Error + UNKNOWN = 2; + + // The client specified an invalid argument. Note that this differs + // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments + // that are problematic regardless of the state of the system + // (e.g., a malformed file name). + // + // HTTP Mapping: 400 Bad Request + INVALID_ARGUMENT = 3; + + // The deadline expired before the operation could complete. For operations + // that change the state of the system, this error may be returned + // even if the operation has completed successfully. For example, a + // successful response from a server could have been delayed long + // enough for the deadline to expire. + // + // HTTP Mapping: 504 Gateway Timeout + DEADLINE_EXCEEDED = 4; + + // Some requested entity (e.g., file or directory) was not found. + // + // Note to server developers: if a request is denied for an entire class + // of users, such as gradual feature rollout or undocumented whitelist, + // `NOT_FOUND` may be used. If a request is denied for some users within + // a class of users, such as user-based access control, `PERMISSION_DENIED` + // must be used. + // + // HTTP Mapping: 404 Not Found + NOT_FOUND = 5; + + // The entity that a client attempted to create (e.g., file or directory) + // already exists. + // + // HTTP Mapping: 409 Conflict + ALREADY_EXISTS = 6; + + // The caller does not have permission to execute the specified + // operation. `PERMISSION_DENIED` must not be used for rejections + // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` + // instead for those errors). `PERMISSION_DENIED` must not be + // used if the caller can not be identified (use `UNAUTHENTICATED` + // instead for those errors). This error code does not imply the + // request is valid or the requested entity exists or satisfies + // other pre-conditions. + // + // HTTP Mapping: 403 Forbidden + PERMISSION_DENIED = 7; + + // The request does not have valid authentication credentials for the + // operation. + // + // HTTP Mapping: 401 Unauthorized + UNAUTHENTICATED = 16; + + // Some resource has been exhausted, perhaps a per-user quota, or + // perhaps the entire file system is out of space. + // + // HTTP Mapping: 429 Too Many Requests + RESOURCE_EXHAUSTED = 8; + + // The operation was rejected because the system is not in a state + // required for the operation's execution. For example, the directory + // to be deleted is non-empty, an rmdir operation is applied to + // a non-directory, etc. + // + // Service implementors can use the following guidelines to decide + // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: + // (a) Use `UNAVAILABLE` if the client can retry just the failing call. + // (b) Use `ABORTED` if the client should retry at a higher level + // (e.g., when a client-specified test-and-set fails, indicating the + // client should restart a read-modify-write sequence). + // (c) Use `FAILED_PRECONDITION` if the client should not retry until + // the system state has been explicitly fixed. E.g., if an "rmdir" + // fails because the directory is non-empty, `FAILED_PRECONDITION` + // should be returned since the client should not retry unless + // the files are deleted from the directory. + // + // HTTP Mapping: 400 Bad Request + FAILED_PRECONDITION = 9; + + // The operation was aborted, typically due to a concurrency issue such as + // a sequencer check failure or transaction abort. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 409 Conflict + ABORTED = 10; + + // The operation was attempted past the valid range. E.g., seeking or + // reading past end-of-file. + // + // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may + // be fixed if the system state changes. For example, a 32-bit file + // system will generate `INVALID_ARGUMENT` if asked to read at an + // offset that is not in the range [0,2^32-1], but it will generate + // `OUT_OF_RANGE` if asked to read from an offset past the current + // file size. + // + // There is a fair bit of overlap between `FAILED_PRECONDITION` and + // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific + // error) when it applies so that callers who are iterating through + // a space can easily look for an `OUT_OF_RANGE` error to detect when + // they are done. + // + // HTTP Mapping: 400 Bad Request + OUT_OF_RANGE = 11; + + // The operation is not implemented or is not supported/enabled in this + // service. + // + // HTTP Mapping: 501 Not Implemented + UNIMPLEMENTED = 12; + + // Internal errors. This means that some invariants expected by the + // underlying system have been broken. This error code is reserved + // for serious errors. + // + // HTTP Mapping: 500 Internal Server Error + INTERNAL = 13; + + // The service is currently unavailable. This is most likely a + // transient condition, which can be corrected by retrying with + // a backoff. + // + // See the guidelines above for deciding between `FAILED_PRECONDITION`, + // `ABORTED`, and `UNAVAILABLE`. + // + // HTTP Mapping: 503 Service Unavailable + UNAVAILABLE = 14; + + // Unrecoverable data loss or corruption. + // + // HTTP Mapping: 500 Internal Server Error + DATA_LOSS = 15; +} diff --git a/google/rpc/error_details.proto b/google/rpc/error_details.proto new file mode 100644 index 0000000000..1f9ad53145 --- /dev/null +++ b/google/rpc/error_details.proto @@ -0,0 +1,200 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; +option java_multiple_files = true; +option java_outer_classname = "ErrorDetailsProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// Describes when the clients can retry a failed request. Clients could ignore +// the recommendation here or retry when this information is missing from error +// responses. +// +// It's always recommended that clients should use exponential backoff when +// retrying. +// +// Clients should wait until `retry_delay` amount of time has passed since +// receiving the error response before retrying. If retrying requests also +// fail, clients should use an exponential backoff scheme to gradually increase +// the delay between retries based on `retry_delay`, until either a maximum +// number of retires have been reached or a maximum retry delay cap has been +// reached. +message RetryInfo { + // Clients should wait at least this long between retrying the same request. + google.protobuf.Duration retry_delay = 1; +} + +// Describes additional debugging info. +message DebugInfo { + // The stack trace entries indicating where the error occurred. + repeated string stack_entries = 1; + + // Additional debugging information provided by the server. + string detail = 2; +} + +// Describes how a quota check failed. +// +// For example if a daily limit was exceeded for the calling project, +// a service could respond with a QuotaFailure detail containing the project +// id and the description of the quota limit that was exceeded. If the +// calling project hasn't enabled the service in the developer console, then +// a service could respond with the project id and set `service_disabled` +// to true. +// +// Also see RetryDetail and Help types for other details about handling a +// quota failure. +message QuotaFailure { + // A message type used to describe a single quota violation. For example, a + // daily quota or a custom quota that was exceeded. + message Violation { + // The subject on which the quota check failed. + // For example, "clientip:" or "project:". + string subject = 1; + + // A description of how the quota check failed. Clients can use this + // description to find more about the quota configuration in the service's + // public documentation, or find the relevant quota limit to adjust through + // developer console. + // + // For example: "Service disabled" or "Daily Limit for read operations + // exceeded". + string description = 2; + } + + // Describes all quota violations. + repeated Violation violations = 1; +} + +// Describes what preconditions have failed. +// +// For example, if an RPC failed because it required the Terms of Service to be +// acknowledged, it could list the terms of service violation in the +// PreconditionFailure message. +message PreconditionFailure { + // A message type used to describe a single precondition failure. + message Violation { + // The type of PreconditionFailure. We recommend using a service-specific + // enum type to define the supported precondition violation types. For + // example, "TOS" for "Terms of Service violation". + string type = 1; + + // The subject, relative to the type, that failed. + // For example, "google.com/cloud" relative to the "TOS" type would + // indicate which terms of service is being referenced. + string subject = 2; + + // A description of how the precondition failed. Developers can use this + // description to understand how to fix the failure. + // + // For example: "Terms of service not accepted". + string description = 3; + } + + // Describes all precondition violations. + repeated Violation violations = 1; +} + +// Describes violations in a client request. This error type focuses on the +// syntactic aspects of the request. +message BadRequest { + // A message type used to describe a single bad request field. + message FieldViolation { + // A path leading to a field in the request body. The value will be a + // sequence of dot-separated identifiers that identify a protocol buffer + // field. E.g., "field_violations.field" would identify this field. + string field = 1; + + // A description of why the request element is bad. + string description = 2; + } + + // Describes all violations in a client request. + repeated FieldViolation field_violations = 1; +} + +// Contains metadata about the request that clients can attach when filing a bug +// or providing other forms of feedback. +message RequestInfo { + // An opaque string that should only be interpreted by the service generating + // it. For example, it can be used to identify requests in the service's logs. + string request_id = 1; + + // Any data that was used to serve this request. For example, an encrypted + // stack trace that can be sent back to the service provider for debugging. + string serving_data = 2; +} + +// Describes the resource that is being accessed. +message ResourceInfo { + // A name for the type of resource being accessed, e.g. "sql table", + // "cloud storage bucket", "file", "Google calendar"; or the type URL + // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". + string resource_type = 1; + + // The name of the resource being accessed. For example, a shared calendar + // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current + // error is + // [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. + string resource_name = 2; + + // The owner of the resource (optional). + // For example, "user:" or "project:". + string owner = 3; + + // Describes what error is encountered when accessing this resource. + // For example, updating a cloud project may require the `writer` permission + // on the developer console project. + string description = 4; +} + +// Provides links to documentation or for performing an out of band action. +// +// For example, if a quota check failed with an error indicating the calling +// project hasn't enabled the accessed service, this can contain a URL pointing +// directly to the right place in the developer console to flip the bit. +message Help { + // Describes a URL link. + message Link { + // Describes what the link offers. + string description = 1; + + // The URL of the link. + string url = 2; + } + + // URL(s) pointing to additional information on handling the current error. + repeated Link links = 1; +} + +// Provides a localized error message that is safe to return to the user +// which can be attached to an RPC error. +message LocalizedMessage { + // The locale used following the specification defined at + // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. + // Examples are: "en-US", "fr-CH", "es-MX" + string locale = 1; + + // The localized error message in the above locale. + string message = 2; +} diff --git a/google/rpc/rpc_publish.yaml b/google/rpc/rpc_publish.yaml new file mode 100644 index 0000000000..90a91e07d6 --- /dev/null +++ b/google/rpc/rpc_publish.yaml @@ -0,0 +1,28 @@ +type: google.api.Service +config_version: 1 +name: rpc.googleapis.com +title: Google RPC Types + +types: +- name: google.rpc.Status +- name: google.rpc.RetryInfo +- name: google.rpc.DebugInfo +- name: google.rpc.QuotaFailure +- name: google.rpc.BadRequest +- name: google.rpc.PreconditionFailure +- name: google.rpc.RequestInfo +- name: google.rpc.ResourceInfo +- name: google.rpc.Help +- name: google.rpc.LocalizedMessage + +enums: +- name: google.rpc.Code + +documentation: + summary: Defines RPC types. + overview: |- + # Google RPC + + This package contains type definitions for general RPC systems. While + [gRPC](https://github.com/grpc) is using these defintions, they are not + designed specifically to support gRPC. diff --git a/google/rpc/status.proto b/google/rpc/status.proto new file mode 100644 index 0000000000..b0daa36950 --- /dev/null +++ b/google/rpc/status.proto @@ -0,0 +1,94 @@ +// Copyright 2017 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. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + +// The `Status` type defines a logical error model that is suitable for +// different programming environments, including REST APIs and RPC APIs. It is +// used by [gRPC](https://github.com/grpc). The error model is designed to be: +// +// - Simple to use and understand for most users +// - Flexible enough to meet unexpected needs +// +// # Overview +// +// The `Status` message contains three pieces of data: error code, error +// message, and error details. The error code should be an enum value of +// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes +// if needed. The error message should be a developer-facing English message +// that helps developers *understand* and *resolve* the error. If a localized +// user-facing error message is needed, put the localized message in the error +// details or localize it in the client. The optional error details may contain +// arbitrary information about the error. There is a predefined set of error +// detail types in the package `google.rpc` that can be used for common error +// conditions. +// +// # Language mapping +// +// The `Status` message is the logical representation of the error model, but it +// is not necessarily the actual wire format. When the `Status` message is +// exposed in different client libraries and different wire protocols, it can be +// mapped differently. For example, it will likely be mapped to some exceptions +// in Java, but more likely mapped to some error codes in C. +// +// # Other uses +// +// The error model and the `Status` message can be used in a variety of +// environments, either with or without APIs, to provide a +// consistent developer experience across different environments. +// +// Example uses of this error model include: +// +// - Partial errors. If a service needs to return partial errors to the client, +// it may embed the `Status` in the normal response to indicate the partial +// errors. +// +// - Workflow errors. A typical workflow has multiple steps. Each step may +// have a `Status` message for error reporting. +// +// - Batch operations. If a client uses batch request and batch response, the +// `Status` message should be used directly inside batch response, one for +// each error sub-response. +// +// - Asynchronous operations. If an API call embeds asynchronous operation +// results in its response, the status of those operations should be +// represented directly using the `Status` message. +// +// - Logging. If some API errors are stored in logs, the message `Status` could +// be used directly after any stripping needed for security/privacy reasons. +message Status { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + string message = 2; + + // A list of messages that carry the error details. There is a common set of + // message types for APIs to use. + repeated google.protobuf.Any details = 3; +} diff --git a/google/type/BUILD.bazel b/google/type/BUILD.bazel new file mode 100644 index 0000000000..3a870be667 --- /dev/null +++ b/google/type/BUILD.bazel @@ -0,0 +1,235 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + +# This is an API workspace, having public visibility by default makes perfect sense. +package(default_visibility = ["//visibility:public"]) + +############################################################################## +# Common +############################################################################## +proto_library( + name = "calendar_period_proto", + srcs = ["calendar_period.proto"], +) + +proto_library( + name = "color_proto", + srcs = ["color.proto"], + deps = [ + "@com_google_protobuf//:wrappers_proto", + ], +) + +proto_library( + name = "date_proto", + srcs = ["date.proto"], +) + +proto_library( + name = "datetime_proto", + srcs = ["datetime.proto"], + deps = [ + "@com_google_protobuf//:duration_proto", + ], +) + +proto_library( + name = "dayofweek_proto", + srcs = ["dayofweek.proto"], +) + +proto_library( + name = "expr_proto", + srcs = ["expr.proto"], +) + +proto_library( + name = "fraction_proto", + srcs = ["fraction.proto"], +) + +proto_library( + name = "latlng_proto", + srcs = ["latlng.proto"], +) + +proto_library( + name = "money_proto", + srcs = ["money.proto"], +) + +proto_library( + name = "postal_address_proto", + srcs = ["postal_address.proto"], +) + +proto_library( + name = "quaternion_proto", + srcs = ["quaternion.proto"], +) + +proto_library( + name = "timeofday_proto", + srcs = ["timeofday.proto"], +) + +############################################################################## +# Java +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") + +java_proto_library( + name = "type_java_proto", + deps = [ + ":calendar_period_proto", + ":color_proto", + ":date_proto", + ":dayofweek_proto", + ":expr_proto", + ":fraction_proto", + ":latlng_proto", + ":money_proto", + ":postal_address_proto", + ":quaternion_proto", + ":timeofday_proto", + ], +) + +############################################################################## +# Go +############################################################################## +load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library") + +go_proto_library( + name = "calendar_period_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/calendarperiod", + protos = [":calendar_period_proto"], +) + +go_proto_library( + name = "color_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/color", + protos = [":color_proto"], +) + +go_proto_library( + name = "date_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/date", + protos = [":date_proto"], +) + +go_proto_library( + name = "datetime_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/date", + protos = [":datetime_proto"], +) + +go_proto_library( + name = "dayofweek_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/dayofweek", + protos = [":dayofweek_proto"], +) + +go_proto_library( + name = "expr_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/expr", + protos = [":expr_proto"], +) + +go_proto_library( + name = "fraction_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/fraction", + protos = [":fraction_proto"], +) + +go_proto_library( + name = "latlng_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/latlng", + protos = [":latlng_proto"], +) + +go_proto_library( + name = "money_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/money", + protos = [":money_proto"], +) + +go_proto_library( + name = "postaladdress_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/postaladdress", + protos = [":postal_address_proto"], +) + +go_proto_library( + name = "quaternion_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/quaternion", + protos = [":quaternion_proto"], +) + +go_proto_library( + name = "timeofday_go_proto", + importpath = "google.golang.org/genproto/googleapis/type/timeofday", + protos = [":timeofday_proto"], +) + +############################################################################## +# C++ +############################################################################## +load( + "@com_google_googleapis_imports//:imports.bzl", + "cc_proto_library", +) + +cc_proto_library( + name = "calendar_period_cc_proto", + deps = [":calendar_period_proto"], +) + +cc_proto_library( + name = "color_cc_proto", + deps = [":color_proto"], +) + +cc_proto_library( + name = "date_cc_proto", + deps = [":date_proto"], +) + +cc_proto_library( + name = "dayofweek_cc_proto", + deps = [":dayofweek_proto"], +) + +cc_proto_library( + name = "expr_cc_proto", + deps = [":expr_proto"], +) + +cc_proto_library( + name = "fraction_cc_proto", + deps = [":fraction_proto"], +) + +cc_proto_library( + name = "latlng_cc_proto", + deps = [":latlng_proto"], +) + +cc_proto_library( + name = "money_cc_proto", + deps = [":money_proto"], +) + +cc_proto_library( + name = "postal_address_cc_proto", + deps = [":postal_address_proto"], +) + +cc_proto_library( + name = "quaternion_cc_proto", + deps = [":quaternion_proto"], +) + +cc_proto_library( + name = "timeofday_cc_proto", + deps = [":timeofday_proto"], +) diff --git a/google/type/README.md b/google/type/README.md new file mode 100644 index 0000000000..6caf02cf1f --- /dev/null +++ b/google/type/README.md @@ -0,0 +1,16 @@ +# Google Common Types + +This package contains definitions of common types for Google APIs. +All types defined in this package are suitable for different APIs to +exchange data, and will never break binary compatibility. They should +have design quality comparable to major programming languages like +Java and C#. + +NOTE: Some common types are defined in the package `google.protobuf` +as they are directly supported by Protocol Buffers compiler and +runtime. Those types are called Well-Known Types. + +## Java Utilities + +A set of Java utilities for the Common Types are provided in the +`//java/com/google/type/util/` package. \ No newline at end of file diff --git a/google/type/calendar_period.proto b/google/type/calendar_period.proto new file mode 100644 index 0000000000..a91d0c35c8 --- /dev/null +++ b/google/type/calendar_period.proto @@ -0,0 +1,57 @@ +// Copyright 2019 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.type; + +option go_package = "google.golang.org/genproto/googleapis/type/calendarperiod;calendarperiod"; +option java_multiple_files = true; +option java_outer_classname = "CalendarPeriodProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// A `CalendarPeriod` represents the abstract concept of a time period that has +// a canonical start. Grammatically, "the start of the current +// `CalendarPeriod`." All calendar times begin at midnight UTC. +enum CalendarPeriod { + // Undefined period, raises an error. + CALENDAR_PERIOD_UNSPECIFIED = 0; + + // A day. + DAY = 1; + + // A week. Weeks begin on Monday, following + // [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). + WEEK = 2; + + // A fortnight. The first calendar fortnight of the year begins at the start + // of week 1 according to + // [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). + FORTNIGHT = 3; + + // A month. + MONTH = 4; + + // A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each + // year. + QUARTER = 5; + + // A half-year. Half-years start on dates 1-Jan and 1-Jul. + HALF = 6; + + // A year. + YEAR = 7; +} diff --git a/google/type/color.proto b/google/type/color.proto new file mode 100644 index 0000000000..417f1c4b19 --- /dev/null +++ b/google/type/color.proto @@ -0,0 +1,170 @@ +// Copyright 2019 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.type; + +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/color;color"; +option java_multiple_files = true; +option java_outer_classname = "ColorProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a color in the RGBA color space. This representation is designed +// for simplicity of conversion to/from color representations in various +// languages over compactness; for example, the fields of this representation +// can be trivially provided to the constructor of "java.awt.Color" in Java; it +// can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" +// method in iOS; and, with just a little work, it can be easily formatted into +// a CSS "rgba()" string in JavaScript, as well. +// +// Note: this proto does not carry information about the absolute color space +// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, +// DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color +// space. +// +// Example (Java): +// +// import com.google.type.Color; +// +// // ... +// public static java.awt.Color fromProto(Color protocolor) { +// float alpha = protocolor.hasAlpha() +// ? protocolor.getAlpha().getValue() +// : 1.0; +// +// return new java.awt.Color( +// protocolor.getRed(), +// protocolor.getGreen(), +// protocolor.getBlue(), +// alpha); +// } +// +// public static Color toProto(java.awt.Color color) { +// float red = (float) color.getRed(); +// float green = (float) color.getGreen(); +// float blue = (float) color.getBlue(); +// float denominator = 255.0; +// Color.Builder resultBuilder = +// Color +// .newBuilder() +// .setRed(red / denominator) +// .setGreen(green / denominator) +// .setBlue(blue / denominator); +// int alpha = color.getAlpha(); +// if (alpha != 255) { +// result.setAlpha( +// FloatValue +// .newBuilder() +// .setValue(((float) alpha) / denominator) +// .build()); +// } +// return resultBuilder.build(); +// } +// // ... +// +// Example (iOS / Obj-C): +// +// // ... +// static UIColor* fromProto(Color* protocolor) { +// float red = [protocolor red]; +// float green = [protocolor green]; +// float blue = [protocolor blue]; +// FloatValue* alpha_wrapper = [protocolor alpha]; +// float alpha = 1.0; +// if (alpha_wrapper != nil) { +// alpha = [alpha_wrapper value]; +// } +// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; +// } +// +// static Color* toProto(UIColor* color) { +// CGFloat red, green, blue, alpha; +// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { +// return nil; +// } +// Color* result = [[Color alloc] init]; +// [result setRed:red]; +// [result setGreen:green]; +// [result setBlue:blue]; +// if (alpha <= 0.9999) { +// [result setAlpha:floatWrapperWithValue(alpha)]; +// } +// [result autorelease]; +// return result; +// } +// // ... +// +// Example (JavaScript): +// +// // ... +// +// var protoToCssColor = function(rgb_color) { +// var redFrac = rgb_color.red || 0.0; +// var greenFrac = rgb_color.green || 0.0; +// var blueFrac = rgb_color.blue || 0.0; +// var red = Math.floor(redFrac * 255); +// var green = Math.floor(greenFrac * 255); +// var blue = Math.floor(blueFrac * 255); +// +// if (!('alpha' in rgb_color)) { +// return rgbToCssColor_(red, green, blue); +// } +// +// var alphaFrac = rgb_color.alpha.value || 0.0; +// var rgbParams = [red, green, blue].join(','); +// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); +// }; +// +// var rgbToCssColor_ = function(red, green, blue) { +// var rgbNumber = new Number((red << 16) | (green << 8) | blue); +// var hexString = rgbNumber.toString(16); +// var missingZeros = 6 - hexString.length; +// var resultBuilder = ['#']; +// for (var i = 0; i < missingZeros; i++) { +// resultBuilder.push('0'); +// } +// resultBuilder.push(hexString); +// return resultBuilder.join(''); +// }; +// +// // ... +message Color { + // The amount of red in the color as a value in the interval [0, 1]. + float red = 1; + + // The amount of green in the color as a value in the interval [0, 1]. + float green = 2; + + // The amount of blue in the color as a value in the interval [0, 1]. + float blue = 3; + + // The fraction of this color that should be applied to the pixel. That is, + // the final pixel color is defined by the equation: + // + // pixel color = alpha * (this color) + (1.0 - alpha) * (background color) + // + // This means that a value of 1.0 corresponds to a solid color, whereas + // a value of 0.0 corresponds to a completely transparent color. This + // uses a wrapper message rather than a simple float scalar so that it is + // possible to distinguish between a default value and the value being unset. + // If omitted, this color object is to be rendered as a solid color + // (as if the alpha value had been explicitly given with a value of 1.0). + google.protobuf.FloatValue alpha = 4; +} diff --git a/google/type/date.proto b/google/type/date.proto new file mode 100644 index 0000000000..b958feeba5 --- /dev/null +++ b/google/type/date.proto @@ -0,0 +1,50 @@ +// Copyright 2019 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.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/date;date"; +option java_multiple_files = true; +option java_outer_classname = "DateProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a whole or partial calendar date, e.g. a birthday. The time of day +// and time zone are either specified elsewhere or are not significant. The date +// is relative to the Proleptic Gregorian Calendar. This can represent: +// +// * A full date, with non-zero year, month and day values +// * A month and day value, with a zero year, e.g. an anniversary +// * A year on its own, with zero month and day values +// * A year and month value, with a zero day, e.g. a credit card expiration date +// +// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. +message Date { + // Year of date. Must be from 1 to 9999, or 0 if specifying a date without + // a year. + int32 year = 1; + + // Month of year. Must be from 1 to 12, or 0 if specifying a year without a + // month and day. + int32 month = 2; + + // Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + // if specifying a year by itself or a year and month where the day is not + // significant. + int32 day = 3; +} diff --git a/google/type/datetime.proto b/google/type/datetime.proto new file mode 100644 index 0000000000..5aebc4b97f --- /dev/null +++ b/google/type/datetime.proto @@ -0,0 +1,97 @@ +// Copyright 2019 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.type; + +import "google/protobuf/duration.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/datetime;datetime"; +option java_multiple_files = true; +option java_outer_classname = "DateTimeProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents civil time in one of a few possible ways: +// +// * When utc_offset is set and time_zone is unset: a civil time on a calendar +// day with a particular offset from UTC. +// * When time_zone is set and utc_offset is unset: a civil time on a calendar +// day in a particular time zone. +// * When neither time_zone nor utc_offset is set: a civil time on a calendar +// day in local time. +// +// The date is relative to the Proleptic Gregorian Calendar. +// +// If year is 0, the DateTime is considered not to have a specific year. month +// and day must have valid, non-zero values. +// +// This type is more flexible than some applications may want. Make sure to +// document and validate your application's limitations. +message DateTime { + // Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a + // datetime without a year. + int32 year = 1; + + // Required. Month of year. Must be from 1 to 12. + int32 month = 2; + + // Required. Day of month. Must be from 1 to 31 and valid for the year and + // month. + int32 day = 3; + + // Required. Hours of day in 24 hour format. Should be from 0 to 23. An API + // may choose to allow the value "24:00:00" for scenarios like business + // closing time. + int32 hours = 4; + + // Required. Minutes of hour of day. Must be from 0 to 59. + int32 minutes = 5; + + // Required. Seconds of minutes of the time. Must normally be from 0 to 59. An + // API may allow the value 60 if it allows leap-seconds. + int32 seconds = 6; + + // Required. Fractions of seconds in nanoseconds. Must be from 0 to + // 999,999,999. + int32 nanos = 7; + + // Optional. Specifies either the UTC offset or the time zone of the DateTime. + // Choose carefully between them, considering that time zone data may change + // in the future (for example, a country modifies their DST start/end dates, + // and future DateTimes in the affected range had already been stored). + // If omitted, the DateTime is considered to be in local time. + oneof time_offset { + // UTC offset. Must be whole seconds, between -18 hours and +18 hours. + // For example, a UTC offset of -4:00 would be represented as + // { seconds: -14400 }. + google.protobuf.Duration utc_offset = 8; + + // Time zone. + TimeZone time_zone = 9; + } +} + +// Represents a time zone from the +// [IANA Time Zone Database](https://www.iana.org/time-zones). +message TimeZone { + // IANA Time Zone Database time zone, e.g. "America/New_York". + string id = 1; + + // Optional. IANA Time Zone Database version number, e.g. "2019a". + string version = 2; +} diff --git a/google/type/dayofweek.proto b/google/type/dayofweek.proto new file mode 100644 index 0000000000..7544e15161 --- /dev/null +++ b/google/type/dayofweek.proto @@ -0,0 +1,51 @@ +// Copyright 2019 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.type; + +option go_package = "google.golang.org/genproto/googleapis/type/dayofweek;dayofweek"; +option java_multiple_files = true; +option java_outer_classname = "DayOfWeekProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a day of week. +enum DayOfWeek { + // The unspecified day-of-week. + DAY_OF_WEEK_UNSPECIFIED = 0; + + // The day-of-week of Monday. + MONDAY = 1; + + // The day-of-week of Tuesday. + TUESDAY = 2; + + // The day-of-week of Wednesday. + WEDNESDAY = 3; + + // The day-of-week of Thursday. + THURSDAY = 4; + + // The day-of-week of Friday. + FRIDAY = 5; + + // The day-of-week of Saturday. + SATURDAY = 6; + + // The day-of-week of Sunday. + SUNDAY = 7; +} diff --git a/google/type/expr.proto b/google/type/expr.proto new file mode 100644 index 0000000000..5d4f2f71b2 --- /dev/null +++ b/google/type/expr.proto @@ -0,0 +1,51 @@ +// Copyright 2019 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.type; + +option go_package = "google.golang.org/genproto/googleapis/type/expr;expr"; +option java_multiple_files = true; +option java_outer_classname = "ExprProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents an expression text. Example: +// +// title: "User account presence" +// description: "Determines whether the request has a user account" +// expression: "size(request.user) > 0" +message Expr { + // Textual representation of an expression in + // Common Expression Language syntax. + // + // The application context of the containing message determines which + // well-known feature set of CEL is supported. + string expression = 1; + + // An optional title for the expression, i.e. a short string describing + // its purpose. This can be used e.g. in UIs which allow to enter the + // expression. + string title = 2; + + // An optional description of the expression. This is a longer text which + // describes the expression, e.g. when hovered over it in a UI. + string description = 3; + + // An optional string indicating the location of the expression for error + // reporting, e.g. a file name and a position in the file. + string location = 4; +} diff --git a/google/type/fraction.proto b/google/type/fraction.proto new file mode 100644 index 0000000000..8ad008dda2 --- /dev/null +++ b/google/type/fraction.proto @@ -0,0 +1,34 @@ +// Copyright 2019 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.type; + +option go_package = "google.golang.org/genproto/googleapis/type/fraction;fraction"; +option java_multiple_files = true; +option java_outer_classname = "FractionProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a fraction in terms of a numerator divided by a denominator. +message Fraction { + // The portion of the denominator in the faction, e.g. 2 in 2/3. + int64 numerator = 1; + + // The value by which the numerator is divided, e.g. 3 in 2/3. Must be + // positive. + int64 denominator = 2; +} diff --git a/google/type/latlng.proto b/google/type/latlng.proto new file mode 100644 index 0000000000..473856f980 --- /dev/null +++ b/google/type/latlng.proto @@ -0,0 +1,38 @@ +// Copyright 2019 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.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/latlng;latlng"; +option java_multiple_files = true; +option java_outer_classname = "LatLngProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// An object representing a latitude/longitude pair. This is expressed as a pair +// of doubles representing degrees latitude and degrees longitude. Unless +// specified otherwise, this must conform to the +//
WGS84 +// standard. Values must be within normalized ranges. +message LatLng { + // The latitude in degrees. It must be in the range [-90.0, +90.0]. + double latitude = 1; + + // The longitude in degrees. It must be in the range [-180.0, +180.0]. + double longitude = 2; +} diff --git a/google/type/money.proto b/google/type/money.proto new file mode 100644 index 0000000000..ef41f1089a --- /dev/null +++ b/google/type/money.proto @@ -0,0 +1,43 @@ +// Copyright 2019 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.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/money;money"; +option java_multiple_files = true; +option java_outer_classname = "MoneyProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents an amount of money with its currency type. +message Money { + // The 3-letter currency code defined in ISO 4217. + string currency_code = 1; + + // The whole units of the amount. + // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + int64 units = 2; + + // Number of nano (10^-9) units of the amount. + // The value must be between -999,999,999 and +999,999,999 inclusive. + // If `units` is positive, `nanos` must be positive or zero. + // If `units` is zero, `nanos` can be positive, zero, or negative. + // If `units` is negative, `nanos` must be negative or zero. + // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + int32 nanos = 3; +} diff --git a/google/type/month.proto b/google/type/month.proto new file mode 100644 index 0000000000..54b7865f4b --- /dev/null +++ b/google/type/month.proto @@ -0,0 +1,66 @@ +// Copyright 2019 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.type; + +option go_package = "google.golang.org/genproto/googleapis/type/month;month"; +option java_multiple_files = true; +option java_outer_classname = "MonthProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a month in the Gregorian calendar. +enum Month { + // The unspecifed month. + MONTH_UNSPECIFIED = 0; + + // The month of January. + JANUARY = 1; + + // The month of February. + FEBRUARY = 2; + + // The month of March. + MARCH = 3; + + // The month of April. + APRIL = 4; + + // The month of May. + MAY = 5; + + // The month of June. + JUNE = 6; + + // The month of July. + JULY = 7; + + // The month of August. + AUGUST = 8; + + // The month of September. + SEPTEMBER = 9; + + // The month of October. + OCTOBER = 10; + + // The month of November. + NOVEMBER = 11; + + // The month of December. + DECEMBER = 12; +} diff --git a/google/type/postal_address.proto b/google/type/postal_address.proto new file mode 100644 index 0000000000..688af8a1bc --- /dev/null +++ b/google/type/postal_address.proto @@ -0,0 +1,135 @@ +// Copyright 2019 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.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/postaladdress;postaladdress"; +option java_multiple_files = true; +option java_outer_classname = "PostalAddressProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a postal address, e.g. for postal delivery or payments addresses. +// Given a postal address, a postal service can deliver items to a premise, P.O. +// Box or similar. +// It is not intended to model geographical locations (roads, towns, +// mountains). +// +// In typical usage an address would be created via user input or from importing +// existing data, depending on the type of process. +// +// Advice on address input / editing: +// - Use an i18n-ready address widget such as +// https://github.com/google/libaddressinput) +// - Users should not be presented with UI elements for input or editing of +// fields outside countries where that field is used. +// +// For more guidance on how to use this schema, please see: +// https://support.google.com/business/answer/6397478 +message PostalAddress { + // The schema revision of the `PostalAddress`. This must be set to 0, which is + // the latest revision. + // + // All new revisions **must** be backward compatible with old revisions. + int32 revision = 1; + + // Required. CLDR region code of the country/region of the address. This + // is never inferred and it is up to the user to ensure the value is + // correct. See http://cldr.unicode.org/ and + // http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + // for details. Example: "CH" for Switzerland. + string region_code = 2; + + // Optional. BCP-47 language code of the contents of this address (if + // known). This is often the UI language of the input form or is expected + // to match one of the languages used in the address' country/region, or their + // transliterated equivalents. + // This can affect formatting in certain countries, but is not critical + // to the correctness of the data and will never affect any validation or + // other non-formatting related operations. + // + // If this value is not known, it should be omitted (rather than specifying a + // possibly incorrect default). + // + // Examples: "zh-Hant", "ja", "ja-Latn", "en". + string language_code = 3; + + // Optional. Postal code of the address. Not all countries use or require + // postal codes to be present, but where they are used, they may trigger + // additional validation with other parts of the address (e.g. state/zip + // validation in the U.S.A.). + string postal_code = 4; + + // Optional. Additional, country-specific, sorting code. This is not used + // in most regions. Where it is used, the value is either a string like + // "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number + // alone, representing the "sector code" (Jamaica), "delivery area indicator" + // (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). + string sorting_code = 5; + + // Optional. Highest administrative subdivision which is used for postal + // addresses of a country or region. + // For example, this can be a state, a province, an oblast, or a prefecture. + // Specifically, for Spain this is the province and not the autonomous + // community (e.g. "Barcelona" and not "Catalonia"). + // Many countries don't use an administrative area in postal addresses. E.g. + // in Switzerland this should be left unpopulated. + string administrative_area = 6; + + // Optional. Generally refers to the city/town portion of the address. + // Examples: US city, IT comune, UK post town. + // In regions of the world where localities are not well defined or do not fit + // into this structure well, leave locality empty and use address_lines. + string locality = 7; + + // Optional. Sublocality of the address. + // For example, this can be neighborhoods, boroughs, districts. + string sublocality = 8; + + // Unstructured address lines describing the lower levels of an address. + // + // Because values in address_lines do not have type information and may + // sometimes contain multiple values in a single field (e.g. + // "Austin, TX"), it is important that the line order is clear. The order of + // address lines should be "envelope order" for the country/region of the + // address. In places where this can vary (e.g. Japan), address_language is + // used to make it explicit (e.g. "ja" for large-to-small ordering and + // "ja-Latn" or "en" for small-to-large). This way, the most specific line of + // an address can be selected based on the language. + // + // The minimum permitted structural representation of an address consists + // of a region_code with all remaining information placed in the + // address_lines. It would be possible to format such an address very + // approximately without geocoding, but no semantic reasoning could be + // made about any of the address components until it was at least + // partially resolved. + // + // Creating an address only containing a region_code and address_lines, and + // then geocoding is the recommended way to handle completely unstructured + // addresses (as opposed to guessing which parts of the address should be + // localities or administrative areas). + repeated string address_lines = 9; + + // Optional. The recipient at the address. + // This field may, under certain circumstances, contain multiline information. + // For example, it might contain "care of" information. + repeated string recipients = 10; + + // Optional. The name of the organization at the address. + string organization = 11; +} diff --git a/google/type/quaternion.proto b/google/type/quaternion.proto new file mode 100644 index 0000000000..7ab5dc7283 --- /dev/null +++ b/google/type/quaternion.proto @@ -0,0 +1,95 @@ +// Copyright 2019 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.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/quaternion;quaternion"; +option java_multiple_files = true; +option java_outer_classname = "QuaternionProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// A quaternion is defined as the quotient of two directed lines in a +// three-dimensional space or equivalently as the quotient of two Euclidean +// vectors (https://en.wikipedia.org/wiki/Quaternion). +// +// Quaternions are often used in calculations involving three-dimensional +// rotations (https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation), +// as they provide greater mathematical robustness by avoiding the gimbal lock +// problems that can be encountered when using Euler angles +// (https://en.wikipedia.org/wiki/Gimbal_lock). +// +// Quaternions are generally represented in this form: +// +// w + xi + yj + zk +// +// where x, y, z, and w are real numbers, and i, j, and k are three imaginary +// numbers. +// +// Our naming choice `(x, y, z, w)` comes from the desire to avoid confusion for +// those interested in the geometric properties of the quaternion in the 3D +// Cartesian space. Other texts often use alternative names or subscripts, such +// as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps +// better suited for mathematical interpretations. +// +// To avoid any confusion, as well as to maintain compatibility with a large +// number of software libraries, the quaternions represented using the protocol +// buffer below *must* follow the Hamilton convention, which defines `ij = k` +// (i.e. a right-handed algebra), and therefore: +// +// i^2 = j^2 = k^2 = ijk = −1 +// ij = −ji = k +// jk = −kj = i +// ki = −ik = j +// +// Please DO NOT use this to represent quaternions that follow the JPL +// convention, or any of the other quaternion flavors out there. +// +// Definitions: +// +// - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`. +// - Unit (or normalized) quaternion: a quaternion whose norm is 1. +// - Pure quaternion: a quaternion whose scalar component (`w`) is 0. +// - Rotation quaternion: a unit quaternion used to represent rotation. +// - Orientation quaternion: a unit quaternion used to represent orientation. +// +// A quaternion can be normalized by dividing it by its norm. The resulting +// quaternion maintains the same direction, but has a norm of 1, i.e. it moves +// on the unit sphere. This is generally necessary for rotation and orientation +// quaternions, to avoid rounding errors: +// https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions +// +// Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation, +// but normalization would be even more useful, e.g. for comparison purposes, if +// it would produce a unique representation. It is thus recommended that `w` be +// kept positive, which can be achieved by changing all the signs when `w` is +// negative. +// +message Quaternion { + // The x component. + double x = 1; + + // The y component. + double y = 2; + + // The z component. + double z = 3; + + // The scalar component. + double w = 4; +} diff --git a/google/type/timeofday.proto b/google/type/timeofday.proto new file mode 100644 index 0000000000..b609a48798 --- /dev/null +++ b/google/type/timeofday.proto @@ -0,0 +1,44 @@ +// Copyright 2019 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.type; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/type/timeofday;timeofday"; +option java_multiple_files = true; +option java_outer_classname = "TimeOfDayProto"; +option java_package = "com.google.type"; +option objc_class_prefix = "GTP"; + +// Represents a time of day. The date and time zone are either not significant +// or are specified elsewhere. An API may choose to allow leap seconds. Related +// types are [google.type.Date][google.type.Date] and `google.protobuf.Timestamp`. +message TimeOfDay { + // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + // to allow the value "24:00:00" for scenarios like business closing time. + int32 hours = 1; + + // Minutes of hour of day. Must be from 0 to 59. + int32 minutes = 2; + + // Seconds of minutes of the time. Must normally be from 0 to 59. An API may + // allow the value 60 if it allows leap-seconds. + int32 seconds = 3; + + // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + int32 nanos = 4; +} diff --git a/google/type/type.yaml b/google/type/type.yaml new file mode 100644 index 0000000000..3c2e20e671 --- /dev/null +++ b/google/type/type.yaml @@ -0,0 +1,37 @@ +type: google.api.Service +config_version: 1 +name: type.googleapis.com +title: Common Types + +types: +- name: google.type.Color +- name: google.type.Date +- name: google.type.DateTime +- name: google.type.Expr +- name: google.type.Fraction +- name: google.type.LatLng +- name: google.type.Money +- name: google.type.PostalAddress +- name: google.type.Quaternion +- name: google.type.TimeOfDay +- name: google.type.TimeZone + +enums: +- name: google.type.CalendarPeriod +- name: google.type.DayOfWeek +- name: google.type.Month + +documentation: + summary: Defines common types for Google APIs. + overview: |- + # Google Common Types + + This package contains definitions of common types for Google APIs. + All types defined in this package are suitable for different APIs to + exchange data, and will never break binary compatibility. They should + have design quality comparable to major programming languages like + Java and C#. + + NOTE: Some common types are defined in the package `google.protobuf` + as they are directly supported by Protocol Buffers compiler and + runtime. Those types are called Well-Known Types. diff --git a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java index 743e6b0d6a..33fd36d516 100755 --- a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java +++ b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java @@ -258,4 +258,88 @@ public void block() { .build()); assertThat(result.getContent()).isEqualTo("Hello, World!"); } + + static GoogleCredentials loadCredentials(String credentialFile) { + try { + InputStream keyStream = new ByteArrayInputStream(credentialFile.getBytes()); + return GoogleCredentials.fromStream(keyStream); + } catch (IOException e) { + fail("Couldn't create fake JSON credentials."); + } + return null; + } + + @Test + public void quotaProjectIdTest() throws Exception { + final String QUOTA_PROJECT_ID_KEY = "x-google-user-project"; + final String QUOTA_PROJECT_ID = "quota_project_id"; + final String QUOTA_PROJECT_ID_FROM_HEADER_VALUE = "quota_project_id_from_headers"; + final String QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE = "quota_project_id_from_credentials"; + final String JSON_KEY_QUOTA_PROJECT_ID = "{\n" + " \"private_key_id\": \"somekeyid\",\n" + + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" + + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" + + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" + + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" + + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" + + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" + + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" + + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" + + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" + + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" + + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" + + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" + + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" + + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" + + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" + + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" + + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" + + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" + + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" + + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" + + " \"project_id\": \"someprojectid\",\n" + + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" + + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" + " \"type\": \"service_account\",\n" + + " \"quota_project_id\": \"" + QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE + "\"\n" + "}"; + final GoogleCredentials credentialsWithQuotaProject = loadCredentials(JSON_KEY_QUOTA_PROJECT_ID); + final CredentialsProvider credentialsProviderWithQuota = new CredentialsProvider() { + @Override + public Credentials getCredentials() throws IOException { + return credentialsWithQuotaProject; + } + }; + final HeaderProvider headerProviderWithQuota = new HeaderProvider() { + @Override + public Map getHeaders() { + return Collections.singletonMap(QUOTA_PROJECT_ID_KEY, QUOTA_PROJECT_ID_FROM_HEADER_VALUE); + } + }; + + EchoSettings settingsSetQuota = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()).setQuotaProjectId(QUOTA_PROJECT_ID).build(); + EchoSettings settingsHeader = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()).setHeaderProvider(headerProviderWithQuota).build(); + EchoSettings settingsHeaderAndQuota = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()).setHeaderProvider(headerProviderWithQuota) + .setQuotaProjectId(QUOTA_PROJECT_ID).build(); + EchoSettings settingsCredentials = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProviderWithQuota).build(); + EchoSettings settingsCredentialsAndQuota = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProviderWithQuota).setQuotaProjectId(QUOTA_PROJECT_ID).build(); + EchoSettings settingsQuotaAll = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProviderWithQuota).setQuotaProjectId(QUOTA_PROJECT_ID) + .setHeaderProvider(headerProviderWithQuota).build(); + + validQuotaProjectId(settingsSetQuota, QUOTA_PROJECT_ID); + validQuotaProjectId(settingsHeader, QUOTA_PROJECT_ID_FROM_HEADER_VALUE); + validQuotaProjectId(settingsHeaderAndQuota, QUOTA_PROJECT_ID); + validQuotaProjectId(settingsCredentials, QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE); + validQuotaProjectId(settingsCredentialsAndQuota, QUOTA_PROJECT_ID); + validQuotaProjectId(client.getSettings(), null); + validQuotaProjectId(settingsQuotaAll, QUOTA_PROJECT_ID); + } + + private void validQuotaProjectId(EchoSettings settings, String expectId) throws Exception { + EchoClient clientSetQuota = EchoClient.create(settings); + Assert.assertEquals(clientSetQuota.getSettings().getQuotaProjectId(), expectId); + } } From e9daabf1cd5440328f8c3d72f24df6f828ebc024 Mon Sep 17 00:00:00 2001 From: summerji Date: Wed, 1 Jul 2020 10:26:30 -0700 Subject: [PATCH 2/6] remove protos files --- .gitignore | 1 + google/api/BUILD.bazel | 671 ------------------ google/api/README.md | 5 - google/api/annotations.proto | 31 - google/api/auth.proto | 184 ----- google/api/backend.proto | 127 ---- google/api/billing.proto | 67 -- google/api/client.proto | 100 --- google/api/config_change.proto | 85 --- google/api/consumer.proto | 82 --- google/api/context.proto | 90 --- google/api/control.proto | 33 - google/api/distribution.proto | 212 ------ google/api/documentation.proto | 157 ---- google/api/endpoint.proto | 70 -- google/api/expr/BUILD.bazel | 1 - google/api/expr/artman_cel.yaml | 37 - google/api/expr/cel.yaml | 61 -- google/api/expr/v1alpha1/BUILD.bazel | 522 -------------- google/api/expr/v1alpha1/cel.yaml | 69 -- google/api/expr/v1alpha1/cel_gapic.yaml | 248 ------- google/api/expr/v1alpha1/cel_service.proto | 44 -- google/api/expr/v1alpha1/checked.proto | 331 --------- .../expr/v1alpha1/conformance_service.proto | 170 ----- google/api/expr/v1alpha1/eval.proto | 119 ---- google/api/expr/v1alpha1/explain.proto | 54 -- google/api/expr/v1alpha1/syntax.proto | 328 --------- google/api/expr/v1alpha1/value.proto | 116 --- google/api/expr/v1beta1/BUILD.bazel | 91 --- google/api/expr/v1beta1/decl.proto | 84 --- google/api/expr/v1beta1/eval.proto | 125 ---- google/api/expr/v1beta1/expr.proto | 265 ------- google/api/expr/v1beta1/source.proto | 62 -- google/api/expr/v1beta1/value.proto | 114 --- google/api/field_behavior.proto | 79 --- google/api/http.proto | 376 ---------- google/api/httpbody.proto | 78 -- google/api/label.proto | 49 -- google/api/launch_stage.proto | 67 -- google/api/log.proto | 55 -- google/api/logging.proto | 81 --- google/api/metric.proto | 256 ------- google/api/monitored_resource.proto | 119 ---- google/api/monitoring.proto | 91 --- google/api/quota.proto | 187 ----- google/api/resource.proto | 264 ------- google/api/service.proto | 176 ----- google/api/serviceconfig.yaml | 24 - google/api/servicecontrol/BUILD.bazel | 0 google/api/servicecontrol/README.md | 126 ---- .../api/servicecontrol/v1/check_error.proto | 133 ---- .../api/servicecontrol/v1/distribution.proto | 158 ----- google/api/servicecontrol/v1/log_entry.proto | 66 -- .../api/servicecontrol/v1/metric_value.proto | 78 -- google/api/servicecontrol/v1/operation.proto | 113 --- .../servicecontrol/v1/quota_controller.proto | 206 ------ .../v1/service_controller.proto | 204 ------ google/api/servicemanagement/BUILD.bazel | 1 - google/api/servicemanagement/README.md | 102 --- .../artman_servicemanagement_v1.yaml | 34 - .../servicemanagement_v1.yaml | 233 ------ google/api/servicemanagement/v1/BUILD.bazel | 383 ---------- .../api/servicemanagement/v1/resources.proto | 299 -------- .../v1/servicemanagement_gapic.yaml | 301 -------- ...servicemanagement_grpc_service_config.json | 12 - .../servicemanagement/v1/servicemanager.proto | 503 ------------- google/api/source_info.proto | 32 - google/api/system_parameter.proto | 96 --- google/api/usage.proto | 90 --- google/cloud/common_resources.proto | 51 -- google/iam/v1/BUILD.bazel | 99 --- google/iam/v1/iam_gapic.yaml | 28 - google/iam/v1/iam_meta_api.yaml | 85 --- google/iam/v1/iam_meta_api_gapic.yaml | 132 ---- google/iam/v1/iam_policy.proto | 145 ---- google/iam/v1/logging/BUILD.bazel | 62 -- google/iam/v1/logging/audit_data.proto | 34 - google/iam/v1/options.proto | 41 -- google/iam/v1/policy.proto | 240 ------- google/longrunning/BUILD.bazel | 114 --- google/longrunning/README.md | 5 - google/longrunning/artman_longrunning.yaml | 31 - google/longrunning/longrunning.yaml | 72 -- google/longrunning/longrunning_gapic.yaml | 100 --- google/longrunning/operations.proto | 241 ------- google/rpc/BUILD.bazel | 109 --- google/rpc/README.md | 5 - google/rpc/code.proto | 185 ----- google/rpc/error_details.proto | 200 ------ google/rpc/rpc_publish.yaml | 28 - google/rpc/status.proto | 94 --- google/type/BUILD.bazel | 235 ------ google/type/README.md | 16 - google/type/calendar_period.proto | 57 -- google/type/color.proto | 170 ----- google/type/date.proto | 50 -- google/type/datetime.proto | 97 --- google/type/dayofweek.proto | 51 -- google/type/expr.proto | 51 -- google/type/fraction.proto | 34 - google/type/latlng.proto | 38 - google/type/money.proto | 43 -- google/type/month.proto | 66 -- google/type/postal_address.proto | 135 ---- google/type/quaternion.proto | 95 --- google/type/timeofday.proto | 44 -- google/type/type.yaml | 37 - 107 files changed, 1 insertion(+), 13147 deletions(-) delete mode 100644 google/api/BUILD.bazel delete mode 100644 google/api/README.md delete mode 100644 google/api/annotations.proto delete mode 100644 google/api/auth.proto delete mode 100644 google/api/backend.proto delete mode 100644 google/api/billing.proto delete mode 100644 google/api/client.proto delete mode 100644 google/api/config_change.proto delete mode 100644 google/api/consumer.proto delete mode 100644 google/api/context.proto delete mode 100644 google/api/control.proto delete mode 100644 google/api/distribution.proto delete mode 100644 google/api/documentation.proto delete mode 100644 google/api/endpoint.proto delete mode 100644 google/api/expr/BUILD.bazel delete mode 100644 google/api/expr/artman_cel.yaml delete mode 100644 google/api/expr/cel.yaml delete mode 100644 google/api/expr/v1alpha1/BUILD.bazel delete mode 100644 google/api/expr/v1alpha1/cel.yaml delete mode 100644 google/api/expr/v1alpha1/cel_gapic.yaml delete mode 100644 google/api/expr/v1alpha1/cel_service.proto delete mode 100644 google/api/expr/v1alpha1/checked.proto delete mode 100644 google/api/expr/v1alpha1/conformance_service.proto delete mode 100644 google/api/expr/v1alpha1/eval.proto delete mode 100644 google/api/expr/v1alpha1/explain.proto delete mode 100644 google/api/expr/v1alpha1/syntax.proto delete mode 100644 google/api/expr/v1alpha1/value.proto delete mode 100644 google/api/expr/v1beta1/BUILD.bazel delete mode 100644 google/api/expr/v1beta1/decl.proto delete mode 100644 google/api/expr/v1beta1/eval.proto delete mode 100644 google/api/expr/v1beta1/expr.proto delete mode 100644 google/api/expr/v1beta1/source.proto delete mode 100644 google/api/expr/v1beta1/value.proto delete mode 100644 google/api/field_behavior.proto delete mode 100644 google/api/http.proto delete mode 100644 google/api/httpbody.proto delete mode 100644 google/api/label.proto delete mode 100644 google/api/launch_stage.proto delete mode 100644 google/api/log.proto delete mode 100644 google/api/logging.proto delete mode 100644 google/api/metric.proto delete mode 100644 google/api/monitored_resource.proto delete mode 100644 google/api/monitoring.proto delete mode 100644 google/api/quota.proto delete mode 100644 google/api/resource.proto delete mode 100644 google/api/service.proto delete mode 100644 google/api/serviceconfig.yaml delete mode 100644 google/api/servicecontrol/BUILD.bazel delete mode 100644 google/api/servicecontrol/README.md delete mode 100644 google/api/servicecontrol/v1/check_error.proto delete mode 100644 google/api/servicecontrol/v1/distribution.proto delete mode 100644 google/api/servicecontrol/v1/log_entry.proto delete mode 100644 google/api/servicecontrol/v1/metric_value.proto delete mode 100644 google/api/servicecontrol/v1/operation.proto delete mode 100644 google/api/servicecontrol/v1/quota_controller.proto delete mode 100644 google/api/servicecontrol/v1/service_controller.proto delete mode 100644 google/api/servicemanagement/BUILD.bazel delete mode 100644 google/api/servicemanagement/README.md delete mode 100644 google/api/servicemanagement/artman_servicemanagement_v1.yaml delete mode 100644 google/api/servicemanagement/servicemanagement_v1.yaml delete mode 100644 google/api/servicemanagement/v1/BUILD.bazel delete mode 100644 google/api/servicemanagement/v1/resources.proto delete mode 100644 google/api/servicemanagement/v1/servicemanagement_gapic.yaml delete mode 100755 google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json delete mode 100644 google/api/servicemanagement/v1/servicemanager.proto delete mode 100644 google/api/source_info.proto delete mode 100644 google/api/system_parameter.proto delete mode 100644 google/api/usage.proto delete mode 100644 google/cloud/common_resources.proto delete mode 100644 google/iam/v1/BUILD.bazel delete mode 100644 google/iam/v1/iam_gapic.yaml delete mode 100644 google/iam/v1/iam_meta_api.yaml delete mode 100644 google/iam/v1/iam_meta_api_gapic.yaml delete mode 100644 google/iam/v1/iam_policy.proto delete mode 100644 google/iam/v1/logging/BUILD.bazel delete mode 100644 google/iam/v1/logging/audit_data.proto delete mode 100644 google/iam/v1/options.proto delete mode 100644 google/iam/v1/policy.proto delete mode 100644 google/longrunning/BUILD.bazel delete mode 100644 google/longrunning/README.md delete mode 100644 google/longrunning/artman_longrunning.yaml delete mode 100644 google/longrunning/longrunning.yaml delete mode 100644 google/longrunning/longrunning_gapic.yaml delete mode 100644 google/longrunning/operations.proto delete mode 100644 google/rpc/BUILD.bazel delete mode 100644 google/rpc/README.md delete mode 100644 google/rpc/code.proto delete mode 100644 google/rpc/error_details.proto delete mode 100644 google/rpc/rpc_publish.yaml delete mode 100644 google/rpc/status.proto delete mode 100644 google/type/BUILD.bazel delete mode 100644 google/type/README.md delete mode 100644 google/type/calendar_period.proto delete mode 100644 google/type/color.proto delete mode 100644 google/type/date.proto delete mode 100644 google/type/datetime.proto delete mode 100644 google/type/dayofweek.proto delete mode 100644 google/type/expr.proto delete mode 100644 google/type/fraction.proto delete mode 100644 google/type/latlng.proto delete mode 100644 google/type/money.proto delete mode 100644 google/type/month.proto delete mode 100644 google/type/postal_address.proto delete mode 100644 google/type/quaternion.proto delete mode 100644 google/type/timeofday.proto delete mode 100644 google/type/type.yaml diff --git a/.gitignore b/.gitignore index 71f411366e..151a113bc0 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ tmp # Showcase src directories showcase-protos showcase-protos-patched +google diff --git a/google/api/BUILD.bazel b/google/api/BUILD.bazel deleted file mode 100644 index ec6301030a..0000000000 --- a/google/api/BUILD.bazel +++ /dev/null @@ -1,671 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -proto_library( - name = "annotations_proto", - srcs = ["annotations.proto"], - deps = [ - ":http_proto", - "@com_google_protobuf//:descriptor_proto", - ], -) - -proto_library( - name = "auth_proto", - srcs = ["auth.proto"], - deps = [":annotations_proto"], -) - -proto_library( - name = "backend_proto", - srcs = ["backend.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "billing_proto", - srcs = ["billing.proto"], - deps = [ - ":annotations_proto", - ":metric_proto", - ], -) - -proto_library( - name = "client_proto", - srcs = ["client.proto"], - deps = [ - "@com_google_protobuf//:descriptor_proto", - ], -) - -proto_library( - name = "config_change_proto", - srcs = ["config_change.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "consumer_proto", - srcs = ["consumer.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "context_proto", - srcs = ["context.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "control_proto", - srcs = ["control.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "distribution_proto", - srcs = ["distribution.proto"], - deps = [ - ":annotations_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -proto_library( - name = "documentation_proto", - srcs = ["documentation.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "endpoint_proto", - srcs = ["endpoint.proto"], - deps = [":annotations_proto"], -) - -proto_library( - name = "field_behavior_proto", - srcs = ["field_behavior.proto"], - deps = [ - "@com_google_protobuf//:descriptor_proto", - ], -) - -proto_library( - name = "http_proto", - srcs = ["http.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "httpbody_proto", - srcs = ["httpbody.proto"], - deps = ["@com_google_protobuf//:any_proto"], -) - -proto_library( - name = "label_proto", - srcs = ["label.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "launch_stage_proto", - srcs = ["launch_stage.proto"], -) - -proto_library( - name = "log_proto", - srcs = ["log.proto"], - deps = [":label_proto"], -) - -proto_library( - name = "logging_proto", - srcs = ["logging.proto"], - deps = [ - ":annotations_proto", - ":label_proto", - ], -) - -proto_library( - name = "metric_proto", - srcs = ["metric.proto"], - deps = [ - ":label_proto", - ":launch_stage_proto", - "@com_google_protobuf//:duration_proto", - ], -) - -proto_library( - name = "monitored_resource_proto", - srcs = ["monitored_resource.proto"], - deps = [ - ":label_proto", - ":launch_stage_proto", - "@com_google_protobuf//:struct_proto", - ], -) - -proto_library( - name = "monitoring_proto", - srcs = ["monitoring.proto"], - deps = [":annotations_proto"], -) - -proto_library( - name = "quota_proto", - srcs = ["quota.proto"], - deps = [":annotations_proto"], -) - -proto_library( - name = "resource_proto", - srcs = ["resource.proto"], - deps = [ - "@com_google_protobuf//:descriptor_proto", - ], -) - -proto_library( - name = "service_proto", - srcs = ["service.proto"], - deps = [ - ":annotations_proto", - ":auth_proto", - ":backend_proto", - ":billing_proto", - ":context_proto", - ":control_proto", - ":documentation_proto", - ":endpoint_proto", - ":http_proto", - ":label_proto", - ":log_proto", - ":logging_proto", - ":metric_proto", - ":monitored_resource_proto", - ":monitoring_proto", - ":quota_proto", - ":resource_proto", - ":source_info_proto", - ":system_parameter_proto", - ":usage_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:api_proto", - "@com_google_protobuf//:type_proto", - "@com_google_protobuf//:wrappers_proto", - ], -) - -proto_library( - name = "source_info_proto", - srcs = ["source_info.proto"], - deps = ["@com_google_protobuf//:any_proto"], -) - -proto_library( - name = "system_parameter_proto", - srcs = ["system_parameter.proto"], - visibility = ["//visibility:public"], -) - -proto_library( - name = "usage_proto", - srcs = ["usage.proto"], - deps = [":annotations_proto"], -) - -############################################################################## -# Java -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") - -java_proto_library( - name = "api_java_proto", - deps = [ - "annotations_proto", - "auth_proto", - "backend_proto", - "billing_proto", - "client_proto", - "config_change_proto", - "consumer_proto", - "context_proto", - "control_proto", - "distribution_proto", - "documentation_proto", - "endpoint_proto", - "field_behavior_proto", - "http_proto", - "httpbody_proto", - "label_proto", - "launch_stage_proto", - "log_proto", - "logging_proto", - "metric_proto", - "monitored_resource_proto", - "monitoring_proto", - "quota_proto", - "resource_proto", - "service_proto", - "source_info_proto", - "system_parameter_proto", - "usage_proto", - ], -) - -############################################################################## -# Go -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library") - -go_proto_library( - name = "annotations_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/annotations", - protos = [ - ":annotations_proto", - ":http_proto", - ], -) - -go_proto_library( - name = "client_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations", - protos = [":client_proto"], -) - -go_proto_library( - name = "configchange_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/configchange", - protos = [":config_change_proto"], -) - -go_proto_library( - name = "distribution_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/distribution", - protos = [":distribution_proto"], -) - -go_proto_library( - name = "field_behavior_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations", - protos = [":field_behavior_proto"], -) - -go_proto_library( - name = "httpbody_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/httpbody", - protos = [":httpbody_proto"], -) - -go_proto_library( - name = "label_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/label", - protos = [":label_proto"], -) - -go_proto_library( - name = "api_go_proto", - importpath = "google.golang.org/genproto/googleapis/api", - protos = [ - ":launch_stage_proto", - ], - deps = [ - ":annotations_go_proto", - ], -) - -go_proto_library( - name = "metric_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/metric", - protos = [":metric_proto"], - deps = [ - ":api_go_proto", - ":label_go_proto", - ], -) - -go_proto_library( - name = "monitoredres_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/monitoredres", - protos = [":monitored_resource_proto"], - deps = [ - ":api_go_proto", - ":label_go_proto", - ], -) - -go_proto_library( - name = "resource_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations", - protos = [":resource_proto"], -) - -go_proto_library( - name = "serviceconfig_go_proto", - importpath = "google.golang.org/genproto/googleapis/api/serviceconfig", - protos = [ - ":auth_proto", - ":backend_proto", - ":billing_proto", - ":context_proto", - ":control_proto", - ":documentation_proto", - ":endpoint_proto", - ":log_proto", - ":logging_proto", - ":monitoring_proto", - ":quota_proto", - ":service_proto", - ":source_info_proto", - ":system_parameter_proto", - ":usage_proto", - ], - deps = [ - ":annotations_go_proto", - ":api_go_proto", - ":label_go_proto", - ":metric_go_proto", - ":monitoredres_go_proto", - ], -) - -############################################################################## -# C++ -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library") - -cc_proto_library( - name = "annotations_cc_proto", - deps = [":annotations_proto"], -) - -cc_proto_library( - name = "auth_cc_proto", - deps = [":auth_proto"], -) - -cc_proto_library( - name = "backend_cc_proto", - deps = [":backend_proto"], -) - -cc_proto_library( - name = "billing_cc_proto", - deps = [":billing_proto"], -) - -cc_proto_library( - name = "client_cc_proto", - deps = [":client_proto"], -) - -cc_proto_library( - name = "config_change_cc_proto", - deps = [":config_change_proto"], -) - -cc_proto_library( - name = "consumer_cc_proto", - deps = [":consumer_proto"], -) - -cc_proto_library( - name = "context_cc_proto", - deps = [":context_proto"], -) - -cc_proto_library( - name = "control_cc_proto", - deps = [":control_proto"], -) - -cc_proto_library( - name = "distribution_cc_proto", - deps = [":distribution_proto"], -) - -cc_proto_library( - name = "documentation_cc_proto", - deps = [":documentation_proto"], -) - -cc_proto_library( - name = "endpoint_cc_proto", - deps = [":endpoint_proto"], -) - -cc_proto_library( - name = "field_behavior_cc_proto", - deps = [":field_behavior_proto"], -) - -cc_proto_library( - name = "http_cc_proto", - deps = [":http_proto"], -) - -cc_proto_library( - name = "httpbody_cc_proto", - deps = [":httpbody_proto"], -) - -cc_proto_library( - name = "label_cc_proto", - deps = [":label_proto"], -) - -cc_proto_library( - name = "launch_stage_cc_proto", - deps = [":launch_stage_proto"], -) - -cc_proto_library( - name = "log_cc_proto", - deps = [":log_proto"], -) - -cc_proto_library( - name = "logging_cc_proto", - deps = [":logging_proto"], -) - -cc_proto_library( - name = "metric_cc_proto", - deps = [":metric_proto"], -) - -cc_proto_library( - name = "monitored_resource_cc_proto", - deps = [":monitored_resource_proto"], -) - -cc_proto_library( - name = "monitoring_cc_proto", - deps = ["monitoring_proto"], -) - -cc_proto_library( - name = "quota_cc_proto", - deps = ["quota_proto"], -) - -cc_proto_library( - name = "resource_cc_proto", - deps = [":resource_proto"], -) - -cc_proto_library( - name = "service_cc_proto", - deps = [":service_proto"], -) - -cc_proto_library( - name = "source_info_cc_proto", - deps = [":source_info_proto"], -) - -cc_proto_library( - name = "system_parameter_cc_proto", - deps = [":system_parameter_proto"], -) - -cc_proto_library( - name = "usage_cc_proto", - deps = [":usage_proto"], -) - -############################################################################## -# Python -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library") - -py_proto_library( - name = "annotations_py_proto", - deps = [":annotations_proto"], -) - -py_proto_library( - name = "auth_py_proto", - deps = [":auth_proto"], -) - -py_proto_library( - name = "backend_py_proto", - deps = [":backend_proto"], -) - -py_proto_library( - name = "billing_py_proto", - deps = [":billing_proto"], -) - -py_proto_library( - name = "client_py_proto", - deps = [":client_proto"], -) - -py_proto_library( - name = "config_change_py_proto", - deps = [":config_change_proto"], -) - -py_proto_library( - name = "consumer_py_proto", - deps = [":consumer_proto"], -) - -py_proto_library( - name = "context_py_proto", - deps = [":context_proto"], -) - -py_proto_library( - name = "control_py_proto", - deps = [":control_proto"], -) - -py_proto_library( - name = "distribution_py_proto", - deps = [":distribution_proto"], -) - -py_proto_library( - name = "documentation_py_proto", - deps = [":documentation_proto"], -) - -py_proto_library( - name = "endpoint_py_proto", - deps = [":endpoint_proto"], -) - -py_proto_library( - name = "field_behavior_py_proto", - deps = [":field_behavior_proto"], -) - -py_proto_library( - name = "http_py_proto", - deps = [":http_proto"], -) - -py_proto_library( - name = "httpbody_py_proto", - deps = [":httpbody_proto"], -) - -py_proto_library( - name = "label_py_proto", - deps = [":label_proto"], -) - -py_proto_library( - name = "launch_stage_py_proto", - deps = [":launch_stage_proto"], -) - -py_proto_library( - name = "log_py_proto", - deps = [":log_proto"], -) - -py_proto_library( - name = "logging_py_proto", - deps = [":logging_proto"], -) - -py_proto_library( - name = "metric_py_proto", - deps = [":metric_proto"], -) - -py_proto_library( - name = "monitored_resource_py_proto", - deps = [":monitored_resource_proto"], -) - -py_proto_library( - name = "monitoring_py_proto", - deps = ["monitoring_proto"], -) - -py_proto_library( - name = "quota_py_proto", - deps = ["quota_proto"], -) - -py_proto_library( - name = "resource_py_proto", - deps = [":resource_proto"], -) - -py_proto_library( - name = "service_py_proto", - deps = [":service_proto"], -) - -py_proto_library( - name = "source_info_py_proto", - deps = [":source_info_proto"], -) - -py_proto_library( - name = "system_parameter_py_proto", - deps = [":system_parameter_proto"], -) - -py_proto_library( - name = "usage_py_proto", - deps = [":usage_proto"], -) diff --git a/google/api/README.md b/google/api/README.md deleted file mode 100644 index eafe588022..0000000000 --- a/google/api/README.md +++ /dev/null @@ -1,5 +0,0 @@ -This folder contains the schema of the configuration model for the API services -platform. - -**Note**: Protos under this directory are in Alpha status, and therefore are -subject to breaking changes. diff --git a/google/api/annotations.proto b/google/api/annotations.proto deleted file mode 100644 index 85c361b47f..0000000000 --- a/google/api/annotations.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015, 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. - -syntax = "proto3"; - -package google.api; - -import "google/api/http.proto"; -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "AnnotationsProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // See `HttpRule`. - HttpRule http = 72295728; -} diff --git a/google/api/auth.proto b/google/api/auth.proto deleted file mode 100644 index 7c5d61666d..0000000000 --- a/google/api/auth.proto +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "AuthProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Authentication` defines the authentication configuration for an API. -// -// Example for an API targeted for external use: -// -// name: calendar.googleapis.com -// authentication: -// providers: -// - id: google_calendar_auth -// jwks_uri: https://www.googleapis.com/oauth2/v1/certs -// issuer: https://securetoken.google.com -// rules: -// - selector: "*" -// requirements: -// provider_id: google_calendar_auth -message Authentication { - // A list of authentication rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated AuthenticationRule rules = 3; - - // Defines a set of authentication providers that a service supports. - repeated AuthProvider providers = 4; -} - -// Authentication rules for the service. -// -// By default, if a method has any authentication requirements, every request -// must include a valid credential matching one of the requirements. -// It's an error to include more than one kind of credential in a single -// request. -// -// If a method doesn't have any auth requirements, request credentials will be -// ignored. -message AuthenticationRule { - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // The requirements for OAuth credentials. - OAuthRequirements oauth = 2; - - // If true, the service accepts API keys without any other credential. - bool allow_without_credential = 5; - - // Requirements for additional authentication providers. - repeated AuthRequirement requirements = 7; -} - -// Configuration for an authentication provider, including support for -// [JSON Web Token -// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). -message AuthProvider { - // The unique identifier of the auth provider. It will be referred to by - // `AuthRequirement.provider_id`. - // - // Example: "bookstore_auth". - string id = 1; - - // Identifies the principal that issued the JWT. See - // https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 - // Usually a URL or an email address. - // - // Example: https://securetoken.google.com - // Example: 1234567-compute@developer.gserviceaccount.com - string issuer = 2; - - // URL of the provider's public key set to validate signature of the JWT. See - // [OpenID - // Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). - // Optional if the key set document: - // - can be retrieved from - // [OpenID - // Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html of - // the issuer. - // - can be inferred from the email domain of the issuer (e.g. a Google - // service account). - // - // Example: https://www.googleapis.com/oauth2/v1/certs - string jwks_uri = 3; - - // The list of JWT - // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). - // that are allowed to access. A JWT containing any of these audiences will - // be accepted. When this setting is absent, only JWTs with audience - // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" - // will be accepted. For example, if no audiences are in the setting, - // LibraryService API will only accept JWTs with the following audience - // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". - // - // Example: - // - // audiences: bookstore_android.apps.googleusercontent.com, - // bookstore_web.apps.googleusercontent.com - string audiences = 4; - - // Redirect URL if JWT token is required but not present or is expired. - // Implement authorizationUrl of securityDefinitions in OpenAPI spec. - string authorization_url = 5; -} - -// OAuth scopes are a way to define data and permissions on data. For example, -// there are scopes defined for "Read-only access to Google Calendar" and -// "Access to Cloud Platform". Users can consent to a scope for an application, -// giving it permission to access that data on their behalf. -// -// OAuth scope specifications should be fairly coarse grained; a user will need -// to see and understand the text description of what your scope means. -// -// In most cases: use one or at most two OAuth scopes for an entire family of -// products. If your product has multiple APIs, you should probably be sharing -// the OAuth scope across all of those APIs. -// -// When you need finer grained OAuth consent screens: talk with your product -// management about how developers will use them in practice. -// -// Please note that even though each of the canonical scopes is enough for a -// request to be accepted and passed to the backend, a request can still fail -// due to the backend requiring additional scopes or permissions. -message OAuthRequirements { - // The list of publicly documented OAuth scopes that are allowed access. An - // OAuth token containing any of these scopes will be accepted. - // - // Example: - // - // canonical_scopes: https://www.googleapis.com/auth/calendar, - // https://www.googleapis.com/auth/calendar.read - string canonical_scopes = 1; -} - -// User-defined authentication requirements, including support for -// [JSON Web Token -// (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). -message AuthRequirement { - // [id][google.api.AuthProvider.id] from authentication provider. - // - // Example: - // - // provider_id: bookstore_auth - string provider_id = 1; - - // NOTE: This will be deprecated soon, once AuthProvider.audiences is - // implemented and accepted in all the runtime components. - // - // The list of JWT - // [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.3). - // that are allowed to access. A JWT containing any of these audiences will - // be accepted. When this setting is absent, only JWTs with audience - // "https://[Service_name][google.api.Service.name]/[API_name][google.protobuf.Api.name]" - // will be accepted. For example, if no audiences are in the setting, - // LibraryService API will only accept JWTs with the following audience - // "https://library-example.googleapis.com/google.example.library.v1.LibraryService". - // - // Example: - // - // audiences: bookstore_android.apps.googleusercontent.com, - // bookstore_web.apps.googleusercontent.com - string audiences = 2; -} diff --git a/google/api/backend.proto b/google/api/backend.proto deleted file mode 100644 index 26a16ef41d..0000000000 --- a/google/api/backend.proto +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "BackendProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Backend` defines the backend configuration for a service. -message Backend { - // A list of API backend rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated BackendRule rules = 1; -} - -// A backend rule provides configuration for an individual API element. -message BackendRule { - // Path Translation specifies how to combine the backend address with the - // request path in order to produce the appropriate forwarding URL for the - // request. - // - // Path Translation is applicable only to HTTP-based backends. Backends which - // do not accept requests over HTTP/HTTPS should leave `path_translation` - // unspecified. - enum PathTranslation { - PATH_TRANSLATION_UNSPECIFIED = 0; - - // Use the backend address as-is, with no modification to the path. If the - // URL pattern contains variables, the variable names and values will be - // appended to the query string. If a query string parameter and a URL - // pattern variable have the same name, this may result in duplicate keys in - // the query string. - // - // # Examples - // - // Given the following operation config: - // - // Method path: /api/company/{cid}/user/{uid} - // Backend address: https://example.cloudfunctions.net/getUser - // - // Requests to the following request paths will call the backend at the - // translated path: - // - // Request path: /api/company/widgetworks/user/johndoe - // Translated: - // https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe - // - // Request path: /api/company/widgetworks/user/johndoe?timezone=EST - // Translated: - // https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe - CONSTANT_ADDRESS = 1; - - // The request path will be appended to the backend address. - // - // # Examples - // - // Given the following operation config: - // - // Method path: /api/company/{cid}/user/{uid} - // Backend address: https://example.appspot.com - // - // Requests to the following request paths will call the backend at the - // translated path: - // - // Request path: /api/company/widgetworks/user/johndoe - // Translated: - // https://example.appspot.com/api/company/widgetworks/user/johndoe - // - // Request path: /api/company/widgetworks/user/johndoe?timezone=EST - // Translated: - // https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST - APPEND_PATH_TO_ADDRESS = 2; - } - - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // The address of the API backend. - string address = 2; - - // The number of seconds to wait for a response from a request. The default - // deadline for gRPC is infinite (no deadline) and HTTP requests is 5 seconds. - double deadline = 3; - - // Minimum deadline in seconds needed for this method. Calls having deadline - // value lower than this will be rejected. - double min_deadline = 4; - - // The number of seconds to wait for the completion of a long running - // operation. The default is no deadline. - double operation_deadline = 5; - - PathTranslation path_translation = 6; - - // Authentication settings used by the backend. - // - // These are typically used to provide service management functionality to - // a backend served on a publicly-routable URL. The `authentication` - // details should match the authentication behavior used by the backend. - // - // For example, specifying `jwt_audience` implies that the backend expects - // authentication via a JWT. - oneof authentication { - // The JWT audience is used when generating a JWT id token for the backend. - string jwt_audience = 7; - } -} diff --git a/google/api/billing.proto b/google/api/billing.proto deleted file mode 100644 index 87c11e7ff3..0000000000 --- a/google/api/billing.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2019 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.api; - -import "google/api/metric.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "BillingProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Billing related configuration of the service. -// -// The following example shows how to configure monitored resources and metrics -// for billing: -// -// monitored_resources: -// - type: library.googleapis.com/branch -// labels: -// - key: /city -// description: The city where the library branch is located in. -// - key: /name -// description: The name of the branch. -// metrics: -// - name: library.googleapis.com/book/borrowed_count -// metric_kind: DELTA -// value_type: INT64 -// billing: -// consumer_destinations: -// - monitored_resource: library.googleapis.com/branch -// metrics: -// - library.googleapis.com/book/borrowed_count -message Billing { - // Configuration of a specific billing destination (Currently only support - // bill against consumer project). - message BillingDestination { - // The monitored resource type. The type must be defined in - // [Service.monitored_resources][google.api.Service.monitored_resources] section. - string monitored_resource = 1; - - // Names of the metrics to report to this billing destination. - // Each name must be defined in [Service.metrics][google.api.Service.metrics] section. - repeated string metrics = 2; - } - - // Billing configurations for sending metrics to the consumer project. - // There can be multiple consumer destinations per service, each one must have - // a different monitored resource type. A metric can be used in at most - // one consumer destination. - repeated BillingDestination consumer_destinations = 8; -} diff --git a/google/api/client.proto b/google/api/client.proto deleted file mode 100644 index 56f8664aa9..0000000000 --- a/google/api/client.proto +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2019 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.api; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "ClientProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // A definition of a client library method signature. - // - // In client libraries, each proto RPC corresponds to one or more methods - // which the end user is able to call, and calls the underlying RPC. - // Normally, this method receives a single argument (a struct or instance - // corresponding to the RPC request object). Defining this field will - // add one or more overloads providing flattened or simpler method signatures - // in some languages. - // - // The fields on the method signature are provided as a comma-separated - // string. - // - // For example, the proto RPC and annotation: - // - // rpc CreateSubscription(CreateSubscriptionRequest) - // returns (Subscription) { - // option (google.api.method_signature) = "name,topic"; - // } - // - // Would add the following Java overload (in addition to the method accepting - // the request object): - // - // public final Subscription createSubscription(String name, String topic) - // - // The following backwards-compatibility guidelines apply: - // - // * Adding this annotation to an unannotated method is backwards - // compatible. - // * Adding this annotation to a method which already has existing - // method signature annotations is backwards compatible if and only if - // the new method signature annotation is last in the sequence. - // * Modifying or removing an existing method signature annotation is - // a breaking change. - // * Re-ordering existing method signature annotations is a breaking - // change. - repeated string method_signature = 1051; -} - -extend google.protobuf.ServiceOptions { - // The hostname for this service. - // This should be specified with no prefix or protocol. - // - // Example: - // - // service Foo { - // option (google.api.default_host) = "foo.googleapi.com"; - // ... - // } - string default_host = 1049; - - // OAuth scopes needed for the client. - // - // Example: - // - // service Foo { - // option (google.api.oauth_scopes) = \ - // "https://www.googleapis.com/auth/cloud-platform"; - // ... - // } - // - // If there is more than one scope, use a comma-separated string: - // - // Example: - // - // service Foo { - // option (google.api.oauth_scopes) = \ - // "https://www.googleapis.com/auth/cloud-platform," - // "https://www.googleapis.com/auth/monitoring"; - // ... - // } - string oauth_scopes = 1050; -} diff --git a/google/api/config_change.proto b/google/api/config_change.proto deleted file mode 100644 index c36764a5ac..0000000000 --- a/google/api/config_change.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/configchange;configchange"; -option java_multiple_files = true; -option java_outer_classname = "ConfigChangeProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Output generated from semantically comparing two versions of a service -// configuration. -// -// Includes detailed information about a field that have changed with -// applicable advice about potential consequences for the change, such as -// backwards-incompatibility. -message ConfigChange { - // Object hierarchy path to the change, with levels separated by a '.' - // character. For repeated fields, an applicable unique identifier field is - // used for the index (usually selector, name, or id). For maps, the term - // 'key' is used. If the field has no unique identifier, the numeric index - // is used. - // Examples: - // - visibility.rules[selector=="google.LibraryService.ListBooks"].restriction - // - quota.metric_rules[selector=="google"].metric_costs[key=="reads"].value - // - logging.producer_destinations[0] - string element = 1; - - // Value of the changed object in the old Service configuration, - // in JSON format. This field will not be populated if ChangeType == ADDED. - string old_value = 2; - - // Value of the changed object in the new Service configuration, - // in JSON format. This field will not be populated if ChangeType == REMOVED. - string new_value = 3; - - // The type for this change, either ADDED, REMOVED, or MODIFIED. - ChangeType change_type = 4; - - // Collection of advice provided for this change, useful for determining the - // possible impact of this change. - repeated Advice advices = 5; -} - -// Generated advice about this change, used for providing more -// information about how a change will affect the existing service. -message Advice { - // Useful description for why this advice was applied and what actions should - // be taken to mitigate any implied risks. - string description = 2; -} - -// Classifies set of possible modifications to an object in the service -// configuration. -enum ChangeType { - // No value was provided. - CHANGE_TYPE_UNSPECIFIED = 0; - - // The changed object exists in the 'new' service configuration, but not - // in the 'old' service configuration. - ADDED = 1; - - // The changed object exists in the 'old' service configuration, but not - // in the 'new' service configuration. - REMOVED = 2; - - // The changed object exists in both service configurations, but its value - // is different. - MODIFIED = 3; -} diff --git a/google/api/consumer.proto b/google/api/consumer.proto deleted file mode 100644 index 0facc2eb1e..0000000000 --- a/google/api/consumer.proto +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2016 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. - -syntax = "proto3"; - -package google.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ConsumerProto"; -option java_package = "com.google.api"; - -// A descriptor for defining project properties for a service. One service may -// have many consumer projects, and the service may want to behave differently -// depending on some properties on the project. For example, a project may be -// associated with a school, or a business, or a government agency, a business -// type property on the project may affect how a service responds to the client. -// This descriptor defines which properties are allowed to be set on a project. -// -// Example: -// -// project_properties: -// properties: -// - name: NO_WATERMARK -// type: BOOL -// description: Allows usage of the API without watermarks. -// - name: EXTENDED_TILE_CACHE_PERIOD -// type: INT64 -message ProjectProperties { - // List of per consumer project-specific properties. - repeated Property properties = 1; -} - -// Defines project properties. -// -// API services can define properties that can be assigned to consumer projects -// so that backends can perform response customization without having to make -// additional calls or maintain additional storage. For example, Maps API -// defines properties that controls map tile cache period, or whether to embed a -// watermark in a result. -// -// These values can be set via API producer console. Only API providers can -// define and set these properties. -message Property { - // Supported data type of the property values - enum PropertyType { - // The type is unspecified, and will result in an error. - UNSPECIFIED = 0; - - // The type is `int64`. - INT64 = 1; - - // The type is `bool`. - BOOL = 2; - - // The type is `string`. - STRING = 3; - - // The type is 'double'. - DOUBLE = 4; - } - - // The name of the property (a.k.a key). - string name = 1; - - // The type of this property. - PropertyType type = 2; - - // The description of the property - string description = 3; -} diff --git a/google/api/context.proto b/google/api/context.proto deleted file mode 100644 index 2d330f6f2a..0000000000 --- a/google/api/context.proto +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ContextProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Context` defines which contexts an API requests. -// -// Example: -// -// context: -// rules: -// - selector: "*" -// requested: -// - google.rpc.context.ProjectContext -// - google.rpc.context.OriginContext -// -// The above specifies that all methods in the API request -// `google.rpc.context.ProjectContext` and -// `google.rpc.context.OriginContext`. -// -// Available context types are defined in package -// `google.rpc.context`. -// -// This also provides mechanism to whitelist any protobuf message extension that -// can be sent in grpc metadata using “x-goog-ext--bin” and -// “x-goog-ext--jspb” format. For example, list any service -// specific protobuf types that can appear in grpc metadata as follows in your -// yaml file: -// -// Example: -// -// context: -// rules: -// - selector: "google.example.library.v1.LibraryService.CreateBook" -// allowed_request_extensions: -// - google.foo.v1.NewExtension -// allowed_response_extensions: -// - google.foo.v1.NewExtension -// -// You can also specify extension ID instead of fully qualified extension name -// here. -message Context { - // A list of RPC context rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated ContextRule rules = 1; -} - -// A context rule provides information about the context for an individual API -// element. -message ContextRule { - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // A list of full type names of requested contexts. - repeated string requested = 2; - - // A list of full type names of provided contexts. - repeated string provided = 3; - - // A list of full type names or extension IDs of extensions allowed in grpc - // side channel from client to backend. - repeated string allowed_request_extensions = 4; - - // A list of full type names or extension IDs of extensions allowed in grpc - // side channel from backend to client. - repeated string allowed_response_extensions = 5; -} diff --git a/google/api/control.proto b/google/api/control.proto deleted file mode 100644 index e769f97830..0000000000 --- a/google/api/control.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ControlProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Selects and configures the service controller used by the service. The -// service controller handles features like abuse, quota, billing, logging, -// monitoring, etc. -message Control { - // The service control environment to use. If empty, no control plane - // feature (like quota and billing) will be enabled. - string environment = 1; -} diff --git a/google/api/distribution.proto b/google/api/distribution.proto deleted file mode 100644 index ee45d9dcd7..0000000000 --- a/google/api/distribution.proto +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright 2019 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.api; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/distribution;distribution"; -option java_multiple_files = true; -option java_outer_classname = "DistributionProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Distribution` contains summary statistics for a population of values. It -// optionally contains a histogram representing the distribution of those values -// across a set of buckets. -// -// The summary statistics are the count, mean, sum of the squared deviation from -// the mean, the minimum, and the maximum of the set of population of values. -// The histogram is based on a sequence of buckets and gives a count of values -// that fall into each bucket. The boundaries of the buckets are given either -// explicitly or by formulas for buckets of fixed or exponentially increasing -// widths. -// -// Although it is not forbidden, it is generally a bad idea to include -// non-finite values (infinities or NaNs) in the population of values, as this -// will render the `mean` and `sum_of_squared_deviation` fields meaningless. -message Distribution { - // The range of the population values. - message Range { - // The minimum of the population values. - double min = 1; - - // The maximum of the population values. - double max = 2; - } - - // `BucketOptions` describes the bucket boundaries used to create a histogram - // for the distribution. The buckets can be in a linear sequence, an - // exponential sequence, or each bucket can be specified explicitly. - // `BucketOptions` does not include the number of values in each bucket. - // - // A bucket has an inclusive lower bound and exclusive upper bound for the - // values that are counted for that bucket. The upper bound of a bucket must - // be strictly greater than the lower bound. The sequence of N buckets for a - // distribution consists of an underflow bucket (number 0), zero or more - // finite buckets (number 1 through N - 2) and an overflow bucket (number N - - // 1). The buckets are contiguous: the lower bound of bucket i (i > 0) is the - // same as the upper bound of bucket i - 1. The buckets span the whole range - // of finite values: lower bound of the underflow bucket is -infinity and the - // upper bound of the overflow bucket is +infinity. The finite buckets are - // so-called because both bounds are finite. - message BucketOptions { - // Specifies a linear sequence of buckets that all have the same width - // (except overflow and underflow). Each bucket represents a constant - // absolute uncertainty on the specific value in the bucket. - // - // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the - // following boundaries: - // - // Upper bound (0 <= i < N-1): offset + (width * i). - // Lower bound (1 <= i < N): offset + (width * (i - 1)). - message Linear { - // Must be greater than 0. - int32 num_finite_buckets = 1; - - // Must be greater than 0. - double width = 2; - - // Lower bound of the first bucket. - double offset = 3; - } - - // Specifies an exponential sequence of buckets that have a width that is - // proportional to the value of the lower bound. Each bucket represents a - // constant relative uncertainty on a specific value in the bucket. - // - // There are `num_finite_buckets + 2` (= N) buckets. Bucket `i` has the - // following boundaries: - // - // Upper bound (0 <= i < N-1): scale * (growth_factor ^ i). - // Lower bound (1 <= i < N): scale * (growth_factor ^ (i - 1)). - message Exponential { - // Must be greater than 0. - int32 num_finite_buckets = 1; - - // Must be greater than 1. - double growth_factor = 2; - - // Must be greater than 0. - double scale = 3; - } - - // Specifies a set of buckets with arbitrary widths. - // - // There are `size(bounds) + 1` (= N) buckets. Bucket `i` has the following - // boundaries: - // - // Upper bound (0 <= i < N-1): bounds[i] - // Lower bound (1 <= i < N); bounds[i - 1] - // - // The `bounds` field must contain at least one element. If `bounds` has - // only one element, then there are no finite buckets, and that single - // element is the common boundary of the overflow and underflow buckets. - message Explicit { - // The values must be monotonically increasing. - repeated double bounds = 1; - } - - // Exactly one of these three fields must be set. - oneof options { - // The linear bucket. - Linear linear_buckets = 1; - - // The exponential buckets. - Exponential exponential_buckets = 2; - - // The explicit buckets. - Explicit explicit_buckets = 3; - } - } - - // Exemplars are example points that may be used to annotate aggregated - // distribution values. They are metadata that gives information about a - // particular value added to a Distribution bucket, such as a trace ID that - // was active when a value was added. They may contain further information, - // such as a example values and timestamps, origin, etc. - message Exemplar { - // Value of the exemplar point. This value determines to which bucket the - // exemplar belongs. - double value = 1; - - // The observation (sampling) time of the above value. - google.protobuf.Timestamp timestamp = 2; - - // Contextual information about the example value. Examples are: - // - // Trace: type.googleapis.com/google.monitoring.v3.SpanContext - // - // Literal string: type.googleapis.com/google.protobuf.StringValue - // - // Labels dropped during aggregation: - // type.googleapis.com/google.monitoring.v3.DroppedLabels - // - // There may be only a single attachment of any given message type in a - // single exemplar, and this is enforced by the system. - repeated google.protobuf.Any attachments = 3; - } - - // The number of values in the population. Must be non-negative. This value - // must equal the sum of the values in `bucket_counts` if a histogram is - // provided. - int64 count = 1; - - // The arithmetic mean of the values in the population. If `count` is zero - // then this field must be zero. - double mean = 2; - - // The sum of squared deviations from the mean of the values in the - // population. For values x_i this is: - // - // Sum[i=1..n]((x_i - mean)^2) - // - // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition - // describes Welford's method for accumulating this sum in one pass. - // - // If `count` is zero then this field must be zero. - double sum_of_squared_deviation = 3; - - // If specified, contains the range of the population values. The field - // must not be present if the `count` is zero. - Range range = 4; - - // Defines the histogram bucket boundaries. If the distribution does not - // contain a histogram, then omit this field. - BucketOptions bucket_options = 6; - - // The number of values in each bucket of the histogram, as described in - // `bucket_options`. If the distribution does not have a histogram, then omit - // this field. If there is a histogram, then the sum of the values in - // `bucket_counts` must equal the value in the `count` field of the - // distribution. - // - // If present, `bucket_counts` should contain N values, where N is the number - // of buckets specified in `bucket_options`. If you supply fewer than N - // values, the remaining values are assumed to be 0. - // - // The order of the values in `bucket_counts` follows the bucket numbering - // schemes described for the three bucket types. The first value must be the - // count for the underflow bucket (number 0). The next N-2 values are the - // counts for the finite buckets (number 1 through N-2). The N'th value in - // `bucket_counts` is the count for the overflow bucket (number N-1). - repeated int64 bucket_counts = 7; - - // Must be in increasing order of `value` field. - repeated Exemplar exemplars = 10; -} diff --git a/google/api/documentation.proto b/google/api/documentation.proto deleted file mode 100644 index 74cbf67e99..0000000000 --- a/google/api/documentation.proto +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "DocumentationProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Documentation` provides the information for describing a service. -// -// Example: -//
documentation:
-//   summary: >
-//     The Google Calendar API gives access
-//     to most calendar features.
-//   pages:
-//   - name: Overview
-//     content: (== include google/foo/overview.md ==)
-//   - name: Tutorial
-//     content: (== include google/foo/tutorial.md ==)
-//     subpages;
-//     - name: Java
-//       content: (== include google/foo/tutorial_java.md ==)
-//   rules:
-//   - selector: google.calendar.Calendar.Get
-//     description: >
-//       ...
-//   - selector: google.calendar.Calendar.Put
-//     description: >
-//       ...
-// 
-// Documentation is provided in markdown syntax. In addition to -// standard markdown features, definition lists, tables and fenced -// code blocks are supported. Section headers can be provided and are -// interpreted relative to the section nesting of the context where -// a documentation fragment is embedded. -// -// Documentation from the IDL is merged with documentation defined -// via the config at normalization time, where documentation provided -// by config rules overrides IDL provided. -// -// A number of constructs specific to the API platform are supported -// in documentation text. -// -// In order to reference a proto element, the following -// notation can be used: -//
[fully.qualified.proto.name][]
-// To override the display text used for the link, this can be used: -//
[display text][fully.qualified.proto.name]
-// Text can be excluded from doc using the following notation: -//
(-- internal comment --)
-// -// A few directives are available in documentation. Note that -// directives must appear on a single line to be properly -// identified. The `include` directive includes a markdown file from -// an external source: -//
(== include path/to/file ==)
-// The `resource_for` directive marks a message to be the resource of -// a collection in REST view. If it is not specified, tools attempt -// to infer the resource from the operations in a collection: -//
(== resource_for v1.shelves.books ==)
-// The directive `suppress_warning` does not directly affect documentation -// and is documented together with service config validation. -message Documentation { - // A short summary of what the service does. Can only be provided by - // plain text. - string summary = 1; - - // The top level pages for the documentation set. - repeated Page pages = 5; - - // A list of documentation rules that apply to individual API elements. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated DocumentationRule rules = 3; - - // The URL to the root of documentation. - string documentation_root_url = 4; - - // Declares a single overview page. For example: - //
documentation:
-  //   summary: ...
-  //   overview: (== include overview.md ==)
-  // 
- // This is a shortcut for the following declaration (using pages style): - //
documentation:
-  //   summary: ...
-  //   pages:
-  //   - name: Overview
-  //     content: (== include overview.md ==)
-  // 
- // Note: you cannot specify both `overview` field and `pages` field. - string overview = 2; -} - -// A documentation rule provides information about individual API elements. -message DocumentationRule { - // The selector is a comma-separated list of patterns. Each pattern is a - // qualified name of the element which may end in "*", indicating a wildcard. - // Wildcards are only allowed at the end and for a whole component of the - // qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A - // wildcard will match one or more components. To specify a default for all - // applicable elements, the whole pattern "*" is used. - string selector = 1; - - // Description of the selected API(s). - string description = 2; - - // Deprecation description of the selected element(s). It can be provided if - // an element is marked as `deprecated`. - string deprecation_description = 3; -} - -// Represents a documentation page. A page can contain subpages to represent -// nested documentation set structure. -message Page { - // The name of the page. It will be used as an identity of the page to - // generate URI of the page, text of the link to this page in navigation, - // etc. The full page name (start from the root page name to this page - // concatenated with `.`) can be used as reference to the page in your - // documentation. For example: - //
pages:
-  // - name: Tutorial
-  //   content: (== include tutorial.md ==)
-  //   subpages:
-  //   - name: Java
-  //     content: (== include tutorial_java.md ==)
-  // 
- // You can reference `Java` page using Markdown reference link syntax: - // `[Java][Tutorial.Java]`. - string name = 1; - - // The Markdown content of the page. You can use (== include {path} - // ==) to include content from a Markdown file. - string content = 2; - - // Subpages of this page. The order of subpages specified here will be - // honored in the generated docset. - repeated Page subpages = 3; -} diff --git a/google/api/endpoint.proto b/google/api/endpoint.proto deleted file mode 100644 index 2077334d24..0000000000 --- a/google/api/endpoint.proto +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "EndpointProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Endpoint` describes a network endpoint that serves a set of APIs. -// A service may expose any number of endpoints, and all endpoints share the -// same service configuration, such as quota configuration and monitoring -// configuration. -// -// Example service configuration: -// -// name: library-example.googleapis.com -// endpoints: -// # Below entry makes 'google.example.library.v1.Library' -// # API be served from endpoint address library-example.googleapis.com. -// # It also allows HTTP OPTIONS calls to be passed to the backend, for -// # it to decide whether the subsequent cross-origin request is -// # allowed to proceed. -// - name: library-example.googleapis.com -// allow_cors: true -message Endpoint { - // The canonical name of this endpoint. - string name = 1; - - // DEPRECATED: This field is no longer supported. Instead of using aliases, - // please specify multiple [google.api.Endpoint][google.api.Endpoint] for each of the intended - // aliases. - // - // Additional names that this endpoint will be hosted on. - repeated string aliases = 2 [deprecated = true]; - - // The list of features enabled on this endpoint. - repeated string features = 4; - - // The specification of an Internet routable address of API frontend that will - // handle requests to this [API - // Endpoint](https://cloud.google.com/apis/design/glossary). It should be - // either a valid IPv4 address or a fully-qualified domain name. For example, - // "8.8.8.8" or "myservice.appspot.com". - string target = 101; - - // Allowing - // [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka - // cross-domain traffic, would allow the backends served from this endpoint to - // receive and respond to HTTP OPTIONS requests. The response will be used by - // the browser to determine whether the subsequent cross-origin request is - // allowed to proceed. - bool allow_cors = 5; -} diff --git a/google/api/expr/BUILD.bazel b/google/api/expr/BUILD.bazel deleted file mode 100644 index a87c57fece..0000000000 --- a/google/api/expr/BUILD.bazel +++ /dev/null @@ -1 +0,0 @@ -exports_files(glob(["*.yaml"])) diff --git a/google/api/expr/artman_cel.yaml b/google/api/expr/artman_cel.yaml deleted file mode 100644 index 89d2d28b2f..0000000000 --- a/google/api/expr/artman_cel.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# This file is auto-generated based on service config and could be -# incorrect. The API producer can manually edit it. Remove all the FIXMEs -# before sending this file out for review. -common: - api_name: cel - api_version: v1alpha1 - organization_name: google-cloud - proto_deps: - - name: google-common-protos - src_proto_paths: - - v1alpha1 - service_yaml: cel.yaml - gapic_yaml: v1alpha1/cel_gapic.yaml -artifacts: -- name: gapic_config - type: GAPIC_CONFIG -- name: java_gapic - type: GAPIC - language: JAVA -- name: python_gapic - type: GAPIC - language: PYTHON -- name: nodejs_gapic - type: GAPIC - language: NODEJS -- name: php_gapic - type: GAPIC - language: PHP -- name: go_gapic - type: GAPIC - language: GO -- name: ruby_gapic - type: GAPIC - language: RUBY -- name: csharp_gapic - type: GAPIC - language: CSHARP diff --git a/google/api/expr/cel.yaml b/google/api/expr/cel.yaml deleted file mode 100644 index bbe7fbde17..0000000000 --- a/google/api/expr/cel.yaml +++ /dev/null @@ -1,61 +0,0 @@ -type: google.api.Service -config_version: 3 -name: cel.googleapis.com -title: Common Expression Language - -apis: -- name: google.api.expr.v1alpha1.ConformanceService -- name: google.api.expr.v1alpha1.CelService - -documentation: - summary: Defines common types for the Common Expression Language. - overview: |- - # Common Expression Language - - The Common Expression Language (CEL) implements common semantics for - expression evaluation, enabling different applications to more easily - interoperate. - - Key Applications - - * Security policy: organization have complex infrastructure and need - common tooling to reason about the system as a whole * Protocols: - expressions are a useful data type and require interoperability across - programming languages and platforms. - - - - Guiding philosophy: - - 1. Keep it small & fast. * CEL evaluates in linear time, is mutation - free, and not Turing-complete. This limitation is a feature of the language - design, which allows the implementation to evaluate orders of magnitude - faster than equivalently sandboxed JavaScript. 2. Make it extensible. * - CEL is designed to be embedded in applications, and allows for extensibility - via its context which allows for functions and data to be provided by the - software that embeds it. 3. Developer-friendly * The language is - approachable to developers. The initial spec was based on the experience of - developing Firebase Rules and usability testing many prior iterations. * - The library itself and accompanying toolings should be easy to adopt by - teams that seek to integrate CEL into their platforms. - - The required components of a system that supports CEL are: - - * The textual representation of an expression as written by a developer. - It is of similar syntax of expressions in C/C++/Java/JavaScript * A binary - representation of an expression. It is an abstract syntax tree (AST). * A - compiler library that converts the textual representation to the binary - representation. This can be done ahead of time (in the control plane) or - just before evaluation (in the data plane). * A context containing one or - more typed variables, often protobuf messages. Most use-case will use - attribute_context.proto * An evaluator library that takes the binary - format in the context and produces a result, usually a Boolean. - - Example of boolean conditions and object construction: - - ``` c // Condition account.balance >= transaction.withdrawal || - (account.overdraftProtection && account.overdraftLimit >= - transaction.withdrawal - account.balance) - - // Object construction common.GeoPoint{ latitude: 10.0, longitude: -5.5 } - ``` diff --git a/google/api/expr/v1alpha1/BUILD.bazel b/google/api/expr/v1alpha1/BUILD.bazel deleted file mode 100644 index 95e41dee39..0000000000 --- a/google/api/expr/v1alpha1/BUILD.bazel +++ /dev/null @@ -1,522 +0,0 @@ -# This file was automatically generated by BuildFileGenerator - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") - -proto_library( - name = "expr_proto", - srcs = [ - "cel_service.proto", - "checked.proto", - "conformance_service.proto", - "eval.proto", - "explain.proto", - "syntax.proto", - "value.proto", - ], - deps = [ - "//google/api:client_proto", - "//google/api:field_behavior_proto", - "//google/rpc:status_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:empty_proto", - "@com_google_protobuf//:struct_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -proto_library_with_info( - name = "expr_proto_with_info", - deps = [ - ":expr_proto", - "//google/cloud:common_resources_proto", - ], -) - -proto_library( - name = "cel_service_proto", - srcs = ["cel_service.proto"], - deps = [ - ":conformance_service_proto", - ], -) - -proto_library( - name = "checked_proto", - srcs = ["checked.proto"], - deps = [ - ":syntax_proto", - "@com_google_protobuf//:empty_proto", - "@com_google_protobuf//:struct_proto", - ], -) - -proto_library( - name = "conformance_service_proto", - srcs = ["conformance_service.proto"], - deps = [ - ":checked_proto", - ":eval_proto", - ":syntax_proto", - "//google/api:client_proto", - "//google/api:field_behavior_proto", - "//google/rpc:status_proto", - ], -) - -proto_library( - name = "eval_proto", - srcs = ["eval.proto"], - deps = [ - ":value_proto", - "//google/rpc:status_proto", - ], -) - -proto_library( - name = "explain_proto", - srcs = ["explain.proto"], - deps = [ - ":value_proto", - ], -) - -proto_library( - name = "syntax_proto", - srcs = ["syntax.proto"], - deps = [ - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:struct_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -proto_library( - name = "value_proto", - srcs = ["value.proto"], - deps = [ - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:struct_proto", - ], -) - -############################################################################## -# Java -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "java_gapic_assembly_gradle_pkg", - "java_gapic_library", - "java_gapic_test", - "java_grpc_library", - "java_proto_library", -) - -java_proto_library( - name = "expr_java_proto", - deps = [":expr_proto"], -) - -java_grpc_library( - name = "expr_java_grpc", - srcs = [":expr_proto"], - deps = [":expr_java_proto"], -) - -java_gapic_library( - name = "expr_java_gapic", - src = ":expr_proto_with_info", - gapic_yaml = "cel_gapic.yaml", - package = "google.api.expr.v1alpha1", - service_yaml = "//google/api/expr:cel.yaml", - test_deps = [":expr_java_grpc"], - deps = [ - ":expr_java_proto", - ], -) - -java_gapic_test( - name = "expr_java_gapic_test_suite", - test_classes = [ - "com.google.cloud.api.expr.v1alpha1.CelServiceClientTest", - "com.google.cloud.api.expr.v1alpha1.ConformanceServiceClientTest", - ], - runtime_deps = [":expr_java_gapic_test"], -) - -# Open Source Packages -java_gapic_assembly_gradle_pkg( - name = "google-cloud-api-expr-v1alpha1-java", - deps = [ - ":expr_java_gapic", - ":expr_java_grpc", - ":expr_java_proto", - ":expr_proto", - ], -) - -############################################################################## -# Go -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "go_gapic_assembly_pkg", - "go_gapic_library", - "go_proto_library", - "go_test", -) - -go_proto_library( - name = "expr_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1", - protos = [":expr_proto"], - deps = [ - "//google/api:annotations_go_proto", - "//google/rpc:status_go_proto", - ], -) - -go_gapic_library( - name = "expr_go_gapic", - src = ":expr_proto_with_info", - gapic_yaml = "cel_gapic.yaml", - importpath = "cloud.google.com/go/expr/apiv1alpha1", - package = "google.api.expr.v1alpha1", - service_yaml = "//google/api/expr:cel.yaml", - deps = [ - ":expr_go_proto", - ], -) - -go_test( - name = "expr_go_gapic_test", - srcs = [":expr_go_gapic_srcjar_test"], - embed = [":expr_go_gapic"], - importpath = "cloud.google.com/go/expr/apiv1alpha1", -) - -# Open Source Packages -go_gapic_assembly_pkg( - name = "gapi-cloud-api-expr-v1alpha1-go", - deps = [ - ":expr_go_gapic", - ":expr_go_gapic_srcjar-smoke-test.srcjar", - ":expr_go_gapic_srcjar-test.srcjar", - ":expr_go_proto", - ], -) - -############################################################################## -# Python -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "moved_proto_library", - "py_gapic_assembly_pkg", - "py_gapic_library", - "py_grpc_library", - "py_proto_library", -) - -moved_proto_library( - name = "expr_moved_proto", - srcs = [":expr_proto"], - deps = [ - "//google/api:client_proto", - "//google/api:field_behavior_proto", - "//google/rpc:status_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:empty_proto", - "@com_google_protobuf//:struct_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -py_proto_library( - name = "expr_py_proto", - plugin = "@protoc_docs_plugin//:docs_plugin", - deps = [":expr_moved_proto"], -) - -py_grpc_library( - name = "expr_py_grpc", - srcs = [":expr_moved_proto"], - deps = [":expr_py_proto"], -) - -py_gapic_library( - name = "expr_py_gapic", - src = ":expr_proto_with_info", - gapic_yaml = "cel_gapic.yaml", - package = "google.api.expr.v1alpha1", - service_yaml = "//google/api/expr:cel.yaml", - deps = [ - ":expr_py_grpc", - ":expr_py_proto", - ], -) - -# Open Source Packages -py_gapic_assembly_pkg( - name = "api-expr-v1alpha1-py", - deps = [ - ":expr_py_gapic", - ":expr_py_grpc", - ":expr_py_proto", - ], -) - -py_proto_library( - name = "checked_py_proto", - deps = [":checked_proto"], -) - -py_proto_library( - name = "eval_py_proto", - deps = [":eval_proto"], -) - -py_proto_library( - name = "explain_py_proto", - deps = [":explain_proto"], -) - -py_proto_library( - name = "syntax_py_proto", - deps = [":syntax_proto"], -) - -py_proto_library( - name = "value_py_proto", - deps = [":value_proto"], -) - -############################################################################## -# PHP -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "php_gapic_assembly_pkg", - "php_gapic_library", - "php_grpc_library", - "php_proto_library", -) - -php_proto_library( - name = "expr_php_proto", - deps = [":expr_proto"], -) - -php_grpc_library( - name = "expr_php_grpc", - srcs = [":expr_proto"], - deps = [":expr_php_proto"], -) - -# To support PHP option (google.api.http) must be specified for all RPCs in -# the service. - -#php_gapic_library( -# name = "expr_php_gapic", -# src = ":expr_proto_with_info", -# gapic_yaml = "cel_gapic.yaml", -# package = "google.api.expr.v1alpha1", -# service_yaml = "//google/api/expr:cel.yaml", -# deps = [ -# ":expr_php_grpc", -# ":expr_php_proto", -# ], -#) - -## Open Source Packages -#php_gapic_assembly_pkg( -# name = "google-cloud-api-expr-v1alpha1-php", -# deps = [ -# ":expr_php_gapic", -# ":expr_php_grpc", -# ":expr_php_proto", -# ], -#) - -############################################################################## -# Node.js -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "nodejs_gapic_assembly_pkg", - "nodejs_gapic_library", -) - -nodejs_gapic_library( - name = "expr_nodejs_gapic", - src = ":expr_proto_with_info", - gapic_yaml = "cel_gapic.yaml", - package = "google.api.expr.v1alpha1", - service_yaml = "//google/api/expr:cel.yaml", - deps = [], -) - -nodejs_gapic_assembly_pkg( - name = "api-expr-v1alpha1-nodejs", - deps = [ - ":expr_nodejs_gapic", - ":expr_proto", - ], -) - -############################################################################## -# Ruby -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "ruby_gapic_assembly_pkg", - "ruby_gapic_library", - "ruby_grpc_library", - "ruby_proto_library", -) - -ruby_proto_library( - name = "expr_ruby_proto", - deps = [":expr_proto"], -) - -ruby_grpc_library( - name = "expr_ruby_grpc", - srcs = [":expr_proto"], - deps = [":expr_ruby_proto"], -) - -ruby_gapic_library( - name = "expr_ruby_gapic", - src = ":expr_proto_with_info", - gapic_yaml = "cel_gapic.yaml", - package = "google.api.expr.v1alpha1", - service_yaml = "//google/api/expr:cel.yaml", - deps = [ - ":expr_ruby_grpc", - ":expr_ruby_proto", - ], -) - -# Open Source Packages -ruby_gapic_assembly_pkg( - name = "google-cloud-api-expr-v1alpha1-ruby", - deps = [ - ":expr_ruby_gapic", - ":expr_ruby_grpc", - ":expr_ruby_proto", - ], -) - -############################################################################## -# C# -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "csharp_gapic_assembly_pkg", - "csharp_gapic_library", - "csharp_grpc_library", - "csharp_proto_library", -) - -csharp_proto_library( - name = "expr_csharp_proto", - deps = [":expr_proto"], -) - -csharp_grpc_library( - name = "expr_csharp_grpc", - srcs = [":expr_proto"], - deps = [":expr_csharp_proto"], -) - -csharp_gapic_library( - name = "expr_csharp_gapic", - src = ":expr_proto_with_info", - gapic_yaml = "cel_gapic.yaml", - package = "google.api.expr.v1alpha1", - service_yaml = "//google/api/expr:cel.yaml", - deps = [ - ":expr_csharp_grpc", - ":expr_csharp_proto", - ], -) - -# Open Source Packages -csharp_gapic_assembly_pkg( - name = "google-cloud-api-expr-v1alpha1-csharp", - deps = [ - ":expr_csharp_gapic", - ":expr_csharp_grpc", - ":expr_csharp_proto", - ], -) - -############################################################################## -# C++ -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "cc_grpc_library", - "cc_proto_library", -) - -cc_proto_library( - name = "cel_service_cc_proto", - deps = [":cel_service_proto"], -) - -cc_grpc_library( - name = "cel_service_cc_grpc", - srcs = [":cel_service_proto"], - generate_mocks = True, - grpc_only = True, - deps = [":cel_service_cc_proto"], -) - -cc_proto_library( - name = "checked_cc_proto", - deps = [":checked_proto"], -) - -cc_proto_library( - name = "conformance_service_cc_proto", - deps = [":conformance_service_proto"], -) - -cc_grpc_library( - name = "conformance_service_cc_grpc", - srcs = [":conformance_service_proto"], - generate_mocks = True, - grpc_only = True, - deps = [":conformance_service_cc_proto"], -) - -cc_proto_library( - name = "eval_cc_proto", - deps = [":eval_proto"], -) - -cc_proto_library( - name = "explain_cc_proto", - deps = [":explain_proto"], -) - -cc_proto_library( - name = "syntax_cc_proto", - deps = [":syntax_proto"], -) - -cc_proto_library( - name = "value_cc_proto", - deps = [":value_proto"], -) \ No newline at end of file diff --git a/google/api/expr/v1alpha1/cel.yaml b/google/api/expr/v1alpha1/cel.yaml deleted file mode 100644 index 2f79c16de1..0000000000 --- a/google/api/expr/v1alpha1/cel.yaml +++ /dev/null @@ -1,69 +0,0 @@ -type: google.api.Service -config_version: 3 -name: cel.googleapis.com -title: Common Expression Language - -apis: -- name: google.api.expr.v1alpha1.ConformanceService - -documentation: - summary: Defines common types for the Common Expression Language. - overview: |- - # Common Expression Language - - The Common Expression Language (CEL) implements common semantics for - expression evaluation, enabling different applications to more easily - interoperate. - - Key Applications - - * Security policy: organization have complex infrastructure and need - common tooling to reason about the system as a whole * Protocols: - expressions are a useful data type and require interoperability across - programming languages and platforms. - - - Guiding philosophy: - - 1. Keep it small & fast. - * CEL evaluates in linear time, is mutation free, and not - Turing-complete. This limitation is a feature of the language - design, which allows the implementation to evaluate orders of - magnitude faster than equivalently sandboxed JavaScript. 2. Make - it extensible. - * CEL is designed to be embedded in applications, and allows for - extensibility via its context which allows for functions and data - to be provided by the software that embeds it. 3. - Developer-friendly - * The language is approachable to developers. The initial spec was - based on the experience of developing Firebase Rules and usability - testing many prior iterations. * The library itself and - accompanying toolings should be easy to adopt by teams that seek - to integrate CEL into their platforms. - - The required components of a system that supports CEL are: - - * The textual representation of an expression as written by a developer. - It is of similar syntax of expressions in C/C++/Java/JavaScript * A - binary representation of an expression. It is an abstract syntax tree - (AST). - * A compiler library that converts the textual representation to the - binary representation. This can be done ahead of time (in the control - plane) or just before evaluation (in the data plane). * A context - containing one or more typed variables, often protobuf messages. Most - use-case will use attribute_context.proto - * An evaluator library that takes the binary format in the context and - produces a result, usually a Boolean. - - Example of boolean conditions and object construction: - - ``` c - // Condition - account.balance >= transaction.withdrawal - || (account.overdraftProtection - && account.overdraftLimit >= transaction.withdrawal - - account.balance) - - // Object construction - common.GeoPoint{ latitude: 10.0, longitude: -5.5 } - ``` diff --git a/google/api/expr/v1alpha1/cel_gapic.yaml b/google/api/expr/v1alpha1/cel_gapic.yaml deleted file mode 100644 index d2213fc7e6..0000000000 --- a/google/api/expr/v1alpha1/cel_gapic.yaml +++ /dev/null @@ -1,248 +0,0 @@ -type: com.google.api.codegen.ConfigProto -config_schema_version: 1.0.0 -# The settings of generated code in a specific language. -language_settings: - java: - package_name: com.google.cloud.api.expr.v1alpha1 - python: - package_name: google.cloud.api.expr_v1alpha1.gapic - go: - package_name: cloud.google.com/go/expr/apiv1alpha1 - csharp: - package_name: Google.Api.Expr.V1alpha1 - ruby: - package_name: Google::Cloud::Api::Expr::V1alpha1 - php: - package_name: Google\Cloud\Api\Expr\V1alpha1 - nodejs: - package_name: expr.v1alpha1 -# A list of API interface configurations. -interfaces: - # The fully qualified name of the API interface. -- name: google.api.expr.v1alpha1.CelService - # A list of resource collection configurations. - # Consists of a name_pattern and an entity_name. - # The name_pattern is a pattern to describe the names of the resources of this - # collection, using the platform's conventions for URI patterns. A generator - # may use this to generate methods to compose and decompose such names. The - # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; - # those will be taken as hints for the parameter names of the generated - # methods. If empty, no name methods are generated. - # The entity_name is the name to be used as a basis for generated methods and - # classes. - collections: [] - # Definition for retryable codes. - retry_codes_def: - - name: idempotent - retry_codes: - - UNAVAILABLE - - DEADLINE_EXCEEDED - - name: non_idempotent - retry_codes: [] - # Definition for retry/backoff parameters. - retry_params_def: - - name: default - initial_retry_delay_millis: 100 - retry_delay_multiplier: 1.3 - max_retry_delay_millis: 60000 - initial_rpc_timeout_millis: 20000 - rpc_timeout_multiplier: 1 - max_rpc_timeout_millis: 20000 - total_timeout_millis: 600000 - # A list of method configurations. - # Common properties: - # - # name - The simple name of the method. - # - # flattening - Specifies the configuration for parameter flattening. - # Describes the parameter groups for which a generator should produce method - # overloads which allow a client to directly pass request message fields as - # method parameters. This information may or may not be used, depending on - # the target language. - # Consists of groups, which each represent a list of parameters to be - # flattened. Each parameter listed must be a field of the request message. - # - # required_fields - Fields that are always required for a request to be - # valid. - # - # resource_name_treatment - An enum that specifies how to treat the resource - # name formats defined in the field_name_patterns and - # response_field_name_patterns fields. - # UNSET: default value - # NONE: the collection configs will not be used by the generated code. - # VALIDATE: string fields will be validated by the client against the - # specified resource name formats. - # STATIC_TYPES: the client will use generated types for resource names. - # - # page_streaming - Specifies the configuration for paging. - # Describes information for generating a method which transforms a paging - # list RPC into a stream of resources. - # Consists of a request and a response. - # The request specifies request information of the list method. It defines - # which fields match the paging pattern in the request. The request consists - # of a page_size_field and a token_field. The page_size_field is the name of - # the optional field specifying the maximum number of elements to be - # returned in the response. The token_field is the name of the field in the - # request containing the page token. - # The response specifies response information of the list method. It defines - # which fields match the paging pattern in the response. The response - # consists of a token_field and a resources_field. The token_field is the - # name of the field in the response containing the next page token. The - # resources_field is the name of the field in the response containing the - # list of resources belonging to the page. - # - # retry_codes_name - Specifies the configuration for retryable codes. The - # name must be defined in interfaces.retry_codes_def. - # - # retry_params_name - Specifies the configuration for retry/backoff - # parameters. The name must be defined in interfaces.retry_params_def. - # - # field_name_patterns - Maps the field name of the request type to - # entity_name of interfaces.collections. - # Specifies the string pattern that the field must follow. - # - # timeout_millis - Specifies the default timeout for a non-retrying call. If - # the call is retrying, refer to retry_params_name instead. - methods: - - name: Parse - flattening: - groups: - - parameters: - - cel_source - required_fields: - - cel_source - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - - name: Check - flattening: - groups: - - parameters: - - parsed_expr - required_fields: - - parsed_expr - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - - name: Eval - flattening: - groups: - - parameters: - required_fields: - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - # The fully qualified name of the API interface. -- name: google.api.expr.v1alpha1.ConformanceService - # A list of resource collection configurations. - # Consists of a name_pattern and an entity_name. - # The name_pattern is a pattern to describe the names of the resources of this - # collection, using the platform's conventions for URI patterns. A generator - # may use this to generate methods to compose and decompose such names. The - # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; - # those will be taken as hints for the parameter names of the generated - # methods. If empty, no name methods are generated. - # The entity_name is the name to be used as a basis for generated methods and - # classes. - collections: [] - # Definition for retryable codes. - retry_codes_def: - - name: idempotent - retry_codes: - - UNAVAILABLE - - DEADLINE_EXCEEDED - - name: non_idempotent - retry_codes: [] - # Definition for retry/backoff parameters. - retry_params_def: - - name: default - initial_retry_delay_millis: 100 - retry_delay_multiplier: 1.3 - max_retry_delay_millis: 60000 - initial_rpc_timeout_millis: 20000 - rpc_timeout_multiplier: 1 - max_rpc_timeout_millis: 20000 - total_timeout_millis: 600000 - # A list of method configurations. - # Common properties: - # - # name - The simple name of the method. - # - # flattening - Specifies the configuration for parameter flattening. - # Describes the parameter groups for which a generator should produce method - # overloads which allow a client to directly pass request message fields as - # method parameters. This information may or may not be used, depending on - # the target language. - # Consists of groups, which each represent a list of parameters to be - # flattened. Each parameter listed must be a field of the request message. - # - # required_fields - Fields that are always required for a request to be - # valid. - # - # resource_name_treatment - An enum that specifies how to treat the resource - # name formats defined in the field_name_patterns and - # response_field_name_patterns fields. - # UNSET: default value - # NONE: the collection configs will not be used by the generated code. - # VALIDATE: string fields will be validated by the client against the - # specified resource name formats. - # STATIC_TYPES: the client will use generated types for resource names. - # - # page_streaming - Specifies the configuration for paging. - # Describes information for generating a method which transforms a paging - # list RPC into a stream of resources. - # Consists of a request and a response. - # The request specifies request information of the list method. It defines - # which fields match the paging pattern in the request. The request consists - # of a page_size_field and a token_field. The page_size_field is the name of - # the optional field specifying the maximum number of elements to be - # returned in the response. The token_field is the name of the field in the - # request containing the page token. - # The response specifies response information of the list method. It defines - # which fields match the paging pattern in the response. The response - # consists of a token_field and a resources_field. The token_field is the - # name of the field in the response containing the next page token. The - # resources_field is the name of the field in the response containing the - # list of resources belonging to the page. - # - # retry_codes_name - Specifies the configuration for retryable codes. The - # name must be defined in interfaces.retry_codes_def. - # - # retry_params_name - Specifies the configuration for retry/backoff - # parameters. The name must be defined in interfaces.retry_params_def. - # - # field_name_patterns - Maps the field name of the request type to - # entity_name of interfaces.collections. - # Specifies the string pattern that the field must follow. - # - # timeout_millis - Specifies the default timeout for a non-retrying call. If - # the call is retrying, refer to retry_params_name instead. - methods: - - name: Parse - flattening: - groups: - - parameters: - - cel_source - required_fields: - - cel_source - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - - name: Check - flattening: - groups: - - parameters: - - parsed_expr - required_fields: - - parsed_expr - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - - name: Eval - flattening: - groups: - - parameters: - required_fields: - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 diff --git a/google/api/expr/v1alpha1/cel_service.proto b/google/api/expr/v1alpha1/cel_service.proto deleted file mode 100644 index 0bf649ff58..0000000000 --- a/google/api/expr/v1alpha1/cel_service.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 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.api.expr.v1alpha1; - -import "google/api/expr/v1alpha1/conformance_service.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "CelServiceProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// Access a CEL implementation from another process or machine. -// A CEL implementation is decomposed as a parser, a static checker, -// and an evaluator. Every CEL implementation is expected to provide -// a server for this API. The API will be used for conformance testing, -// utilities, and execution as a service. -service CelService { - // Transforms CEL source text into a parsed representation. - rpc Parse(ParseRequest) returns (ParseResponse) {} - - // Runs static checks on a parsed CEL representation and return - // an annotated representation, or a set of issues. - rpc Check(CheckRequest) returns (CheckResponse) {} - - // Evaluates a parsed or annotation CEL representation given - // values of external bindings. - rpc Eval(EvalRequest) returns (EvalResponse) {} -} diff --git a/google/api/expr/v1alpha1/checked.proto b/google/api/expr/v1alpha1/checked.proto deleted file mode 100644 index 0a7e3c546a..0000000000 --- a/google/api/expr/v1alpha1/checked.proto +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2019 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.api.expr.v1alpha1; - -import "google/api/expr/v1alpha1/syntax.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "DeclProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// Protos for representing CEL declarations and typed checked expressions. - -// A CEL expression which has been successfully type checked. -message CheckedExpr { - // A map from expression ids to resolved references. - // - // The following entries are in this table: - // - // - An Ident or Select expression is represented here if it resolves to a - // declaration. For instance, if `a.b.c` is represented by - // `select(select(id(a), b), c)`, and `a.b` resolves to a declaration, - // while `c` is a field selection, then the reference is attached to the - // nested select expression (but not to the id or or the outer select). - // In turn, if `a` resolves to a declaration and `b.c` are field selections, - // the reference is attached to the ident expression. - // - Every Call expression has an entry here, identifying the function being - // called. - // - Every CreateStruct expression for a message has an entry, identifying - // the message. - map reference_map = 2; - - // A map from expression ids to types. - // - // Every expression node which has a type different than DYN has a mapping - // here. If an expression has type DYN, it is omitted from this map to save - // space. - map type_map = 3; - - // The source info derived from input that generated the parsed `expr` and - // any optimizations made during the type-checking pass. - SourceInfo source_info = 5; - - // The checked expression. Semantically equivalent to the parsed `expr`, but - // may have structural differences. - Expr expr = 4; -} - -// Represents a CEL type. -message Type { - // List type with typed elements, e.g. `list`. - message ListType { - // The element type. - Type elem_type = 1; - } - - // Map type with parameterized key and value types, e.g. `map`. - message MapType { - // The type of the key. - Type key_type = 1; - - // The type of the value. - Type value_type = 2; - } - - // Function type with result and arg types. - message FunctionType { - // Result type of the function. - Type result_type = 1; - - // Argument types of the function. - repeated Type arg_types = 2; - } - - // Application defined abstract type. - message AbstractType { - // The fully qualified name of this abstract type. - string name = 1; - - // Parameter types for this abstract type. - repeated Type parameter_types = 2; - } - - // CEL primitive types. - enum PrimitiveType { - // Unspecified type. - PRIMITIVE_TYPE_UNSPECIFIED = 0; - - // Boolean type. - BOOL = 1; - - // Int64 type. - // - // Proto-based integer values are widened to int64. - INT64 = 2; - - // Uint64 type. - // - // Proto-based unsigned integer values are widened to uint64. - UINT64 = 3; - - // Double type. - // - // Proto-based float values are widened to double values. - DOUBLE = 4; - - // String type. - STRING = 5; - - // Bytes type. - BYTES = 6; - } - - // Well-known protobuf types treated with first-class support in CEL. - enum WellKnownType { - // Unspecified type. - WELL_KNOWN_TYPE_UNSPECIFIED = 0; - - // Well-known protobuf.Any type. - // - // Any types are a polymorphic message type. During type-checking they are - // treated like `DYN` types, but at runtime they are resolved to a specific - // message type specified at evaluation time. - ANY = 1; - - // Well-known protobuf.Timestamp type, internally referenced as `timestamp`. - TIMESTAMP = 2; - - // Well-known protobuf.Duration type, internally referenced as `duration`. - DURATION = 3; - } - - // The kind of type. - oneof type_kind { - // Dynamic type. - google.protobuf.Empty dyn = 1; - - // Null value. - google.protobuf.NullValue null = 2; - - // Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`. - PrimitiveType primitive = 3; - - // Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`. - PrimitiveType wrapper = 4; - - // Well-known protobuf type such as `google.protobuf.Timestamp`. - WellKnownType well_known = 5; - - // Parameterized list with elements of `list_type`, e.g. `list`. - ListType list_type = 6; - - // Parameterized map with typed keys and values. - MapType map_type = 7; - - // Function type. - FunctionType function = 8; - - // Protocol buffer message type. - // - // The `message_type` string specifies the qualified message type name. For - // example, `google.plus.Profile`. - string message_type = 9; - - // Type param type. - // - // The `type_param` string specifies the type parameter name, e.g. `list` - // would be a `list_type` whose element type was a `type_param` type - // named `E`. - string type_param = 10; - - // Type type. - // - // The `type` value specifies the target type. e.g. int is type with a - // target type of `Primitive.INT`. - Type type = 11; - - // Error type. - // - // During type-checking if an expression is an error, its type is propagated - // as the `ERROR` type. This permits the type-checker to discover other - // errors present in the expression. - google.protobuf.Empty error = 12; - - // Abstract, application defined type. - AbstractType abstract_type = 14; - } -} - -// Represents a declaration of a named value or function. -// -// A declaration is part of the contract between the expression, the agent -// evaluating that expression, and the caller requesting evaluation. -message Decl { - // Identifier declaration which specifies its type and optional `Expr` value. - // - // An identifier without a value is a declaration that must be provided at - // evaluation time. An identifier with a value should resolve to a constant, - // but may be used in conjunction with other identifiers bound at evaluation - // time. - message IdentDecl { - // Required. The type of the identifier. - Type type = 1; - - // The constant value of the identifier. If not specified, the identifier - // must be supplied at evaluation time. - Constant value = 2; - - // Documentation string for the identifier. - string doc = 3; - } - - // Function declaration specifies one or more overloads which indicate the - // function's parameter types and return type, and may optionally specify a - // function definition in terms of CEL expressions. - // - // Functions have no observable side-effects (there may be side-effects like - // logging which are not observable from CEL). - message FunctionDecl { - // An overload indicates a function's parameter types and return type, and - // may optionally include a function body described in terms of [Expr][google.api.expr.v1alpha1.Expr] - // values. - // - // Functions overloads are declared in either a function or method - // call-style. For methods, the `params[0]` is the expected type of the - // target receiver. - // - // Overloads must have non-overlapping argument types after erasure of all - // parameterized type variables (similar as type erasure in Java). - message Overload { - // Required. Globally unique overload name of the function which reflects - // the function name and argument types. - // - // This will be used by a [Reference][google.api.expr.v1alpha1.Reference] to indicate the `overload_id` that - // was resolved for the function `name`. - string overload_id = 1; - - // List of function parameter [Type][google.api.expr.v1alpha1.Type] values. - // - // Param types are disjoint after generic type parameters have been - // replaced with the type `DYN`. Since the `DYN` type is compatible with - // any other type, this means that if `A` is a type parameter, the - // function types `int` and `int` are not disjoint. Likewise, - // `map` is not disjoint from `map`. - // - // When the `result_type` of a function is a generic type param, the - // type param name also appears as the `type` of on at least one params. - repeated Type params = 2; - - // The type param names associated with the function declaration. - // - // For example, `function ex(K key, map map) : V` would yield - // the type params of `K, V`. - repeated string type_params = 3; - - // Required. The result type of the function. For example, the operator - // `string.isEmpty()` would have `result_type` of `kind: BOOL`. - Type result_type = 4; - - // Whether the function is to be used in a method call-style `x.f(...)` - // of a function call-style `f(x, ...)`. - // - // For methods, the first parameter declaration, `params[0]` is the - // expected type of the target receiver. - bool is_instance_function = 5; - - // Documentation string for the overload. - string doc = 6; - } - - // Required. List of function overloads, must contain at least one overload. - repeated Overload overloads = 1; - } - - // The fully qualified name of the declaration. - // - // Declarations are organized in containers and this represents the full path - // to the declaration in its container, as in `google.api.expr.Decl`. - // - // Declarations used as [FunctionDecl.Overload][google.api.expr.v1alpha1.Decl.FunctionDecl.Overload] parameters may or may not - // have a name depending on whether the overload is function declaration or a - // function definition containing a result [Expr][google.api.expr.v1alpha1.Expr]. - string name = 1; - - // Required. The declaration kind. - oneof decl_kind { - // Identifier declaration. - IdentDecl ident = 2; - - // Function declaration. - FunctionDecl function = 3; - } -} - -// Describes a resolved reference to a declaration. -message Reference { - // The fully qualified name of the declaration. - string name = 1; - - // For references to functions, this is a list of `Overload.overload_id` - // values which match according to typing rules. - // - // If the list has more than one element, overload resolution among the - // presented candidates must happen at runtime because of dynamic types. The - // type checker attempts to narrow down this list as much as possible. - // - // Empty if this is not a reference to a [Decl.FunctionDecl][google.api.expr.v1alpha1.Decl.FunctionDecl]. - repeated string overload_id = 3; - - // For references to constants, this may contain the value of the - // constant if known at compile time. - Constant value = 4; -} diff --git a/google/api/expr/v1alpha1/conformance_service.proto b/google/api/expr/v1alpha1/conformance_service.proto deleted file mode 100644 index e0d5286be1..0000000000 --- a/google/api/expr/v1alpha1/conformance_service.proto +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2019 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.api.expr.v1alpha1; - -import "google/api/client.proto"; -import "google/api/expr/v1alpha1/checked.proto"; -import "google/api/expr/v1alpha1/eval.proto"; -import "google/api/expr/v1alpha1/syntax.proto"; -import "google/api/field_behavior.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "ConformanceServiceProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// Access a CEL implementation from another process or machine. -// A CEL implementation is decomposed as a parser, a static checker, -// and an evaluator. Every CEL implementation is expected to provide -// a server for this API. The API will be used for conformance testing -// and other utilities. -service ConformanceService { - option (google.api.default_host) = "cel.googleapis.com"; - - // Transforms CEL source text into a parsed representation. - rpc Parse(ParseRequest) returns (ParseResponse) { - option (google.api.method_signature) = "cel_source"; - } - - // Runs static checks on a parsed CEL representation and return - // an annotated representation, or a set of issues. - rpc Check(CheckRequest) returns (CheckResponse) { - option (google.api.method_signature) = "parsed_expr"; - } - - // Evaluates a parsed or annotation CEL representation given - // values of external bindings. - rpc Eval(EvalRequest) returns (EvalResponse) { - } -} - -// Request message for the Parse method. -message ParseRequest { - // Required. Source text in CEL syntax. - string cel_source = 1 [(google.api.field_behavior) = REQUIRED]; - - // Tag for version of CEL syntax, for future use. - string syntax_version = 2; - - // File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo]. - string source_location = 3; - - // Prevent macro expansion. See "Macros" in Language Defiinition. - bool disable_macros = 4; -} - -// Response message for the Parse method. -message ParseResponse { - // The parsed representation, or unset if parsing failed. - ParsedExpr parsed_expr = 1; - - // Any number of issues with [StatusDetails][] as the details. - repeated google.rpc.Status issues = 2; -} - -// Request message for the Check method. -message CheckRequest { - // Required. The parsed representation of the CEL program. - ParsedExpr parsed_expr = 1 [(google.api.field_behavior) = REQUIRED]; - - // Declarations of types for external variables and functions. - // Required if program uses external variables or functions - // not in the default environment. - repeated Decl type_env = 2; - - // The protocol buffer context. See "Name Resolution" in the - // Language Definition. - string container = 3; - - // If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default), - // add declarations for the standard definitions to the type environment. See - // "Standard Definitions" in the Language Definition. - bool no_std_env = 4; -} - -// Response message for the Check method. -message CheckResponse { - // The annotated representation, or unset if checking failed. - CheckedExpr checked_expr = 1; - - // Any number of issues with [StatusDetails][] as the details. - repeated google.rpc.Status issues = 2; -} - -// Request message for the Eval method. -message EvalRequest { - // Required. Either the parsed or annotated representation of the CEL program. - oneof expr_kind { - // Evaluate based on the parsed representation. - ParsedExpr parsed_expr = 1; - - // Evaluate based on the checked representation. - CheckedExpr checked_expr = 2; - } - - // Bindings for the external variables. The types SHOULD be compatible - // with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. - map bindings = 3; - - // SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked. - string container = 4; -} - -// Response message for the Eval method. -message EvalResponse { - // The execution result, or unset if execution couldn't start. - ExprValue result = 1; - - // Any number of issues with [StatusDetails][] as the details. - // Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue]. - // Nevertheless, we'll allow out-of-band issues to be raised, - // which also makes the replies more regular. - repeated google.rpc.Status issues = 2; -} - -// Warnings or errors in service execution are represented by -// [google.rpc.Status][google.rpc.Status] messages, with the following message -// in the details field. -message IssueDetails { - // Severities of issues. - enum Severity { - // An unspecified severity. - SEVERITY_UNSPECIFIED = 0; - - // Deprecation issue for statements and method that may no longer be - // supported or maintained. - DEPRECATION = 1; - - // Warnings such as: unused variables. - WARNING = 2; - - // Errors such as: unmatched curly braces or variable redefinition. - ERROR = 3; - } - - // The severity of the issue. - Severity severity = 1; - - // Position in the source, if known. - SourcePosition position = 2; - - // Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown. - int64 id = 3; -} diff --git a/google/api/expr/v1alpha1/eval.proto b/google/api/expr/v1alpha1/eval.proto deleted file mode 100644 index 2187427d86..0000000000 --- a/google/api/expr/v1alpha1/eval.proto +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2019 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.api.expr.v1alpha1; - -import "google/api/expr/v1alpha1/value.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "EvalProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// The state of an evaluation. -// -// Can represent an inital, partial, or completed state of evaluation. -message EvalState { - // A single evalution result. - message Result { - // The id of the expression this result if for. - int64 expr = 1; - - // The index in `values` of the resulting value. - int64 value = 2; - } - - // The unique values referenced in this message. - repeated ExprValue values = 1; - - // An ordered list of results. - // - // Tracks the flow of evaluation through the expression. - // May be sparse. - repeated Result results = 3; -} - -// The value of an evaluated expression. -message ExprValue { - // An expression can resolve to a value, error or unknown. - oneof kind { - // A concrete value. - Value value = 1; - - // The set of errors in the critical path of evalution. - // - // Only errors in the critical path are included. For example, - // `( || true) && ` will only result in ``, - // while ` || ` will result in both `` and - // ``. - // - // Errors cause by the presence of other errors are not included in the - // set. For example `.foo`, `foo()`, and ` + 1` will - // only result in ``. - // - // Multiple errors *might* be included when evaluation could result - // in different errors. For example ` + ` and - // `foo(, )` may result in ``, `` or both. - // The exact subset of errors included for this case is unspecified and - // depends on the implementation details of the evaluator. - ErrorSet error = 2; - - // The set of unknowns in the critical path of evaluation. - // - // Unknown behaves identically to Error with regards to propagation. - // Specifically, only unknowns in the critical path are included, unknowns - // caused by the presence of other unknowns are not included, and multiple - // unknowns *might* be included included when evaluation could result in - // different unknowns. For example: - // - // ( || true) && -> - // || -> - // .foo -> - // foo() -> - // + -> or - // - // Unknown takes precidence over Error in cases where a `Value` can short - // circuit the result: - // - // || -> - // && -> - // - // Errors take precidence in all other cases: - // - // + -> - // foo(, ) -> - UnknownSet unknown = 3; - } -} - -// A set of errors. -// -// The errors included depend on the context. See `ExprValue.error`. -message ErrorSet { - // The errors in the set. - repeated google.rpc.Status errors = 1; -} - -// A set of expressions for which the value is unknown. -// -// The unknowns included depend on the context. See `ExprValue.unknown`. -message UnknownSet { - // The ids of the expressions with unknown values. - repeated int64 exprs = 1; -} diff --git a/google/api/expr/v1alpha1/explain.proto b/google/api/expr/v1alpha1/explain.proto deleted file mode 100644 index 56f8440577..0000000000 --- a/google/api/expr/v1alpha1/explain.proto +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2019 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.api.expr.v1alpha1; - -import "google/api/expr/v1alpha1/value.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "ExplainProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// Values of intermediate expressions produced when evaluating expression. -// Deprecated, use `EvalState` instead. -message Explain { - option deprecated = true; - - // ID and value index of one step. - message ExprStep { - // ID of corresponding Expr node. - int64 id = 1; - - // Index of the value in the values list. - int32 value_index = 2; - } - - // All of the observed values. - // - // The field value_index is an index in the values list. - // Separating values from steps is needed to remove redundant values. - repeated Value values = 1; - - // List of steps. - // - // Repeated evaluations of the same expression generate new ExprStep - // instances. The order of such ExprStep instances matches the order of - // elements returned by Comprehension.iter_range. - repeated ExprStep expr_steps = 2; -} diff --git a/google/api/expr/v1alpha1/syntax.proto b/google/api/expr/v1alpha1/syntax.proto deleted file mode 100644 index 59bc26918d..0000000000 --- a/google/api/expr/v1alpha1/syntax.proto +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2019 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.api.expr.v1alpha1; - -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "SyntaxProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// A representation of the abstract syntax of the Common Expression Language. - -// An expression together with source information as returned by the parser. -message ParsedExpr { - // The parsed expression. - Expr expr = 2; - - // The source info derived from input that generated the parsed `expr`. - SourceInfo source_info = 3; -} - -// An abstract representation of a common expression. -// -// Expressions are abstractly represented as a collection of identifiers, -// select statements, function calls, literals, and comprehensions. All -// operators with the exception of the '.' operator are modelled as function -// calls. This makes it easy to represent new operators into the existing AST. -// -// All references within expressions must resolve to a [Decl][google.api.expr.v1alpha1.Decl] provided at -// type-check for an expression to be valid. A reference may either be a bare -// identifier `name` or a qualified identifier `google.api.name`. References -// may either refer to a value or a function declaration. -// -// For example, the expression `google.api.name.startsWith('expr')` references -// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression, and -// the function declaration `startsWith`. -message Expr { - // An identifier expression. e.g. `request`. - message Ident { - // Required. Holds a single, unqualified identifier, possibly preceded by a - // '.'. - // - // Qualified names are represented by the [Expr.Select][google.api.expr.v1alpha1.Expr.Select] expression. - string name = 1; - } - - // A field selection expression. e.g. `request.auth`. - message Select { - // Required. The target of the selection expression. - // - // For example, in the select expression `request.auth`, the `request` - // portion of the expression is the `operand`. - Expr operand = 1; - - // Required. The name of the field to select. - // - // For example, in the select expression `request.auth`, the `auth` portion - // of the expression would be the `field`. - string field = 2; - - // Whether the select is to be interpreted as a field presence test. - // - // This results from the macro `has(request.auth)`. - bool test_only = 3; - } - - // A call expression, including calls to predefined functions and operators. - // - // For example, `value == 10`, `size(map_value)`. - message Call { - // The target of an method call-style expression. For example, `x` in - // `x.f()`. - Expr target = 1; - - // Required. The name of the function or method being called. - string function = 2; - - // The arguments. - repeated Expr args = 3; - } - - // A list creation expression. - // - // Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g. - // `dyn([1, 'hello', 2.0])` - message CreateList { - // The elements part of the list. - repeated Expr elements = 1; - } - - // A map or message creation expression. - // - // Maps are constructed as `{'key_name': 'value'}`. Message construction is - // similar, but prefixed with a type name and composed of field ids: - // `types.MyType{field_id: 'value'}`. - message CreateStruct { - // Represents an entry. - message Entry { - // Required. An id assigned to this node by the parser which is unique - // in a given expression tree. This is used to associate type - // information and other attributes to the node. - int64 id = 1; - - // The `Entry` key kinds. - oneof key_kind { - // The field key for a message creator statement. - string field_key = 2; - - // The key expression for a map creation statement. - Expr map_key = 3; - } - - // Required. The value assigned to the key. - Expr value = 4; - } - - // The type name of the message to be created, empty when creating map - // literals. - string message_name = 1; - - // The entries in the creation expression. - repeated Entry entries = 2; - } - - // A comprehension expression applied to a list or map. - // - // Comprehensions are not part of the core syntax, but enabled with macros. - // A macro matches a specific call signature within a parsed AST and replaces - // the call with an alternate AST block. Macro expansion happens at parse - // time. - // - // The following macros are supported within CEL: - // - // Aggregate type macros may be applied to all elements in a list or all keys - // in a map: - // - // * `all`, `exists`, `exists_one` - test a predicate expression against - // the inputs and return `true` if the predicate is satisfied for all, - // any, or only one value `list.all(x, x < 10)`. - // * `filter` - test a predicate expression against the inputs and return - // the subset of elements which satisfy the predicate: - // `payments.filter(p, p > 1000)`. - // * `map` - apply an expression to all elements in the input and return the - // output aggregate type: `[1, 2, 3].map(i, i * i)`. - // - // The `has(m.x)` macro tests whether the property `x` is present in struct - // `m`. The semantics of this macro depend on the type of `m`. For proto2 - // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the - // macro tests whether the property is set to its default. For map and struct - // types, the macro tests whether the property `x` is defined on `m`. - message Comprehension { - // The name of the iteration variable. - string iter_var = 1; - - // The range over which var iterates. - Expr iter_range = 2; - - // The name of the variable used for accumulation of the result. - string accu_var = 3; - - // The initial value of the accumulator. - Expr accu_init = 4; - - // An expression which can contain iter_var and accu_var. - // - // Returns false when the result has been computed and may be used as - // a hint to short-circuit the remainder of the comprehension. - Expr loop_condition = 5; - - // An expression which can contain iter_var and accu_var. - // - // Computes the next value of accu_var. - Expr loop_step = 6; - - // An expression which can contain accu_var. - // - // Computes the result. - Expr result = 7; - } - - // Required. An id assigned to this node by the parser which is unique in a - // given expression tree. This is used to associate type information and other - // attributes to a node in the parse tree. - int64 id = 2; - - // Required. Variants of expressions. - oneof expr_kind { - // A literal expression. - Constant const_expr = 3; - - // An identifier expression. - Ident ident_expr = 4; - - // A field selection expression, e.g. `request.auth`. - Select select_expr = 5; - - // A call expression, including calls to predefined functions and operators. - Call call_expr = 6; - - // A list creation expression. - CreateList list_expr = 7; - - // A map or message creation expression. - CreateStruct struct_expr = 8; - - // A comprehension expression. - Comprehension comprehension_expr = 9; - } -} - -// Represents a primitive literal. -// -// Named 'Constant' here for backwards compatibility. -// -// This is similar as the primitives supported in the well-known type -// `google.protobuf.Value`, but richer so it can represent CEL's full range of -// primitives. -// -// Lists and structs are not included as constants as these aggregate types may -// contain [Expr][google.api.expr.v1alpha1.Expr] elements which require evaluation and are thus not constant. -// -// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`, -// `true`, `null`. -message Constant { - // Required. The valid constant kinds. - oneof constant_kind { - // null value. - google.protobuf.NullValue null_value = 1; - - // boolean value. - bool bool_value = 2; - - // int64 value. - int64 int64_value = 3; - - // uint64 value. - uint64 uint64_value = 4; - - // double value. - double double_value = 5; - - // string value. - string string_value = 6; - - // bytes value. - bytes bytes_value = 7; - - // protobuf.Duration value. - // - // Deprecated: duration is no longer considered a builtin cel type. - google.protobuf.Duration duration_value = 8 [deprecated = true]; - - // protobuf.Timestamp value. - // - // Deprecated: timestamp is no longer considered a builtin cel type. - google.protobuf.Timestamp timestamp_value = 9 [deprecated = true]; - } -} - -// Source information collected at parse time. -message SourceInfo { - // The syntax version of the source, e.g. `cel1`. - string syntax_version = 1; - - // The location name. All position information attached to an expression is - // relative to this location. - // - // The location could be a file, UI element, or similar. For example, - // `acme/app/AnvilPolicy.cel`. - string location = 2; - - // Monotonically increasing list of character offsets where newlines appear. - // - // The line number of a given position is the index `i` where for a given - // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The - // column may be derivd from `id_positions[id] - line_offsets[i]`. - repeated int32 line_offsets = 3; - - // A map from the parse node id (e.g. `Expr.id`) to the character offset - // within source. - map positions = 4; - - // A map from the parse node id where a macro replacement was made to the - // call `Expr` that resulted in a macro expansion. - // - // For example, `has(value.field)` is a function call that is replaced by a - // `test_only` field selection in the AST. Likewise, the call - // `list.exists(e, e > 10)` translates to a comprehension expression. The key - // in the map corresponds to the expression id of the expanded macro, and the - // value is the call `Expr` that was replaced. - map macro_calls = 5; -} - -// A specific position in source. -message SourcePosition { - // The soucre location name (e.g. file name). - string location = 1; - - // The character offset. - int32 offset = 2; - - // The 1-based index of the starting line in the source text - // where the issue occurs, or 0 if unknown. - int32 line = 3; - - // The 0-based index of the starting position within the line of source text - // where the issue occurs. Only meaningful if line is nonzero. - int32 column = 4; -} diff --git a/google/api/expr/v1alpha1/value.proto b/google/api/expr/v1alpha1/value.proto deleted file mode 100644 index a6ba38767e..0000000000 --- a/google/api/expr/v1alpha1/value.proto +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2019 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.api.expr.v1alpha1; - -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr"; -option java_multiple_files = true; -option java_outer_classname = "ValueProto"; -option java_package = "com.google.api.expr.v1alpha1"; - -// Contains representations for CEL runtime values. - -// Represents a CEL value. -// -// This is similar to `google.protobuf.Value`, but can represent CEL's full -// range of values. -message Value { - // Required. The valid kinds of values. - oneof kind { - // Null value. - google.protobuf.NullValue null_value = 1; - - // Boolean value. - bool bool_value = 2; - - // Signed integer value. - int64 int64_value = 3; - - // Unsigned integer value. - uint64 uint64_value = 4; - - // Floating point value. - double double_value = 5; - - // UTF-8 string value. - string string_value = 6; - - // Byte string value. - bytes bytes_value = 7; - - // An enum value. - EnumValue enum_value = 9; - - // The proto message backing an object value. - google.protobuf.Any object_value = 10; - - // Map value. - MapValue map_value = 11; - - // List value. - ListValue list_value = 12; - - // Type value. - string type_value = 15; - } -} - -// An enum value. -message EnumValue { - // The fully qualified name of the enum type. - string type = 1; - - // The value of the enum. - int32 value = 2; -} - -// A list. -// -// Wrapped in a message so 'not set' and empty can be differentiated, which is -// required for use in a 'oneof'. -message ListValue { - // The ordered values in the list. - repeated Value values = 1; -} - -// A map. -// -// Wrapped in a message so 'not set' and empty can be differentiated, which is -// required for use in a 'oneof'. -message MapValue { - // An entry in the map. - message Entry { - // The key. - // - // Must be unique with in the map. - // Currently only boolean, int, uint, and string values can be keys. - Value key = 1; - - // The value. - Value value = 2; - } - - // The set of map entries. - // - // CEL has fewer restrictions on keys, so a protobuf map represenation - // cannot be used. - repeated Entry entries = 1; -} diff --git a/google/api/expr/v1beta1/BUILD.bazel b/google/api/expr/v1beta1/BUILD.bazel deleted file mode 100644 index 819e1364a3..0000000000 --- a/google/api/expr/v1beta1/BUILD.bazel +++ /dev/null @@ -1,91 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -proto_library( - name = "decl_proto", - srcs = ["decl.proto"], - deps = [ - ":expr_proto", - ], -) - -proto_library( - name = "eval_proto", - srcs = ["eval.proto"], - deps = [ - ":value_proto", - "//google/rpc:status_proto", - ], -) - -proto_library( - name = "expr_proto", - srcs = ["expr.proto"], - deps = [ - ":source_proto", - "@com_google_protobuf//:struct_proto", - ], -) - -proto_library( - name = "source_proto", - srcs = ["source.proto"], -) - -proto_library( - name = "value_proto", - srcs = ["value.proto"], - deps = [ - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:struct_proto", - ], -) - -proto_library( - name = "cel_proto", - deps = [ - ":decl_proto", - ":eval_proto", - ":expr_proto", - ":source_proto", - ":value_proto", - "//google/rpc:status_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:struct_proto", - ], -) - -############################################################################## -# C++ -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "cc_proto_library", -) - -cc_proto_library( - name = "decl_cc_proto", - deps = [":decl_proto"], -) - -cc_proto_library( - name = "eval_cc_proto", - deps = [":eval_proto"], -) - -cc_proto_library( - name = "expr_cc_proto", - deps = [":expr_proto"], -) - -cc_proto_library( - name = "source_cc_proto", - deps = [":source_proto"], -) - -cc_proto_library( - name = "value_cc_proto", - deps = [":value_proto"], -) diff --git a/google/api/expr/v1beta1/decl.proto b/google/api/expr/v1beta1/decl.proto deleted file mode 100644 index d3d748b4e4..0000000000 --- a/google/api/expr/v1beta1/decl.proto +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2019 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.api.expr.v1beta1; - -import "google/api/expr/v1beta1/expr.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; -option java_multiple_files = true; -option java_outer_classname = "DeclProto"; -option java_package = "com.google.api.expr.v1beta1"; - -// A declaration. -message Decl { - // The id of the declaration. - int32 id = 1; - - // The name of the declaration. - string name = 2; - - // The documentation string for the declaration. - string doc = 3; - - // The kind of declaration. - oneof kind { - // An identifier declaration. - IdentDecl ident = 4; - - // A function declaration. - FunctionDecl function = 5; - } -} - -// The declared type of a variable. -// -// Extends runtime type values with extra information used for type checking -// and dispatching. -message DeclType { - // The expression id of the declared type, if applicable. - int32 id = 1; - - // The type name, e.g. 'int', 'my.type.Type' or 'T' - string type = 2; - - // An ordered list of type parameters, e.g. ``. - // Only applies to a subset of types, e.g. `map`, `list`. - repeated DeclType type_params = 4; -} - -// An identifier declaration. -message IdentDecl { - // Optional type of the identifier. - DeclType type = 3; - - // Optional value of the identifier. - Expr value = 4; -} - -// A function declaration. -message FunctionDecl { - // The function arguments. - repeated IdentDecl args = 1; - - // Optional declared return type. - DeclType return_type = 2; - - // If the first argument of the function is the receiver. - bool receiver_function = 3; -} diff --git a/google/api/expr/v1beta1/eval.proto b/google/api/expr/v1beta1/eval.proto deleted file mode 100644 index 0c6c4d98e4..0000000000 --- a/google/api/expr/v1beta1/eval.proto +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2019 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.api.expr.v1beta1; - -import "google/api/expr/v1beta1/value.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; -option java_multiple_files = true; -option java_outer_classname = "EvalProto"; -option java_package = "com.google.api.expr.v1beta1"; - -// The state of an evaluation. -// -// Can represent an initial, partial, or completed state of evaluation. -message EvalState { - // A single evaluation result. - message Result { - // The expression this result is for. - IdRef expr = 1; - - // The index in `values` of the resulting value. - int32 value = 2; - } - - // The unique values referenced in this message. - repeated ExprValue values = 1; - - // An ordered list of results. - // - // Tracks the flow of evaluation through the expression. - // May be sparse. - repeated Result results = 3; -} - -// The value of an evaluated expression. -message ExprValue { - // An expression can resolve to a value, error or unknown. - oneof kind { - // A concrete value. - Value value = 1; - - // The set of errors in the critical path of evalution. - // - // Only errors in the critical path are included. For example, - // `( || true) && ` will only result in ``, - // while ` || ` will result in both `` and - // ``. - // - // Errors cause by the presence of other errors are not included in the - // set. For example `.foo`, `foo()`, and ` + 1` will - // only result in ``. - // - // Multiple errors *might* be included when evaluation could result - // in different errors. For example ` + ` and - // `foo(, )` may result in ``, `` or both. - // The exact subset of errors included for this case is unspecified and - // depends on the implementation details of the evaluator. - ErrorSet error = 2; - - // The set of unknowns in the critical path of evaluation. - // - // Unknown behaves identically to Error with regards to propagation. - // Specifically, only unknowns in the critical path are included, unknowns - // caused by the presence of other unknowns are not included, and multiple - // unknowns *might* be included included when evaluation could result in - // different unknowns. For example: - // - // ( || true) && -> - // || -> - // .foo -> - // foo() -> - // + -> or - // - // Unknown takes precidence over Error in cases where a `Value` can short - // circuit the result: - // - // || -> - // && -> - // - // Errors take precidence in all other cases: - // - // + -> - // foo(, ) -> - UnknownSet unknown = 3; - } -} - -// A set of errors. -// -// The errors included depend on the context. See `ExprValue.error`. -message ErrorSet { - // The errors in the set. - repeated google.rpc.Status errors = 1; -} - -// A set of expressions for which the value is unknown. -// -// The unknowns included depend on the context. See `ExprValue.unknown`. -message UnknownSet { - // The ids of the expressions with unknown values. - repeated IdRef exprs = 1; -} - -// A reference to an expression id. -message IdRef { - // The expression id. - int32 id = 1; -} diff --git a/google/api/expr/v1beta1/expr.proto b/google/api/expr/v1beta1/expr.proto deleted file mode 100644 index 77249bafc5..0000000000 --- a/google/api/expr/v1beta1/expr.proto +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2019 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.api.expr.v1beta1; - -import "google/api/expr/v1beta1/source.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; -option java_multiple_files = true; -option java_outer_classname = "ExprProto"; -option java_package = "com.google.api.expr.v1beta1"; - -// An expression together with source information as returned by the parser. -message ParsedExpr { - // The parsed expression. - Expr expr = 2; - - // The source info derived from input that generated the parsed `expr`. - SourceInfo source_info = 3; - - // The syntax version of the source, e.g. `cel1`. - string syntax_version = 4; -} - -// An abstract representation of a common expression. -// -// Expressions are abstractly represented as a collection of identifiers, -// select statements, function calls, literals, and comprehensions. All -// operators with the exception of the '.' operator are modelled as function -// calls. This makes it easy to represent new operators into the existing AST. -// -// All references within expressions must resolve to a [Decl][google.api.expr.v1beta1.Decl] provided at -// type-check for an expression to be valid. A reference may either be a bare -// identifier `name` or a qualified identifier `google.api.name`. References -// may either refer to a value or a function declaration. -// -// For example, the expression `google.api.name.startsWith('expr')` references -// the declaration `google.api.name` within a [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression, and -// the function declaration `startsWith`. -message Expr { - // An identifier expression. e.g. `request`. - message Ident { - // Required. Holds a single, unqualified identifier, possibly preceded by a - // '.'. - // - // Qualified names are represented by the [Expr.Select][google.api.expr.v1beta1.Expr.Select] expression. - string name = 1; - } - - // A field selection expression. e.g. `request.auth`. - message Select { - // Required. The target of the selection expression. - // - // For example, in the select expression `request.auth`, the `request` - // portion of the expression is the `operand`. - Expr operand = 1; - - // Required. The name of the field to select. - // - // For example, in the select expression `request.auth`, the `auth` portion - // of the expression would be the `field`. - string field = 2; - - // Whether the select is to be interpreted as a field presence test. - // - // This results from the macro `has(request.auth)`. - bool test_only = 3; - } - - // A call expression, including calls to predefined functions and operators. - // - // For example, `value == 10`, `size(map_value)`. - message Call { - // The target of an method call-style expression. For example, `x` in - // `x.f()`. - Expr target = 1; - - // Required. The name of the function or method being called. - string function = 2; - - // The arguments. - repeated Expr args = 3; - } - - // A list creation expression. - // - // Lists may either be homogenous, e.g. `[1, 2, 3]`, or heterogenous, e.g. - // `dyn([1, 'hello', 2.0])` - message CreateList { - // The elements part of the list. - repeated Expr elements = 1; - } - - // A map or message creation expression. - // - // Maps are constructed as `{'key_name': 'value'}`. Message construction is - // similar, but prefixed with a type name and composed of field ids: - // `types.MyType{field_id: 'value'}`. - message CreateStruct { - // Represents an entry. - message Entry { - // Required. An id assigned to this node by the parser which is unique - // in a given expression tree. This is used to associate type - // information and other attributes to the node. - int32 id = 1; - - // The `Entry` key kinds. - oneof key_kind { - // The field key for a message creator statement. - string field_key = 2; - - // The key expression for a map creation statement. - Expr map_key = 3; - } - - // Required. The value assigned to the key. - Expr value = 4; - } - - // The type name of the message to be created, empty when creating map - // literals. - string type = 1; - - // The entries in the creation expression. - repeated Entry entries = 2; - } - - // A comprehension expression applied to a list or map. - // - // Comprehensions are not part of the core syntax, but enabled with macros. - // A macro matches a specific call signature within a parsed AST and replaces - // the call with an alternate AST block. Macro expansion happens at parse - // time. - // - // The following macros are supported within CEL: - // - // Aggregate type macros may be applied to all elements in a list or all keys - // in a map: - // - // * `all`, `exists`, `exists_one` - test a predicate expression against - // the inputs and return `true` if the predicate is satisfied for all, - // any, or only one value `list.all(x, x < 10)`. - // * `filter` - test a predicate expression against the inputs and return - // the subset of elements which satisfy the predicate: - // `payments.filter(p, p > 1000)`. - // * `map` - apply an expression to all elements in the input and return the - // output aggregate type: `[1, 2, 3].map(i, i * i)`. - // - // The `has(m.x)` macro tests whether the property `x` is present in struct - // `m`. The semantics of this macro depend on the type of `m`. For proto2 - // messages `has(m.x)` is defined as 'defined, but not set`. For proto3, the - // macro tests whether the property is set to its default. For map and struct - // types, the macro tests whether the property `x` is defined on `m`. - message Comprehension { - // The name of the iteration variable. - string iter_var = 1; - - // The range over which var iterates. - Expr iter_range = 2; - - // The name of the variable used for accumulation of the result. - string accu_var = 3; - - // The initial value of the accumulator. - Expr accu_init = 4; - - // An expression which can contain iter_var and accu_var. - // - // Returns false when the result has been computed and may be used as - // a hint to short-circuit the remainder of the comprehension. - Expr loop_condition = 5; - - // An expression which can contain iter_var and accu_var. - // - // Computes the next value of accu_var. - Expr loop_step = 6; - - // An expression which can contain accu_var. - // - // Computes the result. - Expr result = 7; - } - - // Required. An id assigned to this node by the parser which is unique in a - // given expression tree. This is used to associate type information and other - // attributes to a node in the parse tree. - int32 id = 2; - - // Required. Variants of expressions. - oneof expr_kind { - // A literal expression. - Literal literal_expr = 3; - - // An identifier expression. - Ident ident_expr = 4; - - // A field selection expression, e.g. `request.auth`. - Select select_expr = 5; - - // A call expression, including calls to predefined functions and operators. - Call call_expr = 6; - - // A list creation expression. - CreateList list_expr = 7; - - // A map or object creation expression. - CreateStruct struct_expr = 8; - - // A comprehension expression. - Comprehension comprehension_expr = 9; - } -} - -// Represents a primitive literal. -// -// This is similar to the primitives supported in the well-known type -// `google.protobuf.Value`, but richer so it can represent CEL's full range of -// primitives. -// -// Lists and structs are not included as constants as these aggregate types may -// contain [Expr][google.api.expr.v1beta1.Expr] elements which require evaluation and are thus not constant. -// -// Examples of literals include: `"hello"`, `b'bytes'`, `1u`, `4.2`, `-2`, -// `true`, `null`. -message Literal { - // Required. The valid constant kinds. - oneof constant_kind { - // null value. - google.protobuf.NullValue null_value = 1; - - // boolean value. - bool bool_value = 2; - - // int64 value. - int64 int64_value = 3; - - // uint64 value. - uint64 uint64_value = 4; - - // double value. - double double_value = 5; - - // string value. - string string_value = 6; - - // bytes value. - bytes bytes_value = 7; - } -} diff --git a/google/api/expr/v1beta1/source.proto b/google/api/expr/v1beta1/source.proto deleted file mode 100644 index 78bb0a064c..0000000000 --- a/google/api/expr/v1beta1/source.proto +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2019 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.api.expr.v1beta1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; -option java_multiple_files = true; -option java_outer_classname = "SourceProto"; -option java_package = "com.google.api.expr.v1beta1"; - -// Source information collected at parse time. -message SourceInfo { - // The location name. All position information attached to an expression is - // relative to this location. - // - // The location could be a file, UI element, or similar. For example, - // `acme/app/AnvilPolicy.cel`. - string location = 2; - - // Monotonically increasing list of character offsets where newlines appear. - // - // The line number of a given position is the index `i` where for a given - // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The - // column may be derivd from `id_positions[id] - line_offsets[i]`. - repeated int32 line_offsets = 3; - - // A map from the parse node id (e.g. `Expr.id`) to the character offset - // within source. - map positions = 4; -} - -// A specific position in source. -message SourcePosition { - // The soucre location name (e.g. file name). - string location = 1; - - // The character offset. - int32 offset = 2; - - // The 1-based index of the starting line in the source text - // where the issue occurs, or 0 if unknown. - int32 line = 3; - - // The 0-based index of the starting position within the line of source text - // where the issue occurs. Only meaningful if line is nonzer.. - int32 column = 4; -} diff --git a/google/api/expr/v1beta1/value.proto b/google/api/expr/v1beta1/value.proto deleted file mode 100644 index 0978228dcd..0000000000 --- a/google/api/expr/v1beta1/value.proto +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2019 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.api.expr.v1beta1; - -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; -option java_multiple_files = true; -option java_outer_classname = "ValueProto"; -option java_package = "com.google.api.expr.v1beta1"; - -// Represents a CEL value. -// -// This is similar to `google.protobuf.Value`, but can represent CEL's full -// range of values. -message Value { - // Required. The valid kinds of values. - oneof kind { - // Null value. - google.protobuf.NullValue null_value = 1; - - // Boolean value. - bool bool_value = 2; - - // Signed integer value. - int64 int64_value = 3; - - // Unsigned integer value. - uint64 uint64_value = 4; - - // Floating point value. - double double_value = 5; - - // UTF-8 string value. - string string_value = 6; - - // Byte string value. - bytes bytes_value = 7; - - // An enum value. - EnumValue enum_value = 9; - - // The proto message backing an object value. - google.protobuf.Any object_value = 10; - - // Map value. - MapValue map_value = 11; - - // List value. - ListValue list_value = 12; - - // A Type value represented by the fully qualified name of the type. - string type_value = 15; - } -} - -// An enum value. -message EnumValue { - // The fully qualified name of the enum type. - string type = 1; - - // The value of the enum. - int32 value = 2; -} - -// A list. -// -// Wrapped in a message so 'not set' and empty can be differentiated, which is -// required for use in a 'oneof'. -message ListValue { - // The ordered values in the list. - repeated Value values = 1; -} - -// A map. -// -// Wrapped in a message so 'not set' and empty can be differentiated, which is -// required for use in a 'oneof'. -message MapValue { - // An entry in the map. - message Entry { - // The key. - // - // Must be unique with in the map. - // Currently only boolean, int, uint, and string values can be keys. - Value key = 1; - - // The value. - Value value = 2; - } - - // The set of map entries. - // - // CEL has fewer restrictions on keys, so a protobuf map represenation - // cannot be used. - repeated Entry entries = 1; -} diff --git a/google/api/field_behavior.proto b/google/api/field_behavior.proto deleted file mode 100644 index eb7f78ef1d..0000000000 --- a/google/api/field_behavior.proto +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2019 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.api; - -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "FieldBehaviorProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.FieldOptions { - // A designation of a specific field behavior (required, output only, etc.) - // in protobuf messages. - // - // Examples: - // - // string name = 1 [(google.api.field_behavior) = REQUIRED]; - // State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - // google.protobuf.Duration ttl = 1 - // [(google.api.field_behavior) = INPUT_ONLY]; - // google.protobuf.Timestamp expire_time = 1 - // [(google.api.field_behavior) = OUTPUT_ONLY, - // (google.api.field_behavior) = IMMUTABLE]; - repeated google.api.FieldBehavior field_behavior = 1052; -} - -// An indicator of the behavior of a given field (for example, that a field -// is required in requests, or given as output but ignored as input). -// This **does not** change the behavior in protocol buffers itself; it only -// denotes the behavior and may affect how API tooling handles the field. -// -// Note: This enum **may** receive new values in the future. -enum FieldBehavior { - // Conventional default for enums. Do not use this. - FIELD_BEHAVIOR_UNSPECIFIED = 0; - - // Specifically denotes a field as optional. - // While all fields in protocol buffers are optional, this may be specified - // for emphasis if appropriate. - OPTIONAL = 1; - - // Denotes a field as required. - // This indicates that the field **must** be provided as part of the request, - // and failure to do so will cause an error (usually `INVALID_ARGUMENT`). - REQUIRED = 2; - - // Denotes a field as output only. - // This indicates that the field is provided in responses, but including the - // field in a request does nothing (the server *must* ignore it and - // *must not* throw an error as a result of the field's presence). - OUTPUT_ONLY = 3; - - // Denotes a field as input only. - // This indicates that the field is provided in requests, and the - // corresponding field is not included in output. - INPUT_ONLY = 4; - - // Denotes a field as immutable. - // This indicates that the field may be set once in a request to create a - // resource, but may not be changed thereafter. - IMMUTABLE = 5; -} diff --git a/google/api/http.proto b/google/api/http.proto deleted file mode 100644 index b2977f5147..0000000000 --- a/google/api/http.proto +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright 2019 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.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "HttpProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Defines the HTTP configuration for an API service. It contains a list of -// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method -// to one or more HTTP REST API methods. -message Http { - // A list of HTTP configuration rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated HttpRule rules = 1; - - // When set to true, URL path parameters will be fully URI-decoded except in - // cases of single segment matches in reserved expansion, where "%2F" will be - // left encoded. - // - // The default behavior is to not decode RFC 6570 reserved characters in multi - // segment matches. - bool fully_decode_reserved_expansion = 2; -} - -// # gRPC Transcoding -// -// gRPC Transcoding is a feature for mapping between a gRPC method and one or -// more HTTP REST endpoints. It allows developers to build a single API service -// that supports both gRPC APIs and REST APIs. Many systems, including [Google -// APIs](https://github.com/googleapis/googleapis), -// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC -// Gateway](https://github.com/grpc-ecosystem/grpc-gateway), -// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature -// and use it for large scale production services. -// -// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies -// how different portions of the gRPC request message are mapped to the URL -// path, URL query parameters, and HTTP request body. It also controls how the -// gRPC response message is mapped to the HTTP response body. `HttpRule` is -// typically specified as an `google.api.http` annotation on the gRPC method. -// -// Each mapping specifies a URL path template and an HTTP method. The path -// template may refer to one or more fields in the gRPC request message, as long -// as each field is a non-repeated field with a primitive (non-message) type. -// The path template controls how fields of the request message are mapped to -// the URL path. -// -// Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/{name=messages/*}" -// }; -// } -// } -// message GetMessageRequest { -// string name = 1; // Mapped to URL path. -// } -// message Message { -// string text = 1; // The resource content. -// } -// -// This enables an HTTP REST to gRPC mapping as below: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` -// -// Any fields in the request message which are not bound by the path template -// automatically become HTTP query parameters if there is no HTTP request body. -// For example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get:"/v1/messages/{message_id}" -// }; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // Mapped to URL path. -// int64 revision = 2; // Mapped to URL query parameter `revision`. -// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. -// } -// -// This enables a HTTP JSON to RPC mapping as below: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | -// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: -// "foo"))` -// -// Note that fields which are mapped to URL query parameters must have a -// primitive type or a repeated primitive type or a non-repeated message type. -// In the case of a repeated type, the parameter can be repeated in the URL -// as `...?param=A¶m=B`. In the case of a message type, each field of the -// message is mapped to a separate parameter, such as -// `...?foo.a=A&foo.b=B&foo.c=C`. -// -// For HTTP methods that allow a request body, the `body` field -// specifies the mapping. Consider a REST update method on the -// message resource collection: -// -// service Messaging { -// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { -// option (google.api.http) = { -// patch: "/v1/messages/{message_id}" -// body: "message" -// }; -// } -// } -// message UpdateMessageRequest { -// string message_id = 1; // mapped to the URL -// Message message = 2; // mapped to the body -// } -// -// The following HTTP JSON to RPC mapping is enabled, where the -// representation of the JSON in the request body is determined by -// protos JSON encoding: -// -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" message { text: "Hi!" })` -// -// The special name `*` can be used in the body mapping to define that -// every field not bound by the path template should be mapped to the -// request body. This enables the following alternative definition of -// the update method: -// -// service Messaging { -// rpc UpdateMessage(Message) returns (Message) { -// option (google.api.http) = { -// patch: "/v1/messages/{message_id}" -// body: "*" -// }; -// } -// } -// message Message { -// string message_id = 1; -// string text = 2; -// } -// -// -// The following HTTP JSON to RPC mapping is enabled: -// -// HTTP | gRPC -// -----|----- -// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: -// "123456" text: "Hi!")` -// -// Note that when using `*` in the body mapping, it is not possible to -// have HTTP parameters, as all fields not bound by the path end in -// the body. This makes this option more rarely used in practice when -// defining REST APIs. The common usage of `*` is in custom methods -// which don't use the URL at all for transferring data. -// -// It is possible to define multiple HTTP methods for one RPC by using -// the `additional_bindings` option. Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/messages/{message_id}" -// additional_bindings { -// get: "/v1/users/{user_id}/messages/{message_id}" -// } -// }; -// } -// } -// message GetMessageRequest { -// string message_id = 1; -// string user_id = 2; -// } -// -// This enables the following two alternative HTTP JSON to RPC mappings: -// -// HTTP | gRPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: -// "123456")` -// -// ## Rules for HTTP mapping -// -// 1. Leaf request fields (recursive expansion nested messages in the request -// message) are classified into three categories: -// - Fields referred by the path template. They are passed via the URL path. -// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP -// request body. -// - All other fields are passed via the URL query parameters, and the -// parameter name is the field path in the request message. A repeated -// field can be represented as multiple query parameters under the same -// name. -// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields -// are passed via URL path and HTTP request body. -// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all -// fields are passed via URL path and URL query parameters. -// -// ### Path template syntax -// -// Template = "/" Segments [ Verb ] ; -// Segments = Segment { "/" Segment } ; -// Segment = "*" | "**" | LITERAL | Variable ; -// Variable = "{" FieldPath [ "=" Segments ] "}" ; -// FieldPath = IDENT { "." IDENT } ; -// Verb = ":" LITERAL ; -// -// The syntax `*` matches a single URL path segment. The syntax `**` matches -// zero or more URL path segments, which must be the last part of the URL path -// except the `Verb`. -// -// The syntax `Variable` matches part of the URL path as specified by its -// template. A variable template must not contain other variables. If a variable -// matches a single path segment, its template may be omitted, e.g. `{var}` -// is equivalent to `{var=*}`. -// -// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` -// contains any reserved character, such characters should be percent-encoded -// before the matching. -// -// If a variable contains exactly one path segment, such as `"{var}"` or -// `"{var=*}"`, when such a variable is expanded into a URL path on the client -// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The -// server side does the reverse decoding. Such variables show up in the -// [Discovery -// Document](https://developers.google.com/discovery/v1/reference/apis) as -// `{var}`. -// -// If a variable contains multiple path segments, such as `"{var=foo/*}"` -// or `"{var=**}"`, when such a variable is expanded into a URL path on the -// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. -// The server side does the reverse decoding, except "%2F" and "%2f" are left -// unchanged. Such variables show up in the -// [Discovery -// Document](https://developers.google.com/discovery/v1/reference/apis) as -// `{+var}`. -// -// ## Using gRPC API Service Configuration -// -// gRPC API Service Configuration (service config) is a configuration language -// for configuring a gRPC service to become a user-facing product. The -// service config is simply the YAML representation of the `google.api.Service` -// proto message. -// -// As an alternative to annotating your proto file, you can configure gRPC -// transcoding in your service config YAML files. You do this by specifying a -// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same -// effect as the proto annotation. This can be particularly useful if you -// have a proto that is reused in multiple services. Note that any transcoding -// specified in the service config will override any matching transcoding -// configuration in the proto. -// -// Example: -// -// http: -// rules: -// # Selects a gRPC method and applies HttpRule to it. -// - selector: example.v1.Messaging.GetMessage -// get: /v1/messages/{message_id}/{sub.subfield} -// -// ## Special notes -// -// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the -// proto to JSON conversion must follow the [proto3 -// specification](https://developers.google.com/protocol-buffers/docs/proto3#json). -// -// While the single segment variable follows the semantics of -// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String -// Expansion, the multi segment variable **does not** follow RFC 6570 Section -// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion -// does not expand special characters like `?` and `#`, which would lead -// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding -// for multi segment variables. -// -// The path variables **must not** refer to any repeated or mapped field, -// because client libraries are not capable of handling such variable expansion. -// -// The path variables **must not** capture the leading "/" character. The reason -// is that the most common use case "{var}" does not capture the leading "/" -// character. For consistency, all path variables must share the same behavior. -// -// Repeated message fields must not be mapped to URL query parameters, because -// no client library can support such complicated mapping. -// -// If an API needs to use a JSON array for request or response body, it can map -// the request or response body to a repeated field. However, some gRPC -// Transcoding implementations may not support this feature. -message HttpRule { - // Selects a method to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Determines the URL pattern is matched by this rules. This pattern can be - // used with any of the {get|put|post|delete|patch} methods. A custom method - // can be defined using the 'custom' field. - oneof pattern { - // Maps to HTTP GET. Used for listing and getting information about - // resources. - string get = 2; - - // Maps to HTTP PUT. Used for replacing a resource. - string put = 3; - - // Maps to HTTP POST. Used for creating a resource or performing an action. - string post = 4; - - // Maps to HTTP DELETE. Used for deleting a resource. - string delete = 5; - - // Maps to HTTP PATCH. Used for updating a resource. - string patch = 6; - - // The custom pattern is used for specifying an HTTP method that is not - // included in the `pattern` field, such as HEAD, or "*" to leave the - // HTTP method unspecified for this rule. The wild-card rule is useful - // for services that provide content to Web (HTML) clients. - CustomHttpPattern custom = 8; - } - - // The name of the request field whose value is mapped to the HTTP request - // body, or `*` for mapping all request fields not captured by the path - // pattern to the HTTP body, or omitted for not having any HTTP request body. - // - // NOTE: the referred field must be present at the top-level of the request - // message type. - string body = 7; - - // Optional. The name of the response field whose value is mapped to the HTTP - // response body. When omitted, the entire response message will be used - // as the HTTP response body. - // - // NOTE: The referred field must be present at the top-level of the response - // message type. - string response_body = 12; - - // Additional HTTP bindings for the selector. Nested bindings must - // not contain an `additional_bindings` field themselves (that is, - // the nesting may only be one level deep). - repeated HttpRule additional_bindings = 11; -} - -// A custom pattern is used for defining custom HTTP verb. -message CustomHttpPattern { - // The name of this custom HTTP verb. - string kind = 1; - - // The path matched by this custom verb. - string path = 2; -} diff --git a/google/api/httpbody.proto b/google/api/httpbody.proto deleted file mode 100644 index 45c1e76b1d..0000000000 --- a/google/api/httpbody.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2019 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.api; - -import "google/protobuf/any.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; -option java_multiple_files = true; -option java_outer_classname = "HttpBodyProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Message that represents an arbitrary HTTP body. It should only be used for -// payload formats that can't be represented as JSON, such as raw binary or -// an HTML page. -// -// -// This message can be used both in streaming and non-streaming API methods in -// the request as well as the response. -// -// It can be used as a top-level request field, which is convenient if one -// wants to extract parameters from either the URL or HTTP template into the -// request fields and also want access to the raw HTTP body. -// -// Example: -// -// message GetResourceRequest { -// // A unique request id. -// string request_id = 1; -// -// // The raw HTTP body is bound to this field. -// google.api.HttpBody http_body = 2; -// } -// -// service ResourceService { -// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); -// rpc UpdateResource(google.api.HttpBody) returns -// (google.protobuf.Empty); -// } -// -// Example with streaming methods: -// -// service CaldavService { -// rpc GetCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// rpc UpdateCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// } -// -// Use of this type only changes how the request and response bodies are -// handled, all other features will continue to work unchanged. -message HttpBody { - // The HTTP Content-Type header value specifying the content type of the body. - string content_type = 1; - - // The HTTP request/response body as raw binary. - bytes data = 2; - - // Application specific response metadata. Must be set in the first response - // for streaming APIs. - repeated google.protobuf.Any extensions = 3; -} diff --git a/google/api/label.proto b/google/api/label.proto deleted file mode 100644 index 668efd1c6b..0000000000 --- a/google/api/label.proto +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2019 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.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/label;label"; -option java_multiple_files = true; -option java_outer_classname = "LabelProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// A description of a label. -message LabelDescriptor { - // Value types that can be used as label values. - enum ValueType { - // A variable-length string. This is the default. - STRING = 0; - - // Boolean; true or false. - BOOL = 1; - - // A 64-bit signed integer. - INT64 = 2; - } - - // The label key. - string key = 1; - - // The type of data that can be assigned to the label. - ValueType value_type = 2; - - // A human-readable description for the label. - string description = 3; -} diff --git a/google/api/launch_stage.proto b/google/api/launch_stage.proto deleted file mode 100644 index 55fd914242..0000000000 --- a/google/api/launch_stage.proto +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api;api"; -option java_multiple_files = true; -option java_outer_classname = "LaunchStageProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// The launch stage as defined by [Google Cloud Platform -// Launch Stages](http://cloud.google.com/terms/launch-stages). -enum LaunchStage { - // Do not use this default value. - LAUNCH_STAGE_UNSPECIFIED = 0; - - // Early Access features are limited to a closed group of testers. To use - // these features, you must sign up in advance and sign a Trusted Tester - // agreement (which includes confidentiality provisions). These features may - // be unstable, changed in backward-incompatible ways, and are not - // guaranteed to be released. - EARLY_ACCESS = 1; - - // Alpha is a limited availability test for releases before they are cleared - // for widespread use. By Alpha, all significant design issues are resolved - // and we are in the process of verifying functionality. Alpha customers - // need to apply for access, agree to applicable terms, and have their - // projects whitelisted. Alpha releases don’t have to be feature complete, - // no SLAs are provided, and there are no technical support obligations, but - // they will be far enough along that customers can actually use them in - // test environments or for limited-use tests -- just like they would in - // normal production cases. - ALPHA = 2; - - // Beta is the point at which we are ready to open a release for any - // customer to use. There are no SLA or technical support obligations in a - // Beta release. Products will be complete from a feature perspective, but - // may have some open outstanding issues. Beta releases are suitable for - // limited production use cases. - BETA = 3; - - // GA features are open to all developers and are considered stable and - // fully qualified for production use. - GA = 4; - - // Deprecated features are scheduled to be shut down and removed. For more - // information, see the “Deprecation Policy” section of our [Terms of - // Service](https://cloud.google.com/terms/) - // and the [Google Cloud Platform Subject to the Deprecation - // Policy](https://cloud.google.com/terms/deprecation) documentation. - DEPRECATED = 5; -} diff --git a/google/api/log.proto b/google/api/log.proto deleted file mode 100644 index 1125e1fe30..0000000000 --- a/google/api/log.proto +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2019 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.api; - -import "google/api/label.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "LogProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// A description of a log type. Example in YAML format: -// -// - name: library.googleapis.com/activity_history -// description: The history of borrowing and returning library items. -// display_name: Activity -// labels: -// - key: /customer_id -// description: Identifier of a library customer -message LogDescriptor { - // The name of the log. It must be less than 512 characters long and can - // include the following characters: upper- and lower-case alphanumeric - // characters [A-Za-z0-9], and punctuation characters including - // slash, underscore, hyphen, period [/_-.]. - string name = 1; - - // The set of labels that are available to describe a specific log entry. - // Runtime requests that contain labels not specified here are - // considered invalid. - repeated LabelDescriptor labels = 2; - - // A human-readable description of this log. This information appears in - // the documentation and can contain details. - string description = 3; - - // The human-readable name for this log. This information appears on - // the user interface and should be concise. - string display_name = 4; -} diff --git a/google/api/logging.proto b/google/api/logging.proto deleted file mode 100644 index 9090b2a1cd..0000000000 --- a/google/api/logging.proto +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "LoggingProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Logging configuration of the service. -// -// The following example shows how to configure logs to be sent to the -// producer and consumer projects. In the example, the `activity_history` -// log is sent to both the producer and consumer projects, whereas the -// `purchase_history` log is only sent to the producer project. -// -// monitored_resources: -// - type: library.googleapis.com/branch -// labels: -// - key: /city -// description: The city where the library branch is located in. -// - key: /name -// description: The name of the branch. -// logs: -// - name: activity_history -// labels: -// - key: /customer_id -// - name: purchase_history -// logging: -// producer_destinations: -// - monitored_resource: library.googleapis.com/branch -// logs: -// - activity_history -// - purchase_history -// consumer_destinations: -// - monitored_resource: library.googleapis.com/branch -// logs: -// - activity_history -message Logging { - // Configuration of a specific logging destination (the producer project - // or the consumer project). - message LoggingDestination { - // The monitored resource type. The type must be defined in the - // [Service.monitored_resources][google.api.Service.monitored_resources] section. - string monitored_resource = 3; - - // Names of the logs to be sent to this destination. Each name must - // be defined in the [Service.logs][google.api.Service.logs] section. If the log name is - // not a domain scoped name, it will be automatically prefixed with - // the service name followed by "/". - repeated string logs = 1; - } - - // Logging configurations for sending logs to the producer project. - // There can be multiple producer destinations, each one must have a - // different monitored resource type. A log can be used in at most - // one producer destination. - repeated LoggingDestination producer_destinations = 1; - - // Logging configurations for sending logs to the consumer project. - // There can be multiple consumer destinations, each one must have a - // different monitored resource type. A log can be used in at most - // one consumer destination. - repeated LoggingDestination consumer_destinations = 2; -} diff --git a/google/api/metric.proto b/google/api/metric.proto deleted file mode 100644 index 78c3826b6c..0000000000 --- a/google/api/metric.proto +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2019 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.api; - -import "google/api/label.proto"; -import "google/api/launch_stage.proto"; -import "google/protobuf/duration.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/metric;metric"; -option java_multiple_files = true; -option java_outer_classname = "MetricProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Defines a metric type and its schema. Once a metric descriptor is created, -// deleting or altering it stops data collection and makes the metric type's -// existing data unusable. -message MetricDescriptor { - // Additional annotations that can be used to guide the usage of a metric. - message MetricDescriptorMetadata { - // Deprecated. Please use the MetricDescriptor.launch_stage instead. - // The launch stage of the metric definition. - LaunchStage launch_stage = 1 [deprecated = true]; - - // The sampling period of metric data points. For metrics which are written - // periodically, consecutive data points are stored at this time interval, - // excluding data loss due to errors. Metrics with a higher granularity have - // a smaller sampling period. - google.protobuf.Duration sample_period = 2; - - // The delay of data points caused by ingestion. Data points older than this - // age are guaranteed to be ingested and available to be read, excluding - // data loss due to errors. - google.protobuf.Duration ingest_delay = 3; - } - - // The kind of measurement. It describes how the data is reported. - enum MetricKind { - // Do not use this default value. - METRIC_KIND_UNSPECIFIED = 0; - - // An instantaneous measurement of a value. - GAUGE = 1; - - // The change in a value during a time interval. - DELTA = 2; - - // A value accumulated over a time interval. Cumulative - // measurements in a time series should have the same start time - // and increasing end times, until an event resets the cumulative - // value to zero and sets a new start time for the following - // points. - CUMULATIVE = 3; - } - - // The value type of a metric. - enum ValueType { - // Do not use this default value. - VALUE_TYPE_UNSPECIFIED = 0; - - // The value is a boolean. - // This value type can be used only if the metric kind is `GAUGE`. - BOOL = 1; - - // The value is a signed 64-bit integer. - INT64 = 2; - - // The value is a double precision floating point number. - DOUBLE = 3; - - // The value is a text string. - // This value type can be used only if the metric kind is `GAUGE`. - STRING = 4; - - // The value is a [`Distribution`][google.api.Distribution]. - DISTRIBUTION = 5; - - // The value is money. - MONEY = 6; - } - - // The resource name of the metric descriptor. - string name = 1; - - // The metric type, including its DNS name prefix. The type is not - // URL-encoded. All user-defined metric types have the DNS name - // `custom.googleapis.com` or `external.googleapis.com`. Metric types should - // use a natural hierarchical grouping. For example: - // - // "custom.googleapis.com/invoice/paid/amount" - // "external.googleapis.com/prometheus/up" - // "appengine.googleapis.com/http/server/response_latencies" - string type = 8; - - // The set of labels that can be used to describe a specific - // instance of this metric type. For example, the - // `appengine.googleapis.com/http/server/response_latencies` metric - // type has a label for the HTTP response code, `response_code`, so - // you can look at latencies for successful responses or just - // for responses that failed. - repeated LabelDescriptor labels = 2; - - // Whether the metric records instantaneous values, changes to a value, etc. - // Some combinations of `metric_kind` and `value_type` might not be supported. - MetricKind metric_kind = 3; - - // Whether the measurement is an integer, a floating-point number, etc. - // Some combinations of `metric_kind` and `value_type` might not be supported. - ValueType value_type = 4; - - // The units in which the metric value is reported. It is only applicable - // if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` - // defines the representation of the stored metric values. - // - // Different systems may scale the values to be more easily displayed (so a - // value of `0.02KBy` _might_ be displayed as `20By`, and a value of - // `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is - // `KBy`, then the value of the metric is always in thousands of bytes, no - // matter how it may be displayed.. - // - // If you want a custom metric to record the exact number of CPU-seconds used - // by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is - // `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005 - // CPU-seconds, then the value is written as `12005`. - // - // Alternatively, if you want a custome metric to record data in a more - // granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is - // `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`), - // or use `Kis{CPU}` and write `11.723` (which is `12005/1024`). - // - // The supported units are a subset of [The Unified Code for Units of - // Measure](http://unitsofmeasure.org/ucum.html) standard: - // - // **Basic units (UNIT)** - // - // * `bit` bit - // * `By` byte - // * `s` second - // * `min` minute - // * `h` hour - // * `d` day - // - // **Prefixes (PREFIX)** - // - // * `k` kilo (10^3) - // * `M` mega (10^6) - // * `G` giga (10^9) - // * `T` tera (10^12) - // * `P` peta (10^15) - // * `E` exa (10^18) - // * `Z` zetta (10^21) - // * `Y` yotta (10^24) - - // * `m` milli (10^-3) - // * `u` micro (10^-6) - // * `n` nano (10^-9) - // * `p` pico (10^-12) - // * `f` femto (10^-15) - // * `a` atto (10^-18) - // * `z` zepto (10^-21) - // * `y` yocto (10^-24) - - // * `Ki` kibi (2^10) - // * `Mi` mebi (2^20) - // * `Gi` gibi (2^30) - // * `Ti` tebi (2^40) - // * `Pi` pebi (2^50) - // - // **Grammar** - // - // The grammar also includes these connectors: - // - // * `/` division or ratio (as an infix operator). For examples, - // `kBy/{email}` or `MiBy/10ms` (although you should almost never - // have `/s` in a metric `unit`; rates should always be computed at - // query time from the underlying cumulative or delta value). - // * `.` multiplication or composition (as an infix operator). For - // examples, `GBy.d` or `k{watt}.h`. - // - // The grammar for a unit is as follows: - // - // Expression = Component { "." Component } { "/" Component } ; - // - // Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] - // | Annotation - // | "1" - // ; - // - // Annotation = "{" NAME "}" ; - // - // Notes: - // - // * `Annotation` is just a comment if it follows a `UNIT`. If the annotation - // is used alone, then the unit is equivalent to `1`. For examples, - // `{request}/s == 1/s`, `By{transmitted}/s == By/s`. - // * `NAME` is a sequence of non-blank printable ASCII characters not - // containing `{` or `}`. - // * `1` represents a unitary [dimensionless - // unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such - // as in `1/s`. It is typically used when none of the basic units are - // appropriate. For example, "new users per day" can be represented as - // `1/d` or `{new-users}/d` (and a metric value `5` would mean "5 new - // users). Alternatively, "thousands of page views per day" would be - // represented as `1000/d` or `k1/d` or `k{page_views}/d` (and a metric - // value of `5.3` would mean "5300 page views per day"). - // * `%` represents dimensionless value of 1/100, and annotates values giving - // a percentage (so the metric values are typically in the range of 0..100, - // and a metric value `3` means "3 percent"). - // * `10^2.%` indicates a metric contains a ratio, typically in the range - // 0..1, that will be multiplied by 100 and displayed as a percentage - // (so a metric value `0.03` means "3 percent"). - // - string unit = 5; - - // A detailed description of the metric, which can be used in documentation. - string description = 6; - - // A concise name for the metric, which can be displayed in user interfaces. - // Use sentence case without an ending period, for example "Request count". - // This field is optional but it is recommended to be set for any metrics - // associated with user-visible concepts, such as Quota. - string display_name = 7; - - // Optional. Metadata which can be used to guide usage of the metric. - MetricDescriptorMetadata metadata = 10; - - // Optional. The launch stage of the metric definition. - LaunchStage launch_stage = 12; -} - -// A specific metric, identified by specifying values for all of the -// labels of a [`MetricDescriptor`][google.api.MetricDescriptor]. -message Metric { - // An existing metric type, see [google.api.MetricDescriptor][google.api.MetricDescriptor]. - // For example, `custom.googleapis.com/invoice/paid/amount`. - string type = 3; - - // The set of label values that uniquely identify this metric. All - // labels listed in the `MetricDescriptor` must be assigned values. - map labels = 2; -} diff --git a/google/api/monitored_resource.proto b/google/api/monitored_resource.proto deleted file mode 100644 index 2c94902a29..0000000000 --- a/google/api/monitored_resource.proto +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2019 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.api; - -import "google/api/label.proto"; -import "google/api/launch_stage.proto"; -import "google/protobuf/struct.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/monitoredres;monitoredres"; -option java_multiple_files = true; -option java_outer_classname = "MonitoredResourceProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a -// type name and a set of labels. For example, the monitored resource -// descriptor for Google Compute Engine VM instances has a type of -// `"gce_instance"` and specifies the use of the labels `"instance_id"` and -// `"zone"` to identify particular VM instances. -// -// Different APIs can support different monitored resource types. APIs generally -// provide a `list` method that returns the monitored resource descriptors used -// by the API. -message MonitoredResourceDescriptor { - // Optional. The resource name of the monitored resource descriptor: - // `"projects/{project_id}/monitoredResourceDescriptors/{type}"` where - // {type} is the value of the `type` field in this object and - // {project_id} is a project ID that provides API-specific context for - // accessing the type. APIs that do not use project information can use the - // resource name format `"monitoredResourceDescriptors/{type}"`. - string name = 5; - - // Required. The monitored resource type. For example, the type - // `"cloudsql_database"` represents databases in Google Cloud SQL. - // The maximum length of this value is 256 characters. - string type = 1; - - // Optional. A concise name for the monitored resource type that might be - // displayed in user interfaces. It should be a Title Cased Noun Phrase, - // without any article or other determiners. For example, - // `"Google Cloud SQL Database"`. - string display_name = 2; - - // Optional. A detailed description of the monitored resource type that might - // be used in documentation. - string description = 3; - - // Required. A set of labels used to describe instances of this monitored - // resource type. For example, an individual Google Cloud SQL database is - // identified by values for the labels `"database_id"` and `"zone"`. - repeated LabelDescriptor labels = 4; - - // Optional. The launch stage of the monitored resource definition. - LaunchStage launch_stage = 7; -} - -// An object representing a resource that can be used for monitoring, logging, -// billing, or other purposes. Examples include virtual machine instances, -// databases, and storage devices such as disks. The `type` field identifies a -// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object that describes the resource's -// schema. Information in the `labels` field identifies the actual resource and -// its attributes according to the schema. For example, a particular Compute -// Engine VM instance could be represented by the following object, because the -// [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] for `"gce_instance"` has labels -// `"instance_id"` and `"zone"`: -// -// { "type": "gce_instance", -// "labels": { "instance_id": "12345678901234", -// "zone": "us-central1-a" }} -message MonitoredResource { - // Required. The monitored resource type. This field must match - // the `type` field of a [MonitoredResourceDescriptor][google.api.MonitoredResourceDescriptor] object. For - // example, the type of a Compute Engine VM instance is `gce_instance`. - string type = 1; - - // Required. Values for all of the labels listed in the associated monitored - // resource descriptor. For example, Compute Engine VM instances use the - // labels `"project_id"`, `"instance_id"`, and `"zone"`. - map labels = 2; -} - -// Auxiliary metadata for a [MonitoredResource][google.api.MonitoredResource] object. -// [MonitoredResource][google.api.MonitoredResource] objects contain the minimum set of information to -// uniquely identify a monitored resource instance. There is some other useful -// auxiliary metadata. Monitoring and Logging use an ingestion -// pipeline to extract metadata for cloud resources of all types, and store -// the metadata in this message. -message MonitoredResourceMetadata { - // Output only. Values for predefined system metadata labels. - // System labels are a kind of metadata extracted by Google, including - // "machine_image", "vpc", "subnet_id", - // "security_group", "name", etc. - // System label values can be only strings, Boolean values, or a list of - // strings. For example: - // - // { "name": "my-test-instance", - // "security_group": ["a", "b", "c"], - // "spot_instance": false } - google.protobuf.Struct system_labels = 1; - - // Output only. A map of user-defined metadata labels. - map user_labels = 2; -} diff --git a/google/api/monitoring.proto b/google/api/monitoring.proto deleted file mode 100644 index 07e962d1ba..0000000000 --- a/google/api/monitoring.proto +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "MonitoringProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Monitoring configuration of the service. -// -// The example below shows how to configure monitored resources and metrics -// for monitoring. In the example, a monitored resource and two metrics are -// defined. The `library.googleapis.com/book/returned_count` metric is sent -// to both producer and consumer projects, whereas the -// `library.googleapis.com/book/overdue_count` metric is only sent to the -// consumer project. -// -// monitored_resources: -// - type: library.googleapis.com/branch -// labels: -// - key: /city -// description: The city where the library branch is located in. -// - key: /name -// description: The name of the branch. -// metrics: -// - name: library.googleapis.com/book/returned_count -// metric_kind: DELTA -// value_type: INT64 -// labels: -// - key: /customer_id -// - name: library.googleapis.com/book/overdue_count -// metric_kind: GAUGE -// value_type: INT64 -// labels: -// - key: /customer_id -// monitoring: -// producer_destinations: -// - monitored_resource: library.googleapis.com/branch -// metrics: -// - library.googleapis.com/book/returned_count -// consumer_destinations: -// - monitored_resource: library.googleapis.com/branch -// metrics: -// - library.googleapis.com/book/returned_count -// - library.googleapis.com/book/overdue_count -message Monitoring { - // Configuration of a specific monitoring destination (the producer project - // or the consumer project). - message MonitoringDestination { - // The monitored resource type. The type must be defined in - // [Service.monitored_resources][google.api.Service.monitored_resources] section. - string monitored_resource = 1; - - // Types of the metrics to report to this monitoring destination. - // Each type must be defined in [Service.metrics][google.api.Service.metrics] section. - repeated string metrics = 2; - } - - // Monitoring configurations for sending metrics to the producer project. - // There can be multiple producer destinations. A monitored resouce type may - // appear in multiple monitoring destinations if different aggregations are - // needed for different sets of metrics associated with that monitored - // resource type. A monitored resource and metric pair may only be used once - // in the Monitoring configuration. - repeated MonitoringDestination producer_destinations = 1; - - // Monitoring configurations for sending metrics to the consumer project. - // There can be multiple consumer destinations. A monitored resouce type may - // appear in multiple monitoring destinations if different aggregations are - // needed for different sets of metrics associated with that monitored - // resource type. A monitored resource and metric pair may only be used once - // in the Monitoring configuration. - repeated MonitoringDestination consumer_destinations = 2; -} diff --git a/google/api/quota.proto b/google/api/quota.proto deleted file mode 100644 index 2e6e52b66d..0000000000 --- a/google/api/quota.proto +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "QuotaProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Quota configuration helps to achieve fairness and budgeting in service -// usage. -// -// The metric based quota configuration works this way: -// - The service configuration defines a set of metrics. -// - For API calls, the quota.metric_rules maps methods to metrics with -// corresponding costs. -// - The quota.limits defines limits on the metrics, which will be used for -// quota checks at runtime. -// -// An example quota configuration in yaml format: -// -// quota: -// limits: -// -// - name: apiWriteQpsPerProject -// metric: library.googleapis.com/write_calls -// unit: "1/min/{project}" # rate limit for consumer projects -// values: -// STANDARD: 10000 -// -// -// # The metric rules bind all methods to the read_calls metric, -// # except for the UpdateBook and DeleteBook methods. These two methods -// # are mapped to the write_calls metric, with the UpdateBook method -// # consuming at twice rate as the DeleteBook method. -// metric_rules: -// - selector: "*" -// metric_costs: -// library.googleapis.com/read_calls: 1 -// - selector: google.example.library.v1.LibraryService.UpdateBook -// metric_costs: -// library.googleapis.com/write_calls: 2 -// - selector: google.example.library.v1.LibraryService.DeleteBook -// metric_costs: -// library.googleapis.com/write_calls: 1 -// -// Corresponding Metric definition: -// -// metrics: -// - name: library.googleapis.com/read_calls -// display_name: Read requests -// metric_kind: DELTA -// value_type: INT64 -// -// - name: library.googleapis.com/write_calls -// display_name: Write requests -// metric_kind: DELTA -// value_type: INT64 -// -// -message Quota { - // List of `QuotaLimit` definitions for the service. - repeated QuotaLimit limits = 3; - - // List of `MetricRule` definitions, each one mapping a selected method to one - // or more metrics. - repeated MetricRule metric_rules = 4; -} - -// Bind API methods to metrics. Binding a method to a metric causes that -// metric's configured quota behaviors to apply to the method call. -message MetricRule { - // Selects the methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Metrics to update when the selected methods are called, and the associated - // cost applied to each metric. - // - // The key of the map is the metric name, and the values are the amount - // increased for the metric against which the quota limits are defined. - // The value must not be negative. - map metric_costs = 2; -} - -// `QuotaLimit` defines a specific limit that applies over a specified duration -// for a limit type. There can be at most one limit for a duration and limit -// type combination defined within a `QuotaGroup`. -message QuotaLimit { - // Name of the quota limit. - // - // The name must be provided, and it must be unique within the service. The - // name can only include alphanumeric characters as well as '-'. - // - // The maximum length of the limit name is 64 characters. - string name = 6; - - // Optional. User-visible, extended description for this quota limit. - // Should be used only when more context is needed to understand this limit - // than provided by the limit's display name (see: `display_name`). - string description = 2; - - // Default number of tokens that can be consumed during the specified - // duration. This is the number of tokens assigned when a client - // application developer activates the service for his/her project. - // - // Specifying a value of 0 will block all requests. This can be used if you - // are provisioning quota to selected consumers and blocking others. - // Similarly, a value of -1 will indicate an unlimited quota. No other - // negative values are allowed. - // - // Used by group-based quotas only. - int64 default_limit = 3; - - // Maximum number of tokens that can be consumed during the specified - // duration. Client application developers can override the default limit up - // to this maximum. If specified, this value cannot be set to a value less - // than the default limit. If not specified, it is set to the default limit. - // - // To allow clients to apply overrides with no upper bound, set this to -1, - // indicating unlimited maximum quota. - // - // Used by group-based quotas only. - int64 max_limit = 4; - - // Free tier value displayed in the Developers Console for this limit. - // The free tier is the number of tokens that will be subtracted from the - // billed amount when billing is enabled. - // This field can only be set on a limit with duration "1d", in a billable - // group; it is invalid on any other limit. If this field is not set, it - // defaults to 0, indicating that there is no free tier for this service. - // - // Used by group-based quotas only. - int64 free_tier = 7; - - // Duration of this limit in textual notation. Example: "100s", "24h", "1d". - // For duration longer than a day, only multiple of days is supported. We - // support only "100s" and "1d" for now. Additional support will be added in - // the future. "0" indicates indefinite duration. - // - // Used by group-based quotas only. - string duration = 5; - - // The name of the metric this quota limit applies to. The quota limits with - // the same metric will be checked together during runtime. The metric must be - // defined within the service config. - string metric = 8; - - // Specify the unit of the quota limit. It uses the same syntax as - // [Metric.unit][]. The supported unit kinds are determined by the quota - // backend system. - // - // Here are some examples: - // * "1/min/{project}" for quota per minute per project. - // - // Note: the order of unit components is insignificant. - // The "1" at the beginning is required to follow the metric unit syntax. - string unit = 9; - - // Tiered limit values. You must specify this as a key:value pair, with an - // integer value that is the maximum number of requests allowed for the - // specified unit. Currently only STANDARD is supported. - map values = 10; - - // User-visible display name for this limit. - // Optional. If not set, the UI will provide a default display name based on - // the quota configuration. This field can be used to override the default - // display name generated from the configuration. - string display_name = 12; -} diff --git a/google/api/resource.proto b/google/api/resource.proto deleted file mode 100644 index fdb7001ad6..0000000000 --- a/google/api/resource.proto +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2019 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.api; - -import "google/protobuf/descriptor.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "ResourceProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.FieldOptions { - // An annotation that describes a resource reference, see - // [ResourceReference][]. - google.api.ResourceReference resource_reference = 1055; -} - -extend google.protobuf.FileOptions { - // An annotation that describes a resource definition without a corresponding - // message; see [ResourceDescriptor][]. - repeated google.api.ResourceDescriptor resource_definition = 1053; -} - -extend google.protobuf.MessageOptions { - // An annotation that describes a resource definition, see - // [ResourceDescriptor][]. - google.api.ResourceDescriptor resource = 1053; -} - -// A simple descriptor of a resource type. -// -// ResourceDescriptor annotates a resource message (either by means of a -// protobuf annotation or use in the service config), and associates the -// resource's schema, the resource type, and the pattern of the resource name. -// -// Example: -// -// message Topic { -// // Indicates this message defines a resource schema. -// // Declares the resource type in the format of {service}/{kind}. -// // For Kubernetes resources, the format is {api group}/{kind}. -// option (google.api.resource) = { -// type: "pubsub.googleapis.com/Topic" -// name_descriptor: { -// pattern: "projects/{project}/topics/{topic}" -// parent_type: "cloudresourcemanager.googleapis.com/Project" -// parent_name_extractor: "projects/{project}" -// } -// }; -// } -// -// The ResourceDescriptor Yaml config will look like: -// -// resources: -// - type: "pubsub.googleapis.com/Topic" -// name_descriptor: -// - pattern: "projects/{project}/topics/{topic}" -// parent_type: "cloudresourcemanager.googleapis.com/Project" -// parent_name_extractor: "projects/{project}" -// -// Sometimes, resources have multiple patterns, typically because they can -// live under multiple parents. -// -// Example: -// -// message LogEntry { -// option (google.api.resource) = { -// type: "logging.googleapis.com/LogEntry" -// name_descriptor: { -// pattern: "projects/{project}/logs/{log}" -// parent_type: "cloudresourcemanager.googleapis.com/Project" -// parent_name_extractor: "projects/{project}" -// } -// name_descriptor: { -// pattern: "folders/{folder}/logs/{log}" -// parent_type: "cloudresourcemanager.googleapis.com/Folder" -// parent_name_extractor: "folders/{folder}" -// } -// name_descriptor: { -// pattern: "organizations/{organization}/logs/{log}" -// parent_type: "cloudresourcemanager.googleapis.com/Organization" -// parent_name_extractor: "organizations/{organization}" -// } -// name_descriptor: { -// pattern: "billingAccounts/{billing_account}/logs/{log}" -// parent_type: "billing.googleapis.com/BillingAccount" -// parent_name_extractor: "billingAccounts/{billing_account}" -// } -// }; -// } -// -// The ResourceDescriptor Yaml config will look like: -// -// resources: -// - type: 'logging.googleapis.com/LogEntry' -// name_descriptor: -// - pattern: "projects/{project}/logs/{log}" -// parent_type: "cloudresourcemanager.googleapis.com/Project" -// parent_name_extractor: "projects/{project}" -// - pattern: "folders/{folder}/logs/{log}" -// parent_type: "cloudresourcemanager.googleapis.com/Folder" -// parent_name_extractor: "folders/{folder}" -// - pattern: "organizations/{organization}/logs/{log}" -// parent_type: "cloudresourcemanager.googleapis.com/Organization" -// parent_name_extractor: "organizations/{organization}" -// - pattern: "billingAccounts/{billing_account}/logs/{log}" -// parent_type: "billing.googleapis.com/BillingAccount" -// parent_name_extractor: "billingAccounts/{billing_account}" -// -// For flexible resources, the resource name doesn't contain parent names, but -// the resource itself has parents for policy evaluation. -// -// Example: -// -// message Shelf { -// option (google.api.resource) = { -// type: "library.googleapis.com/Shelf" -// name_descriptor: { -// pattern: "shelves/{shelf}" -// parent_type: "cloudresourcemanager.googleapis.com/Project" -// } -// name_descriptor: { -// pattern: "shelves/{shelf}" -// parent_type: "cloudresourcemanager.googleapis.com/Folder" -// } -// }; -// } -// -// The ResourceDescriptor Yaml config will look like: -// -// resources: -// - type: 'library.googleapis.com/Shelf' -// name_descriptor: -// - pattern: "shelves/{shelf}" -// parent_type: "cloudresourcemanager.googleapis.com/Project" -// - pattern: "shelves/{shelf}" -// parent_type: "cloudresourcemanager.googleapis.com/Folder" -message ResourceDescriptor { - // A description of the historical or future-looking state of the - // resource pattern. - enum History { - // The "unset" value. - HISTORY_UNSPECIFIED = 0; - - // The resource originally had one pattern and launched as such, and - // additional patterns were added later. - ORIGINALLY_SINGLE_PATTERN = 1; - - // The resource has one pattern, but the API owner expects to add more - // later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents - // that from being necessary once there are multiple patterns.) - FUTURE_MULTI_PATTERN = 2; - } - - // The resource type. It must be in the format of - // {service_name}/{resource_type_kind}. The `resource_type_kind` must be - // singular and must not include version numbers. - // - // Example: `storage.googleapis.com/Bucket` - // - // The value of the resource_type_kind must follow the regular expression - // /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and - // should use PascalCase (UpperCamelCase). The maximum number of - // characters allowed for the `resource_type_kind` is 100. - string type = 1; - - // Optional. The relative resource name pattern associated with this resource - // type. The DNS prefix of the full resource name shouldn't be specified here. - // - // The path pattern must follow the syntax, which aligns with HTTP binding - // syntax: - // - // Template = Segment { "/" Segment } ; - // Segment = LITERAL | Variable ; - // Variable = "{" LITERAL "}" ; - // - // Examples: - // - // - "projects/{project}/topics/{topic}" - // - "projects/{project}/knowledgeBases/{knowledge_base}" - // - // The components in braces correspond to the IDs for each resource in the - // hierarchy. It is expected that, if multiple patterns are provided, - // the same component name (e.g. "project") refers to IDs of the same - // type of resource. - repeated string pattern = 2; - - // Optional. The field on the resource that designates the resource name - // field. If omitted, this is assumed to be "name". - string name_field = 3; - - // Optional. The historical or future-looking state of the resource pattern. - // - // Example: - // - // // The InspectTemplate message originally only supported resource - // // names with organization, and project was added later. - // message InspectTemplate { - // option (google.api.resource) = { - // type: "dlp.googleapis.com/InspectTemplate" - // pattern: - // "organizations/{organization}/inspectTemplates/{inspect_template}" - // pattern: "projects/{project}/inspectTemplates/{inspect_template}" - // history: ORIGINALLY_SINGLE_PATTERN - // }; - // } - History history = 4; - - // The plural name used in the resource name, such as 'projects' for - // the name of 'projects/{project}'. It is the same concept of the `plural` - // field in k8s CRD spec - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - string plural = 5; - - // The same concept of the `singular` field in k8s CRD spec - // https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - // Such as "project" for the `resourcemanager.googleapis.com/Project` type. - string singular = 6; -} - -// Defines a proto annotation that describes a string field that refers to -// an API resource. -message ResourceReference { - // The resource type that the annotated field references. - // - // Example: - // - // message Subscription { - // string topic = 2 [(google.api.resource_reference) = { - // type: "pubsub.googleapis.com/Topic" - // }]; - // } - string type = 1; - - // The resource type of a child collection that the annotated field - // references. This is useful for annotating the `parent` field that - // doesn't have a fixed resource type. - // - // Example: - // - // message ListLogEntriesRequest { - // string parent = 1 [(google.api.resource_reference) = { - // child_type: "logging.googleapis.com/LogEntry" - // }; - // } - string child_type = 2; -} diff --git a/google/api/service.proto b/google/api/service.proto deleted file mode 100644 index c29eb5c899..0000000000 --- a/google/api/service.proto +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2019 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.api; - -import "google/api/auth.proto"; -import "google/api/backend.proto"; -import "google/api/billing.proto"; -import "google/api/context.proto"; -import "google/api/control.proto"; -import "google/api/documentation.proto"; -import "google/api/endpoint.proto"; -import "google/api/http.proto"; -import "google/api/label.proto"; -import "google/api/log.proto"; -import "google/api/logging.proto"; -import "google/api/metric.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/monitoring.proto"; -import "google/api/quota.proto"; -import "google/api/resource.proto"; -import "google/api/source_info.proto"; -import "google/api/system_parameter.proto"; -import "google/api/usage.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/api.proto"; -import "google/protobuf/type.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// `Service` is the root object of Google service configuration schema. It -// describes basic information about a service, such as the name and the -// title, and delegates other aspects to sub-sections. Each sub-section is -// either a proto message or a repeated proto message that configures a -// specific aspect, such as auth. See each proto message definition for details. -// -// Example: -// -// type: google.api.Service -// config_version: 3 -// name: calendar.googleapis.com -// title: Google Calendar API -// apis: -// - name: google.calendar.v3.Calendar -// authentication: -// providers: -// - id: google_calendar_auth -// jwks_uri: https://www.googleapis.com/oauth2/v1/certs -// issuer: https://securetoken.google.com -// rules: -// - selector: "*" -// requirements: -// provider_id: google_calendar_auth -message Service { - // The semantic version of the service configuration. The config version - // affects the interpretation of the service configuration. For example, - // certain features are enabled by default for certain config versions. - // The latest config version is `3`. - google.protobuf.UInt32Value config_version = 20; - - // The service name, which is a DNS-like logical identifier for the - // service, such as `calendar.googleapis.com`. The service name - // typically goes through DNS verification to make sure the owner - // of the service also owns the DNS name. - string name = 1; - - // A unique ID for a specific instance of this message, typically assigned - // by the client for tracking purpose. If empty, the server may choose to - // generate one instead. Must be no longer than 60 characters. - string id = 33; - - // The product title for this service. - string title = 2; - - // The Google project that owns this service. - string producer_project_id = 22; - - // A list of API interfaces exported by this service. Only the `name` field - // of the [google.protobuf.Api][google.protobuf.Api] needs to be provided by the configuration - // author, as the remaining fields will be derived from the IDL during the - // normalization process. It is an error to specify an API interface here - // which cannot be resolved against the associated IDL files. - repeated google.protobuf.Api apis = 3; - - // A list of all proto message types included in this API service. - // Types referenced directly or indirectly by the `apis` are - // automatically included. Messages which are not referenced but - // shall be included, such as types used by the `google.protobuf.Any` type, - // should be listed here by name. Example: - // - // types: - // - name: google.protobuf.Int32 - repeated google.protobuf.Type types = 4; - - // A list of all enum types included in this API service. Enums - // referenced directly or indirectly by the `apis` are automatically - // included. Enums which are not referenced but shall be included - // should be listed here by name. Example: - // - // enums: - // - name: google.someapi.v1.SomeEnum - repeated google.protobuf.Enum enums = 5; - - // Additional API documentation. - Documentation documentation = 6; - - // API backend configuration. - Backend backend = 8; - - // HTTP configuration. - Http http = 9; - - // Quota configuration. - Quota quota = 10; - - // Auth configuration. - Authentication authentication = 11; - - // Context configuration. - Context context = 12; - - // Configuration controlling usage of this service. - Usage usage = 15; - - // Configuration for network endpoints. If this is empty, then an endpoint - // with the same name as the service is automatically generated to service all - // defined APIs. - repeated Endpoint endpoints = 18; - - // Configuration for the service control plane. - Control control = 21; - - // Defines the logs used by this service. - repeated LogDescriptor logs = 23; - - // Defines the metrics used by this service. - repeated MetricDescriptor metrics = 24; - - // Defines the monitored resources used by this service. This is required - // by the [Service.monitoring][google.api.Service.monitoring] and [Service.logging][google.api.Service.logging] configurations. - repeated MonitoredResourceDescriptor monitored_resources = 25; - - // Billing configuration. - Billing billing = 26; - - // Logging configuration. - Logging logging = 27; - - // Monitoring configuration. - Monitoring monitoring = 28; - - // System parameter configuration. - SystemParameters system_parameters = 29; - - // Output only. The source information for this configuration if available. - SourceInfo source_info = 37; -} diff --git a/google/api/serviceconfig.yaml b/google/api/serviceconfig.yaml deleted file mode 100644 index 6d883d4282..0000000000 --- a/google/api/serviceconfig.yaml +++ /dev/null @@ -1,24 +0,0 @@ -type: google.api.Service -config_version: 1 -name: serviceconfig.googleapis.com -title: Service Config API - -types: -- name: google.api.ConfigChange -- name: google.api.Distribution -- name: google.api.DocumentationRule -- name: google.api.HttpBody -- name: google.api.LabelDescriptor -- name: google.api.Metric -- name: google.api.MonitoredResource -- name: google.api.MonitoredResourceDescriptor -- name: google.api.MonitoredResourceMetadata -- name: google.api.ResourceDescriptor -- name: google.api.ResourceReference -- name: google.api.Service - -enums: -- name: google.api.FieldBehavior - -documentation: - summary: Lets you define and config your API service. diff --git a/google/api/servicecontrol/BUILD.bazel b/google/api/servicecontrol/BUILD.bazel deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/google/api/servicecontrol/README.md b/google/api/servicecontrol/README.md deleted file mode 100644 index 3d9590ee02..0000000000 --- a/google/api/servicecontrol/README.md +++ /dev/null @@ -1,126 +0,0 @@ -Google Service Control provides control plane functionality to managed services, -such as logging, monitoring, and status checks. This page provides an overview -of what it does and how it works. - -## Why use Service Control? - -When you develop a cloud service, you typically start with the business -requirements and the architecture design, then proceed with API definition -and implementation. Before you put your service into production, you -need to deal with many control plane issues: - -* How to control access to your service. -* How to send logging and monitoring data to both consumers and producers. -* How to create and manage dashboards to visualize this data. -* How to automatically scale the control plane components with your service. - -Service Control is a mature and feature-rich control plane provider -that addresses these needs with high efficiency, high scalability, -and high availability. It provides a simple public API that can be accessed -from anywhere using JSON REST and gRPC clients, so when you move your service -from on-premise to a cloud provider, or from one cloud provider to another, -you don't need to change the control plane provider. - -Services built using Google Cloud Endpoints already take advantage of -Service Control. Cloud Endpoints sends logging and monitoring data -through Google Service Control for every request arriving at its -proxy. If you need to report any additional logging and monitoring data for -your Cloud Endpoints service, you can call the Service Control API directly -from your service. - -The Service Control API definition is open sourced and available on -[GitHub](https://github.com/googleapis/googleapis/tree/master/google/api/servicecontrol). -By changing the DNS name, you can easily use alternative implementations of -the Service Control API. - -## Architecture - -Google Service Control works with a set of *managed services* and their -*operations* (activities), *checks* whether an operation is allowed to proceed, -and *reports* completed operations. Behind the scenes, it leverages other -Google Cloud services, such as -[Google Service Management](/service-management), -[Stackdriver Logging](/logging), and [Stackdriver Monitoring](/monitoring), -while hiding their complexity from service producers. It enables service -producers to send telemetry data to their consumers. It uses caching, -batching, aggregation, and retries to deliver higher performance and -availability than the individual backend systems it encapsulates. - -
-
- The overall architecture of a service that uses Google Service Control. -
-
Figure 1: Using Google Service Control.
-
- -The Service Control API provides two methods: - -* [`services.check`](/service-control/reference/rest/v1/services/check), used for: - * Ensuring valid consumer status - * Validating API keys -* [`services.report`](/service-control/reference/rest/v1/services/report), used for: - * Sending logs to Stackdriver Logging - * Sending metrics to Stackdriver Monitoring - -We’ll look at these in more detail in the rest of this overview. - -## Managed services - -A [managed service](/service-management/reference/rest/v1/services) is -a network service managed by -[Google Service Management](/service-management). Each managed service has a -unique name, such as `example.googleapis.com`, which must be a valid -fully-qualified DNS name, as per RFC 1035. - -For example: - -* Google Cloud Pub/Sub (`pubsub.googleapis.com`) -* Google Cloud Vision (`vision.googleapis.com`) -* Google Cloud Bigtable (`bigtable.googleapis.com`) -* Google Cloud Datastore (`datastore.googleapis.com`) - -Google Service Management manages the lifecycle of each service’s -configuration, which is used to customize Google Service Control's behavior. -Service configurations are also used by Google Cloud Console -for displaying APIs and their settings, enabling/disabling APIs, and more. - -## Operations - -Google Service Control uses the generic concept of an *operation* -to represent the -activities of a managed service, such as API calls and resource usage. Each -operation is associated with a managed service and a specific service -consumer, and has a set of properties that describe the operation, such as -the API method name and resource usage amount. For more information, see the -[Operation definition](/service-control/rest/v1/Operation). - -## Check - -The [`services.check`](/service-control/reference/rest/v1/services/check) -method determines whether an operation should be allowed to proceed -for a managed service. - -For example: - -* Check if the consumer is still active. -* Check if the consumer has enabled the service. -* Check if the API key is still valid. - -By performing multiple checks within a single method call, it provides -better performance, higher reliability, and reduced development cost to -service producers compared to checking with multiple backend systems. - -## Report - -The [`services.report`](/service-control/reference/rest/v1/services/report) -method reports completed operations for -a managed service to backend systems, such as logging and monitoring. The -reported data can be seen in Google API Console and Google Cloud Console, -and retrieved with appropriate APIs, such as the Stackdriver Logging and -Stackdriver Monitoring APIs. - -## Next steps - -* Read our [Getting Started guide](/service-control/getting-started) to find out - how to set up and use the Google Service Control API. diff --git a/google/api/servicecontrol/v1/check_error.proto b/google/api/servicecontrol/v1/check_error.proto deleted file mode 100644 index de3969d2f2..0000000000 --- a/google/api/servicecontrol/v1/check_error.proto +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "CheckErrorProto"; -option java_package = "com.google.api.servicecontrol.v1"; - -// Defines the errors to be returned in -// [google.api.servicecontrol.v1.CheckResponse.check_errors][google.api.servicecontrol.v1.CheckResponse.check_errors]. -message CheckError { - // Error codes for Check responses. - enum Code { - // This is never used in `CheckResponse`. - ERROR_CODE_UNSPECIFIED = 0; - - // The consumer's project id, network container, or resource container was - // not found. Same as [google.rpc.Code.NOT_FOUND][]. - NOT_FOUND = 5; - - // The consumer doesn't have access to the specified resource. - // Same as [google.rpc.Code.PERMISSION_DENIED][]. - PERMISSION_DENIED = 7; - - // Quota check failed. Same as [google.rpc.Code.RESOURCE_EXHAUSTED][]. - RESOURCE_EXHAUSTED = 8; - - // The consumer has been flagged as an abuser. - ABUSER_DETECTED = 103; - - // The consumer hasn't activated the service. - SERVICE_NOT_ACTIVATED = 104; - - // The consumer cannot access the service because billing is disabled. - BILLING_DISABLED = 107; - - // The consumer's project has been marked as deleted (soft deletion). - PROJECT_DELETED = 108; - - // The consumer's project number or id does not represent a valid project. - PROJECT_INVALID = 114; - - // The IP address of the consumer is invalid for the specific consumer - // project. - IP_ADDRESS_BLOCKED = 109; - - // The referer address of the consumer request is invalid for the specific - // consumer project. - REFERER_BLOCKED = 110; - - // The client application of the consumer request is invalid for the - // specific consumer project. - CLIENT_APP_BLOCKED = 111; - - // The API targeted by this request is invalid for the specified consumer - // project. - API_TARGET_BLOCKED = 122; - - // The consumer's API key is invalid. - API_KEY_INVALID = 105; - - // The consumer's API Key has expired. - API_KEY_EXPIRED = 112; - - // The consumer's API Key was not found in config record. - API_KEY_NOT_FOUND = 113; - - // Request is not allowed as per security policies defined in Org Policy. - SECURITY_POLICY_VIOLATED = 121; - - // The credential in the request can not be verified. - INVALID_CREDENTIAL = 123; - - // Request is not allowed as per location policies defined in Org Policy. - LOCATION_POLICY_VIOLATED = 124; - - // The input consumer info does not represent a valid consumer folder or - // organization. - CONSUMER_INVALID = 125; - - // NOTE: By convention, all *_UNAVAILABLE codes are required to be in the - // 300 - 399 range. - - // NOTE: Unless there are very special business requirements, service - // producer should ignore the following errors. These errors should not - // cause the rejection of client requests. - - // The backend server for looking up project id/number is unavailable. - NAMESPACE_LOOKUP_UNAVAILABLE = 300; - - // The backend server for checking service status is unavailable. - SERVICE_STATUS_UNAVAILABLE = 301; - - // The backend server for checking billing status is unavailable. - BILLING_STATUS_UNAVAILABLE = 302; - - // The backend server for checking quota limits is unavailable. - QUOTA_CHECK_UNAVAILABLE = 303; - - // Cloud Resource Manager backend server is unavailable. - CLOUD_RESOURCE_MANAGER_BACKEND_UNAVAILABLE = 305; - - // Backend server for evaluating security policy is unavailable. - SECURITY_POLICY_BACKEND_UNAVAILABLE = 306; - - // Backend server for evaluating location policy is unavailable. - LOCATION_POLICY_BACKEND_UNAVAILABLE = 307; - } - - // The error code. - Code code = 1; - - // Free-form text providing details on the error cause of the error. - string detail = 2; -} diff --git a/google/api/servicecontrol/v1/distribution.proto b/google/api/servicecontrol/v1/distribution.proto deleted file mode 100644 index 40b89f5ba6..0000000000 --- a/google/api/servicecontrol/v1/distribution.proto +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "DistributionProto"; -option java_package = "com.google.api.servicecontrol.v1"; - -// Distribution represents a frequency distribution of double-valued sample -// points. It contains the size of the population of sample points plus -// additional optional information: -// -// - the arithmetic mean of the samples -// - the minimum and maximum of the samples -// - the sum-squared-deviation of the samples, used to compute variance -// - a histogram of the values of the sample points -message Distribution { - // Describing buckets with constant width. - message LinearBuckets { - // The number of finite buckets. With the underflow and overflow buckets, - // the total number of buckets is `num_finite_buckets` + 2. - // See comments on `bucket_options` for details. - int32 num_finite_buckets = 1; - - // The i'th linear bucket covers the interval - // [offset + (i-1) * width, offset + i * width) - // where i ranges from 1 to num_finite_buckets, inclusive. - // Must be strictly positive. - double width = 2; - - // The i'th linear bucket covers the interval - // [offset + (i-1) * width, offset + i * width) - // where i ranges from 1 to num_finite_buckets, inclusive. - double offset = 3; - } - - // Describing buckets with exponentially growing width. - message ExponentialBuckets { - // The number of finite buckets. With the underflow and overflow buckets, - // the total number of buckets is `num_finite_buckets` + 2. - // See comments on `bucket_options` for details. - int32 num_finite_buckets = 1; - - // The i'th exponential bucket covers the interval - // [scale * growth_factor^(i-1), scale * growth_factor^i) - // where i ranges from 1 to num_finite_buckets inclusive. - // Must be larger than 1.0. - double growth_factor = 2; - - // The i'th exponential bucket covers the interval - // [scale * growth_factor^(i-1), scale * growth_factor^i) - // where i ranges from 1 to num_finite_buckets inclusive. - // Must be > 0. - double scale = 3; - } - - // Describing buckets with arbitrary user-provided width. - message ExplicitBuckets { - // 'bound' is a list of strictly increasing boundaries between - // buckets. Note that a list of length N-1 defines N buckets because - // of fenceposting. See comments on `bucket_options` for details. - // - // The i'th finite bucket covers the interval - // [bound[i-1], bound[i]) - // where i ranges from 1 to bound_size() - 1. Note that there are no - // finite buckets at all if 'bound' only contains a single element; in - // that special case the single bound defines the boundary between the - // underflow and overflow buckets. - // - // bucket number lower bound upper bound - // i == 0 (underflow) -inf bound[i] - // 0 < i < bound_size() bound[i-1] bound[i] - // i == bound_size() (overflow) bound[i-1] +inf - repeated double bounds = 1; - } - - // The total number of samples in the distribution. Must be >= 0. - int64 count = 1; - - // The arithmetic mean of the samples in the distribution. If `count` is - // zero then this field must be zero. - double mean = 2; - - // The minimum of the population of values. Ignored if `count` is zero. - double minimum = 3; - - // The maximum of the population of values. Ignored if `count` is zero. - double maximum = 4; - - // The sum of squared deviations from the mean: - // Sum[i=1..count]((x_i - mean)^2) - // where each x_i is a sample values. If `count` is zero then this field - // must be zero, otherwise validation of the request fails. - double sum_of_squared_deviation = 5; - - // The number of samples in each histogram bucket. `bucket_counts` are - // optional. If present, they must sum to the `count` value. - // - // The buckets are defined below in `bucket_option`. There are N buckets. - // `bucket_counts[0]` is the number of samples in the underflow bucket. - // `bucket_counts[1]` to `bucket_counts[N-1]` are the numbers of samples - // in each of the finite buckets. And `bucket_counts[N] is the number - // of samples in the overflow bucket. See the comments of `bucket_option` - // below for more details. - // - // Any suffix of trailing zeros may be omitted. - repeated int64 bucket_counts = 6; - - // Defines the buckets in the histogram. `bucket_option` and `bucket_counts` - // must be both set, or both unset. - // - // Buckets are numbered in the range of [0, N], with a total of N+1 buckets. - // There must be at least two buckets (a single-bucket histogram gives - // no information that isn't already provided by `count`). - // - // The first bucket is the underflow bucket which has a lower bound - // of -inf. The last bucket is the overflow bucket which has an - // upper bound of +inf. All other buckets (if any) are called "finite" - // buckets because they have finite lower and upper bounds. As described - // below, there are three ways to define the finite buckets. - // - // (1) Buckets with constant width. - // (2) Buckets with exponentially growing widths. - // (3) Buckets with arbitrary user-provided widths. - // - // In all cases, the buckets cover the entire real number line (-inf, - // +inf). Bucket upper bounds are exclusive and lower bounds are - // inclusive. The upper bound of the underflow bucket is equal to the - // lower bound of the smallest finite bucket; the lower bound of the - // overflow bucket is equal to the upper bound of the largest finite - // bucket. - oneof bucket_option { - // Buckets with constant width. - LinearBuckets linear_buckets = 7; - - // Buckets with exponentially growing width. - ExponentialBuckets exponential_buckets = 8; - - // Buckets with arbitrary user-provided width. - ExplicitBuckets explicit_buckets = 9; - } -} diff --git a/google/api/servicecontrol/v1/log_entry.proto b/google/api/servicecontrol/v1/log_entry.proto deleted file mode 100644 index 50b0fc4686..0000000000 --- a/google/api/servicecontrol/v1/log_entry.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/logging/type/log_severity.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "LogEntryProto"; -option java_package = "com.google.api.servicecontrol.v1"; - -// An individual log entry. -message LogEntry { - // Required. The log to which this log entry belongs. Examples: `"syslog"`, - // `"book_log"`. - string name = 10; - - // The time the event described by the log entry occurred. If - // omitted, defaults to operation start time. - google.protobuf.Timestamp timestamp = 11; - - // The severity of the log entry. The default value is - // `LogSeverity.DEFAULT`. - google.logging.type.LogSeverity severity = 12; - - // A unique ID for the log entry used for deduplication. If omitted, - // the implementation will generate one based on operation_id. - string insert_id = 4; - - // A set of user-defined (key, value) data that provides additional - // information about the log entry. - map labels = 13; - - // The log entry payload, which can be one of multiple types. - oneof payload { - // The log entry payload, represented as a protocol buffer that is - // expressed as a JSON object. The only accepted type currently is - // [AuditLog][google.cloud.audit.AuditLog]. - google.protobuf.Any proto_payload = 2; - - // The log entry payload, represented as a Unicode string (UTF-8). - string text_payload = 3; - - // The log entry payload, represented as a structure that - // is expressed as a JSON object. - google.protobuf.Struct struct_payload = 6; - } -} diff --git a/google/api/servicecontrol/v1/metric_value.proto b/google/api/servicecontrol/v1/metric_value.proto deleted file mode 100644 index 9a62ff6989..0000000000 --- a/google/api/servicecontrol/v1/metric_value.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/api/servicecontrol/v1/distribution.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/money.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "MetricValueSetProto"; -option java_package = "com.google.api.servicecontrol.v1"; - -// Represents a single metric value. -message MetricValue { - // The labels describing the metric value. - // See comments on - // [google.api.servicecontrol.v1.Operation.labels][google.api.servicecontrol.v1.Operation.labels] - // for the overriding relationship. - map labels = 1; - - // The start of the time period over which this metric value's measurement - // applies. The time period has different semantics for different metric - // types (cumulative, delta, and gauge). See the metric definition - // documentation in the service configuration for details. - google.protobuf.Timestamp start_time = 2; - - // The end of the time period over which this metric value's measurement - // applies. - google.protobuf.Timestamp end_time = 3; - - // The value. The type of value used in the request must - // agree with the metric definition in the service configuration, otherwise - // the MetricValue is rejected. - oneof value { - // A boolean value. - bool bool_value = 4; - - // A signed 64-bit integer value. - int64 int64_value = 5; - - // A double precision floating point value. - double double_value = 6; - - // A text string value. - string string_value = 7; - - // A distribution value. - Distribution distribution_value = 8; - } -} - -// Represents a set of metric values in the same metric. -// Each metric value in the set should have a unique combination of start time, -// end time, and label values. -message MetricValueSet { - // The metric name defined in the service configuration. - string metric_name = 1; - - // The values in this metric. - repeated MetricValue metric_values = 2; -} diff --git a/google/api/servicecontrol/v1/operation.proto b/google/api/servicecontrol/v1/operation.proto deleted file mode 100644 index 301f3575c7..0000000000 --- a/google/api/servicecontrol/v1/operation.proto +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/api/servicecontrol/v1/log_entry.proto"; -import "google/api/servicecontrol/v1/metric_value.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "OperationProto"; -option java_package = "com.google.api.servicecontrol.v1"; - -// Represents information regarding an operation. -message Operation { - // Defines the importance of the data contained in the operation. - enum Importance { - // The API implementation may cache and aggregate the data. - // The data may be lost when rare and unexpected system failures occur. - LOW = 0; - - // The API implementation doesn't cache and aggregate the data. - // If the method returns successfully, it's guaranteed that the data has - // been persisted in durable storage. - HIGH = 1; - } - - // Identity of the operation. This must be unique within the scope of the - // service that generated the operation. If the service calls - // Check() and Report() on the same operation, the two calls should carry - // the same id. - // - // UUID version 4 is recommended, though not required. - // In scenarios where an operation is computed from existing information - // and an idempotent id is desirable for deduplication purpose, UUID version 5 - // is recommended. See RFC 4122 for details. - string operation_id = 1; - - // Fully qualified name of the operation. Reserved for future use. - string operation_name = 2; - - // Identity of the consumer who is using the service. - // This field should be filled in for the operations initiated by a - // consumer, but not for service-initiated operations that are - // not related to a specific consumer. - // - // This can be in one of the following formats: - // project:, - // project_number:, - // api_key:. - string consumer_id = 3; - - // Required. Start time of the operation. - google.protobuf.Timestamp start_time = 4; - - // End time of the operation. - // Required when the operation is used in - // [ServiceController.Report][google.api.servicecontrol.v1.ServiceController.Report], - // but optional when the operation is used in - // [ServiceController.Check][google.api.servicecontrol.v1.ServiceController.Check]. - google.protobuf.Timestamp end_time = 5; - - // Labels describing the operation. Only the following labels are allowed: - // - // - Labels describing monitored resources as defined in - // the service configuration. - // - Default labels of metric values. When specified, labels defined in the - // metric value override these default. - // - The following labels defined by Google Cloud Platform: - // - `cloud.googleapis.com/location` describing the location where the - // operation happened, - // - `servicecontrol.googleapis.com/user_agent` describing the user agent - // of the API request, - // - `servicecontrol.googleapis.com/service_agent` describing the service - // used to handle the API request (e.g. ESP), - // - `servicecontrol.googleapis.com/platform` describing the platform - // where the API is served (e.g. GAE, GCE, GKE). - map labels = 6; - - // Represents information about this operation. Each MetricValueSet - // corresponds to a metric defined in the service configuration. - // The data type used in the MetricValueSet must agree with - // the data type specified in the metric definition. - // - // Within a single operation, it is not allowed to have more than one - // MetricValue instances that have the same metric names and identical - // label value combinations. If a request has such duplicated MetricValue - // instances, the entire request is rejected with - // an invalid argument error. - repeated MetricValueSet metric_value_sets = 7; - - // Represents information to be logged. - repeated LogEntry log_entries = 8; - - // DO NOT USE. This is an experimental field. - Importance importance = 11; -} diff --git a/google/api/servicecontrol/v1/quota_controller.proto b/google/api/servicecontrol/v1/quota_controller.proto deleted file mode 100644 index 808a735451..0000000000 --- a/google/api/servicecontrol/v1/quota_controller.proto +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/api/servicecontrol/v1/metric_value.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "QuotaControllerProto"; -option java_package = "com.google.api.servicecontrol.v1"; - -// [Google Quota Control API](/service-control/overview) -// -// Allows clients to allocate and release quota against a [managed -// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). -service QuotaController { - // Attempts to allocate quota for the specified consumer. It should be called - // before the operation is executed. - // - // This method requires the `servicemanagement.services.quota` - // permission on the specified service. For more information, see - // [Cloud IAM](https://cloud.google.com/iam). - // - // **NOTE:** The client **must** fail-open on server errors `INTERNAL`, - // `UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system - // reliability, the server may inject these errors to prohibit any hard - // dependency on the quota functionality. - rpc AllocateQuota(AllocateQuotaRequest) returns (AllocateQuotaResponse) { - option (google.api.http) = { - post: "/v1/services/{service_name}:allocateQuota" - body: "*" - }; - } -} - -// Request message for the AllocateQuota method. -message AllocateQuotaRequest { - // Name of the service as specified in the service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See [google.api.Service][google.api.Service] for the definition of a - // service name. - string service_name = 1; - - // Operation that describes the quota allocation. - QuotaOperation allocate_operation = 2; - - // Specifies which version of service configuration should be used to process - // the request. If unspecified or no matching version can be found, the latest - // one will be used. - string service_config_id = 4; -} - -// Represents information regarding a quota operation. -message QuotaOperation { - // Supported quota modes. - enum QuotaMode { - // Guard against implicit default. Must not be used. - UNSPECIFIED = 0; - - // For AllocateQuota request, allocates quota for the amount specified in - // the service configuration or specified using the quota metrics. If the - // amount is higher than the available quota, allocation error will be - // returned and no quota will be allocated. - NORMAL = 1; - - // The operation allocates quota for the amount specified in the service - // configuration or specified using the quota metrics. If the amount is - // higher than the available quota, request does not fail but all available - // quota will be allocated. - BEST_EFFORT = 2; - - // For AllocateQuota request, only checks if there is enough quota - // available and does not change the available quota. No lock is placed on - // the available quota either. - CHECK_ONLY = 3; - } - - // Identity of the operation. This is expected to be unique within the scope - // of the service that generated the operation, and guarantees idempotency in - // case of retries. - // - // UUID version 4 is recommended, though not required. In scenarios where an - // operation is computed from existing information and an idempotent id is - // desirable for deduplication purpose, UUID version 5 is recommended. See - // RFC 4122 for details. - string operation_id = 1; - - // Fully qualified name of the API method for which this quota operation is - // requested. This name is used for matching quota rules or metric rules and - // billing status rules defined in service configuration. This field is not - // required if the quota operation is performed on non-API resources. - // - // Example of an RPC method name: - // google.example.library.v1.LibraryService.CreateShelf - string method_name = 2; - - // Identity of the consumer for whom this quota operation is being performed. - // - // This can be in one of the following formats: - // project:, - // project_number:, - // api_key:. - string consumer_id = 3; - - // Labels describing the operation. - map labels = 4; - - // Represents information about this operation. Each MetricValueSet - // corresponds to a metric defined in the service configuration. - // The data type used in the MetricValueSet must agree with - // the data type specified in the metric definition. - // - // Within a single operation, it is not allowed to have more than one - // MetricValue instances that have the same metric names and identical - // label value combinations. If a request has such duplicated MetricValue - // instances, the entire request is rejected with - // an invalid argument error. - repeated MetricValueSet quota_metrics = 5; - - // Quota mode for this operation. - QuotaMode quota_mode = 6; -} - -// Response message for the AllocateQuota method. -message AllocateQuotaResponse { - // The same operation_id value used in the AllocateQuotaRequest. Used for - // logging and diagnostics purposes. - string operation_id = 1; - - // Indicates the decision of the allocate. - repeated QuotaError allocate_errors = 2; - - // Quota metrics to indicate the result of allocation. Depending on the - // request, one or more of the following metrics will be included: - // - // 1. Per quota group or per quota metric incremental usage will be specified - // using the following delta metric : - // "serviceruntime.googleapis.com/api/consumer/quota_used_count" - // - // 2. The quota limit reached condition will be specified using the following - // boolean metric : - // "serviceruntime.googleapis.com/quota/exceeded" - repeated MetricValueSet quota_metrics = 3; - - // ID of the actual config used to process the request. - string service_config_id = 4; -} - -// Represents error information for -// [QuotaOperation][google.api.servicecontrol.v1.QuotaOperation]. -message QuotaError { - // Error codes related to project config validations are deprecated since the - // quota controller methods do not perform these validations. Instead services - // have to call the Check method, without quota_properties field, to perform - // these validations before calling the quota controller methods. These - // methods check only for project deletion to be wipe out compliant. - enum Code { - // This is never used. - UNSPECIFIED = 0; - - // Quota allocation failed. - // Same as [google.rpc.Code.RESOURCE_EXHAUSTED][]. - RESOURCE_EXHAUSTED = 8; - - // Consumer cannot access the service because the service requires active - // billing. - BILLING_NOT_ACTIVE = 107; - - // Consumer's project has been marked as deleted (soft deletion). - PROJECT_DELETED = 108; - - // Specified API key is invalid. - API_KEY_INVALID = 105; - - // Specified API Key has expired. - API_KEY_EXPIRED = 112; - } - - // Error code. - Code code = 1; - - // Subject to whom this error applies. See the specific enum for more details - // on this field. For example, "clientip:" or - // "project:". - string subject = 2; - - // Free-form text that provides details on the cause of the error. - string description = 3; -} diff --git a/google/api/servicecontrol/v1/service_controller.proto b/google/api/servicecontrol/v1/service_controller.proto deleted file mode 100644 index 38f53ca065..0000000000 --- a/google/api/servicecontrol/v1/service_controller.proto +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.api.servicecontrol.v1; - -import "google/api/annotations.proto"; -import "google/api/servicecontrol/v1/check_error.proto"; -import "google/api/servicecontrol/v1/operation.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/servicecontrol/v1;servicecontrol"; -option java_multiple_files = true; -option java_outer_classname = "ServiceControllerProto"; -option java_package = "com.google.api.servicecontrol.v1"; -option objc_class_prefix = "GASC"; - -// [Google Service Control API](/service-control/overview) -// -// Lets clients check and report operations against a [managed -// service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService). -service ServiceController { - // Checks an operation with Google Service Control to decide whether - // the given operation should proceed. It should be called before the - // operation is executed. - // - // If feasible, the client should cache the check results and reuse them for - // 60 seconds. In case of server errors, the client can rely on the cached - // results for longer time. - // - // NOTE: the [CheckRequest][google.api.servicecontrol.v1.CheckRequest] has the - // size limit of 64KB. - // - // This method requires the `servicemanagement.services.check` permission - // on the specified service. For more information, see - // [Google Cloud IAM](https://cloud.google.com/iam). - rpc Check(CheckRequest) returns (CheckResponse) { - option (google.api.http) = { - post: "/v1/services/{service_name}:check" - body: "*" - }; - } - - // Reports operation results to Google Service Control, such as logs and - // metrics. It should be called after an operation is completed. - // - // If feasible, the client should aggregate reporting data for up to 5 - // seconds to reduce API traffic. Limiting aggregation to 5 seconds is to - // reduce data loss during client crashes. Clients should carefully choose - // the aggregation time window to avoid data loss risk more than 0.01% - // for business and compliance reasons. - // - // NOTE: the [ReportRequest][google.api.servicecontrol.v1.ReportRequest] has - // the size limit of 1MB. - // - // This method requires the `servicemanagement.services.report` permission - // on the specified service. For more information, see - // [Google Cloud IAM](https://cloud.google.com/iam). - rpc Report(ReportRequest) returns (ReportResponse) { - option (google.api.http) = { - post: "/v1/services/{service_name}:report" - body: "*" - }; - } -} - -// Request message for the Check method. -message CheckRequest { - // The service name as specified in its service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See - // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - // for the definition of a service name. - string service_name = 1; - - // The operation to be checked. - Operation operation = 2; - - // Specifies which version of service configuration should be used to process - // the request. - // - // If unspecified or no matching version can be found, the - // latest one will be used. - string service_config_id = 4; -} - -// Response message for the Check method. -message CheckResponse { - message CheckInfo { - // Consumer info of this check. - ConsumerInfo consumer_info = 2; - } - - // `ConsumerInfo` provides information about the consumer project. - message ConsumerInfo { - // The Google cloud project number, e.g. 1234567890. A value of 0 indicates - // no project number is found. - int64 project_number = 1; - } - - // The same operation_id value used in the - // [CheckRequest][google.api.servicecontrol.v1.CheckRequest]. Used for logging - // and diagnostics purposes. - string operation_id = 1; - - // The current service rollout id used to process the request. - string service_rollout_id = 11; - - // Indicate the decision of the check. - // - // If no check errors are present, the service should process the operation. - // Otherwise the service should use the list of errors to determine the - // appropriate action. - repeated CheckError check_errors = 2; - - // The actual config id used to process the request. - string service_config_id = 5; - - // Feedback data returned from the server during processing a Check request. - CheckInfo check_info = 6; -} - -// Request message for the Report method. -message ReportRequest { - // The service name as specified in its service configuration. For example, - // `"pubsub.googleapis.com"`. - // - // See - // [google.api.Service](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service) - // for the definition of a service name. - string service_name = 1; - - // Operations to be reported. - // - // Typically the service should report one operation per request. - // Putting multiple operations into a single request is allowed, but should - // be used only when multiple operations are natually available at the time - // of the report. - // - // If multiple operations are in a single request, the total request size - // should be no larger than 1MB. See - // [ReportResponse.report_errors][google.api.servicecontrol.v1.ReportResponse.report_errors] - // for partial failure behavior. - repeated Operation operations = 2; - - // Specifies which version of service config should be used to process the - // request. - // - // If unspecified or no matching version can be found, the - // latest one will be used. - string service_config_id = 3; -} - -// Response message for the Report method. -message ReportResponse { - // Represents the processing error of one - // [Operation][google.api.servicecontrol.v1.Operation] in the request. - message ReportError { - // The - // [Operation.operation_id][google.api.servicecontrol.v1.Operation.operation_id] - // value from the request. - string operation_id = 1; - - // Details of the error when processing the - // [Operation][google.api.servicecontrol.v1.Operation]. - google.rpc.Status status = 2; - } - - // Partial failures, one for each `Operation` in the request that failed - // processing. There are three possible combinations of the RPC status: - // - // 1. The combination of a successful RPC status and an empty `report_errors` - // list indicates a complete success where all `Operations` in the - // request are processed successfully. - // 2. The combination of a successful RPC status and a non-empty - // `report_errors` list indicates a partial success where some - // `Operations` in the request succeeded. Each - // `Operation` that failed processing has a corresponding item - // in this list. - // 3. A failed RPC status indicates a general non-deterministic failure. - // When this happens, it's impossible to know which of the - // 'Operations' in the request succeeded or failed. - repeated ReportError report_errors = 1; - - // The actual config id used to process the request. - string service_config_id = 2; - - // The current service rollout id used to process the request. - string service_rollout_id = 4; -} diff --git a/google/api/servicemanagement/BUILD.bazel b/google/api/servicemanagement/BUILD.bazel deleted file mode 100644 index 1e5b8c2afa..0000000000 --- a/google/api/servicemanagement/BUILD.bazel +++ /dev/null @@ -1 +0,0 @@ -exports_files(glob(["*.yaml"])) \ No newline at end of file diff --git a/google/api/servicemanagement/README.md b/google/api/servicemanagement/README.md deleted file mode 100644 index e3e36df498..0000000000 --- a/google/api/servicemanagement/README.md +++ /dev/null @@ -1,102 +0,0 @@ -Google Service Management manages a set of *services*. Service -Management allows *service producers* to -publish their services on Google Cloud Platform so that they can be discovered -and used by *service consumers*. It also handles the tasks of tracking -service lifecycle and programming various backend systems -- such as -[Stackdriver Logging](https://cloud.google.com/stackdriver), -[Stackdriver Monitoring](https://cloud.google.com/stackdriver) -- to support -the managed services. - -If you are a service producer, you can use the Google Service Management API -and [Google Cloud SDK (gcloud)](/sdk) to publish and manage your services. -Each managed service has a service configuration which declares various aspects -of the service such as its API surface, along with parameters to configure the -supporting backend -systems, such as logging and monitoring. If you build your service using -[Google Cloud Endpoints](https://cloud.google.com/endpoints/), the service -configuration will be handled automatically. - -If you are a service consumer and want to use a managed service, you can use the -Google Service Management API or [Google Cloud Console](https://console.cloud.google.com) -to activate the -service for your [Google developer project](https://developers.google.com/console/help/new/), -then start using its APIs and functions. - -## Managed services - -REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}`
-REST schema is defined [here](/service-management/reference/rest/v1/services). - -A managed service refers to a network service managed by -Service Management. Each managed service has a unique name, such as -`example.googleapis.com`, which must be a valid fully-qualified DNS name, as per -RFC 1035. - -A managed service typically provides some REST APIs and/or other -functions to their service consumers, such as mobile apps or cloud services. - -Service producers can use methods, such as -[services.create](/service-management/reference/rest/v1/services/create), -[services.delete](/service-management/reference/rest/v1/services/delete), -[services.undelete](/service-management/reference/rest/v1/services/undelete), -to manipulate their managed services. - -## Service producers - -A service producer is the Google developer project responsible for publishing -and maintaining a managed service. Each managed service is owned by exactly one -service producer. - -## Service consumers - -A service consumer is a Google developer project that has enabled and can -invoke APIs on a managed service. A managed service can have many service -consumers. - -## Service configuration - -REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}/configs/{config_id}`
-REST schema is defined [here](/service-management/reference/rest/v1/services.configs). - -Each managed service is described by a service configuration which covers a wide -range of features, including its name, title, RPC API definitions, -REST API definitions, documentation, authentication, and more. - -To change the configuration of a managed service, the service producer needs to -publish an updated service configuration to Service Management. -Service Management keeps a history of published -service configurations, making it possible to easily retrace how a service's -configuration evolved over time. Service configurations can be published using -the -[services.configs.create](/service-management/reference/rest/v1/services.configs/create) -or [services.configs.submit](/service-management/reference/rest/v1/services.configs/submit) -methods. - -Alternatively, `services.configs.submit` allows publishing an -[OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification, formerly -known as the Swagger Specification, which is automatically converted to a -corresponding service configuration. - -## Service rollout - -REST URL: `https://servicemanagement.googleapis.com/v1/services/{service-name}/rollouts/{rollout-id}`
-REST schema is defined [here](/service-management/reference/rest/v1/services.rollouts). - -A `Rollout` defines how Google Service Management should deploy service -configurations to backend systems and how the configurations take effect at -runtime. It lets service producers specify multiple service configuration -versions to be deployed together, and a strategy that indicates how they -should be used. - -Updating a managed service's configuration can be dangerous, as a configuration -error can lead to a service outage. To mitigate risks, Service Management -supports gradual rollout of service configuration changes. This feature gives -service producers time to identity potential issues and rollback service -configuration changes in case of errors, thus minimizing the customer -impact of bad configurations. For example, you could specify that 5% of traffic -uses configuration 1, while the remaining 95% uses configuration 2. - -Service Management keeps a history of rollouts so that service -producers can undo to previous configuration versions. You can rollback a configuration -by initiating a new `Rollout` that clones a previously submitted -rollout record. \ No newline at end of file diff --git a/google/api/servicemanagement/artman_servicemanagement_v1.yaml b/google/api/servicemanagement/artman_servicemanagement_v1.yaml deleted file mode 100644 index cfb5fce219..0000000000 --- a/google/api/servicemanagement/artman_servicemanagement_v1.yaml +++ /dev/null @@ -1,34 +0,0 @@ -common: - api_name: servicemanagement - api_version: v1 - organization_name: google-cloud - proto_deps: - - name: google-common-protos - src_proto_paths: - - v1 - service_yaml: servicemanagement_v1.yaml - gapic_yaml: v1/servicemanagement_gapic.yaml -artifacts: -- name: gapic_config - type: GAPIC_CONFIG -- name: java_gapic - type: GAPIC - language: JAVA -- name: python_gapic - type: GAPIC - language: PYTHON -- name: nodejs_gapic - type: GAPIC - language: NODEJS -- name: php_gapic - type: GAPIC - language: PHP -- name: go_gapic - type: GAPIC - language: GO -- name: ruby_gapic - type: GAPIC - language: RUBY -- name: csharp_gapic - type: GAPIC - language: CSHARP diff --git a/google/api/servicemanagement/servicemanagement_v1.yaml b/google/api/servicemanagement/servicemanagement_v1.yaml deleted file mode 100644 index b23a788f86..0000000000 --- a/google/api/servicemanagement/servicemanagement_v1.yaml +++ /dev/null @@ -1,233 +0,0 @@ -type: google.api.Service -config_version: 2 -name: servicemanagement.googleapis.com -title: Google Service Management API - -apis: -- name: google.api.servicemanagement.v1.ServiceManager - -types: -- name: google.api.servicemanagement.v1.ConfigSource -- name: google.api.servicemanagement.v1.ConfigRef -- name: google.api.servicemanagement.v1.OperationMetadata -- name: google.api.servicemanagement.v1.Rollout -- name: google.api.servicemanagement.v1.SubmitConfigSourceResponse -- name: google.api.servicemanagement.v1.UndeleteServiceResponse - -documentation: - summary: |- - Google Service Management allows service producers to publish their services - on Google Cloud Platform so that they can be discovered and used by service - consumers. - overview: |- - Google Service Management manages a set of *services*. Service Management - allows *service producers* to publish their services on Google Cloud - Platform so that they can be discovered and used by *service consumers*. It - also handles the tasks of tracking service lifecycle and programming various - backend systems -- such as [Stackdriver - Logging](https://cloud.google.com/stackdriver), [Stackdriver - Monitoring](https://cloud.google.com/stackdriver) -- to support the managed - services. - - If you are a service producer, you can use the Google Service Management API - and [Google Cloud SDK (gcloud)](/sdk) to publish and manage your services. - Each managed service has a service configuration which declares various - aspects of the service such as its API surface, along with parameters to - configure the supporting backend systems, such as logging and monitoring. If - you build your service using [Google Cloud - Endpoints](https://cloud.google.com/endpoints/), the service configuration - will be handled automatically. - - If you are a service consumer and want to use a managed service, you can use - the Google Service Management API or [Google Cloud - Console](https://console.cloud.google.com) to activate the service for your - [Google developer project](https://developers.google.com/console/help/new/), - then start using its APIs and functions. - - ## Managed services - - REST URL: - `https://servicemanagement.googleapis.com/v1/services/{service-name}`
- REST schema is defined - [here](/service-management/reference/rest/v1/services). - - A managed service refers to a network service managed by Service Management. - Each managed service has a unique name, such as `example.googleapis.com`, - which must be a valid fully-qualified DNS name, as per RFC 1035. - - A managed service typically provides some REST APIs and/or other functions - to their service consumers, such as mobile apps or cloud services. - - Service producers can use methods, such as - [services.create](/service-management/reference/rest/v1/services/create), - [services.delete](/service-management/reference/rest/v1/services/delete), - [services.undelete](/service-management/reference/rest/v1/services/undelete), - to manipulate their managed services. - - ## Service producers - - A service producer is the Google developer project responsible for - publishing and maintaining a managed service. Each managed service is owned - by exactly one service producer. - - ## Service consumers - - A service consumer is a Google developer project that has enabled and can - invoke APIs on a managed service. A managed service can have many service - consumers. - - ## Service configuration - - REST URL: - `https://servicemanagement.googleapis.com/v1/services/{service-name}/configs/{config_id}` -
REST schema is defined - [here](/service-management/reference/rest/v1/services.configs). - - Each managed service is described by a service configuration which covers a - wide range of features, including its name, title, RPC API definitions, REST - API definitions, documentation, authentication, and more. - - To change the configuration of a managed service, the service producer needs - to publish an updated service configuration to Service Management. Service - Management keeps a history of published service configurations, making it - possible to easily retrace how a service's configuration evolved over time. - Service configurations can be published using the - [services.configs.create](/service-management/reference/rest/v1/services.configs/create) - or - [services.configs.submit](/service-management/reference/rest/v1/services.configs/submit) - methods. - - Alternatively, `services.configs.submit` allows publishing an - [OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification, - formerly known as the Swagger Specification, which is automatically - converted to a corresponding service configuration. - - ## Service rollout - - REST URL: - `https://servicemanagement.googleapis.com/v1/services/{service-name}/rollouts/{rollout-id}` -
REST schema is defined - [here](/service-management/reference/rest/v1/services.rollouts). - - A `Rollout` defines how Google Service Management should deploy service - configurations to backend systems and how the configurations take effect at - runtime. It lets service producers specify multiple service configuration - versions to be deployed together, and a strategy that indicates how they - should be used. - - Updating a managed service's configuration can be dangerous, as a - configuration error can lead to a service outage. To mitigate risks, Service - Management supports gradual rollout of service configuration changes. This - feature gives service producers time to identity potential issues and - rollback service configuration changes in case of errors, thus minimizing - the customer impact of bad configurations. For example, you could specify - that 5% of traffic uses configuration 1, while the remaining 95% uses - configuration 2. - - Service Management keeps a history of rollouts so that service producers can - undo to previous configuration versions. You can rollback a configuration by - initiating a new `Rollout` that clones a previously submitted rollout - record. - rules: - - selector: google.longrunning.Operations.ListOperations - description: Lists service operations that match the specified filter in the request. - -backend: - rules: - - selector: google.longrunning.Operations.ListOperations - deadline: 10.0 - - selector: google.longrunning.Operations.GetOperation - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.ListServices - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.GetService - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.CreateService - deadline: 20.0 - - selector: google.api.servicemanagement.v1.ServiceManager.DeleteService - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.UndeleteService - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.ListServiceConfigs - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.GetServiceConfig - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.CreateServiceConfig - deadline: 20.0 - - selector: google.api.servicemanagement.v1.ServiceManager.SubmitConfigSource - deadline: 20.0 - - selector: google.api.servicemanagement.v1.ServiceManager.ListServiceRollouts - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.GetServiceRollout - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.GenerateConfigReport - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.EnableService - deadline: 10.0 - - selector: google.api.servicemanagement.v1.ServiceManager.DisableService - deadline: 10.0 - - selector: google.iam.v1.IAMPolicy.SetIamPolicy - deadline: 10.0 - - selector: google.iam.v1.IAMPolicy.GetIamPolicy - deadline: 10.0 - - selector: google.iam.v1.IAMPolicy.TestIamPermissions - deadline: 10.0 - -http: - rules: - - selector: google.longrunning.Operations.ListOperations - get: /v1/operations - - - selector: google.iam.v1.IAMPolicy.SetIamPolicy - post: '/v1/{resource=services/*}:setIamPolicy' - body: '*' - additional_bindings: - - post: '/v1/{resource=services/*/consumers/*}:setIamPolicy' - body: '*' - - - selector: google.iam.v1.IAMPolicy.GetIamPolicy - post: '/v1/{resource=services/*}:getIamPolicy' - body: '*' - additional_bindings: - - post: '/v1/{resource=services/*/consumers/*}:getIamPolicy' - body: '*' - - - selector: google.iam.v1.IAMPolicy.TestIamPermissions - post: '/v1/{resource=services/*}:testIamPermissions' - body: '*' - additional_bindings: - - post: '/v1/{resource=services/*/consumers/*}:testIamPermissions' - body: '*' - - -authentication: - rules: - - selector: '*' - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform, - https://www.googleapis.com/auth/service.management - - selector: |- - google.api.servicemanagement.v1.ServiceManager.GetService, - google.api.servicemanagement.v1.ServiceManager.GetServiceConfig, - google.api.servicemanagement.v1.ServiceManager.GetServiceRollout, - google.api.servicemanagement.v1.ServiceManager.ListServiceConfigs, - google.api.servicemanagement.v1.ServiceManager.ListServiceRollouts, - google.api.servicemanagement.v1.ServiceManager.ListServices - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform, - https://www.googleapis.com/auth/cloud-platform.read-only, - https://www.googleapis.com/auth/service.management, - https://www.googleapis.com/auth/service.management.readonly - - selector: |- - google.iam.v1.IAMPolicy.GetIamPolicy, - google.iam.v1.IAMPolicy.TestIamPermissions - oauth: - canonical_scopes: |- - https://www.googleapis.com/auth/cloud-platform, - https://www.googleapis.com/auth/cloud-platform.read-only, - https://www.googleapis.com/auth/service.management, - https://www.googleapis.com/auth/service.management.readonly diff --git a/google/api/servicemanagement/v1/BUILD.bazel b/google/api/servicemanagement/v1/BUILD.bazel deleted file mode 100644 index 359d9f19a9..0000000000 --- a/google/api/servicemanagement/v1/BUILD.bazel +++ /dev/null @@ -1,383 +0,0 @@ -# This file was automatically generated by BuildFileGenerator - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -load("@rules_proto//proto:defs.bzl", "proto_library") -load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") - -proto_library( - name = "servicemanagement_proto", - srcs = [ - "resources.proto", - "servicemanager.proto", - ], - deps = [ - "//google/api:annotations_proto", - "//google/api:config_change_proto", - "//google/api:metric_proto", - "//google/api:service_proto", - "//google/longrunning:operations_proto", - "//google/rpc:status_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:field_mask_proto", - "@com_google_protobuf//:struct_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -proto_library_with_info( - name = "servicemanagement_proto_with_info", - deps = [ - ":servicemanagement_proto", - "//google/cloud:common_resources_proto", - ], -) - -############################################################################## -# Java -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "java_gapic_assembly_gradle_pkg", - "java_gapic_library", - "java_gapic_test", - "java_grpc_library", - "java_proto_library", -) - -java_proto_library( - name = "servicemanagement_java_proto", - deps = [":servicemanagement_proto"], -) - -java_grpc_library( - name = "servicemanagement_java_grpc", - srcs = [":servicemanagement_proto"], - deps = [":servicemanagement_java_proto"], -) - -java_gapic_library( - name = "servicemanagement_java_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - test_deps = [ - ":servicemanagement_java_grpc" - ], - deps = [ - ":servicemanagement_java_proto", - "//google/api:api_java_proto", - ], -) - -java_gapic_test( - name = "servicemanagement_java_gapic_test_suite", - test_classes = [ - "com.google.cloud.api.servicemanagement.v1.ServiceManagerClientTest", - ], - runtime_deps = [":servicemanagement_java_gapic_test"], -) - -# Open Source Packages -java_gapic_assembly_gradle_pkg( - name = "google-cloud-api-servicemanagement-v1-java", - deps = [ - ":servicemanagement_java_gapic", - ":servicemanagement_java_grpc", - ":servicemanagement_java_proto", - ":servicemanagement_proto", - ], -) - -############################################################################## -# Go -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "go_gapic_assembly_pkg", - "go_gapic_library", - "go_proto_library", - "go_test", -) - -go_proto_library( - name = "servicemanagement_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "google.golang.org/genproto/googleapis/api/servicemanagement/v1", - protos = [":servicemanagement_proto"], - deps = [ - "//google/api:annotations_go_proto", - "//google/api:configchange_go_proto", - "//google/api:metric_go_proto", - "//google/api:serviceconfig_go_proto", - "//google/longrunning:longrunning_go_proto", - "//google/rpc:status_go_proto", - ], -) - -go_gapic_library( - name = "servicemanagement_go_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - importpath = "cloud.google.com/go/api/servicemanagement/apiv1", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - deps = [ - ":servicemanagement_go_proto", - "//google/api:serviceconfig_go_proto", - "//google/longrunning:longrunning_go_gapic", - "//google/longrunning:longrunning_go_proto", - "@com_google_cloud_go//longrunning:go_default_library", - "@io_bazel_rules_go//proto/wkt:any_go_proto", - "@io_bazel_rules_go//proto/wkt:struct_go_proto", - ], -) - -go_test( - name = "servicemanagement_go_gapic_test", - srcs = [":servicemanagement_go_gapic_srcjar_test"], - embed = [":servicemanagement_go_gapic"], - importpath = "cloud.google.com/go/api/servicemanagement/apiv1", -) - -# Open Source Packages -go_gapic_assembly_pkg( - name = "gapi-cloud-api-servicemanagement-v1-go", - deps = [ - ":servicemanagement_go_gapic", - ":servicemanagement_go_gapic_srcjar-smoke-test.srcjar", - ":servicemanagement_go_gapic_srcjar-test.srcjar", - ":servicemanagement_go_proto", - ], -) - -############################################################################## -# Python -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "moved_proto_library", - "py_gapic_assembly_pkg", - "py_gapic_library", - "py_grpc_library", - "py_proto_library", -) - -moved_proto_library( - name = "servicemanagement_moved_proto", - srcs = [":servicemanagement_proto"], - deps = [ - "//google/api:annotations_proto", - "//google/api:config_change_proto", - "//google/api:metric_proto", - "//google/api:service_proto", - "//google/longrunning:operations_proto", - "//google/rpc:status_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:field_mask_proto", - "@com_google_protobuf//:struct_proto", - "@com_google_protobuf//:timestamp_proto", - ], -) - -py_proto_library( - name = "servicemanagement_py_proto", - plugin = "@protoc_docs_plugin//:docs_plugin", - deps = [":servicemanagement_moved_proto"], -) - -py_grpc_library( - name = "servicemanagement_py_grpc", - srcs = [":servicemanagement_moved_proto"], - deps = [":servicemanagement_py_proto"], -) - -py_gapic_library( - name = "servicemanagement_py_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - deps = [ - ":servicemanagement_py_grpc", - ":servicemanagement_py_proto", - ], -) - -# Open Source Packages -py_gapic_assembly_pkg( - name = "api-servicemanagement-v1-py", - deps = [ - ":servicemanagement_py_gapic", - ":servicemanagement_py_grpc", - ":servicemanagement_py_proto", - ], -) - -############################################################################## -# PHP -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "php_gapic_assembly_pkg", - "php_gapic_library", - "php_grpc_library", - "php_proto_library", -) - -php_proto_library( - name = "servicemanagement_php_proto", - deps = [":servicemanagement_proto"], -) - -php_grpc_library( - name = "servicemanagement_php_grpc", - srcs = [":servicemanagement_proto"], - deps = [":servicemanagement_php_proto"], -) - -php_gapic_library( - name = "servicemanagement_php_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - deps = [ - ":servicemanagement_php_grpc", - ":servicemanagement_php_proto", - ], -) - -# Open Source Packages -php_gapic_assembly_pkg( - name = "google-cloud-api-servicemanagement-v1-php", - deps = [ - ":servicemanagement_php_gapic", - ":servicemanagement_php_grpc", - ":servicemanagement_php_proto", - ], -) - -############################################################################## -# Node.js -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "nodejs_gapic_assembly_pkg", - "nodejs_gapic_library", -) - -nodejs_gapic_library( - name = "servicemanagement_nodejs_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - deps = [], -) - -nodejs_gapic_assembly_pkg( - name = "api-servicemanagement-v1-nodejs", - deps = [ - ":servicemanagement_nodejs_gapic", - ":servicemanagement_proto", - ], -) - -############################################################################## -# Ruby -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "ruby_gapic_assembly_pkg", - "ruby_gapic_library", - "ruby_grpc_library", - "ruby_proto_library", -) - -ruby_proto_library( - name = "servicemanagement_ruby_proto", - deps = [":servicemanagement_proto"], -) - -ruby_grpc_library( - name = "servicemanagement_ruby_grpc", - srcs = [":servicemanagement_proto"], - deps = [":servicemanagement_ruby_proto"], -) - -ruby_gapic_library( - name = "servicemanagement_ruby_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - deps = [ - ":servicemanagement_ruby_grpc", - ":servicemanagement_ruby_proto", - ], -) - -# Open Source Packages -ruby_gapic_assembly_pkg( - name = "google-cloud-api-servicemanagement-v1-ruby", - deps = [ - ":servicemanagement_ruby_gapic", - ":servicemanagement_ruby_grpc", - ":servicemanagement_ruby_proto", - ], -) - -############################################################################## -# C# -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "csharp_gapic_assembly_pkg", - "csharp_gapic_library", - "csharp_grpc_library", - "csharp_proto_library", -) - -csharp_proto_library( - name = "servicemanagement_csharp_proto", - deps = [":servicemanagement_proto"], -) - -csharp_grpc_library( - name = "servicemanagement_csharp_grpc", - srcs = [":servicemanagement_proto"], - deps = [":servicemanagement_csharp_proto"], -) - -csharp_gapic_library( - name = "servicemanagement_csharp_gapic", - src = ":servicemanagement_proto_with_info", - gapic_yaml = "servicemanagement_gapic.yaml", - package = "google.api.servicemanagement.v1", - service_yaml = "//google/api/servicemanagement:servicemanagement_v1.yaml", - deps = [ - ":servicemanagement_csharp_grpc", - ":servicemanagement_csharp_proto", - ], -) - -# Open Source Packages -csharp_gapic_assembly_pkg( - name = "google-cloud-api-servicemanagement-v1-csharp", - deps = [ - ":servicemanagement_csharp_gapic", - ":servicemanagement_csharp_grpc", - ":servicemanagement_csharp_proto", - ], -) - -############################################################################## -# C++ -############################################################################## -# Put your C++ rules here diff --git a/google/api/servicemanagement/v1/resources.proto b/google/api/servicemanagement/v1/resources.proto deleted file mode 100644 index 1c924849cb..0000000000 --- a/google/api/servicemanagement/v1/resources.proto +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -package google.api.servicemanagement.v1; - -import "google/api/annotations.proto"; -import "google/api/config_change.proto"; -import "google/api/metric.proto"; -import "google/api/service.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ServiceManagement.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicemanagement/v1;servicemanagement"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesProto"; -option java_package = "com.google.api.servicemanagement.v1"; -option objc_class_prefix = "GASM"; -option php_namespace = "Google\\Cloud\\ServiceManagement\\V1"; - -// The full representation of a Service that is managed by -// Google Service Management. -message ManagedService { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. - string service_name = 2; - - // ID of the project that produces and owns this service. - string producer_project_id = 3; -} - -// The metadata associated with a long running operation resource. -message OperationMetadata { - // Represents the status of one operation step. - message Step { - // The short description of the step. - string description = 2; - - // The status code. - Status status = 4; - } - - // Code describes the status of the operation (or one of its steps). - enum Status { - // Unspecifed code. - STATUS_UNSPECIFIED = 0; - - // The operation or step has completed without errors. - DONE = 1; - - // The operation or step has not started yet. - NOT_STARTED = 2; - - // The operation or step is in progress. - IN_PROGRESS = 3; - - // The operation or step has completed with errors. If the operation is - // rollbackable, the rollback completed with errors too. - FAILED = 4; - - // The operation or step has completed with cancellation. - CANCELLED = 5; - } - - // The full name of the resources that this operation is directly - // associated with. - repeated string resource_names = 1; - - // Detailed status information for each step. The order is undetermined. - repeated Step steps = 2; - - // Percentage of completion of this operation, ranging from 0 to 100. - int32 progress_percentage = 3; - - // The start time of the operation. - google.protobuf.Timestamp start_time = 4; -} - -// Represents a diagnostic message (error or warning) -message Diagnostic { - // The kind of diagnostic information possible. - enum Kind { - // Warnings and errors - WARNING = 0; - - // Only errors - ERROR = 1; - } - - // File name and line number of the error or warning. - string location = 1; - - // The kind of diagnostic information provided. - Kind kind = 2; - - // Message describing the error or warning. - string message = 3; -} - -// Represents a source file which is used to generate the service configuration -// defined by `google.api.Service`. -message ConfigSource { - // A unique ID for a specific instance of this message, typically assigned - // by the client for tracking purpose. If empty, the server may choose to - // generate one instead. - string id = 5; - - // Set of source configuration files that are used to generate a service - // configuration (`google.api.Service`). - repeated ConfigFile files = 2; -} - -// Generic specification of a source configuration file -message ConfigFile { - enum FileType { - // Unknown file type. - FILE_TYPE_UNSPECIFIED = 0; - - // YAML-specification of service. - SERVICE_CONFIG_YAML = 1; - - // OpenAPI specification, serialized in JSON. - OPEN_API_JSON = 2; - - // OpenAPI specification, serialized in YAML. - OPEN_API_YAML = 3; - - // FileDescriptorSet, generated by protoc. - // - // To generate, use protoc with imports and source info included. - // For an example test.proto file, the following command would put the value - // in a new file named out.pb. - // - // $protoc --include_imports --include_source_info test.proto -o out.pb - FILE_DESCRIPTOR_SET_PROTO = 4; - - // Uncompiled Proto file. Used for storage and display purposes only, - // currently server-side compilation is not supported. Should match the - // inputs to 'protoc' command used to generated FILE_DESCRIPTOR_SET_PROTO. A - // file of this type can only be included if at least one file of type - // FILE_DESCRIPTOR_SET_PROTO is included. - PROTO_FILE = 6; - } - - // The file name of the configuration file (full or relative path). - string file_path = 1; - - // The bytes that constitute the file. - bytes file_contents = 3; - - // The type of configuration file this represents. - FileType file_type = 4; -} - -// Represents a service configuration with its name and id. -message ConfigRef { - // Resource name of a service config. It must have the following - // format: "services/{service name}/configs/{config id}". - string name = 1; -} - -// Change report associated with a particular service configuration. -// -// It contains a list of ConfigChanges based on the comparison between -// two service configurations. -message ChangeReport { - // List of changes between two service configurations. - // The changes will be alphabetically sorted based on the identifier - // of each change. - // A ConfigChange identifier is a dot separated path to the configuration. - // Example: visibility.rules[selector='LibraryService.CreateBook'].restriction - repeated google.api.ConfigChange config_changes = 1; -} - -// A rollout resource that defines how service configuration versions are pushed -// to control plane systems. Typically, you create a new version of the -// service config, and then create a Rollout to push the service config. -message Rollout { - // Strategy that specifies how clients of Google Service Controller want to - // send traffic to use different config versions. This is generally - // used by API proxy to split traffic based on your configured precentage for - // each config version. - // - // One example of how to gradually rollout a new service configuration using - // this - // strategy: - // Day 1 - // - // Rollout { - // id: "example.googleapis.com/rollout_20160206" - // traffic_percent_strategy { - // percentages: { - // "example.googleapis.com/20160201": 70.00 - // "example.googleapis.com/20160206": 30.00 - // } - // } - // } - // - // Day 2 - // - // Rollout { - // id: "example.googleapis.com/rollout_20160207" - // traffic_percent_strategy: { - // percentages: { - // "example.googleapis.com/20160206": 100.00 - // } - // } - // } - message TrafficPercentStrategy { - // Maps service configuration IDs to their corresponding traffic percentage. - // Key is the service configuration ID, Value is the traffic percentage - // which must be greater than 0.0 and the sum must equal to 100.0. - map percentages = 1; - } - - // Strategy used to delete a service. This strategy is a placeholder only - // used by the system generated rollout to delete a service. - message DeleteServiceStrategy {} - - // Status of a Rollout. - enum RolloutStatus { - // No status specified. - ROLLOUT_STATUS_UNSPECIFIED = 0; - - // The Rollout is in progress. - IN_PROGRESS = 1; - - // The Rollout has completed successfully. - SUCCESS = 2; - - // The Rollout has been cancelled. This can happen if you have overlapping - // Rollout pushes, and the previous ones will be cancelled. - CANCELLED = 3; - - // The Rollout has failed and the rollback attempt has failed too. - FAILED = 4; - - // The Rollout has not started yet and is pending for execution. - PENDING = 5; - - // The Rollout has failed and rolled back to the previous successful - // Rollout. - FAILED_ROLLED_BACK = 6; - } - - // Optional unique identifier of this Rollout. Only lower case letters, digits - // and '-' are allowed. - // - // If not specified by client, the server will generate one. The generated id - // will have the form of , where "date" is the create - // date in ISO 8601 format. "revision number" is a monotonically increasing - // positive number that is reset every day for each service. - // An example of the generated rollout_id is '2016-02-16r1' - string rollout_id = 1; - - // Creation time of the rollout. Readonly. - google.protobuf.Timestamp create_time = 2; - - // The user who created the Rollout. Readonly. - string created_by = 3; - - // The status of this rollout. Readonly. In case of a failed rollout, - // the system will automatically rollback to the current Rollout - // version. Readonly. - RolloutStatus status = 4; - - // Strategy that defines which versions of service configurations should be - // pushed - // and how they should be used at runtime. - oneof strategy { - // Google Service Control selects service configurations based on - // traffic percentage. - TrafficPercentStrategy traffic_percent_strategy = 5; - - // The strategy associated with a rollout to delete a `ManagedService`. - // Readonly. - DeleteServiceStrategy delete_service_strategy = 200; - } - - // The name of the service associated with this Rollout. - string service_name = 8; -} diff --git a/google/api/servicemanagement/v1/servicemanagement_gapic.yaml b/google/api/servicemanagement/v1/servicemanagement_gapic.yaml deleted file mode 100644 index 0cca80e290..0000000000 --- a/google/api/servicemanagement/v1/servicemanagement_gapic.yaml +++ /dev/null @@ -1,301 +0,0 @@ -type: com.google.api.codegen.ConfigProto -config_schema_version: 1.0.0 -# The settings of generated code in a specific language. -language_settings: - java: - package_name: com.google.cloud.api.servicemanagement.v1 - python: - package_name: google.cloud.api.servicemanagement_v1.gapic - go: - package_name: cloud.google.com/go/api/servicemanagement/apiv1 - csharp: - package_name: Google.Api.Servicemanagement.V1 - ruby: - package_name: Google::Cloud::Api::Servicemanagement::V1 - php: - package_name: Google\Cloud\Api\Servicemanagement\V1 - nodejs: - package_name: servicemanagement.v1 -# A list of API interface configurations. -interfaces: - # The fully qualified name of the API interface. -- name: google.api.servicemanagement.v1.ServiceManager - # A list of resource collection configurations. - # Consists of a name_pattern and an entity_name. - # The name_pattern is a pattern to describe the names of the resources of this - # collection, using the platform's conventions for URI patterns. A generator - # may use this to generate methods to compose and decompose such names. The - # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; - # those will be taken as hints for the parameter names of the generated - # methods. If empty, no name methods are generated. - # The entity_name is the name to be used as a basis for generated methods and - # classes. - smoke_test: - method: ListServices - init_fields: - - producer_project_id=$PROJECT_ID - collections: [] - # Definition for retryable codes. - retry_codes_def: - - name: idempotent - retry_codes: - - UNAVAILABLE - - DEADLINE_EXCEEDED - - name: non_idempotent - retry_codes: [] - # Definition for retry/backoff parameters. - retry_params_def: - - name: default - initial_retry_delay_millis: 100 - retry_delay_multiplier: 1.3 - max_retry_delay_millis: 60000 - initial_rpc_timeout_millis: 20000 - rpc_timeout_multiplier: 1 - max_rpc_timeout_millis: 20000 - total_timeout_millis: 600000 - # A list of method configurations. - # Common properties: - # - # name - The simple name of the method. - # - # flattening - Specifies the configuration for parameter flattening. - # Describes the parameter groups for which a generator should produce method - # overloads which allow a client to directly pass request message fields as - # method parameters. This information may or may not be used, depending on - # the target language. - # Consists of groups, which each represent a list of parameters to be - # flattened. Each parameter listed must be a field of the request message. - # - # required_fields - Fields that are always required for a request to be - # valid. - # - # resource_name_treatment - An enum that specifies how to treat the resource - # name formats defined in the field_name_patterns and - # response_field_name_patterns fields. - # UNSET: default value - # NONE: the collection configs will not be used by the generated code. - # VALIDATE: string fields will be validated by the client against the - # specified resource name formats. - # STATIC_TYPES: the client will use generated types for resource names. - # - # page_streaming - Specifies the configuration for paging. - # Describes information for generating a method which transforms a paging - # list RPC into a stream of resources. - # Consists of a request and a response. - # The request specifies request information of the list method. It defines - # which fields match the paging pattern in the request. The request consists - # of a page_size_field and a token_field. The page_size_field is the name of - # the optional field specifying the maximum number of elements to be - # returned in the response. The token_field is the name of the field in the - # request containing the page token. - # The response specifies response information of the list method. It defines - # which fields match the paging pattern in the response. The response - # consists of a token_field and a resources_field. The token_field is the - # name of the field in the response containing the next page token. The - # resources_field is the name of the field in the response containing the - # list of resources belonging to the page. - # - # retry_codes_name - Specifies the configuration for retryable codes. The - # name must be defined in interfaces.retry_codes_def. - # - # retry_params_name - Specifies the configuration for retry/backoff - # parameters. The name must be defined in interfaces.retry_params_def. - # - # field_name_patterns - Maps the field name of the request type to - # entity_name of interfaces.collections. - # Specifies the string pattern that the field must follow. - # - # timeout_millis - Specifies the default timeout for a non-retrying call. If - # the call is retrying, refer to retry_params_name instead. - methods: - - name: ListServices - flattening: - groups: - - parameters: - - producer_project_id - - consumer_id - required_fields: - page_streaming: - request: - page_size_field: page_size - token_field: page_token - response: - token_field: next_page_token - resources_field: services - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: GetService - flattening: - groups: - - parameters: - - service_name - required_fields: - - service_name - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: CreateService - flattening: - groups: - - parameters: - - service - required_fields: - - service - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 20000 - - name: DeleteService - flattening: - groups: - - parameters: - - service_name - required_fields: - - service_name - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 60000 - - name: UndeleteService - flattening: - groups: - - parameters: - - service_name - required_fields: - - service_name - retry_codes_name: non_idempotent - retry_params_name: default - # REVIEW: Could this operation take a long time? - timeout_millis: 60000 - - name: ListServiceConfigs - flattening: - groups: - - parameters: - - service_name - required_fields: - - service_name - page_streaming: - request: - page_size_field: page_size - token_field: page_token - response: - token_field: next_page_token - resources_field: service_configs - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: GetServiceConfig - flattening: - groups: - - parameters: - - service_name - - config_id - - view - required_fields: - - service_name - - config_id - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: CreateServiceConfig - flattening: - groups: - - parameters: - - service_name - - service_config - required_fields: - - service_name - - service_config - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 20000 - - name: SubmitConfigSource - flattening: - groups: - - parameters: - - service_name - - config_source - - validate_only - required_fields: - - service_name - - config_source - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 10000 - - name: ListServiceRollouts - flattening: - groups: - - parameters: - - service_name - - filter - required_fields: - - service_name - page_streaming: - request: - page_size_field: page_size - token_field: page_token - response: - token_field: next_page_token - resources_field: rollouts - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: GetServiceRollout - flattening: - groups: - - parameters: - - service_name - - rollout_id - required_fields: - - service_name - - rollout_id - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: CreateServiceRollout - flattening: - groups: - - parameters: - - service_name - - rollout - required_fields: - - service_name - - rollout - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 10000 - - name: GenerateConfigReport - flattening: - groups: - - parameters: - - new_config - - old_config - required_fields: - - new_config - - old_config - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 10000 - - name: EnableService - flattening: - groups: - - parameters: - - service_name - - consumer_id - required_fields: - - service_name - - consumer_id - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 - - name: DisableService - flattening: - groups: - - parameters: - - service_name - - consumer_id - required_fields: - - service_name - - consumer_id - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 10000 diff --git a/google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json b/google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json deleted file mode 100755 index e2ec9d59e9..0000000000 --- a/google/api/servicemanagement/v1/servicemanagement_grpc_service_config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "methodConfig": [ - { - "name": [ - { - "service": "google.api.servicemanagement.v1.ServiceManager" - } - ], - "timeout": "10s" - } - ] -} diff --git a/google/api/servicemanagement/v1/servicemanager.proto b/google/api/servicemanagement/v1/servicemanager.proto deleted file mode 100644 index 02d506665d..0000000000 --- a/google/api/servicemanagement/v1/servicemanager.proto +++ /dev/null @@ -1,503 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -package google.api.servicemanagement.v1; - -import "google/api/annotations.proto"; -import "google/api/service.proto"; -import "google/api/servicemanagement/v1/resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ServiceManagement.V1"; -option go_package = "google.golang.org/genproto/googleapis/api/servicemanagement/v1;servicemanagement"; -option java_multiple_files = true; -option java_outer_classname = "ServiceManagerProto"; -option java_package = "com.google.api.servicemanagement.v1"; -option objc_class_prefix = "GASM"; -option php_namespace = "Google\\Cloud\\ServiceManagement\\V1"; - -// [Google Service Management API](/service-management/overview) -service ServiceManager { - // Lists managed services. - // - // Returns all public services. For authenticated users, also returns all - // services the calling user has "servicemanagement.services.get" permission - // for. - // - // **BETA:** If the caller specifies the `consumer_id`, it returns only the - // services enabled on the consumer. The `consumer_id` must have the format - // of "project:{PROJECT-ID}". - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v1/services" - }; - } - - // Gets a managed service. Authentication is required unless the service is - // public. - rpc GetService(GetServiceRequest) returns (ManagedService) { - option (google.api.http) = { - get: "/v1/services/{service_name}" - }; - } - - // Creates a new managed service. - // Please note one producer project can own no more than 20 services. - // - // Operation - rpc CreateService(CreateServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/services" - body: "service" - }; - } - - // Deletes a managed service. This method will change the service to the - // `Soft-Delete` state for 30 days. Within this period, service producers may - // call - // [UndeleteService][google.api.servicemanagement.v1.ServiceManager.UndeleteService] - // to restore the service. After 30 days, the service will be permanently - // deleted. - // - // Operation - rpc DeleteService(DeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/services/{service_name}" - }; - } - - // Revives a previously deleted managed service. The method restores the - // service using the configuration at the time the service was deleted. - // The target service must exist and must have been deleted within the - // last 30 days. - // - // Operation - rpc UndeleteService(UndeleteServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/services/{service_name}:undelete" - }; - } - - // Lists the history of the service configuration for a managed service, - // from the newest to the oldest. - rpc ListServiceConfigs(ListServiceConfigsRequest) - returns (ListServiceConfigsResponse) { - option (google.api.http) = { - get: "/v1/services/{service_name}/configs" - }; - } - - // Gets a service configuration (version) for a managed service. - rpc GetServiceConfig(GetServiceConfigRequest) returns (google.api.Service) { - option (google.api.http) = { - get: "/v1/services/{service_name}/configs/{config_id}" - additional_bindings { get: "/v1/services/{service_name}/config" } - }; - } - - // Creates a new service configuration (version) for a managed service. - // This method only stores the service configuration. To roll out the service - // configuration to backend systems please call - // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. - // - // Only the 100 most recent service configurations and ones referenced by - // existing rollouts are kept for each service. The rest will be deleted - // eventually. - rpc CreateServiceConfig(CreateServiceConfigRequest) - returns (google.api.Service) { - option (google.api.http) = { - post: "/v1/services/{service_name}/configs" - body: "service_config" - }; - } - - // Creates a new service configuration (version) for a managed service based - // on - // user-supplied configuration source files (for example: OpenAPI - // Specification). This method stores the source configurations as well as the - // generated service configuration. To rollout the service configuration to - // other services, - // please call - // [CreateServiceRollout][google.api.servicemanagement.v1.ServiceManager.CreateServiceRollout]. - // - // Only the 100 most recent configuration sources and ones referenced by - // existing service configurtions are kept for each service. The rest will be - // deleted eventually. - // - // Operation - rpc SubmitConfigSource(SubmitConfigSourceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/services/{service_name}/configs:submit" - body: "*" - }; - } - - // Lists the history of the service configuration rollouts for a managed - // service, from the newest to the oldest. - rpc ListServiceRollouts(ListServiceRolloutsRequest) - returns (ListServiceRolloutsResponse) { - option (google.api.http) = { - get: "/v1/services/{service_name}/rollouts" - }; - } - - // Gets a service configuration - // [rollout][google.api.servicemanagement.v1.Rollout]. - rpc GetServiceRollout(GetServiceRolloutRequest) returns (Rollout) { - option (google.api.http) = { - get: "/v1/services/{service_name}/rollouts/{rollout_id}" - }; - } - - // Creates a new service configuration rollout. Based on rollout, the - // Google Service Management will roll out the service configurations to - // different backend services. For example, the logging configuration will be - // pushed to Google Cloud Logging. - // - // Please note that any previous pending and running Rollouts and associated - // Operations will be automatically cancelled so that the latest Rollout will - // not be blocked by previous Rollouts. - // - // Only the 100 most recent (in any state) and the last 10 successful (if not - // already part of the set of 100 most recent) rollouts are kept for each - // service. The rest will be deleted eventually. - // - // Operation - rpc CreateServiceRollout(CreateServiceRolloutRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/services/{service_name}/rollouts" - body: "rollout" - }; - } - - // Generates and returns a report (errors, warnings and changes from - // existing configurations) associated with - // GenerateConfigReportRequest.new_value - // - // If GenerateConfigReportRequest.old_value is specified, - // GenerateConfigReportRequest will contain a single ChangeReport based on the - // comparison between GenerateConfigReportRequest.new_value and - // GenerateConfigReportRequest.old_value. - // If GenerateConfigReportRequest.old_value is not specified, this method - // will compare GenerateConfigReportRequest.new_value with the last pushed - // service configuration. - rpc GenerateConfigReport(GenerateConfigReportRequest) - returns (GenerateConfigReportResponse) { - option (google.api.http) = { - post: "/v1/services:generateConfigReport" - body: "*" - }; - } - - // Enables a [service][google.api.servicemanagement.v1.ManagedService] for a - // project, so it can be used for the project. See [Cloud Auth - // Guide](https://cloud.google.com/docs/authentication) for more information. - // - // Operation - rpc EnableService(EnableServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/services/{service_name}:enable" - body: "*" - }; - } - - // Disables a [service][google.api.servicemanagement.v1.ManagedService] for a - // project, so it can no longer be be used for the project. It prevents - // accidental usage that may cause unexpected billing charges or security - // leaks. - // - // Operation - rpc DisableService(DisableServiceRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/services/{service_name}:disable" - body: "*" - }; - } -} - -// Request message for `ListServices` method. -message ListServicesRequest { - // Include services produced by the specified project. - string producer_project_id = 1; - - // Requested size of the next page of data. - int32 page_size = 5; - - // Token identifying which result to start with; returned by a previous list - // call. - string page_token = 6; - - // Include services consumed by the specified consumer. - // - // The Google Service Management implementation accepts the following - // forms: - // - project: - string consumer_id = 7; -} - -// Response message for `ListServices` method. -message ListServicesResponse { - // The returned services will only have the name field set. - repeated ManagedService services = 1; - - // Token that can be passed to `ListServices` to resume a paginated query. - string next_page_token = 2; -} - -// Request message for `GetService` method. -message GetServiceRequest { - // The name of the service. See the `ServiceManager` overview for naming - // requirements. For example: `example.googleapis.com`. - string service_name = 1; -} - -// Request message for CreateService method. -message CreateServiceRequest { - // Initial values for the service resource. - ManagedService service = 1; -} - -// Request message for DeleteService method. -message DeleteServiceRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; -} - -// Request message for UndeleteService method. -message UndeleteServiceRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; -} - -// Response message for UndeleteService method. -message UndeleteServiceResponse { - // Revived service resource. - ManagedService service = 1; -} - -// Request message for GetServiceConfig method. -message GetServiceConfigRequest { - enum ConfigView { - // Server response includes all fields except SourceInfo. - BASIC = 0; - - // Server response includes all fields including SourceInfo. - // SourceFiles are of type 'google.api.servicemanagement.v1.ConfigFile' - // and are only available for configs created using the - // SubmitConfigSource method. - FULL = 1; - } - - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The id of the service configuration resource. - string config_id = 2; - - // Specifies which parts of the Service Config should be returned in the - // response. - ConfigView view = 3; -} - -// Request message for ListServiceConfigs method. -message ListServiceConfigsRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The token of the page to retrieve. - string page_token = 2; - - // The max number of items to include in the response list. - int32 page_size = 3; -} - -// Response message for ListServiceConfigs method. -message ListServiceConfigsResponse { - // The list of service configuration resources. - repeated google.api.Service service_configs = 1; - - // The token of the next page of results. - string next_page_token = 2; -} - -// Request message for CreateServiceConfig method. -message CreateServiceConfigRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The service configuration resource. - google.api.Service service_config = 2; -} - -// Request message for SubmitConfigSource method. -message SubmitConfigSourceRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The source configuration for the service. - ConfigSource config_source = 2; - - // Optional. If set, this will result in the generation of a - // `google.api.Service` configuration based on the `ConfigSource` provided, - // but the generated config and the sources will NOT be persisted. - bool validate_only = 3; -} - -// Response message for SubmitConfigSource method. -message SubmitConfigSourceResponse { - // The generated service configuration. - google.api.Service service_config = 1; -} - -// Request message for 'CreateServiceRollout' -message CreateServiceRolloutRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The rollout resource. The `service_name` field is output only. - Rollout rollout = 2; -} - -// Request message for 'ListServiceRollouts' -message ListServiceRolloutsRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The token of the page to retrieve. - string page_token = 2; - - // The max number of items to include in the response list. - int32 page_size = 3; - - // Use `filter` to return subset of rollouts. - // The following filters are supported: - // -- To limit the results to only those in - // [status](google.api.servicemanagement.v1.RolloutStatus) 'SUCCESS', - // use filter='status=SUCCESS' - // -- To limit the results to those in - // [status](google.api.servicemanagement.v1.RolloutStatus) 'CANCELLED' - // or 'FAILED', use filter='status=CANCELLED OR status=FAILED' - string filter = 4; -} - -// Response message for ListServiceRollouts method. -message ListServiceRolloutsResponse { - // The list of rollout resources. - repeated Rollout rollouts = 1; - - // The token of the next page of results. - string next_page_token = 2; -} - -// Request message for GetServiceRollout method. -message GetServiceRolloutRequest { - // The name of the service. See the [overview](/service-management/overview) - // for naming requirements. For example: `example.googleapis.com`. - string service_name = 1; - - // The id of the rollout resource. - string rollout_id = 2; -} - -// Request message for EnableService method. -message EnableServiceRequest { - // Name of the service to enable. Specifying an unknown service name will - // cause the request to fail. - string service_name = 1; - - // The identity of consumer resource which service enablement will be - // applied to. - // - // The Google Service Management implementation accepts the following - // forms: - // - "project:" - // - // Note: this is made compatible with - // google.api.servicecontrol.v1.Operation.consumer_id. - string consumer_id = 2; -} - -// Request message for DisableService method. -message DisableServiceRequest { - // Name of the service to disable. Specifying an unknown service name - // will cause the request to fail. - string service_name = 1; - - // The identity of consumer resource which service disablement will be - // applied to. - // - // The Google Service Management implementation accepts the following - // forms: - // - "project:" - // - // Note: this is made compatible with - // google.api.servicecontrol.v1.Operation.consumer_id. - string consumer_id = 2; -} - -// Request message for GenerateConfigReport method. -message GenerateConfigReportRequest { - // Service configuration for which we want to generate the report. - // For this version of API, the supported types are - // [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef], - // [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource], - // and [google.api.Service][google.api.Service] - google.protobuf.Any new_config = 1; - - // Service configuration against which the comparison will be done. - // For this version of API, the supported types are - // [google.api.servicemanagement.v1.ConfigRef][google.api.servicemanagement.v1.ConfigRef], - // [google.api.servicemanagement.v1.ConfigSource][google.api.servicemanagement.v1.ConfigSource], - // and [google.api.Service][google.api.Service] - google.protobuf.Any old_config = 2; -} - -// Response message for GenerateConfigReport method. -message GenerateConfigReportResponse { - // Name of the service this report belongs to. - string service_name = 1; - - // ID of the service configuration this report belongs to. - string id = 2; - - // list of ChangeReport, each corresponding to comparison between two - // service configurations. - repeated ChangeReport change_reports = 3; - - // Errors / Linter warnings associated with the service definition this - // report - // belongs to. - repeated Diagnostic diagnostics = 4; -} diff --git a/google/api/source_info.proto b/google/api/source_info.proto deleted file mode 100644 index 5954143ded..0000000000 --- a/google/api/source_info.proto +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2019 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.api; - -import "google/protobuf/any.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "SourceInfoProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Source information used to create a Service Config -message SourceInfo { - // All files used during config generation. - repeated google.protobuf.Any source_files = 1; -} diff --git a/google/api/system_parameter.proto b/google/api/system_parameter.proto deleted file mode 100644 index 740a5538b4..0000000000 --- a/google/api/system_parameter.proto +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "SystemParameterProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// ### System parameter configuration -// -// A system parameter is a special kind of parameter defined by the API -// system, not by an individual API. It is typically mapped to an HTTP header -// and/or a URL query parameter. This configuration specifies which methods -// change the names of the system parameters. -message SystemParameters { - // Define system parameters. - // - // The parameters defined here will override the default parameters - // implemented by the system. If this field is missing from the service - // config, default system parameters will be used. Default system parameters - // and names is implementation-dependent. - // - // Example: define api key for all methods - // - // system_parameters - // rules: - // - selector: "*" - // parameters: - // - name: api_key - // url_query_parameter: api_key - // - // - // Example: define 2 api key names for a specific method. - // - // system_parameters - // rules: - // - selector: "/ListShelves" - // parameters: - // - name: api_key - // http_header: Api-Key1 - // - name: api_key - // http_header: Api-Key2 - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated SystemParameterRule rules = 1; -} - -// Define a system parameter rule mapping system parameter definitions to -// methods. -message SystemParameterRule { - // Selects the methods to which this rule applies. Use '*' to indicate all - // methods in all APIs. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Define parameters. Multiple names may be defined for a parameter. - // For a given method call, only one of them should be used. If multiple - // names are used the behavior is implementation-dependent. - // If none of the specified names are present the behavior is - // parameter-dependent. - repeated SystemParameter parameters = 2; -} - -// Define a parameter's name and location. The parameter may be passed as either -// an HTTP header or a URL query parameter, and if both are passed the behavior -// is implementation-dependent. -message SystemParameter { - // Define the name of the parameter, such as "api_key" . It is case sensitive. - string name = 1; - - // Define the HTTP header name to use for the parameter. It is case - // insensitive. - string http_header = 2; - - // Define the URL query parameter name to use for the parameter. It is case - // sensitive. - string url_query_parameter = 3; -} diff --git a/google/api/usage.proto b/google/api/usage.proto deleted file mode 100644 index 6ab4e408cd..0000000000 --- a/google/api/usage.proto +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2019 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.api; - -option go_package = "google.golang.org/genproto/googleapis/api/serviceconfig;serviceconfig"; -option java_multiple_files = true; -option java_outer_classname = "UsageProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Configuration controlling usage of a service. -message Usage { - // Requirements that must be satisfied before a consumer project can use the - // service. Each requirement is of the form /; - // for example 'serviceusage.googleapis.com/billing-enabled'. - repeated string requirements = 1; - - // A list of usage rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated UsageRule rules = 6; - - // The full resource name of a channel used for sending notifications to the - // service producer. - // - // Google Service Management currently only supports - // [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification - // channel. To use Google Cloud Pub/Sub as the channel, this must be the name - // of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format - // documented in https://cloud.google.com/pubsub/docs/overview. - string producer_notification_channel = 7; -} - -// Usage configuration rules for the service. -// -// NOTE: Under development. -// -// -// Use this rule to configure unregistered calls for the service. Unregistered -// calls are calls that do not contain consumer project identity. -// (Example: calls that do not contain an API key). -// By default, API methods do not allow unregistered calls, and each method call -// must be identified by a consumer project identity. Use this rule to -// allow/disallow unregistered calls. -// -// Example of an API that wants to allow unregistered calls for entire service. -// -// usage: -// rules: -// - selector: "*" -// allow_unregistered_calls: true -// -// Example of a method that wants to allow unregistered calls. -// -// usage: -// rules: -// - selector: "google.example.library.v1.LibraryService.CreateBook" -// allow_unregistered_calls: true -message UsageRule { - // Selects the methods to which this rule applies. Use '*' to indicate all - // methods in all APIs. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // If true, the selected method allows unregistered calls, e.g. calls - // that don't identify any user or application. - bool allow_unregistered_calls = 2; - - // If true, the selected method should skip service control and the control - // plane features, such as quota and billing, will not be available. - // This flag is used by Google Cloud Endpoints to bypass checks for internal - // methods, such as service health check methods. - bool skip_service_control = 3; -} diff --git a/google/cloud/common_resources.proto b/google/cloud/common_resources.proto deleted file mode 100644 index 50cfeda77f..0000000000 --- a/google/cloud/common_resources.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2019 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. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; \ No newline at end of file diff --git a/google/iam/v1/BUILD.bazel b/google/iam/v1/BUILD.bazel deleted file mode 100644 index f8991d206a..0000000000 --- a/google/iam/v1/BUILD.bazel +++ /dev/null @@ -1,99 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") - -proto_library( - name = "iam_policy_proto", - srcs = ["iam_policy.proto"], - deps = [ - ":options_proto", - ":policy_proto", - "//google/api:annotations_proto", - "//google/api:client_proto", - "//google/api:field_behavior_proto", - "//google/api:resource_proto", - ], -) - -proto_library( - name = "policy_proto", - srcs = ["policy.proto"], - deps = [ - "//google/api:annotations_proto", - "//google/type:expr_proto", - ], -) - -proto_library( - name = "options_proto", - srcs = ["options.proto"], - deps = [ - "//google/api:annotations_proto", - ], -) - -proto_library_with_info( - name = "iam_proto_with_info", - deps = [ - ":iam_policy_proto", - ":options_proto", - ":policy_proto", - ], -) - -############################################################################## -# Java -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "java_grpc_library", "java_proto_library") - -java_proto_library( - name = "iam_java_proto", - deps = [ - ":iam_policy_proto", - ":policy_proto", - ":options_proto", - ], -) - -java_grpc_library( - name = "iam_java_grpc", - srcs = [":iam_policy_proto"], - deps = [":iam_java_proto"], -) - -############################################################################## -# Go -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "go_gapic_assembly_pkg", - "go_proto_library", -) - -go_proto_library( - name = "iam_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "google.golang.org/genproto/googleapis/iam/v1", - protos = [ - ":iam_policy_proto", - ":options_proto", - ":policy_proto", - ], - deps = [ - "//google/api:annotations_go_proto", - "//google/type:expr_go_proto", - ], -) - -go_gapic_assembly_pkg( - name = "gapi-cloud-iam-v1-go", - deps = [ - ":iam_go_proto", - ], -) diff --git a/google/iam/v1/iam_gapic.yaml b/google/iam/v1/iam_gapic.yaml deleted file mode 100644 index e2d0a674f9..0000000000 --- a/google/iam/v1/iam_gapic.yaml +++ /dev/null @@ -1,28 +0,0 @@ -type: com.google.api.codegen.ConfigProto -config_schema_version: 1.0.0 -language_settings: - java: - package_name: com.google.cloud.iam.v1 - python: - package_name: google.cloud.iam_v1.gapic - go: - package_name: cloud.google.com/go/iam/apiv1 - csharp: - package_name: Google.Iam.V1 - ruby: - package_name: Google::Cloud::Iam::V1 - php: - package_name: Google\Cloud\Iam\V1 - nodejs: - package_name: iam.core.v1 - domain_layer_location: google-cloud -resource_name_generation: -- message_name: SetIamPolicyRequest - field_entity_map: - resource: "*" -- message_name: GetIamPolicyRequest - field_entity_map: - resource: "*" -- message_name: TestIamPermissionsRequest - field_entity_map: - resource: "*" diff --git a/google/iam/v1/iam_meta_api.yaml b/google/iam/v1/iam_meta_api.yaml deleted file mode 100644 index 9398567908..0000000000 --- a/google/iam/v1/iam_meta_api.yaml +++ /dev/null @@ -1,85 +0,0 @@ -type: google.api.Service -config_version: 2 -name: iam-meta-api.googleapis.com -title: IAM Meta API - -apis: -- name: google.iam.v1.IAMPolicy - -types: -- name: google.iam.v1.PolicyDelta - -documentation: - summary: Manages access control for Google Cloud Platform resources. - overview: |- - # Google Identity and Access Management (IAM) API - - Documentation of the access control API that will be implemented by all - 1st party services provided by the Google Cloud Platform (like Cloud - Storage, Compute Engine, App Engine). - - Any implementation of an API that offers access control features - will implement the google.iam.v1.IAMPolicy interface. - - ## Data model - - Access control is applied when a principal (user or service account), - takes some action on a resource exposed by a service. Resources, - identified by - URI-like names, are the unit of access control specification. It is up to - the service implementations to choose what granularity of access control - to support and what set of actions (permissions) to support for the - resources - they provide. For example one database service may allow access control to - be specified only at the Table level, whereas another might allow access - control to also be specified at the Column level. - - This is intentionally not a CRUD style API because access control policies - are created and deleted implicitly with the resources to which they are - attached. - - ## Policy - - A `Policy` consists of a list of bindings. A `Binding` binds a set of - members to a role, where the members can include user accounts, user - groups, user - domains, and service accounts. A role is a named set of permissions, - defined by the IAM system. The definition of a role is outside the - policy. - - A permission check involves determining the roles that include the - specified permission, and then determining if the principal specified by - the check is a member of a binding to at least one of these roles. The - membership check is recursive when a group is bound to a role. - rules: - - selector: google.iam.v1.IAMPolicy.GetIamPolicy - description: |- - Gets the access control policy for a resource. Returns an empty policy - if the resource exists and does not have a policy set. - - - selector: google.iam.v1.IAMPolicy.SetIamPolicy - description: |- - Sets the access control policy on the specified resource. Replaces - any existing policy. - - - selector: google.iam.v1.IAMPolicy.TestIamPermissions - description: |- - Returns permissions that a caller has on the specified resource. If the - resource does not exist, this will return an empty set of - permissions, not a NOT_FOUND error. - - Note: This operation is designed to be used for building - permission-aware UIs and command-line tools, not for authorization - checking. This operation may "fail open" without warning. - -http: - rules: - - selector: google.iam.v1.IAMPolicy.GetIamPolicy - post: '/v1/{resource=**}:getIamPolicy' - body: '*' - - selector: google.iam.v1.IAMPolicy.SetIamPolicy - post: '/v1/{resource=**}:setIamPolicy' - body: '*' - - selector: google.iam.v1.IAMPolicy.TestIamPermissions - post: '/v1/{resource=**}:testIamPermissions' - body: '*' diff --git a/google/iam/v1/iam_meta_api_gapic.yaml b/google/iam/v1/iam_meta_api_gapic.yaml deleted file mode 100644 index 5c4c833395..0000000000 --- a/google/iam/v1/iam_meta_api_gapic.yaml +++ /dev/null @@ -1,132 +0,0 @@ -type: com.google.api.codegen.ConfigProto -config_schema_version: 1.0.0 -# The settings of generated code in a specific language. -language_settings: - java: - package_name: com.google.cloud.iam.v1 - python: - package_name: google.cloud.iam_v1.gapic - go: - package_name: cloud.google.com/go/iam/apiv1 - csharp: - package_name: Google.Iam.V1 - ruby: - package_name: Google::Cloud::Iam::V1 - php: - package_name: Google\Cloud\Iam\V1 - nodejs: - package_name: iam.v1 -# A list of API interface configurations. -interfaces: -# The fully qualified name of the API interface. -- name: google.iam.v1.IAMPolicy - # A list of resource collection configurations. - # Consists of a name_pattern and an entity_name. - # The name_pattern is a pattern to describe the names of the resources of this - # collection, using the platform's conventions for URI patterns. A generator - # may use this to generate methods to compose and decompose such names. The - # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; - # those will be taken as hints for the parameter names of the generated - # methods. If empty, no name methods are generated. - # The entity_name is the name to be used as a basis for generated methods and - # classes. - collections: [] - # Definition for retryable codes. - retry_codes_def: - - name: idempotent - retry_codes: - - DEADLINE_EXCEEDED - - UNAVAILABLE - - name: non_idempotent - retry_codes: [] - # Definition for retry/backoff parameters. - retry_params_def: - - name: default - initial_retry_delay_millis: 100 - retry_delay_multiplier: 1.3 - max_retry_delay_millis: 60000 - initial_rpc_timeout_millis: 20000 - rpc_timeout_multiplier: 1 - max_rpc_timeout_millis: 20000 - total_timeout_millis: 600000 - # A list of method configurations. - # Common properties: - # - # name - The simple name of the method. - # - # flattening - Specifies the configuration for parameter flattening. - # Describes the parameter groups for which a generator should produce method - # overloads which allow a client to directly pass request message fields as - # method parameters. This information may or may not be used, depending on - # the target language. - # Consists of groups, which each represent a list of parameters to be - # flattened. Each parameter listed must be a field of the request message. - # - # required_fields - Fields that are always required for a request to be - # valid. - # - # page_streaming - Specifies the configuration for paging. - # Describes information for generating a method which transforms a paging - # list RPC into a stream of resources. - # Consists of a request and a response. - # The request specifies request information of the list method. It defines - # which fields match the paging pattern in the request. The request consists - # of a page_size_field and a token_field. The page_size_field is the name of - # the optional field specifying the maximum number of elements to be - # returned in the response. The token_field is the name of the field in the - # request containing the page token. - # The response specifies response information of the list method. It defines - # which fields match the paging pattern in the response. The response - # consists of a token_field and a resources_field. The token_field is the - # name of the field in the response containing the next page token. The - # resources_field is the name of the field in the response containing the - # list of resources belonging to the page. - # - # retry_codes_name - Specifies the configuration for retryable codes. The - # name must be defined in interfaces.retry_codes_def. - # - # retry_params_name - Specifies the configuration for retry/backoff - # parameters. The name must be defined in interfaces.retry_params_def. - # - # field_name_patterns - Maps the field name of the request type to - # entity_name of interfaces.collections. - # Specifies the string pattern that the field must follow. - # - # timeout_millis - Specifies the default timeout for a non-retrying call. If - # the call is retrying, refer to retry_params_name instead. - methods: - - name: SetIamPolicy - flattening: - groups: - - parameters: - - resource - - policy - required_fields: - - resource - - policy - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - - name: GetIamPolicy - flattening: - groups: - - parameters: - - resource - - options - required_fields: - - resource - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 - - name: TestIamPermissions - flattening: - groups: - - parameters: - - resource - - permissions - required_fields: - - resource - - permissions - retry_codes_name: non_idempotent - retry_params_name: default - timeout_millis: 60000 diff --git a/google/iam/v1/iam_policy.proto b/google/iam/v1/iam_policy.proto deleted file mode 100644 index 7072854e4c..0000000000 --- a/google/iam/v1/iam_policy.proto +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2019 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.iam.v1; - -import "google/iam/v1/options.proto"; -import "google/iam/v1/policy.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "IamPolicyProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// ## API Overview -// -// Manages Identity and Access Management (IAM) policies. -// -// Any implementation of an API that offers access control features -// implements the google.iam.v1.IAMPolicy interface. -// -// ## Data model -// -// Access control is applied when a principal (user or service account), takes -// some action on a resource exposed by a service. Resources, identified by -// URI-like names, are the unit of access control specification. Service -// implementations can choose the granularity of access control and the -// supported permissions for their resources. -// For example one database service may allow access control to be -// specified only at the Table level, whereas another might allow access control -// to also be specified at the Column level. -// -// ## Policy Structure -// -// See google.iam.v1.Policy -// -// This is intentionally not a CRUD style API because access control policies -// are created and deleted implicitly with the resources to which they are -// attached. -service IAMPolicy { - option (google.api.default_host) = "iam-meta-api.googleapis.com"; - - // Sets the access control policy on the specified resource. Replaces any - // existing policy. - rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:setIamPolicy" - body: "*" - }; - } - - // Gets the access control policy for a resource. - // Returns an empty policy if the resource exists and does not have a policy - // set. - rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:getIamPolicy" - body: "*" - }; - } - - // Returns permissions that a caller has on the specified resource. - // If the resource does not exist, this will return an empty set of - // permissions, not a NOT_FOUND error. - // - // Note: This operation is designed to be used for building permission-aware - // UIs and command-line tools, not for authorization checking. This operation - // may "fail open" without warning. - rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=**}:testIamPermissions" - body: "*" - }; - } -} - -// Request message for `SetIamPolicy` method. -message SetIamPolicyRequest { - // REQUIRED: The resource for which the policy is being specified. - // See the operation documentation for the appropriate value for this field. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // REQUIRED: The complete policy to be applied to the `resource`. The size of - // the policy is limited to a few 10s of KB. An empty policy is a - // valid policy but certain Cloud Platform services (such as Projects) - // might reject them. - Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `GetIamPolicy` method. -message GetIamPolicyRequest { - // REQUIRED: The resource for which the policy is being requested. - // See the operation documentation for the appropriate value for this field. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // OPTIONAL: A `GetPolicyOptions` object for specifying options to - // `GetIamPolicy`. This field is only used by Cloud IAM. - GetPolicyOptions options = 2; -} - -// Request message for `TestIamPermissions` method. -message TestIamPermissionsRequest { - // REQUIRED: The resource for which the policy detail is being requested. - // See the operation documentation for the appropriate value for this field. - string resource = 1[ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // The set of permissions to check for the `resource`. Permissions with - // wildcards (such as '*' or 'storage.*') are not allowed. For more - // information see - // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for `TestIamPermissions` method. -message TestIamPermissionsResponse { - // A subset of `TestPermissionsRequest.permissions` that the caller is - // allowed. - repeated string permissions = 1; -} diff --git a/google/iam/v1/logging/BUILD.bazel b/google/iam/v1/logging/BUILD.bazel deleted file mode 100644 index cf95b5c37f..0000000000 --- a/google/iam/v1/logging/BUILD.bazel +++ /dev/null @@ -1,62 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") - -proto_library( - name = "audit_data_proto", - srcs = [ - "audit_data.proto", - ], - deps = [ - "//google/api:annotations_proto", - "//google/iam/v1:policy_proto", - ], -) - -proto_library_with_info( - name = "logging_proto_with_info", - deps = [":audit_data_proto"], -) - -############################################################################## -# Java -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") - -java_proto_library( - name = "logging_java_proto", - deps = [":audit_data_proto"], -) - -############################################################################## -# Go -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "go_gapic_assembly_pkg", - "go_proto_library", -) - -go_proto_library( - name = "logging_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "google.golang.org/genproto/googleapis/iam/v1/logging", - protos = [":audit_data_proto"], - deps = [ - "//google/api:annotations_go_proto", - "//google/iam/v1:iam_go_proto", - ], -) - -go_gapic_assembly_pkg( - name = "gapi-cloud-iam-admin-go", - deps = [ - ":logging_go_proto", - ], -) diff --git a/google/iam/v1/logging/audit_data.proto b/google/iam/v1/logging/audit_data.proto deleted file mode 100644 index dfe441ba66..0000000000 --- a/google/iam/v1/logging/audit_data.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.iam.v1.logging; - -import "google/api/annotations.proto"; -import "google/iam/v1/policy.proto"; - -option csharp_namespace = "Google.Cloud.Iam.V1.Logging"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1/logging;logging"; -option java_multiple_files = true; -option java_outer_classname = "AuditDataProto"; -option java_package = "com.google.iam.v1.logging"; - -// Audit log information specific to Cloud IAM. This message is serialized -// as an `Any` type in the `ServiceData` message of an -// `AuditLog` message. -message AuditData { - // Policy delta between the original policy and the newly set policy. - google.iam.v1.PolicyDelta policy_delta = 2; -} diff --git a/google/iam/v1/options.proto b/google/iam/v1/options.proto deleted file mode 100644 index a4e17e588d..0000000000 --- a/google/iam/v1/options.proto +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2019 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.iam.v1; - -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "OptionsProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// Encapsulates settings provided to GetIamPolicy. -message GetPolicyOptions { - // Optional. The policy format version to be returned. - // - // Valid values are 0, 1, and 3. Requests specifying an invalid value will be - // rejected. - // - // Requests for policies with any conditional bindings must specify version 3. - // Policies without any conditional bindings may specify any valid value or - // leave the field unset. - int32 requested_policy_version = 1; -} diff --git a/google/iam/v1/policy.proto b/google/iam/v1/policy.proto deleted file mode 100644 index e3aba47e8e..0000000000 --- a/google/iam/v1/policy.proto +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2019 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.iam.v1; - -import "google/type/expr.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "PolicyProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// Defines an Identity and Access Management (IAM) policy. It is used to -// specify access control policies for Cloud Platform resources. -// -// -// A `Policy` is a collection of `bindings`. A `binding` binds one or more -// `members` to a single `role`. Members can be user accounts, service accounts, -// Google groups, and domains (such as G Suite). A `role` is a named list of -// permissions (defined by IAM or configured by users). A `binding` can -// optionally specify a `condition`, which is a logic expression that further -// constrains the role binding based on attributes about the request and/or -// target resource. -// -// **JSON Example** -// -// { -// "bindings": [ -// { -// "role": "roles/resourcemanager.organizationAdmin", -// "members": [ -// "user:mike@example.com", -// "group:admins@example.com", -// "domain:google.com", -// "serviceAccount:my-project-id@appspot.gserviceaccount.com" -// ] -// }, -// { -// "role": "roles/resourcemanager.organizationViewer", -// "members": ["user:eve@example.com"], -// "condition": { -// "title": "expirable access", -// "description": "Does not grant access after Sep 2020", -// "expression": "request.time < -// timestamp('2020-10-01T00:00:00.000Z')", -// } -// } -// ] -// } -// -// **YAML Example** -// -// bindings: -// - members: -// - user:mike@example.com -// - group:admins@example.com -// - domain:google.com -// - serviceAccount:my-project-id@appspot.gserviceaccount.com -// role: roles/resourcemanager.organizationAdmin -// - members: -// - user:eve@example.com -// role: roles/resourcemanager.organizationViewer -// condition: -// title: expirable access -// description: Does not grant access after Sep 2020 -// expression: request.time < timestamp('2020-10-01T00:00:00.000Z') -// -// For a description of IAM and its features, see the -// [IAM developer's guide](https://cloud.google.com/iam/docs). -message Policy { - // Specifies the format of the policy. - // - // Valid values are 0, 1, and 3. Requests specifying an invalid value will be - // rejected. - // - // Operations affecting conditional bindings must specify version 3. This can - // be either setting a conditional policy, modifying a conditional binding, - // or removing a binding (conditional or unconditional) from the stored - // conditional policy. - // Operations on non-conditional policies may specify any valid value or - // leave the field unset. - // - // If no etag is provided in the call to `setIamPolicy`, version compliance - // checks against the stored policy is skipped. - int32 version = 1; - - // Associates a list of `members` to a `role`. Optionally may specify a - // `condition` that determines when binding is in effect. - // `bindings` with no members will result in an error. - repeated Binding bindings = 4; - - // `etag` is used for optimistic concurrency control as a way to help - // prevent simultaneous updates of a policy from overwriting each other. - // It is strongly suggested that systems make use of the `etag` in the - // read-modify-write cycle to perform policy updates in order to avoid race - // conditions: An `etag` is returned in the response to `getIamPolicy`, and - // systems are expected to put that etag in the request to `setIamPolicy` to - // ensure that their change will be applied to the same version of the policy. - // - // If no `etag` is provided in the call to `setIamPolicy`, then the existing - // policy is overwritten. Due to blind-set semantics of an etag-less policy, - // 'setIamPolicy' will not fail even if the incoming policy version does not - // meet the requirements for modifying the stored policy. - bytes etag = 3; -} - -// Associates `members` with a `role`. -message Binding { - // Role that is assigned to `members`. - // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - string role = 1; - - // Specifies the identities requesting access for a Cloud Platform resource. - // `members` can have the following values: - // - // * `allUsers`: A special identifier that represents anyone who is - // on the internet; with or without a Google account. - // - // * `allAuthenticatedUsers`: A special identifier that represents anyone - // who is authenticated with a Google account or a service account. - // - // * `user:{emailid}`: An email address that represents a specific Google - // account. For example, `alice@example.com` . - // - // - // * `serviceAccount:{emailid}`: An email address that represents a service - // account. For example, `my-other-app@appspot.gserviceaccount.com`. - // - // * `group:{emailid}`: An email address that represents a Google group. - // For example, `admins@example.com`. - // - // - // * `domain:{domain}`: The G Suite domain (primary) that represents all the - // users of that domain. For example, `google.com` or `example.com`. - // - // - repeated string members = 2; - - // The condition that is associated with this binding. - // NOTE: An unsatisfied condition will not allow user access via current - // binding. Different bindings, including their conditions, are examined - // independently. - google.type.Expr condition = 3; -} - -// The difference delta between two policies. -message PolicyDelta { - // The delta for Bindings between two policies. - repeated BindingDelta binding_deltas = 1; - - // The delta for AuditConfigs between two policies. - repeated AuditConfigDelta audit_config_deltas = 2; -} - -// One delta entry for Binding. Each individual change (only one member in each -// entry) to a binding will be a separate entry. -message BindingDelta { - // The type of action performed on a Binding in a policy. - enum Action { - // Unspecified. - ACTION_UNSPECIFIED = 0; - - // Addition of a Binding. - ADD = 1; - - // Removal of a Binding. - REMOVE = 2; - } - - // The action that was performed on a Binding. - // Required - Action action = 1; - - // Role that is assigned to `members`. - // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. - // Required - string role = 2; - - // A single identity requesting access for a Cloud Platform resource. - // Follows the same format of Binding.members. - // Required - string member = 3; - - // The condition that is associated with this binding. - google.type.Expr condition = 4; -} - -// One delta entry for AuditConfig. Each individual change (only one -// exempted_member in each entry) to a AuditConfig will be a separate entry. -message AuditConfigDelta { - // The type of action performed on an audit configuration in a policy. - enum Action { - // Unspecified. - ACTION_UNSPECIFIED = 0; - - // Addition of an audit configuration. - ADD = 1; - - // Removal of an audit configuration. - REMOVE = 2; - } - - // The action that was performed on an audit configuration in a policy. - // Required - Action action = 1; - - // Specifies a service that was configured for Cloud Audit Logging. - // For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. - // `allServices` is a special value that covers all services. - // Required - string service = 2; - - // A single identity that is exempted from "data access" audit - // logging for the `service` specified above. - // Follows the same format of Binding.members. - string exempted_member = 3; - - // Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always - // enabled, and cannot be configured. - // Required - string log_type = 4; -} diff --git a/google/longrunning/BUILD.bazel b/google/longrunning/BUILD.bazel deleted file mode 100644 index f23ea9ae9f..0000000000 --- a/google/longrunning/BUILD.bazel +++ /dev/null @@ -1,114 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info") - -proto_library( - name = "operations_proto", - srcs = ["operations.proto"], - deps = [ - "//google/api:annotations_proto", - "//google/rpc:status_proto", - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:descriptor_proto", - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:empty_proto", - ], -) - -proto_library_with_info( - name = "longrunning_proto_with_info", - deps = [":operations_proto"], -) - -############################################################################## -# Java -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "java_grpc_library", "java_proto_library") - -java_proto_library( - name = "longrunning_java_proto", - deps = [":operations_proto"], -) - -java_grpc_library( - name = "longrunning_java_grpc", - srcs = [":operations_proto"], - deps = [":longrunning_java_proto"], -) - -############################################################################## -# Go -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "go_gapic_assembly_pkg", - "go_gapic_library", - "go_proto_library", - "go_test", -) - -go_proto_library( - name = "longrunning_go_proto", - compilers = ["@io_bazel_rules_go//proto:go_grpc"], - importpath = "google.golang.org/genproto/googleapis/longrunning", - protos = [":operations_proto"], - visibility = ["//visibility:public"], - deps = [ - "//google/api:annotations_go_proto", - "//google/rpc:status_go_proto", - ], -) - -go_gapic_library( - name = "longrunning_go_gapic", - src = ":longrunning_proto_with_info", - gapic_yaml = "longrunning_gapic.yaml", - importpath = "cloud.google.com/go/longrunning/autogen", - service_yaml = "//google/longrunning:longrunning.yaml", - deps = [":longrunning_go_proto"], -) - -go_test( - name = "longrunning_go_gapic_test", - srcs = [":longrunning_go_gapic_srcjar_test"], - embed = [":longrunning_go_gapic"], - importpath = "cloud.google.com/go/longrunning/autogen", -) - -# Open Source Packages -go_gapic_assembly_pkg( - name = "gapi-cloud-longrunning-go", - deps = [ - ":longrunning_go_gapic", - ":longrunning_go_gapic_srcjar-smoke-test.srcjar", - ":longrunning_go_gapic_srcjar-test.srcjar", - ":longrunning_go_proto", - ], -) - -############################################################################## -# C++ -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "cc_grpc_library", - "cc_proto_library", -) - -cc_proto_library( - name = "longrunning_cc_proto", - deps = [":operations_proto"], -) - -cc_grpc_library( - name = "longrunning_cc_grpc", - srcs = [":operations_proto"], - grpc_only = True, - deps = [":longrunning_cc_proto"], -) diff --git a/google/longrunning/README.md b/google/longrunning/README.md deleted file mode 100644 index 905642277f..0000000000 --- a/google/longrunning/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Google Long Running Operations API - -This package contains the definition of an abstract interface that -manages long running operations with API services. See -[google.longrunning.Operations][] for details. \ No newline at end of file diff --git a/google/longrunning/artman_longrunning.yaml b/google/longrunning/artman_longrunning.yaml deleted file mode 100644 index ddda18b02a..0000000000 --- a/google/longrunning/artman_longrunning.yaml +++ /dev/null @@ -1,31 +0,0 @@ -common: - api_name: longrunning - api_version: v1 - organization_name: google - service_yaml: longrunning.yaml - gapic_yaml: longrunning_gapic.yaml - src_proto_paths: - - . - proto_deps: - - name: google-common-protos -artifacts: -- name: java_gapic - type: GAPIC_ONLY - language: JAVA -- name: php_gapic - type: GAPIC - language: PHP -- name: ruby_gapic - type: GAPIC - language: RUBY -- name: go_gapic - type: GAPIC - language: GO -- name: csharp_gapic - type: GAPIC - language: CSHARP -- name: nodejs_gapic - type: GAPIC - language: NODEJS -- name: gapic_config - type: GAPIC_CONFIG diff --git a/google/longrunning/longrunning.yaml b/google/longrunning/longrunning.yaml deleted file mode 100644 index ff8fccf062..0000000000 --- a/google/longrunning/longrunning.yaml +++ /dev/null @@ -1,72 +0,0 @@ -type: google.api.Service -config_version: 1 -name: longrunning.googleapis.com -title: Long Running Operations API - -apis: - - name: google.longrunning.Operations - -types: - - name: google.longrunning.OperationInfo - -documentation: - overview: |- - # Long Running Operation API - - This package contains the definition of Long Running Operation (LRO) - interface. It is a standard interface that API services can implement for - managing asynchronous operations. - - ## What are Long Running Operations? - - A Long Running Operation (LRO) is a way of representing an action that may - take a significant amount of time to complete. For example, an API call that - starts exporting a large amount of data could take quite a while to complete - and is therefore best represented as an LRO. A common rule of thumb is to - think of LROs as "API promises" that represent the result of some on-going - action. - - ## Using LROs - - If an API method could potentially take long time to finish, the method - should return a long running operation instead of a direct response. This - means that even if there are situations where the response could be - immediate, the API should still return an LRO -- it just may be already - marked as completed. For example, if a data export operation is called on an - empty resource, the operation itself may be possible to execute immediately, - and would result in an already completed LRO. - - Additionally, the operation should be managed using the LRO interface, which - allows clients to poll the operation for status updates or cancel it - entirely. - - Finally, an LRO represents an action and as a result, the operation is not - created directly. Instead, the operation comes into existence as a - side-effect of the action it represents. For example, an RPC called - `ExportData` would create and return an LRO. This means that there should - never be an RPC called `CreateOperation`. - - This also means that any permissions on the operation would be based on - action it represents. Any immediate side effects of starting the operation - must be visible in the service as soon as the LRO is returned. For example, - if an LRO is returned when creating a resource, that resource should be - visible in the API immediately, but be in a non-final state until the LRO is - completed. - - ## LROs versus Jobs - - A job is a common design pattern often used in data processing that tends to - be used to represent some contained piece of work that would be stored, - re-run, and modified over time. Jobs also typically interact with multiple - resources and are created, deleted, and updated directly as independent - resources. - - Jobs can also offer support for more complex actions such as pausing and - resuming an individual job, where each action could return an LRO as a - response. - - In general, if an action may take a while but it represents a single piece - of work, it's best to represent the response as an LRO. If the action is - something more complex (for example, it involves lots of resources and can't - be created as a byproduct of a single action), it may make more sense to - represent it as a job. diff --git a/google/longrunning/longrunning_gapic.yaml b/google/longrunning/longrunning_gapic.yaml deleted file mode 100644 index acd110f63f..0000000000 --- a/google/longrunning/longrunning_gapic.yaml +++ /dev/null @@ -1,100 +0,0 @@ -type: com.google.api.codegen.ConfigProto -config_schema_version: 1.0.0 -language_settings: - java: - package_name: com.google.longrunning - python: - package_name: google.longrunning.gapic - go: - package_name: cloud.google.com/go/longrunning/autogen - domain_layer_location: cloud.google.com/go/longrunning - csharp: - package_name: Google.LongRunning - ruby: - package_name: Google::Longrunning - php: - package_name: Google\ApiCore\LongRunning - nodejs: - package_name: longrunning -interfaces: -- name: google.longrunning.Operations - required_constructor_params: - - service_address - - scopes - retry_codes_def: - - name: idempotent - retry_codes: - - UNAVAILABLE - - DEADLINE_EXCEEDED - - name: non_idempotent - retry_codes: [] - retry_params_def: - - name: default - initial_retry_delay_millis: 100 - retry_delay_multiplier: 1.3 - max_retry_delay_millis: 60000 - initial_rpc_timeout_millis: 90000 - rpc_timeout_multiplier: 1 - max_rpc_timeout_millis: 90000 - total_timeout_millis: 600000 - methods: - - name: GetOperation - flattening: - groups: - - parameters: - - name - required_fields: - - name - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 60000 - - name: ListOperations - flattening: - groups: - - parameters: - - name - - filter - required_fields: - - name - - filter - page_streaming: - request: - page_size_field: page_size - token_field: page_token - response: - token_field: next_page_token - resources_field: operations - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 60000 - - name: CancelOperation - flattening: - groups: - - parameters: - - name - required_fields: - - name - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 60000 - - name: DeleteOperation - flattening: - groups: - - parameters: - - name - required_fields: - - name - retry_codes_name: idempotent - retry_params_name: default - timeout_millis: 60000 - - name: WaitOperation - surface_treatments: - - include_languages: - - go - - java - - csharp - - ruby - - nodejs - - python - - php - visibility: DISABLED diff --git a/google/longrunning/operations.proto b/google/longrunning/operations.proto deleted file mode 100644 index 90778e03e1..0000000000 --- a/google/longrunning/operations.proto +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright 2019 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.longrunning; - -import "google/api/annotations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; -import "google/protobuf/descriptor.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.LongRunning"; -option go_package = "google.golang.org/genproto/googleapis/longrunning;longrunning"; -option java_multiple_files = true; -option java_outer_classname = "OperationsProto"; -option java_package = "com.google.longrunning"; -option php_namespace = "Google\\LongRunning"; - -extend google.protobuf.MethodOptions { - // Additional information regarding long-running operations. - // In particular, this specifies the types that are returned from - // long-running operations. - // - // Required for methods that return `google.longrunning.Operation`; invalid - // otherwise. - google.longrunning.OperationInfo operation_info = 1049; -} - -// Manages long-running operations with an API service. -// -// When an API method normally takes long time to complete, it can be designed -// to return [Operation][google.longrunning.Operation] to the client, and the client can use this -// interface to receive the real response asynchronously by polling the -// operation resource, or pass the operation resource to another API (such as -// Google Cloud Pub/Sub API) to receive the response. Any API service that -// returns long-running operations should implement the `Operations` interface -// so developers can have a consistent client experience. -service Operations { - // Lists operations that match the specified filter in the request. If the - // server doesn't support this method, it returns `UNIMPLEMENTED`. - // - // NOTE: the `name` binding allows API services to override the binding - // to use different resource name schemes, such as `users/*/operations`. To - // override the binding, API services can add a binding such as - // `"/v1/{name=users/*}/operations"` to their service configuration. - // For backwards compatibility, the default name includes the operations - // collection id, however overriding users must ensure the name binding - // is the parent resource, without the operations collection id. - rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) { - option (google.api.http) = { - get: "/v1/{name=operations}" - }; - } - - // Gets the latest state of a long-running operation. Clients can use this - // method to poll the operation result at intervals as recommended by the API - // service. - rpc GetOperation(GetOperationRequest) returns (Operation) { - option (google.api.http) = { - get: "/v1/{name=operations/**}" - }; - } - - // Deletes a long-running operation. This method indicates that the client is - // no longer interested in the operation result. It does not cancel the - // operation. If the server doesn't support this method, it returns - // `google.rpc.Code.UNIMPLEMENTED`. - rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=operations/**}" - }; - } - - // Starts asynchronous cancellation on a long-running operation. The server - // makes a best effort to cancel the operation, but success is not - // guaranteed. If the server doesn't support this method, it returns - // `google.rpc.Code.UNIMPLEMENTED`. Clients can use - // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or - // other methods to check whether the cancellation succeeded or whether the - // operation completed despite cancellation. On successful cancellation, - // the operation is not deleted; instead, it becomes an operation with - // an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{name=operations/**}:cancel" - body: "*" - }; - } - - // Waits for the specified long-running operation until it is done or reaches - // at most a specified timeout, returning the latest state. If the operation - // is already done, the latest state is immediately returned. If the timeout - // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - // timeout is used. If the server does not support this method, it returns - // `google.rpc.Code.UNIMPLEMENTED`. - // Note that this method is on a best-effort basis. It may return the latest - // state before the specified timeout (including immediately), meaning even an - // immediate response is no guarantee that the operation is done. - rpc WaitOperation(WaitOperationRequest) returns (Operation) { - } -} - -// This resource represents a long-running operation that is the result of a -// network API call. -message Operation { - // The server-assigned name, which is only unique within the same service that - // originally returns it. If you use the default HTTP mapping, the - // `name` should have the format of `operations/some/unique/name`. - string name = 1; - - // Service-specific metadata associated with the operation. It typically - // contains progress information and common metadata such as create time. - // Some services might not provide such metadata. Any method that returns a - // long-running operation should document the metadata type, if any. - google.protobuf.Any metadata = 2; - - // If the value is `false`, it means the operation is still in progress. - // If `true`, the operation is completed, and either `error` or `response` is - // available. - bool done = 3; - - // The operation result, which can be either an `error` or a valid `response`. - // If `done` == `false`, neither `error` nor `response` is set. - // If `done` == `true`, exactly one of `error` or `response` is set. - oneof result { - // The error result of the operation in case of failure or cancellation. - google.rpc.Status error = 4; - - // The normal response of the operation in case of success. If the original - // method returns no data on success, such as `Delete`, the response is - // `google.protobuf.Empty`. If the original method is standard - // `Get`/`Create`/`Update`, the response should be the resource. For other - // methods, the response should have the type `XxxResponse`, where `Xxx` - // is the original method name. For example, if the original method name - // is `TakeSnapshot()`, the inferred response type is - // `TakeSnapshotResponse`. - google.protobuf.Any response = 5; - } -} - -// The request message for [Operations.GetOperation][google.longrunning.Operations.GetOperation]. -message GetOperationRequest { - // The name of the operation resource. - string name = 1; -} - -// The request message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. -message ListOperationsRequest { - // The name of the operation's parent resource. - string name = 4; - - // The standard list filter. - string filter = 1; - - // The standard list page size. - int32 page_size = 2; - - // The standard list page token. - string page_token = 3; -} - -// The response message for [Operations.ListOperations][google.longrunning.Operations.ListOperations]. -message ListOperationsResponse { - // A list of operations that matches the specified filter in the request. - repeated Operation operations = 1; - - // The standard List next-page token. - string next_page_token = 2; -} - -// The request message for [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]. -message CancelOperationRequest { - // The name of the operation resource to be cancelled. - string name = 1; -} - -// The request message for [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation]. -message DeleteOperationRequest { - // The name of the operation resource to be deleted. - string name = 1; -} - -// The request message for [Operations.WaitOperation][google.longrunning.Operations.WaitOperation]. -message WaitOperationRequest { - // The name of the operation resource to wait on. - string name = 1; - - // The maximum duration to wait before timing out. If left blank, the wait - // will be at most the time permitted by the underlying HTTP/RPC protocol. - // If RPC context deadline is also specified, the shorter one will be used. - google.protobuf.Duration timeout = 2; -} - -// A message representing the message types used by a long-running operation. -// -// Example: -// -// rpc LongRunningRecognize(LongRunningRecognizeRequest) -// returns (google.longrunning.Operation) { -// option (google.longrunning.operation_info) = { -// response_type: "LongRunningRecognizeResponse" -// metadata_type: "LongRunningRecognizeMetadata" -// }; -// } -message OperationInfo { - // Required. The message name of the primary return type for this - // long-running operation. - // This type will be used to deserialize the LRO's response. - // - // If the response is in a different package from the rpc, a fully-qualified - // message name must be used (e.g. `google.protobuf.Struct`). - // - // Note: Altering this value constitutes a breaking change. - string response_type = 1; - - // Required. The message name of the metadata type for this long-running - // operation. - // - // If the response is in a different package from the rpc, a fully-qualified - // message name must be used (e.g. `google.protobuf.Struct`). - // - // Note: Altering this value constitutes a breaking change. - string metadata_type = 2; -} diff --git a/google/rpc/BUILD.bazel b/google/rpc/BUILD.bazel deleted file mode 100644 index 645f329f35..0000000000 --- a/google/rpc/BUILD.bazel +++ /dev/null @@ -1,109 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -proto_library( - name = "code_proto", - srcs = ["code.proto"], - deps = [], -) - -proto_library( - name = "error_details_proto", - srcs = ["error_details.proto"], - deps = [ - "@com_google_protobuf//:duration_proto", - ], -) - -proto_library( - name = "status_proto", - srcs = ["status.proto"], - deps = [ - "@com_google_protobuf//:any_proto", - ], -) - -############################################################################## -# Java -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") - -java_proto_library( - name = "rpc_java_proto", - deps = [ - ":code_proto", - ":error_details_proto", - ":status_proto", - ], -) - -############################################################################## -# Go -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library") - -go_proto_library( - name = "code_go_proto", - importpath = "google.golang.org/genproto/googleapis/rpc/code", - protos = [":code_proto"], -) - -go_proto_library( - name = "errdetails_go_proto", - importpath = "google.golang.org/genproto/googleapis/rpc/errdetails", - protos = [":error_details_proto"], -) - -go_proto_library( - name = "status_go_proto", - importpath = "google.golang.org/genproto/googleapis/rpc/status", - protos = [":status_proto"], -) - -############################################################################## -# C++ -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "cc_proto_library", -) - -cc_proto_library( - name = "code_cc_proto", - deps = [":code_proto"], -) - -cc_proto_library( - name = "error_details_cc_proto", - deps = [":error_details_proto"], -) - -cc_proto_library( - name = "status_cc_proto", - deps = [":status_proto"], -) - -############################################################################## -# Python -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library") - -py_proto_library( - name = "code_py_proto", - deps = [":code_proto"], -) - -py_proto_library( - name = "error_details_py_proto", - deps = [":error_details_proto"], -) - -py_proto_library( - name = "status_py_proto", - deps = [":status_proto"], -) diff --git a/google/rpc/README.md b/google/rpc/README.md deleted file mode 100644 index 164bc80987..0000000000 --- a/google/rpc/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Google RPC - -This package contains type definitions for general RPC systems. While -[gRPC](https://github.com/grpc) is using these definitions, they -are not designed specifically to support gRPC. diff --git a/google/rpc/code.proto b/google/rpc/code.proto deleted file mode 100644 index 142e28d30f..0000000000 --- a/google/rpc/code.proto +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.rpc; - -option go_package = "google.golang.org/genproto/googleapis/rpc/code;code"; -option java_multiple_files = true; -option java_outer_classname = "CodeProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - -// The canonical error codes for Google APIs. -// -// -// Sometimes multiple error codes may apply. Services should return -// the most specific error code that applies. For example, prefer -// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. -// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. -enum Code { - // Not an error; returned on success - // - // HTTP Mapping: 200 OK - OK = 0; - - // The operation was cancelled, typically by the caller. - // - // HTTP Mapping: 499 Client Closed Request - CANCELLED = 1; - - // Unknown error. For example, this error may be returned when - // a `Status` value received from another address space belongs to - // an error space that is not known in this address space. Also - // errors raised by APIs that do not return enough error information - // may be converted to this error. - // - // HTTP Mapping: 500 Internal Server Error - UNKNOWN = 2; - - // The client specified an invalid argument. Note that this differs - // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments - // that are problematic regardless of the state of the system - // (e.g., a malformed file name). - // - // HTTP Mapping: 400 Bad Request - INVALID_ARGUMENT = 3; - - // The deadline expired before the operation could complete. For operations - // that change the state of the system, this error may be returned - // even if the operation has completed successfully. For example, a - // successful response from a server could have been delayed long - // enough for the deadline to expire. - // - // HTTP Mapping: 504 Gateway Timeout - DEADLINE_EXCEEDED = 4; - - // Some requested entity (e.g., file or directory) was not found. - // - // Note to server developers: if a request is denied for an entire class - // of users, such as gradual feature rollout or undocumented whitelist, - // `NOT_FOUND` may be used. If a request is denied for some users within - // a class of users, such as user-based access control, `PERMISSION_DENIED` - // must be used. - // - // HTTP Mapping: 404 Not Found - NOT_FOUND = 5; - - // The entity that a client attempted to create (e.g., file or directory) - // already exists. - // - // HTTP Mapping: 409 Conflict - ALREADY_EXISTS = 6; - - // The caller does not have permission to execute the specified - // operation. `PERMISSION_DENIED` must not be used for rejections - // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` - // instead for those errors). `PERMISSION_DENIED` must not be - // used if the caller can not be identified (use `UNAUTHENTICATED` - // instead for those errors). This error code does not imply the - // request is valid or the requested entity exists or satisfies - // other pre-conditions. - // - // HTTP Mapping: 403 Forbidden - PERMISSION_DENIED = 7; - - // The request does not have valid authentication credentials for the - // operation. - // - // HTTP Mapping: 401 Unauthorized - UNAUTHENTICATED = 16; - - // Some resource has been exhausted, perhaps a per-user quota, or - // perhaps the entire file system is out of space. - // - // HTTP Mapping: 429 Too Many Requests - RESOURCE_EXHAUSTED = 8; - - // The operation was rejected because the system is not in a state - // required for the operation's execution. For example, the directory - // to be deleted is non-empty, an rmdir operation is applied to - // a non-directory, etc. - // - // Service implementors can use the following guidelines to decide - // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: - // (a) Use `UNAVAILABLE` if the client can retry just the failing call. - // (b) Use `ABORTED` if the client should retry at a higher level - // (e.g., when a client-specified test-and-set fails, indicating the - // client should restart a read-modify-write sequence). - // (c) Use `FAILED_PRECONDITION` if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" - // fails because the directory is non-empty, `FAILED_PRECONDITION` - // should be returned since the client should not retry unless - // the files are deleted from the directory. - // - // HTTP Mapping: 400 Bad Request - FAILED_PRECONDITION = 9; - - // The operation was aborted, typically due to a concurrency issue such as - // a sequencer check failure or transaction abort. - // - // See the guidelines above for deciding between `FAILED_PRECONDITION`, - // `ABORTED`, and `UNAVAILABLE`. - // - // HTTP Mapping: 409 Conflict - ABORTED = 10; - - // The operation was attempted past the valid range. E.g., seeking or - // reading past end-of-file. - // - // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may - // be fixed if the system state changes. For example, a 32-bit file - // system will generate `INVALID_ARGUMENT` if asked to read at an - // offset that is not in the range [0,2^32-1], but it will generate - // `OUT_OF_RANGE` if asked to read from an offset past the current - // file size. - // - // There is a fair bit of overlap between `FAILED_PRECONDITION` and - // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific - // error) when it applies so that callers who are iterating through - // a space can easily look for an `OUT_OF_RANGE` error to detect when - // they are done. - // - // HTTP Mapping: 400 Bad Request - OUT_OF_RANGE = 11; - - // The operation is not implemented or is not supported/enabled in this - // service. - // - // HTTP Mapping: 501 Not Implemented - UNIMPLEMENTED = 12; - - // Internal errors. This means that some invariants expected by the - // underlying system have been broken. This error code is reserved - // for serious errors. - // - // HTTP Mapping: 500 Internal Server Error - INTERNAL = 13; - - // The service is currently unavailable. This is most likely a - // transient condition, which can be corrected by retrying with - // a backoff. - // - // See the guidelines above for deciding between `FAILED_PRECONDITION`, - // `ABORTED`, and `UNAVAILABLE`. - // - // HTTP Mapping: 503 Service Unavailable - UNAVAILABLE = 14; - - // Unrecoverable data loss or corruption. - // - // HTTP Mapping: 500 Internal Server Error - DATA_LOSS = 15; -} diff --git a/google/rpc/error_details.proto b/google/rpc/error_details.proto deleted file mode 100644 index 1f9ad53145..0000000000 --- a/google/rpc/error_details.proto +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.rpc; - -import "google/protobuf/duration.proto"; - -option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; -option java_multiple_files = true; -option java_outer_classname = "ErrorDetailsProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - -// Describes when the clients can retry a failed request. Clients could ignore -// the recommendation here or retry when this information is missing from error -// responses. -// -// It's always recommended that clients should use exponential backoff when -// retrying. -// -// Clients should wait until `retry_delay` amount of time has passed since -// receiving the error response before retrying. If retrying requests also -// fail, clients should use an exponential backoff scheme to gradually increase -// the delay between retries based on `retry_delay`, until either a maximum -// number of retires have been reached or a maximum retry delay cap has been -// reached. -message RetryInfo { - // Clients should wait at least this long between retrying the same request. - google.protobuf.Duration retry_delay = 1; -} - -// Describes additional debugging info. -message DebugInfo { - // The stack trace entries indicating where the error occurred. - repeated string stack_entries = 1; - - // Additional debugging information provided by the server. - string detail = 2; -} - -// Describes how a quota check failed. -// -// For example if a daily limit was exceeded for the calling project, -// a service could respond with a QuotaFailure detail containing the project -// id and the description of the quota limit that was exceeded. If the -// calling project hasn't enabled the service in the developer console, then -// a service could respond with the project id and set `service_disabled` -// to true. -// -// Also see RetryDetail and Help types for other details about handling a -// quota failure. -message QuotaFailure { - // A message type used to describe a single quota violation. For example, a - // daily quota or a custom quota that was exceeded. - message Violation { - // The subject on which the quota check failed. - // For example, "clientip:" or "project:". - string subject = 1; - - // A description of how the quota check failed. Clients can use this - // description to find more about the quota configuration in the service's - // public documentation, or find the relevant quota limit to adjust through - // developer console. - // - // For example: "Service disabled" or "Daily Limit for read operations - // exceeded". - string description = 2; - } - - // Describes all quota violations. - repeated Violation violations = 1; -} - -// Describes what preconditions have failed. -// -// For example, if an RPC failed because it required the Terms of Service to be -// acknowledged, it could list the terms of service violation in the -// PreconditionFailure message. -message PreconditionFailure { - // A message type used to describe a single precondition failure. - message Violation { - // The type of PreconditionFailure. We recommend using a service-specific - // enum type to define the supported precondition violation types. For - // example, "TOS" for "Terms of Service violation". - string type = 1; - - // The subject, relative to the type, that failed. - // For example, "google.com/cloud" relative to the "TOS" type would - // indicate which terms of service is being referenced. - string subject = 2; - - // A description of how the precondition failed. Developers can use this - // description to understand how to fix the failure. - // - // For example: "Terms of service not accepted". - string description = 3; - } - - // Describes all precondition violations. - repeated Violation violations = 1; -} - -// Describes violations in a client request. This error type focuses on the -// syntactic aspects of the request. -message BadRequest { - // A message type used to describe a single bad request field. - message FieldViolation { - // A path leading to a field in the request body. The value will be a - // sequence of dot-separated identifiers that identify a protocol buffer - // field. E.g., "field_violations.field" would identify this field. - string field = 1; - - // A description of why the request element is bad. - string description = 2; - } - - // Describes all violations in a client request. - repeated FieldViolation field_violations = 1; -} - -// Contains metadata about the request that clients can attach when filing a bug -// or providing other forms of feedback. -message RequestInfo { - // An opaque string that should only be interpreted by the service generating - // it. For example, it can be used to identify requests in the service's logs. - string request_id = 1; - - // Any data that was used to serve this request. For example, an encrypted - // stack trace that can be sent back to the service provider for debugging. - string serving_data = 2; -} - -// Describes the resource that is being accessed. -message ResourceInfo { - // A name for the type of resource being accessed, e.g. "sql table", - // "cloud storage bucket", "file", "Google calendar"; or the type URL - // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". - string resource_type = 1; - - // The name of the resource being accessed. For example, a shared calendar - // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current - // error is - // [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. - string resource_name = 2; - - // The owner of the resource (optional). - // For example, "user:" or "project:". - string owner = 3; - - // Describes what error is encountered when accessing this resource. - // For example, updating a cloud project may require the `writer` permission - // on the developer console project. - string description = 4; -} - -// Provides links to documentation or for performing an out of band action. -// -// For example, if a quota check failed with an error indicating the calling -// project hasn't enabled the accessed service, this can contain a URL pointing -// directly to the right place in the developer console to flip the bit. -message Help { - // Describes a URL link. - message Link { - // Describes what the link offers. - string description = 1; - - // The URL of the link. - string url = 2; - } - - // URL(s) pointing to additional information on handling the current error. - repeated Link links = 1; -} - -// Provides a localized error message that is safe to return to the user -// which can be attached to an RPC error. -message LocalizedMessage { - // The locale used following the specification defined at - // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. - // Examples are: "en-US", "fr-CH", "es-MX" - string locale = 1; - - // The localized error message in the above locale. - string message = 2; -} diff --git a/google/rpc/rpc_publish.yaml b/google/rpc/rpc_publish.yaml deleted file mode 100644 index 90a91e07d6..0000000000 --- a/google/rpc/rpc_publish.yaml +++ /dev/null @@ -1,28 +0,0 @@ -type: google.api.Service -config_version: 1 -name: rpc.googleapis.com -title: Google RPC Types - -types: -- name: google.rpc.Status -- name: google.rpc.RetryInfo -- name: google.rpc.DebugInfo -- name: google.rpc.QuotaFailure -- name: google.rpc.BadRequest -- name: google.rpc.PreconditionFailure -- name: google.rpc.RequestInfo -- name: google.rpc.ResourceInfo -- name: google.rpc.Help -- name: google.rpc.LocalizedMessage - -enums: -- name: google.rpc.Code - -documentation: - summary: Defines RPC types. - overview: |- - # Google RPC - - This package contains type definitions for general RPC systems. While - [gRPC](https://github.com/grpc) is using these defintions, they are not - designed specifically to support gRPC. diff --git a/google/rpc/status.proto b/google/rpc/status.proto deleted file mode 100644 index b0daa36950..0000000000 --- a/google/rpc/status.proto +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2017 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. - -syntax = "proto3"; - -package google.rpc; - -import "google/protobuf/any.proto"; - -option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; -option java_multiple_files = true; -option java_outer_classname = "StatusProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - -// The `Status` type defines a logical error model that is suitable for -// different programming environments, including REST APIs and RPC APIs. It is -// used by [gRPC](https://github.com/grpc). The error model is designed to be: -// -// - Simple to use and understand for most users -// - Flexible enough to meet unexpected needs -// -// # Overview -// -// The `Status` message contains three pieces of data: error code, error -// message, and error details. The error code should be an enum value of -// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes -// if needed. The error message should be a developer-facing English message -// that helps developers *understand* and *resolve* the error. If a localized -// user-facing error message is needed, put the localized message in the error -// details or localize it in the client. The optional error details may contain -// arbitrary information about the error. There is a predefined set of error -// detail types in the package `google.rpc` that can be used for common error -// conditions. -// -// # Language mapping -// -// The `Status` message is the logical representation of the error model, but it -// is not necessarily the actual wire format. When the `Status` message is -// exposed in different client libraries and different wire protocols, it can be -// mapped differently. For example, it will likely be mapped to some exceptions -// in Java, but more likely mapped to some error codes in C. -// -// # Other uses -// -// The error model and the `Status` message can be used in a variety of -// environments, either with or without APIs, to provide a -// consistent developer experience across different environments. -// -// Example uses of this error model include: -// -// - Partial errors. If a service needs to return partial errors to the client, -// it may embed the `Status` in the normal response to indicate the partial -// errors. -// -// - Workflow errors. A typical workflow has multiple steps. Each step may -// have a `Status` message for error reporting. -// -// - Batch operations. If a client uses batch request and batch response, the -// `Status` message should be used directly inside batch response, one for -// each error sub-response. -// -// - Asynchronous operations. If an API call embeds asynchronous operation -// results in its response, the status of those operations should be -// represented directly using the `Status` message. -// -// - Logging. If some API errors are stored in logs, the message `Status` could -// be used directly after any stripping needed for security/privacy reasons. -message Status { - // The status code, which should be an enum value of - // [google.rpc.Code][google.rpc.Code]. - int32 code = 1; - - // A developer-facing error message, which should be in English. Any - // user-facing error message should be localized and sent in the - // [google.rpc.Status.details][google.rpc.Status.details] field, or localized - // by the client. - string message = 2; - - // A list of messages that carry the error details. There is a common set of - // message types for APIs to use. - repeated google.protobuf.Any details = 3; -} diff --git a/google/type/BUILD.bazel b/google/type/BUILD.bazel deleted file mode 100644 index 3a870be667..0000000000 --- a/google/type/BUILD.bazel +++ /dev/null @@ -1,235 +0,0 @@ -load("@rules_proto//proto:defs.bzl", "proto_library") - -# This is an API workspace, having public visibility by default makes perfect sense. -package(default_visibility = ["//visibility:public"]) - -############################################################################## -# Common -############################################################################## -proto_library( - name = "calendar_period_proto", - srcs = ["calendar_period.proto"], -) - -proto_library( - name = "color_proto", - srcs = ["color.proto"], - deps = [ - "@com_google_protobuf//:wrappers_proto", - ], -) - -proto_library( - name = "date_proto", - srcs = ["date.proto"], -) - -proto_library( - name = "datetime_proto", - srcs = ["datetime.proto"], - deps = [ - "@com_google_protobuf//:duration_proto", - ], -) - -proto_library( - name = "dayofweek_proto", - srcs = ["dayofweek.proto"], -) - -proto_library( - name = "expr_proto", - srcs = ["expr.proto"], -) - -proto_library( - name = "fraction_proto", - srcs = ["fraction.proto"], -) - -proto_library( - name = "latlng_proto", - srcs = ["latlng.proto"], -) - -proto_library( - name = "money_proto", - srcs = ["money.proto"], -) - -proto_library( - name = "postal_address_proto", - srcs = ["postal_address.proto"], -) - -proto_library( - name = "quaternion_proto", - srcs = ["quaternion.proto"], -) - -proto_library( - name = "timeofday_proto", - srcs = ["timeofday.proto"], -) - -############################################################################## -# Java -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library") - -java_proto_library( - name = "type_java_proto", - deps = [ - ":calendar_period_proto", - ":color_proto", - ":date_proto", - ":dayofweek_proto", - ":expr_proto", - ":fraction_proto", - ":latlng_proto", - ":money_proto", - ":postal_address_proto", - ":quaternion_proto", - ":timeofday_proto", - ], -) - -############################################################################## -# Go -############################################################################## -load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library") - -go_proto_library( - name = "calendar_period_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/calendarperiod", - protos = [":calendar_period_proto"], -) - -go_proto_library( - name = "color_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/color", - protos = [":color_proto"], -) - -go_proto_library( - name = "date_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/date", - protos = [":date_proto"], -) - -go_proto_library( - name = "datetime_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/date", - protos = [":datetime_proto"], -) - -go_proto_library( - name = "dayofweek_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/dayofweek", - protos = [":dayofweek_proto"], -) - -go_proto_library( - name = "expr_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/expr", - protos = [":expr_proto"], -) - -go_proto_library( - name = "fraction_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/fraction", - protos = [":fraction_proto"], -) - -go_proto_library( - name = "latlng_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/latlng", - protos = [":latlng_proto"], -) - -go_proto_library( - name = "money_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/money", - protos = [":money_proto"], -) - -go_proto_library( - name = "postaladdress_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/postaladdress", - protos = [":postal_address_proto"], -) - -go_proto_library( - name = "quaternion_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/quaternion", - protos = [":quaternion_proto"], -) - -go_proto_library( - name = "timeofday_go_proto", - importpath = "google.golang.org/genproto/googleapis/type/timeofday", - protos = [":timeofday_proto"], -) - -############################################################################## -# C++ -############################################################################## -load( - "@com_google_googleapis_imports//:imports.bzl", - "cc_proto_library", -) - -cc_proto_library( - name = "calendar_period_cc_proto", - deps = [":calendar_period_proto"], -) - -cc_proto_library( - name = "color_cc_proto", - deps = [":color_proto"], -) - -cc_proto_library( - name = "date_cc_proto", - deps = [":date_proto"], -) - -cc_proto_library( - name = "dayofweek_cc_proto", - deps = [":dayofweek_proto"], -) - -cc_proto_library( - name = "expr_cc_proto", - deps = [":expr_proto"], -) - -cc_proto_library( - name = "fraction_cc_proto", - deps = [":fraction_proto"], -) - -cc_proto_library( - name = "latlng_cc_proto", - deps = [":latlng_proto"], -) - -cc_proto_library( - name = "money_cc_proto", - deps = [":money_proto"], -) - -cc_proto_library( - name = "postal_address_cc_proto", - deps = [":postal_address_proto"], -) - -cc_proto_library( - name = "quaternion_cc_proto", - deps = [":quaternion_proto"], -) - -cc_proto_library( - name = "timeofday_cc_proto", - deps = [":timeofday_proto"], -) diff --git a/google/type/README.md b/google/type/README.md deleted file mode 100644 index 6caf02cf1f..0000000000 --- a/google/type/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Google Common Types - -This package contains definitions of common types for Google APIs. -All types defined in this package are suitable for different APIs to -exchange data, and will never break binary compatibility. They should -have design quality comparable to major programming languages like -Java and C#. - -NOTE: Some common types are defined in the package `google.protobuf` -as they are directly supported by Protocol Buffers compiler and -runtime. Those types are called Well-Known Types. - -## Java Utilities - -A set of Java utilities for the Common Types are provided in the -`//java/com/google/type/util/` package. \ No newline at end of file diff --git a/google/type/calendar_period.proto b/google/type/calendar_period.proto deleted file mode 100644 index a91d0c35c8..0000000000 --- a/google/type/calendar_period.proto +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2019 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.type; - -option go_package = "google.golang.org/genproto/googleapis/type/calendarperiod;calendarperiod"; -option java_multiple_files = true; -option java_outer_classname = "CalendarPeriodProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// A `CalendarPeriod` represents the abstract concept of a time period that has -// a canonical start. Grammatically, "the start of the current -// `CalendarPeriod`." All calendar times begin at midnight UTC. -enum CalendarPeriod { - // Undefined period, raises an error. - CALENDAR_PERIOD_UNSPECIFIED = 0; - - // A day. - DAY = 1; - - // A week. Weeks begin on Monday, following - // [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). - WEEK = 2; - - // A fortnight. The first calendar fortnight of the year begins at the start - // of week 1 according to - // [ISO 8601](https://en.wikipedia.org/wiki/ISO_week_date). - FORTNIGHT = 3; - - // A month. - MONTH = 4; - - // A quarter. Quarters start on dates 1-Jan, 1-Apr, 1-Jul, and 1-Oct of each - // year. - QUARTER = 5; - - // A half-year. Half-years start on dates 1-Jan and 1-Jul. - HALF = 6; - - // A year. - YEAR = 7; -} diff --git a/google/type/color.proto b/google/type/color.proto deleted file mode 100644 index 417f1c4b19..0000000000 --- a/google/type/color.proto +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2019 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.type; - -import "google/protobuf/wrappers.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/color;color"; -option java_multiple_files = true; -option java_outer_classname = "ColorProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a color in the RGBA color space. This representation is designed -// for simplicity of conversion to/from color representations in various -// languages over compactness; for example, the fields of this representation -// can be trivially provided to the constructor of "java.awt.Color" in Java; it -// can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" -// method in iOS; and, with just a little work, it can be easily formatted into -// a CSS "rgba()" string in JavaScript, as well. -// -// Note: this proto does not carry information about the absolute color space -// that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, -// DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color -// space. -// -// Example (Java): -// -// import com.google.type.Color; -// -// // ... -// public static java.awt.Color fromProto(Color protocolor) { -// float alpha = protocolor.hasAlpha() -// ? protocolor.getAlpha().getValue() -// : 1.0; -// -// return new java.awt.Color( -// protocolor.getRed(), -// protocolor.getGreen(), -// protocolor.getBlue(), -// alpha); -// } -// -// public static Color toProto(java.awt.Color color) { -// float red = (float) color.getRed(); -// float green = (float) color.getGreen(); -// float blue = (float) color.getBlue(); -// float denominator = 255.0; -// Color.Builder resultBuilder = -// Color -// .newBuilder() -// .setRed(red / denominator) -// .setGreen(green / denominator) -// .setBlue(blue / denominator); -// int alpha = color.getAlpha(); -// if (alpha != 255) { -// result.setAlpha( -// FloatValue -// .newBuilder() -// .setValue(((float) alpha) / denominator) -// .build()); -// } -// return resultBuilder.build(); -// } -// // ... -// -// Example (iOS / Obj-C): -// -// // ... -// static UIColor* fromProto(Color* protocolor) { -// float red = [protocolor red]; -// float green = [protocolor green]; -// float blue = [protocolor blue]; -// FloatValue* alpha_wrapper = [protocolor alpha]; -// float alpha = 1.0; -// if (alpha_wrapper != nil) { -// alpha = [alpha_wrapper value]; -// } -// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -// } -// -// static Color* toProto(UIColor* color) { -// CGFloat red, green, blue, alpha; -// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { -// return nil; -// } -// Color* result = [[Color alloc] init]; -// [result setRed:red]; -// [result setGreen:green]; -// [result setBlue:blue]; -// if (alpha <= 0.9999) { -// [result setAlpha:floatWrapperWithValue(alpha)]; -// } -// [result autorelease]; -// return result; -// } -// // ... -// -// Example (JavaScript): -// -// // ... -// -// var protoToCssColor = function(rgb_color) { -// var redFrac = rgb_color.red || 0.0; -// var greenFrac = rgb_color.green || 0.0; -// var blueFrac = rgb_color.blue || 0.0; -// var red = Math.floor(redFrac * 255); -// var green = Math.floor(greenFrac * 255); -// var blue = Math.floor(blueFrac * 255); -// -// if (!('alpha' in rgb_color)) { -// return rgbToCssColor_(red, green, blue); -// } -// -// var alphaFrac = rgb_color.alpha.value || 0.0; -// var rgbParams = [red, green, blue].join(','); -// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); -// }; -// -// var rgbToCssColor_ = function(red, green, blue) { -// var rgbNumber = new Number((red << 16) | (green << 8) | blue); -// var hexString = rgbNumber.toString(16); -// var missingZeros = 6 - hexString.length; -// var resultBuilder = ['#']; -// for (var i = 0; i < missingZeros; i++) { -// resultBuilder.push('0'); -// } -// resultBuilder.push(hexString); -// return resultBuilder.join(''); -// }; -// -// // ... -message Color { - // The amount of red in the color as a value in the interval [0, 1]. - float red = 1; - - // The amount of green in the color as a value in the interval [0, 1]. - float green = 2; - - // The amount of blue in the color as a value in the interval [0, 1]. - float blue = 3; - - // The fraction of this color that should be applied to the pixel. That is, - // the final pixel color is defined by the equation: - // - // pixel color = alpha * (this color) + (1.0 - alpha) * (background color) - // - // This means that a value of 1.0 corresponds to a solid color, whereas - // a value of 0.0 corresponds to a completely transparent color. This - // uses a wrapper message rather than a simple float scalar so that it is - // possible to distinguish between a default value and the value being unset. - // If omitted, this color object is to be rendered as a solid color - // (as if the alpha value had been explicitly given with a value of 1.0). - google.protobuf.FloatValue alpha = 4; -} diff --git a/google/type/date.proto b/google/type/date.proto deleted file mode 100644 index b958feeba5..0000000000 --- a/google/type/date.proto +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2019 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.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/date;date"; -option java_multiple_files = true; -option java_outer_classname = "DateProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a whole or partial calendar date, e.g. a birthday. The time of day -// and time zone are either specified elsewhere or are not significant. The date -// is relative to the Proleptic Gregorian Calendar. This can represent: -// -// * A full date, with non-zero year, month and day values -// * A month and day value, with a zero year, e.g. an anniversary -// * A year on its own, with zero month and day values -// * A year and month value, with a zero day, e.g. a credit card expiration date -// -// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. -message Date { - // Year of date. Must be from 1 to 9999, or 0 if specifying a date without - // a year. - int32 year = 1; - - // Month of year. Must be from 1 to 12, or 0 if specifying a year without a - // month and day. - int32 month = 2; - - // Day of month. Must be from 1 to 31 and valid for the year and month, or 0 - // if specifying a year by itself or a year and month where the day is not - // significant. - int32 day = 3; -} diff --git a/google/type/datetime.proto b/google/type/datetime.proto deleted file mode 100644 index 5aebc4b97f..0000000000 --- a/google/type/datetime.proto +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2019 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.type; - -import "google/protobuf/duration.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/datetime;datetime"; -option java_multiple_files = true; -option java_outer_classname = "DateTimeProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents civil time in one of a few possible ways: -// -// * When utc_offset is set and time_zone is unset: a civil time on a calendar -// day with a particular offset from UTC. -// * When time_zone is set and utc_offset is unset: a civil time on a calendar -// day in a particular time zone. -// * When neither time_zone nor utc_offset is set: a civil time on a calendar -// day in local time. -// -// The date is relative to the Proleptic Gregorian Calendar. -// -// If year is 0, the DateTime is considered not to have a specific year. month -// and day must have valid, non-zero values. -// -// This type is more flexible than some applications may want. Make sure to -// document and validate your application's limitations. -message DateTime { - // Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a - // datetime without a year. - int32 year = 1; - - // Required. Month of year. Must be from 1 to 12. - int32 month = 2; - - // Required. Day of month. Must be from 1 to 31 and valid for the year and - // month. - int32 day = 3; - - // Required. Hours of day in 24 hour format. Should be from 0 to 23. An API - // may choose to allow the value "24:00:00" for scenarios like business - // closing time. - int32 hours = 4; - - // Required. Minutes of hour of day. Must be from 0 to 59. - int32 minutes = 5; - - // Required. Seconds of minutes of the time. Must normally be from 0 to 59. An - // API may allow the value 60 if it allows leap-seconds. - int32 seconds = 6; - - // Required. Fractions of seconds in nanoseconds. Must be from 0 to - // 999,999,999. - int32 nanos = 7; - - // Optional. Specifies either the UTC offset or the time zone of the DateTime. - // Choose carefully between them, considering that time zone data may change - // in the future (for example, a country modifies their DST start/end dates, - // and future DateTimes in the affected range had already been stored). - // If omitted, the DateTime is considered to be in local time. - oneof time_offset { - // UTC offset. Must be whole seconds, between -18 hours and +18 hours. - // For example, a UTC offset of -4:00 would be represented as - // { seconds: -14400 }. - google.protobuf.Duration utc_offset = 8; - - // Time zone. - TimeZone time_zone = 9; - } -} - -// Represents a time zone from the -// [IANA Time Zone Database](https://www.iana.org/time-zones). -message TimeZone { - // IANA Time Zone Database time zone, e.g. "America/New_York". - string id = 1; - - // Optional. IANA Time Zone Database version number, e.g. "2019a". - string version = 2; -} diff --git a/google/type/dayofweek.proto b/google/type/dayofweek.proto deleted file mode 100644 index 7544e15161..0000000000 --- a/google/type/dayofweek.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2019 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.type; - -option go_package = "google.golang.org/genproto/googleapis/type/dayofweek;dayofweek"; -option java_multiple_files = true; -option java_outer_classname = "DayOfWeekProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a day of week. -enum DayOfWeek { - // The unspecified day-of-week. - DAY_OF_WEEK_UNSPECIFIED = 0; - - // The day-of-week of Monday. - MONDAY = 1; - - // The day-of-week of Tuesday. - TUESDAY = 2; - - // The day-of-week of Wednesday. - WEDNESDAY = 3; - - // The day-of-week of Thursday. - THURSDAY = 4; - - // The day-of-week of Friday. - FRIDAY = 5; - - // The day-of-week of Saturday. - SATURDAY = 6; - - // The day-of-week of Sunday. - SUNDAY = 7; -} diff --git a/google/type/expr.proto b/google/type/expr.proto deleted file mode 100644 index 5d4f2f71b2..0000000000 --- a/google/type/expr.proto +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2019 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.type; - -option go_package = "google.golang.org/genproto/googleapis/type/expr;expr"; -option java_multiple_files = true; -option java_outer_classname = "ExprProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents an expression text. Example: -// -// title: "User account presence" -// description: "Determines whether the request has a user account" -// expression: "size(request.user) > 0" -message Expr { - // Textual representation of an expression in - // Common Expression Language syntax. - // - // The application context of the containing message determines which - // well-known feature set of CEL is supported. - string expression = 1; - - // An optional title for the expression, i.e. a short string describing - // its purpose. This can be used e.g. in UIs which allow to enter the - // expression. - string title = 2; - - // An optional description of the expression. This is a longer text which - // describes the expression, e.g. when hovered over it in a UI. - string description = 3; - - // An optional string indicating the location of the expression for error - // reporting, e.g. a file name and a position in the file. - string location = 4; -} diff --git a/google/type/fraction.proto b/google/type/fraction.proto deleted file mode 100644 index 8ad008dda2..0000000000 --- a/google/type/fraction.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2019 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.type; - -option go_package = "google.golang.org/genproto/googleapis/type/fraction;fraction"; -option java_multiple_files = true; -option java_outer_classname = "FractionProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a fraction in terms of a numerator divided by a denominator. -message Fraction { - // The portion of the denominator in the faction, e.g. 2 in 2/3. - int64 numerator = 1; - - // The value by which the numerator is divided, e.g. 3 in 2/3. Must be - // positive. - int64 denominator = 2; -} diff --git a/google/type/latlng.proto b/google/type/latlng.proto deleted file mode 100644 index 473856f980..0000000000 --- a/google/type/latlng.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2019 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.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/latlng;latlng"; -option java_multiple_files = true; -option java_outer_classname = "LatLngProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// An object representing a latitude/longitude pair. This is expressed as a pair -// of doubles representing degrees latitude and degrees longitude. Unless -// specified otherwise, this must conform to the -//
WGS84 -// standard. Values must be within normalized ranges. -message LatLng { - // The latitude in degrees. It must be in the range [-90.0, +90.0]. - double latitude = 1; - - // The longitude in degrees. It must be in the range [-180.0, +180.0]. - double longitude = 2; -} diff --git a/google/type/money.proto b/google/type/money.proto deleted file mode 100644 index ef41f1089a..0000000000 --- a/google/type/money.proto +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2019 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.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/money;money"; -option java_multiple_files = true; -option java_outer_classname = "MoneyProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents an amount of money with its currency type. -message Money { - // The 3-letter currency code defined in ISO 4217. - string currency_code = 1; - - // The whole units of the amount. - // For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. - int64 units = 2; - - // Number of nano (10^-9) units of the amount. - // The value must be between -999,999,999 and +999,999,999 inclusive. - // If `units` is positive, `nanos` must be positive or zero. - // If `units` is zero, `nanos` can be positive, zero, or negative. - // If `units` is negative, `nanos` must be negative or zero. - // For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. - int32 nanos = 3; -} diff --git a/google/type/month.proto b/google/type/month.proto deleted file mode 100644 index 54b7865f4b..0000000000 --- a/google/type/month.proto +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2019 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.type; - -option go_package = "google.golang.org/genproto/googleapis/type/month;month"; -option java_multiple_files = true; -option java_outer_classname = "MonthProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a month in the Gregorian calendar. -enum Month { - // The unspecifed month. - MONTH_UNSPECIFIED = 0; - - // The month of January. - JANUARY = 1; - - // The month of February. - FEBRUARY = 2; - - // The month of March. - MARCH = 3; - - // The month of April. - APRIL = 4; - - // The month of May. - MAY = 5; - - // The month of June. - JUNE = 6; - - // The month of July. - JULY = 7; - - // The month of August. - AUGUST = 8; - - // The month of September. - SEPTEMBER = 9; - - // The month of October. - OCTOBER = 10; - - // The month of November. - NOVEMBER = 11; - - // The month of December. - DECEMBER = 12; -} diff --git a/google/type/postal_address.proto b/google/type/postal_address.proto deleted file mode 100644 index 688af8a1bc..0000000000 --- a/google/type/postal_address.proto +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2019 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.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/postaladdress;postaladdress"; -option java_multiple_files = true; -option java_outer_classname = "PostalAddressProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a postal address, e.g. for postal delivery or payments addresses. -// Given a postal address, a postal service can deliver items to a premise, P.O. -// Box or similar. -// It is not intended to model geographical locations (roads, towns, -// mountains). -// -// In typical usage an address would be created via user input or from importing -// existing data, depending on the type of process. -// -// Advice on address input / editing: -// - Use an i18n-ready address widget such as -// https://github.com/google/libaddressinput) -// - Users should not be presented with UI elements for input or editing of -// fields outside countries where that field is used. -// -// For more guidance on how to use this schema, please see: -// https://support.google.com/business/answer/6397478 -message PostalAddress { - // The schema revision of the `PostalAddress`. This must be set to 0, which is - // the latest revision. - // - // All new revisions **must** be backward compatible with old revisions. - int32 revision = 1; - - // Required. CLDR region code of the country/region of the address. This - // is never inferred and it is up to the user to ensure the value is - // correct. See http://cldr.unicode.org/ and - // http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html - // for details. Example: "CH" for Switzerland. - string region_code = 2; - - // Optional. BCP-47 language code of the contents of this address (if - // known). This is often the UI language of the input form or is expected - // to match one of the languages used in the address' country/region, or their - // transliterated equivalents. - // This can affect formatting in certain countries, but is not critical - // to the correctness of the data and will never affect any validation or - // other non-formatting related operations. - // - // If this value is not known, it should be omitted (rather than specifying a - // possibly incorrect default). - // - // Examples: "zh-Hant", "ja", "ja-Latn", "en". - string language_code = 3; - - // Optional. Postal code of the address. Not all countries use or require - // postal codes to be present, but where they are used, they may trigger - // additional validation with other parts of the address (e.g. state/zip - // validation in the U.S.A.). - string postal_code = 4; - - // Optional. Additional, country-specific, sorting code. This is not used - // in most regions. Where it is used, the value is either a string like - // "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number - // alone, representing the "sector code" (Jamaica), "delivery area indicator" - // (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). - string sorting_code = 5; - - // Optional. Highest administrative subdivision which is used for postal - // addresses of a country or region. - // For example, this can be a state, a province, an oblast, or a prefecture. - // Specifically, for Spain this is the province and not the autonomous - // community (e.g. "Barcelona" and not "Catalonia"). - // Many countries don't use an administrative area in postal addresses. E.g. - // in Switzerland this should be left unpopulated. - string administrative_area = 6; - - // Optional. Generally refers to the city/town portion of the address. - // Examples: US city, IT comune, UK post town. - // In regions of the world where localities are not well defined or do not fit - // into this structure well, leave locality empty and use address_lines. - string locality = 7; - - // Optional. Sublocality of the address. - // For example, this can be neighborhoods, boroughs, districts. - string sublocality = 8; - - // Unstructured address lines describing the lower levels of an address. - // - // Because values in address_lines do not have type information and may - // sometimes contain multiple values in a single field (e.g. - // "Austin, TX"), it is important that the line order is clear. The order of - // address lines should be "envelope order" for the country/region of the - // address. In places where this can vary (e.g. Japan), address_language is - // used to make it explicit (e.g. "ja" for large-to-small ordering and - // "ja-Latn" or "en" for small-to-large). This way, the most specific line of - // an address can be selected based on the language. - // - // The minimum permitted structural representation of an address consists - // of a region_code with all remaining information placed in the - // address_lines. It would be possible to format such an address very - // approximately without geocoding, but no semantic reasoning could be - // made about any of the address components until it was at least - // partially resolved. - // - // Creating an address only containing a region_code and address_lines, and - // then geocoding is the recommended way to handle completely unstructured - // addresses (as opposed to guessing which parts of the address should be - // localities or administrative areas). - repeated string address_lines = 9; - - // Optional. The recipient at the address. - // This field may, under certain circumstances, contain multiline information. - // For example, it might contain "care of" information. - repeated string recipients = 10; - - // Optional. The name of the organization at the address. - string organization = 11; -} diff --git a/google/type/quaternion.proto b/google/type/quaternion.proto deleted file mode 100644 index 7ab5dc7283..0000000000 --- a/google/type/quaternion.proto +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2019 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.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/quaternion;quaternion"; -option java_multiple_files = true; -option java_outer_classname = "QuaternionProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// A quaternion is defined as the quotient of two directed lines in a -// three-dimensional space or equivalently as the quotient of two Euclidean -// vectors (https://en.wikipedia.org/wiki/Quaternion). -// -// Quaternions are often used in calculations involving three-dimensional -// rotations (https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation), -// as they provide greater mathematical robustness by avoiding the gimbal lock -// problems that can be encountered when using Euler angles -// (https://en.wikipedia.org/wiki/Gimbal_lock). -// -// Quaternions are generally represented in this form: -// -// w + xi + yj + zk -// -// where x, y, z, and w are real numbers, and i, j, and k are three imaginary -// numbers. -// -// Our naming choice `(x, y, z, w)` comes from the desire to avoid confusion for -// those interested in the geometric properties of the quaternion in the 3D -// Cartesian space. Other texts often use alternative names or subscripts, such -// as `(a, b, c, d)`, `(1, i, j, k)`, or `(0, 1, 2, 3)`, which are perhaps -// better suited for mathematical interpretations. -// -// To avoid any confusion, as well as to maintain compatibility with a large -// number of software libraries, the quaternions represented using the protocol -// buffer below *must* follow the Hamilton convention, which defines `ij = k` -// (i.e. a right-handed algebra), and therefore: -// -// i^2 = j^2 = k^2 = ijk = −1 -// ij = −ji = k -// jk = −kj = i -// ki = −ik = j -// -// Please DO NOT use this to represent quaternions that follow the JPL -// convention, or any of the other quaternion flavors out there. -// -// Definitions: -// -// - Quaternion norm (or magnitude): `sqrt(x^2 + y^2 + z^2 + w^2)`. -// - Unit (or normalized) quaternion: a quaternion whose norm is 1. -// - Pure quaternion: a quaternion whose scalar component (`w`) is 0. -// - Rotation quaternion: a unit quaternion used to represent rotation. -// - Orientation quaternion: a unit quaternion used to represent orientation. -// -// A quaternion can be normalized by dividing it by its norm. The resulting -// quaternion maintains the same direction, but has a norm of 1, i.e. it moves -// on the unit sphere. This is generally necessary for rotation and orientation -// quaternions, to avoid rounding errors: -// https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions -// -// Note that `(x, y, z, w)` and `(-x, -y, -z, -w)` represent the same rotation, -// but normalization would be even more useful, e.g. for comparison purposes, if -// it would produce a unique representation. It is thus recommended that `w` be -// kept positive, which can be achieved by changing all the signs when `w` is -// negative. -// -message Quaternion { - // The x component. - double x = 1; - - // The y component. - double y = 2; - - // The z component. - double z = 3; - - // The scalar component. - double w = 4; -} diff --git a/google/type/timeofday.proto b/google/type/timeofday.proto deleted file mode 100644 index b609a48798..0000000000 --- a/google/type/timeofday.proto +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2019 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.type; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/type/timeofday;timeofday"; -option java_multiple_files = true; -option java_outer_classname = "TimeOfDayProto"; -option java_package = "com.google.type"; -option objc_class_prefix = "GTP"; - -// Represents a time of day. The date and time zone are either not significant -// or are specified elsewhere. An API may choose to allow leap seconds. Related -// types are [google.type.Date][google.type.Date] and `google.protobuf.Timestamp`. -message TimeOfDay { - // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose - // to allow the value "24:00:00" for scenarios like business closing time. - int32 hours = 1; - - // Minutes of hour of day. Must be from 0 to 59. - int32 minutes = 2; - - // Seconds of minutes of the time. Must normally be from 0 to 59. An API may - // allow the value 60 if it allows leap-seconds. - int32 seconds = 3; - - // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. - int32 nanos = 4; -} diff --git a/google/type/type.yaml b/google/type/type.yaml deleted file mode 100644 index 3c2e20e671..0000000000 --- a/google/type/type.yaml +++ /dev/null @@ -1,37 +0,0 @@ -type: google.api.Service -config_version: 1 -name: type.googleapis.com -title: Common Types - -types: -- name: google.type.Color -- name: google.type.Date -- name: google.type.DateTime -- name: google.type.Expr -- name: google.type.Fraction -- name: google.type.LatLng -- name: google.type.Money -- name: google.type.PostalAddress -- name: google.type.Quaternion -- name: google.type.TimeOfDay -- name: google.type.TimeZone - -enums: -- name: google.type.CalendarPeriod -- name: google.type.DayOfWeek -- name: google.type.Month - -documentation: - summary: Defines common types for Google APIs. - overview: |- - # Google Common Types - - This package contains definitions of common types for Google APIs. - All types defined in this package are suitable for different APIs to - exchange data, and will never break binary compatibility. They should - have design quality comparable to major programming languages like - Java and C#. - - NOTE: Some common types are defined in the package `google.protobuf` - as they are directly supported by Protocol Buffers compiler and - runtime. Those types are called Well-Known Types. From 7325da28556bec0efcda1a81977faa49ffb47eb8 Mon Sep 17 00:00:00 2001 From: summerji Date: Wed, 1 Jul 2020 10:30:16 -0700 Subject: [PATCH 3/6] format files --- .../com/google/api/showcase/ShowcaseTest.java | 139 +++++++++++------- 1 file changed, 86 insertions(+), 53 deletions(-) diff --git a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java index 33fd36d516..98db4a1c9a 100755 --- a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java +++ b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java @@ -275,59 +275,92 @@ public void quotaProjectIdTest() throws Exception { final String QUOTA_PROJECT_ID = "quota_project_id"; final String QUOTA_PROJECT_ID_FROM_HEADER_VALUE = "quota_project_id_from_headers"; final String QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE = "quota_project_id_from_credentials"; - final String JSON_KEY_QUOTA_PROJECT_ID = "{\n" + " \"private_key_id\": \"somekeyid\",\n" - + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" - + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" - + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" - + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" - + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" - + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" - + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" - + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" - + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" - + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" - + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" - + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" - + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" - + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" - + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" - + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" - + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" - + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" - + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" - + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" - + " \"project_id\": \"someprojectid\",\n" - + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" - + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" + " \"type\": \"service_account\",\n" - + " \"quota_project_id\": \"" + QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE + "\"\n" + "}"; - final GoogleCredentials credentialsWithQuotaProject = loadCredentials(JSON_KEY_QUOTA_PROJECT_ID); - final CredentialsProvider credentialsProviderWithQuota = new CredentialsProvider() { - @Override - public Credentials getCredentials() throws IOException { - return credentialsWithQuotaProject; - } - }; - final HeaderProvider headerProviderWithQuota = new HeaderProvider() { - @Override - public Map getHeaders() { - return Collections.singletonMap(QUOTA_PROJECT_ID_KEY, QUOTA_PROJECT_ID_FROM_HEADER_VALUE); - } - }; - - EchoSettings settingsSetQuota = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()).setQuotaProjectId(QUOTA_PROJECT_ID).build(); - EchoSettings settingsHeader = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()).setHeaderProvider(headerProviderWithQuota).build(); - EchoSettings settingsHeaderAndQuota = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()).setHeaderProvider(headerProviderWithQuota) - .setQuotaProjectId(QUOTA_PROJECT_ID).build(); - EchoSettings settingsCredentials = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) - .setCredentialsProvider(credentialsProviderWithQuota).build(); - EchoSettings settingsCredentialsAndQuota = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) - .setCredentialsProvider(credentialsProviderWithQuota).setQuotaProjectId(QUOTA_PROJECT_ID).build(); - EchoSettings settingsQuotaAll = EchoSettings.newBuilder().setTransportChannelProvider(channelProvider) - .setCredentialsProvider(credentialsProviderWithQuota).setQuotaProjectId(QUOTA_PROJECT_ID) - .setHeaderProvider(headerProviderWithQuota).build(); + final String JSON_KEY_QUOTA_PROJECT_ID = + "{\n" + + " \"private_key_id\": \"somekeyid\",\n" + + " \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggS" + + "kAgEAAoIBAQC+K2hSuFpAdrJI\\nnCgcDz2M7t7bjdlsadsasad+fvRSW6TjNQZ3p5LLQY1kSZRqBqylRkzteMOyHg" + + "aR\\n0Pmxh3ILCND5men43j3h4eDbrhQBuxfEMalkG92sL+PNQSETY2tnvXryOvmBRwa/\\nQP/9dJfIkIDJ9Fw9N4" + + "Bhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nknddadwkwewcVxHFhcZJO+XWf6ofLUXpRwiTZakGMn8EE1uVa2" + + "LgczOjwWHGi99MFjxSer5m9\\n1tCa3/KEGKiS/YL71JvjwX3mb+cewlkcmweBKZHM2JPTk0ZednFSpVZMtycjkbLa" + + "\\ndYOS8V85AgMBewECggEBAKksaldajfDZDV6nGqbFjMiizAKJolr/M3OQw16K6o3/\\n0S31xIe3sSlgW0+UbYlF" + + "4U8KifhManD1apVSC3csafaspP4RZUHFhtBywLO9pR5c\\nr6S5aLp+gPWFyIp1pfXbWGvc5VY/v9x7ya1VEa6rXvL" + + "sKupSeWAW4tMj3eo/64ge\\nsdaceaLYw52KeBYiT6+vpsnYrEkAHO1fF/LavbLLOFJmFTMxmsNaG0tuiJHgjshB\\" + + "n82DpMCbXG9YcCgI/DbzuIjsdj2JC1cascSP//3PmefWysucBQe7Jryb6NQtASmnv\\nCdDw/0jmZTEjpe4S1lxfHp" + + "lAhHFtdgYTvyYtaLZiVVkCgYEA8eVpof2rceecw/I6\\n5ng1q3Hl2usdWV/4mZMvR0fOemacLLfocX6IYxT1zA1FF" + + "JlbXSRsJMf/Qq39mOR2\\nSpW+hr4jCoHeRVYLgsbggtrevGmILAlNoqCMpGZ6vDmJpq6ECV9olliDvpPgWOP+\\nm" + + "YPDreFBGxWvQrADNbRt2dmGsrsCgYEAyUHqB2wvJHFqdmeBsaacewzV8x9WgmeX\\ngUIi9REwXlGDW0Mz50dxpxcK" + + "CAYn65+7TCnY5O/jmL0VRxU1J2mSWyWTo1C+17L0\\n3fUqjxL1pkefwecxwecvC+gFFYdJ4CQ/MHHXU81Lwl1iWdF" + + "Cd2UoGddYaOF+KNeM\\nHC7cmqra+JsCgYEAlUNywzq8nUg7282E+uICfCB0LfwejuymR93CtsFgb7cRd6ak\\nECR" + + "8FGfCpH8ruWJINllbQfcHVCX47ndLZwqv3oVFKh6pAS/vVI4dpOepP8++7y1u\\ncoOvtreXCX6XqfrWDtKIvv0vjl" + + "HBhhhp6mCcRpdQjV38H7JsyJ7lih/oNjECgYAt\\nkndj5uNl5SiuVxHFhcZJO+XWf6ofLUregtevZakGMn8EE1uVa" + + "2AY7eafmoU/nZPT\\n00YB0TBATdCbn/nBSuKDESkhSg9s2GEKQZG5hBmL5uCMfo09z3SfxZIhJdlerreP\\nJ7gSi" + + "dI12N+EZxYd4xIJh/HFDgp7RRO87f+WJkofMQKBgGTnClK1VMaCRbJZPriw\\nEfeFCoOX75MxKwXs6xgrw4W//AYG" + + "GUjDt83lD6AZP6tws7gJ2IwY/qP7+lyhjEqN\\nHtfPZRGFkGZsdaksdlaksd323423d+15/UvrlRSFPNj1tWQmNKk" + + "XyRDW4IG1Oa2p\\nrALStNBx5Y9t0/LQnFI4w3aG\\n-----END PRIVATE KEY-----\\n\",\n" + + " \"project_id\": \"someprojectid\",\n" + + " \"client_email\": \"someclientid@developer.gserviceaccount.com\",\n" + + " \"client_id\": \"someclientid.apps.googleusercontent.com\",\n" + + " \"type\": \"service_account\",\n" + + " \"quota_project_id\": \"" + + QUOTA_PROJECT_ID_FROM_CREDENTIALS_VALUE + + "\"\n" + + "}"; + final GoogleCredentials credentialsWithQuotaProject = + loadCredentials(JSON_KEY_QUOTA_PROJECT_ID); + final CredentialsProvider credentialsProviderWithQuota = + new CredentialsProvider() { + @Override + public Credentials getCredentials() throws IOException { + return credentialsWithQuotaProject; + } + }; + final HeaderProvider headerProviderWithQuota = + new HeaderProvider() { + @Override + public Map getHeaders() { + return Collections.singletonMap( + QUOTA_PROJECT_ID_KEY, QUOTA_PROJECT_ID_FROM_HEADER_VALUE); + } + }; + + EchoSettings settingsSetQuota = + EchoSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .setQuotaProjectId(QUOTA_PROJECT_ID) + .build(); + EchoSettings settingsHeader = + EchoSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .setHeaderProvider(headerProviderWithQuota) + .build(); + EchoSettings settingsHeaderAndQuota = + EchoSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .setHeaderProvider(headerProviderWithQuota) + .setQuotaProjectId(QUOTA_PROJECT_ID) + .build(); + EchoSettings settingsCredentials = + EchoSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProviderWithQuota) + .build(); + EchoSettings settingsCredentialsAndQuota = + EchoSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProviderWithQuota) + .setQuotaProjectId(QUOTA_PROJECT_ID) + .build(); + EchoSettings settingsQuotaAll = + EchoSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(credentialsProviderWithQuota) + .setQuotaProjectId(QUOTA_PROJECT_ID) + .setHeaderProvider(headerProviderWithQuota) + .build(); validQuotaProjectId(settingsSetQuota, QUOTA_PROJECT_ID); validQuotaProjectId(settingsHeader, QUOTA_PROJECT_ID_FROM_HEADER_VALUE); From 0e5abf259b0411b0d0410a87ab00d1908edc74a2 Mon Sep 17 00:00:00 2001 From: summerji Date: Wed, 1 Jul 2020 14:51:09 -0700 Subject: [PATCH 4/6] add gax dependencies --- .gitignore | 1 + showcase/java/build.gradle | 4 +++- .../com/google/api/showcase/ShowcaseTest.java | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 151a113bc0..1d4aaae042 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ tmp showcase-protos showcase-protos-patched google +googleapis diff --git a/showcase/java/build.gradle b/showcase/java/build.gradle index 8ccae8cdb3..00d136aefa 100755 --- a/showcase/java/build.gradle +++ b/showcase/java/build.gradle @@ -39,9 +39,11 @@ repositories { } dependencies { - implementation 'com.google.cloud:gapic-google-cloud-showcase-v1beta1:0.0.0-SNAPSHOT' + implementation 'com.google.cloud:gapic-google-cloud-showcase-v1beta1-java:0.0.0-SNAPSHOT' implementation "io.grpc:grpc-netty-shaded:1.13.1" + compile 'com.google.api:gax:1.57.0' + testCompile 'com.google.api:gax:1.57.0' testImplementation 'junit:junit:4.13' testImplementation "com.google.truth:truth:1.0" } diff --git a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java index 98db4a1c9a..5e8e7d550f 100755 --- a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java +++ b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java @@ -19,12 +19,17 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; +import com.google.api.gax.core.CredentialsProvider; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.auth.Credentials; +import com.google.auth.oauth2.GoogleCredentials; import com.google.api.gax.rpc.AbortedException; import com.google.api.gax.rpc.ApiStreamObserver; import com.google.api.gax.rpc.BidiStreamObserver; import com.google.api.gax.rpc.ClientStream; import com.google.api.gax.rpc.ServerStream; import com.google.api.gax.rpc.StreamController; +import com.google.api.gax.rpc.HeaderProvider; import com.google.protobuf.Duration; import com.google.rpc.Code; import com.google.rpc.Status; @@ -48,12 +53,20 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import org.junit.Assert; +import java.io.IOException; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.Collections; +import java.util.Map; + /** Integration tests via Showcase: https://github.com/googleapis/gapic-showcase */ @RunWith(JUnit4.class) public class ShowcaseTest { private EchoClient client; + private ShowcaseTransportChannelProvider channelProvider; @Before public void setup() throws Exception { @@ -61,6 +74,8 @@ public void setup() throws Exception { if (host == null) host = "localhost"; String port = System.getenv("PORT"); if (port == null) port = "7469"; + channelProvider = new ShowcaseTransportChannelProvider( + host, Integer.parseInt(port), new ShowcaseHeaderProvider()); // init client for all tests client = From 90498a6b4acc0d5f441c32c4b5d79d09a0e763db Mon Sep 17 00:00:00 2001 From: summerji Date: Wed, 1 Jul 2020 14:54:08 -0700 Subject: [PATCH 5/6] formatting --- .../com/google/api/showcase/ShowcaseTest.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java index 5e8e7d550f..3a78621802 100755 --- a/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java +++ b/showcase/java/src/test/java/com/google/api/showcase/ShowcaseTest.java @@ -21,15 +21,15 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.api.gax.core.NoCredentialsProvider; -import com.google.auth.Credentials; -import com.google.auth.oauth2.GoogleCredentials; import com.google.api.gax.rpc.AbortedException; import com.google.api.gax.rpc.ApiStreamObserver; import com.google.api.gax.rpc.BidiStreamObserver; import com.google.api.gax.rpc.ClientStream; +import com.google.api.gax.rpc.HeaderProvider; import com.google.api.gax.rpc.ServerStream; import com.google.api.gax.rpc.StreamController; -import com.google.api.gax.rpc.HeaderProvider; +import com.google.auth.Credentials; +import com.google.auth.oauth2.GoogleCredentials; import com.google.protobuf.Duration; import com.google.rpc.Code; import com.google.rpc.Status; @@ -41,25 +41,24 @@ import com.google.showcase.v1beta1.EchoSettings; import com.google.showcase.v1beta1.ExpandRequest; import io.grpc.StatusRuntimeException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import org.junit.Assert; -import java.io.IOException; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Collections; -import java.util.Map; - /** Integration tests via Showcase: https://github.com/googleapis/gapic-showcase */ @RunWith(JUnit4.class) @@ -74,8 +73,9 @@ public void setup() throws Exception { if (host == null) host = "localhost"; String port = System.getenv("PORT"); if (port == null) port = "7469"; - channelProvider = new ShowcaseTransportChannelProvider( - host, Integer.parseInt(port), new ShowcaseHeaderProvider()); + channelProvider = + new ShowcaseTransportChannelProvider( + host, Integer.parseInt(port), new ShowcaseHeaderProvider()); // init client for all tests client = From c39250083b5db357e3b5834400c6d3872da6825a Mon Sep 17 00:00:00 2001 From: summerji Date: Wed, 1 Jul 2020 15:13:21 -0700 Subject: [PATCH 6/6] add dependencies --- showcase/java/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/showcase/java/build.gradle b/showcase/java/build.gradle index 00d136aefa..3542549c4f 100755 --- a/showcase/java/build.gradle +++ b/showcase/java/build.gradle @@ -39,7 +39,7 @@ repositories { } dependencies { - implementation 'com.google.cloud:gapic-google-cloud-showcase-v1beta1-java:0.0.0-SNAPSHOT' + implementation 'com.google.cloud:gapic-google-cloud-showcase-v1beta1:0.0.0-SNAPSHOT' implementation "io.grpc:grpc-netty-shaded:1.13.1" compile 'com.google.api:gax:1.57.0'