Skip to content

Commit

Permalink
build: fix Network Management API version v1 YAML and BUILD dependencies
Browse files Browse the repository at this point in the history
feat: add Location & IAM mixins

PiperOrigin-RevId: 615459446
  • Loading branch information
Google APIs authored and Copybara-Service committed Mar 13, 2024
1 parent 3ac4944 commit 32480e2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 33 deletions.
43 changes: 36 additions & 7 deletions google/cloud/networkmanagement/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
# * extra_protoc_file_parameters
# The complete list of preserved parameters can be found in the source code.

# buildifier: disable=load-on-top

# 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")
# buildifier: disable=same-origin-load
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "networkmanagement_proto",
Expand All @@ -43,12 +46,15 @@ proto_library_with_info(
deps = [
":networkmanagement_proto",
"//google/cloud:common_resources_proto",
"//google/cloud/location:location_proto",
"//google/iam/v1:iam_policy_proto",
],
)

##############################################################################
# Java
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_gapic_assembly_gradle_pkg",
Expand All @@ -72,23 +78,30 @@ java_grpc_library(
java_gapic_library(
name = "networkmanagement_java_gapic",
srcs = [":networkmanagement_proto_with_info"],
gapic_yaml = None,
grpc_service_config = "networkmanagement_grpc_service_config.json",
rest_numeric_enums = True,
service_yaml = "networkmanagement_v1.yaml",
test_deps = [
":networkmanagement_java_grpc",
"//google/cloud/location:location_java_grpc",
"//google/iam/v1:iam_java_grpc",
],
transport = "grpc+rest",
deps = [
":networkmanagement_java_proto",
"//google/api:api_java_proto",
"//google/cloud/location:location_java_proto",
"//google/iam/v1:iam_java_proto",
],
)

java_gapic_test(
name = "networkmanagement_java_gapic_test_suite",
test_classes = [
"com.google.cloud.networkmanagement.v1.ReachabilityServiceClientHttpJsonTest",
# This test is temporarily disabled due to the issue:
# https://github.com/googleapis/sdk-platform-java/issues/1839
# "com.google.cloud.networkmanagement.v1.ReachabilityServiceClientHttpJsonTest",
"com.google.cloud.networkmanagement.v1.ReachabilityServiceClientTest",
],
runtime_deps = [":networkmanagement_java_gapic_test"],
Expand All @@ -110,6 +123,7 @@ java_gapic_assembly_gradle_pkg(
##############################################################################
# Go
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_gapic_assembly_pkg",
Expand Down Expand Up @@ -141,6 +155,8 @@ go_gapic_library(
transport = "grpc+rest",
deps = [
":networkmanagement_go_proto",
"//google/cloud/location:location_go_proto",
"//google/iam/v1:iam_go_proto",
"//google/longrunning:longrunning_go_proto",
"@com_google_cloud_go_longrunning//:go_default_library",
"@com_google_cloud_go_longrunning//autogen:go_default_library",
Expand All @@ -162,24 +178,29 @@ go_gapic_assembly_pkg(
##############################################################################
# Python
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"py_gapic_assembly_pkg",
"py_gapic_library",
"py_test",
)

py_gapic_library(
name = "networkmanagement_py_gapic",
srcs = [":networkmanagement_proto"],
grpc_service_config = "networkmanagement_grpc_service_config.json",
opt_args = [
"warehouse-package-name=google-cloud-network-management",
"python-gapic-namespace=google.cloud",
"python-gapic-name=network_management",
"python-gapic-namespace=google.cloud",
"warehouse-package-name=google-cloud-network-management",
],
rest_numeric_enums = True,
service_yaml = "networkmanagement_v1.yaml",
transport = "grpc+rest",
deps = [
"//google/iam/v1:iam_policy_py_proto",
],
)

py_test(
Expand All @@ -203,6 +224,7 @@ py_gapic_assembly_pkg(
##############################################################################
# PHP
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_gapic_assembly_pkg",
Expand All @@ -223,7 +245,9 @@ php_gapic_library(
rest_numeric_enums = True,
service_yaml = "networkmanagement_v1.yaml",
transport = "grpc+rest",
deps = [":networkmanagement_php_proto"],
deps = [
":networkmanagement_php_proto",
],
)

# Open Source Packages
Expand All @@ -238,6 +262,7 @@ php_gapic_assembly_pkg(
##############################################################################
# Node.js
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
Expand Down Expand Up @@ -268,6 +293,7 @@ nodejs_gapic_assembly_pkg(
##############################################################################
# Ruby
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_cloud_gapic_library",
Expand All @@ -291,9 +317,9 @@ ruby_cloud_gapic_library(
name = "networkmanagement_ruby_gapic",
srcs = [":networkmanagement_proto_with_info"],
extra_protoc_parameters = [
"ruby-cloud-gem-name=google-cloud-network_management-v1",
"ruby-cloud-api-shortname=networkmanagement",
"ruby-cloud-api-id=networkmanagement.googleapis.com",
"ruby-cloud-api-shortname=networkmanagement",
"ruby-cloud-gem-name=google-cloud-network_management-v1",
"ruby-cloud-product-url=https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest",
],
grpc_service_config = "networkmanagement_grpc_service_config.json",
Expand Down Expand Up @@ -321,6 +347,7 @@ ruby_gapic_assembly_pkg(
##############################################################################
# C#
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_gapic_assembly_pkg",
Expand All @@ -331,6 +358,7 @@ load(

csharp_proto_library(
name = "networkmanagement_csharp_proto",
extra_opts = [],
deps = [":networkmanagement_proto"],
)

Expand Down Expand Up @@ -367,6 +395,7 @@ csharp_gapic_assembly_pkg(
##############################################################################
# C++
##############################################################################
# buildifier: disable=same-origin-load
load(
"@com_google_googleapis_imports//:imports.bzl",
"cc_grpc_library",
Expand Down
20 changes: 3 additions & 17 deletions google/cloud/networkmanagement/v1/networkmanagement_v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ name: networkmanagement.googleapis.com
title: Network Management API

apis:
- name: google.cloud.location.Locations
- name: google.cloud.networkmanagement.v1.ReachabilityService
- name: google.iam.v1.IAMPolicy
- name: google.longrunning.Operations

types:
- name: google.cloud.networkmanagement.v1.OperationMetadata
Expand Down Expand Up @@ -43,23 +46,6 @@ documentation:
permission-aware UIs and command-line tools, not for authorization
checking. This operation may "fail open" without warning.
backend:
rules:
- selector: google.cloud.location.Locations.GetLocation
deadline: 60.0
- selector: google.cloud.location.Locations.ListLocations
deadline: 60.0
- selector: google.cloud.networkmanagement.v1.ReachabilityService.GetConnectivityTest
deadline: 60.0
- selector: google.cloud.networkmanagement.v1.ReachabilityService.ListConnectivityTests
deadline: 60.0
- selector: 'google.iam.v1.IAMPolicy.*'
deadline: 60.0
- selector: 'google.longrunning.Operations.*'
deadline: 60.0
- selector: google.longrunning.Operations.GetOperation
deadline: 10.0

http:
rules:
- selector: google.cloud.location.Locations.GetLocation
Expand Down
28 changes: 19 additions & 9 deletions google/cloud/networkmanagement/v1/reachability.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,10 @@ package google.cloud.networkmanagement.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/networkmanagement/v1/connectivity_test.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";

Expand All @@ -44,18 +46,21 @@ option ruby_package = "Google::Cloud::NetworkManagement::V1";
// to troubleshoot connectivity issues.
service ReachabilityService {
option (google.api.default_host) = "networkmanagement.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";

// Lists all Connectivity Tests owned by a project.
rpc ListConnectivityTests(ListConnectivityTestsRequest) returns (ListConnectivityTestsResponse) {
rpc ListConnectivityTests(ListConnectivityTestsRequest)
returns (ListConnectivityTestsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/global}/connectivityTests"
};
option (google.api.method_signature) = "parent";
}

// Gets the details of a specific Connectivity Test.
rpc GetConnectivityTest(GetConnectivityTestRequest) returns (ConnectivityTest) {
rpc GetConnectivityTest(GetConnectivityTestRequest)
returns (ConnectivityTest) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/global/connectivityTests/*}"
};
Expand All @@ -75,7 +80,8 @@ service ReachabilityService {
// incomplete, the reachability result returns a value of
// <code>AMBIGUOUS</code>. For more information,
// see the Connectivity Test documentation.
rpc CreateConnectivityTest(CreateConnectivityTestRequest) returns (google.longrunning.Operation) {
rpc CreateConnectivityTest(CreateConnectivityTestRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/locations/global}/connectivityTests"
body: "resource"
Expand All @@ -101,7 +107,8 @@ service ReachabilityService {
// If the endpoint specifications in `ConnectivityTest` are incomplete, the
// reachability result returns a value of `AMBIGUOUS`. See the documentation
// in `ConnectivityTest` for for more details.
rpc UpdateConnectivityTest(UpdateConnectivityTestRequest) returns (google.longrunning.Operation) {
rpc UpdateConnectivityTest(UpdateConnectivityTestRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1/{resource.name=projects/*/locations/global/connectivityTests/*}"
body: "resource"
Expand All @@ -125,7 +132,8 @@ service ReachabilityService {
// example, specified resources are deleted in the network, or you lost
// read permissions to the network configurations of listed projects), then
// the reachability result returns a value of `UNKNOWN`.
rpc RerunConnectivityTest(RerunConnectivityTestRequest) returns (google.longrunning.Operation) {
rpc RerunConnectivityTest(RerunConnectivityTestRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/locations/global/connectivityTests/*}:rerun"
body: "*"
Expand All @@ -137,7 +145,8 @@ service ReachabilityService {
}

// Deletes a specific `ConnectivityTest`.
rpc DeleteConnectivityTest(DeleteConnectivityTestRequest) returns (google.longrunning.Operation) {
rpc DeleteConnectivityTest(DeleteConnectivityTestRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/global/connectivityTests/*}"
};
Expand Down Expand Up @@ -228,7 +237,8 @@ message CreateConnectivityTestRequest {
message UpdateConnectivityTestRequest {
// Required. Mask of fields to update. At least one path must be supplied in
// this field.
google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED];
google.protobuf.FieldMask update_mask = 1
[(google.api.field_behavior) = REQUIRED];

// Required. Only fields specified in update_mask are updated.
ConnectivityTest resource = 2 [(google.api.field_behavior) = REQUIRED];
Expand Down

0 comments on commit 32480e2

Please sign in to comment.