#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# grpc-gateway generates REST gateway code from annotations in the gRPC service proto file.This
# does not work for the longrunning operations service as the URL mapping specified in the
# longrunning operations service definition proto is generic and needs to be overriden for the
# URL patterns used by InstanceAdmin and DatabaseAdmin services.
#
# This file specifies gRPC HTTP URL overrides for the longrunning operations service and is
# provided as an input to the gateway generator.
type: google.api.Service
config_version: 3

http:
  rules:
  - selector: google.longrunning.Operations.GetOperation
    get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}'
    additional_bindings:
    - get: '/v1/{name=projects/*/instances/*/operations/*}'
  - selector: google.longrunning.Operations.ListOperations
    get: '/v1/{name=projects/*/instances/*/databases/*/operations}'
    additional_bindings:
    - get: '/v1/{name=projects/*/instances/*/operations}'
  - selector: google.longrunning.Operations.CancelOperation
    post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel'
    additional_bindings:
    - post: '/v1/{name=projects/*/instances/*/operations/*}:cancel'
  - selector: google.longrunning.Operations.DeleteOperation
    delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}'
    additional_bindings:
    - delete: '/v1/{name=projects/*/instances/*/operations/*}'
