1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.networkservices.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/protobuf/timestamp.proto"; 21 22option csharp_namespace = "Google.Cloud.NetworkServices.V1"; 23option go_package = "cloud.google.com/go/networkservices/apiv1/networkservicespb;networkservicespb"; 24option java_multiple_files = true; 25option java_outer_classname = "CommonProto"; 26option java_package = "com.google.cloud.networkservices.v1"; 27option php_namespace = "Google\\Cloud\\NetworkServices\\V1"; 28option ruby_package = "Google::Cloud::NetworkServices::V1"; 29 30// Represents the metadata of the long-running operation. 31message OperationMetadata { 32 // Output only. The time the operation was created. 33 google.protobuf.Timestamp create_time = 1 34 [(google.api.field_behavior) = OUTPUT_ONLY]; 35 36 // Output only. The time the operation finished running. 37 google.protobuf.Timestamp end_time = 2 38 [(google.api.field_behavior) = OUTPUT_ONLY]; 39 40 // Output only. Server-defined resource path for the target of the operation. 41 string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; 42 43 // Output only. Name of the verb executed by the operation. 44 string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; 45 46 // Output only. Human-readable status of the operation, if any. 47 string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 48 49 // Output only. Identifies whether the user has requested cancellation 50 // of the operation. Operations that have successfully been cancelled 51 // have [Operation.error][] value with a 52 // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to 53 // `Code.CANCELLED`. 54 bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; 55 56 // Output only. API version used to start the operation. 57 string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; 58} 59 60// Specification of a port-based selector. 61message TrafficPortSelector { 62 // Optional. A list of ports. Can be port numbers or port range 63 // (example, [80-90] specifies all ports from 80 to 90, including 64 // 80 and 90) or named ports or * to specify all ports. If the 65 // list is empty, all ports are selected. 66 repeated string ports = 1 [(google.api.field_behavior) = OPTIONAL]; 67} 68 69// A definition of a matcher that selects endpoints to which the policies 70// should be applied. 71message EndpointMatcher { 72 // The matcher that is based on node metadata presented by xDS clients. 73 message MetadataLabelMatcher { 74 // Defines a name-pair value for a single label. 75 message MetadataLabels { 76 // Required. Label name presented as key in xDS Node Metadata. 77 string label_name = 1 [(google.api.field_behavior) = REQUIRED]; 78 79 // Required. Label value presented as value corresponding to the above 80 // key, in xDS Node Metadata. 81 string label_value = 2 [(google.api.field_behavior) = REQUIRED]; 82 } 83 84 // Possible criteria values that define logic of how matching is made. 85 enum MetadataLabelMatchCriteria { 86 // Default value. Should not be used. 87 METADATA_LABEL_MATCH_CRITERIA_UNSPECIFIED = 0; 88 89 // At least one of the Labels specified in the matcher should match the 90 // metadata presented by xDS client. 91 MATCH_ANY = 1; 92 93 // The metadata presented by the xDS client should contain all of the 94 // labels specified here. 95 MATCH_ALL = 2; 96 } 97 98 // Specifies how matching should be done. 99 // 100 // Supported values are: 101 // MATCH_ANY: At least one of the Labels specified in the 102 // matcher should match the metadata presented by xDS client. 103 // MATCH_ALL: The metadata presented by the xDS client should 104 // contain all of the labels specified here. 105 // 106 // The selection is determined based on the best match. For 107 // example, suppose there are three EndpointPolicy 108 // resources P1, P2 and P3 and if P1 has a the matcher as 109 // MATCH_ANY <A:1, B:1>, P2 has MATCH_ALL <A:1,B:1>, and P3 has 110 // MATCH_ALL <A:1,B:1,C:1>. 111 // 112 // If a client with label <A:1> connects, the config from P1 113 // will be selected. 114 // 115 // If a client with label <A:1,B:1> connects, the config from P2 116 // will be selected. 117 // 118 // If a client with label <A:1,B:1,C:1> connects, the config 119 // from P3 will be selected. 120 // 121 // If there is more than one best match, (for example, if a 122 // config P4 with selector <A:1,D:1> exists and if a client with 123 // label <A:1,B:1,D:1> connects), an error will be thrown. 124 MetadataLabelMatchCriteria metadata_label_match_criteria = 1; 125 126 // The list of label value pairs that must match labels in the 127 // provided metadata based on filterMatchCriteria This list can 128 // have at most 64 entries. The list can be empty if the match 129 // criteria is MATCH_ANY, to specify a wildcard match (i.e this 130 // matches any client). 131 repeated MetadataLabels metadata_labels = 2; 132 } 133 134 // Specifies type of the matcher used for this endpoint matcher. 135 oneof matcher_type { 136 // The matcher is based on node metadata presented by xDS clients. 137 MetadataLabelMatcher metadata_label_matcher = 1; 138 } 139} 140