// 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.
// You may obtain a copy of the License at
//
//      https://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.

// Generated by the C++ microgenerator.
// If you make any local changes, they will be lost.
// file:///workspace/generator/discovery/compute_public_google_rest_v1.json
// revision: 20231110

syntax = "proto3";

package google.cloud.cpp.compute.v1;

import "google/cloud/compute/v1/internal/common_047.proto";

message BackendServiceReference {
  optional string backend_service = 1 [json_name = "backendService"];
}

message ForwardingRuleReference {
  optional string forwarding_rule = 1 [json_name = "forwardingRule"];
}

// A full or valid partial URL to a health check service. For example, the
// following are valid URLs: -
// https://www.googleapis.com/compute/beta/projects/project-id/regions/us-west1/healthCheckServices/health-check-service
// -
// projects/project-id/regions/us-west1/healthCheckServices/health-check-service
// - regions/us-west1/healthCheckServices/health-check-service
message HealthCheckServiceReference {
  optional string health_check_service = 1 [json_name = "healthCheckService"];
}

message HealthStatusForNetworkEndpoint {
  // URL of the backend service associated with the health state of the network
  // endpoint.
  optional BackendServiceReference backend_service = 1
      [json_name = "backendService"];

  // URL of the forwarding rule associated with the health state of the network
  // endpoint.
  optional ForwardingRuleReference forwarding_rule = 2
      [json_name = "forwardingRule"];

  // URL of the health check associated with the health state of the network
  // endpoint.
  optional HealthCheckReference health_check = 3 [json_name = "healthCheck"];

  // URL of the health check service associated with the health state of the
  // network endpoint.
  optional HealthCheckServiceReference health_check_service = 4
      [json_name = "healthCheckService"];

  // Health state of the network endpoint determined based on the health checks
  // configured.
  // DRAINING: Endpoint is being drained.
  // HEALTHY: Endpoint is healthy.
  // UNHEALTHY: Endpoint is unhealthy.
  // UNKNOWN: Health status of the endpoint is unknown.
  optional string health_state = 5 [json_name = "healthState"];
}

// The network endpoint.
message NetworkEndpoint {
  // Metadata defined as annotations on the network endpoint.
  map<string, string> annotations = 1 [json_name = "annotations"];

  // Optional fully qualified domain name of network endpoint. This can only be
  // specified when NetworkEndpointGroup.network_endpoint_type is
  // NON_GCP_FQDN_PORT.
  optional string fqdn = 2 [json_name = "fqdn"];

  // The name for a specific VM instance that the IP address belongs to. This is
  // required for network endpoints of type GCE_VM_IP_PORT. The instance must be
  // in the same zone of network endpoint group. The name must be 1-63
  // characters long, and comply with RFC1035.
  optional string instance = 3 [json_name = "instance"];

  // Optional IPv4 address of network endpoint. The IP address must belong to a
  // VM in Compute Engine (either the primary IP or as part of an aliased IP
  // range). If the IP address is not specified, then the primary IP address for
  // the VM instance in the network that the network endpoint group belongs to
  // will be used.
  optional string ip_address = 4 [json_name = "ipAddress"];

  // Optional port number of network endpoint. If not specified, the defaultPort
  // for the network endpoint group will be used.
  optional int32 port = 5 [json_name = "port"];
}

// Represents a collection of network endpoints. A network endpoint group (NEG)
// defines how a set of endpoints should be reached, whether they are reachable,
// and where they are located. For more information about using NEGs for
// different use cases, see Network endpoint groups overview.
message NetworkEndpointGroup {
  // Metadata defined as annotations on the network endpoint group.
  map<string, string> annotations = 1 [json_name = "annotations"];

  // Only valid when networkEndpointType is "SERVERLESS". Only one of cloudRun,
  // appEngine or cloudFunction may be set.
  optional NetworkEndpointGroupAppEngine app_engine = 2
      [json_name = "appEngine"];

  // Only valid when networkEndpointType is "SERVERLESS". Only one of cloudRun,
  // appEngine or cloudFunction may be set.
  optional NetworkEndpointGroupCloudFunction cloud_function = 3
      [json_name = "cloudFunction"];

  // Only valid when networkEndpointType is "SERVERLESS". Only one of cloudRun,
  // appEngine or cloudFunction may be set.
  optional NetworkEndpointGroupCloudRun cloud_run = 4 [json_name = "cloudRun"];

  // [Output Only] Creation timestamp in RFC3339 text format.
  optional string creation_timestamp = 5 [json_name = "creationTimestamp"];

  // The default port used if the port number is not specified in the network
  // endpoint.
  optional int32 default_port = 6 [json_name = "defaultPort"];

  // An optional description of this resource. Provide this property when you
  // create the resource.
  optional string description = 7 [json_name = "description"];

  // [Output Only] The unique identifier for the resource. This identifier is
  // defined by the server.
  optional string id = 8 [json_name = "id"];

  // [Output Only] Type of the resource. Always compute#networkEndpointGroup for
  // network endpoint group.
  optional string kind = 9 [json_name = "kind"];

  // Name of the resource; provided by the client when the resource is created.
  // The name must be 1-63 characters long, and comply with RFC1035.
  // Specifically, the name must be 1-63 characters long and match the regular
  // expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character
  // must be a lowercase letter, and all following characters must be a dash,
  // lowercase letter, or digit, except the last character, which cannot be a
  // dash.
  optional string name = 10 [json_name = "name"];

  // The URL of the network to which all network endpoints in the NEG belong.
  // Uses "default" project network if unspecified.
  optional string network = 11 [json_name = "network"];

  // Type of network endpoints in this network endpoint group. Can be one of
  // GCE_VM_IP, GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT,
  // INTERNET_IP_PORT, SERVERLESS, PRIVATE_SERVICE_CONNECT.
  // GCE_VM_IP: The network endpoint is represented by an IP address.
  // GCE_VM_IP_PORT: The network endpoint is represented by IP address and port
  // pair.
  // INTERNET_FQDN_PORT: The network endpoint is represented by fully qualified
  // domain name and port.
  // INTERNET_IP_PORT: The network endpoint is represented by an internet IP
  // address and port.
  // NON_GCP_PRIVATE_IP_PORT: The network endpoint is represented by an IP
  // address and port. The endpoint belongs to a VM or pod running in a
  // customer's on-premises.
  // PRIVATE_SERVICE_CONNECT: The network endpoint is either public Google APIs
  // or services exposed by other GCP Project with a Service Attachment. The
  // connection is set up by private service connect
  // SERVERLESS: The network endpoint is handled by specified serverless
  // infrastructure.
  optional string network_endpoint_type = 12
      [json_name = "networkEndpointType"];

  optional NetworkEndpointGroupPscData psc_data = 13 [json_name = "pscData"];

  // The target service url used to set up private service connection to a
  // Google API or a PSC Producer Service Attachment. An example value is:
  // "asia-northeast3-cloudkms.googleapis.com"
  optional string psc_target_service = 14 [json_name = "pscTargetService"];

  // [Output Only] The URL of the region where the network endpoint group is
  // located.
  optional string region = 15 [json_name = "region"];

  // [Output Only] Server-defined URL for the resource.
  optional string self_link = 16 [json_name = "selfLink"];

  // [Output only] Number of network endpoints in the network endpoint group.
  optional int32 size = 17 [json_name = "size"];

  // Optional URL of the subnetwork to which all network endpoints in the NEG
  // belong.
  optional string subnetwork = 18 [json_name = "subnetwork"];

  // [Output Only] The URL of the zone where the network endpoint group is
  // located.
  optional string zone = 19 [json_name = "zone"];
}

// Configuration for an App Engine network endpoint group (NEG). The service is
// optional, may be provided explicitly or in the URL mask. The version is
// optional and can only be provided explicitly or in the URL mask when service
// is present. Note: App Engine service must be in the same project and located
// in the same region as the Serverless NEG.
message NetworkEndpointGroupAppEngine {
  // Optional serving service. The service name is case-sensitive and must be
  // 1-63 characters long. Example value: "default", "my-service".
  optional string service = 1 [json_name = "service"];

  // A template to parse service and version fields from a request URL. URL mask
  // allows for routing to multiple App Engine services without having to create
  // multiple Network Endpoint Groups and backend services. For example, the
  // request URLs "foo1-dot-appname.appspot.com/v1" and
  // "foo1-dot-appname.appspot.com/v2" can be backed by the same Serverless NEG
  // with URL mask "<service>-dot-appname.appspot.com/<version>". The URL mask
  // will parse them to { service = "foo1", version = "v1" } and { service =
  // "foo1", version = "v2" } respectively.
  optional string url_mask = 2 [json_name = "urlMask"];

  // Optional serving version. The version name is case-sensitive and must be
  // 1-100 characters long. Example value: "v1", "v2".
  optional string version = 3 [json_name = "version"];
}

// Configuration for a Cloud Function network endpoint group (NEG). The function
// must be provided explicitly or in the URL mask. Note: Cloud Function must be
// in the same project and located in the same region as the Serverless NEG.
message NetworkEndpointGroupCloudFunction {
  // A user-defined name of the Cloud Function. The function name is
  // case-sensitive and must be 1-63 characters long. Example value: "func1".
  optional string function = 1 [json_name = "function"];

  // A template to parse function field from a request URL. URL mask allows for
  // routing to multiple Cloud Functions without having to create multiple
  // Network Endpoint Groups and backend services. For example, request URLs "
  // mydomain.com/function1" and "mydomain.com/function2" can be backed by the
  // same Serverless NEG with URL mask "/<function>". The URL mask will parse
  // them to { function = "function1" } and { function = "function2" }
  // respectively.
  optional string url_mask = 2 [json_name = "urlMask"];
}

// Configuration for a Cloud Run network endpoint group (NEG). The service must
// be provided explicitly or in the URL mask. The tag is optional, may be
// provided explicitly or in the URL mask. Note: Cloud Run service must be in
// the same project and located in the same region as the Serverless NEG.
message NetworkEndpointGroupCloudRun {
  // Cloud Run service is the main resource of Cloud Run. The service must be
  // 1-63 characters long, and comply with RFC1035. Example value:
  // "run-service".
  optional string service = 1 [json_name = "service"];

  // Optional Cloud Run tag represents the "named-revision" to provide
  // additional fine-grained traffic routing information. The tag must be 1-63
  // characters long, and comply with RFC1035. Example value: "revision-0010".
  optional string tag = 2 [json_name = "tag"];

  // A template to parse <service> and <tag> fields from a request URL. URL mask
  // allows for routing to multiple Run services without having to create
  // multiple network endpoint groups and backend services. For example, request
  // URLs "foo1.domain.com/bar1" and "foo1.domain.com/bar2" can be backed by the
  // same Serverless Network Endpoint Group (NEG) with URL mask
  // "<tag>.domain.com/<service>". The URL mask will parse them to {
  // service="bar1", tag="foo1" } and { service="bar2", tag="foo2" }
  // respectively.
  optional string url_mask = 3 [json_name = "urlMask"];
}

message NetworkEndpointGroupList {
  // [Output Only] Unique identifier for the resource; defined by the server.
  optional string id = 1 [json_name = "id"];

  // A list of NetworkEndpointGroup resources.
  repeated NetworkEndpointGroup items = 2 [json_name = "items"];

  // [Output Only] The resource type, which is always
  // compute#networkEndpointGroupList for network endpoint group lists.
  optional string kind = 3 [json_name = "kind"];

  // [Output Only] This token allows you to get the next page of results for
  // list requests. If the number of results is larger than maxResults, use the
  // nextPageToken as a value for the query parameter pageToken in the next list
  // request. Subsequent list requests will have their own nextPageToken to
  // continue paging through the results.
  optional string next_page_token = 4 [json_name = "nextPageToken"];

  // [Output Only] Server-defined URL for this resource.
  optional string self_link = 5 [json_name = "selfLink"];

  message Warning {
    // [Output Only] A warning code, if applicable. For example, Compute Engine
    // returns NO_RESULTS_ON_PAGE if there are no results in the response.
    // CLEANUP_FAILED: Warning about failed cleanup of transient changes made by
    // a failed operation.
    // DEPRECATED_RESOURCE_USED: A link to a deprecated resource was created.
    // DEPRECATED_TYPE_USED: When deploying and at least one of the resources
    // has a type marked as deprecated
    // DISK_SIZE_LARGER_THAN_IMAGE_SIZE: The user created a boot disk that is
    // larger than image size.
    // EXPERIMENTAL_TYPE_USED: When deploying and at least one of the resources
    // has a type marked as experimental
    // EXTERNAL_API_WARNING: Warning that is present in an external api call
    // FIELD_VALUE_OVERRIDEN: Warning that value of a field has been overridden.
    // Deprecated unused field.
    // INJECTED_KERNELS_DEPRECATED: The operation involved use of an injected
    // kernel, which is deprecated.
    // INVALID_HEALTH_CHECK_FOR_DYNAMIC_WIEGHTED_LB: A WEIGHTED_MAGLEV backend
    // service is associated with a health check that is not of type
    // HTTP/HTTPS/HTTP2.
    // LARGE_DEPLOYMENT_WARNING: When deploying a deployment with a exceedingly
    // large number of resources
    // LIST_OVERHEAD_QUOTA_EXCEED: Resource can't be retrieved due to list
    // overhead quota exceed which captures the amount of resources filtered out
    // by user-defined list filter.
    // MISSING_TYPE_DEPENDENCY: A resource depends on a missing type
    // NEXT_HOP_ADDRESS_NOT_ASSIGNED: The route's nextHopIp address is not
    // assigned to an instance on the network.
    // NEXT_HOP_CANNOT_IP_FORWARD: The route's next hop instance cannot ip
    // forward.
    // NEXT_HOP_INSTANCE_HAS_NO_IPV6_INTERFACE: The route's nextHopInstance URL
    // refers to an instance that does not have an ipv6 interface on the same
    // network as the route.
    // NEXT_HOP_INSTANCE_NOT_FOUND: The route's nextHopInstance URL refers to an
    // instance that does not exist.
    // NEXT_HOP_INSTANCE_NOT_ON_NETWORK: The route's nextHopInstance URL refers
    // to an instance that is not on the same network as the route.
    // NEXT_HOP_NOT_RUNNING: The route's next hop instance does not have a
    // status of RUNNING.
    // NOT_CRITICAL_ERROR: Error which is not critical. We decided to continue
    // the process despite the mentioned error.
    // NO_RESULTS_ON_PAGE: No results are present on a particular list page.
    // PARTIAL_SUCCESS: Success is reported, but some results may be missing due
    // to errors
    // REQUIRED_TOS_AGREEMENT: The user attempted to use a resource that
    // requires a TOS they have not accepted.
    // RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING: Warning that a resource is in
    // use.
    // RESOURCE_NOT_DELETED: One or more of the resources set to auto-delete
    // could not be deleted because they were in use.
    // SCHEMA_VALIDATION_IGNORED: When a resource schema validation is ignored.
    // SINGLE_INSTANCE_PROPERTY_TEMPLATE: Instance template used in instance
    // group manager is valid as such, but its application does not make a lot
    // of sense, because it allows only single instance in instance group.
    // UNDECLARED_PROPERTIES: When undeclared properties in the schema are
    // present
    // UNREACHABLE: A given scope cannot be reached.
    optional string code = 1 [json_name = "code"];

    message DataItem {
      // [Output Only] A key that provides more detail on the warning being
      // returned. For example, for warnings where there are no results in a
      // list request for a particular zone, this key might be scope and the key
      // value might be the zone name. Other examples might be a key indicating
      // a deprecated resource and a suggested replacement, or a warning about
      // invalid network settings (for example, if an instance attempts to
      // perform IP forwarding but is not enabled for IP forwarding).
      optional string key = 1 [json_name = "key"];

      // [Output Only] A warning data value corresponding to the key.
      optional string value = 2 [json_name = "value"];
    }

    // [Output Only] Metadata about this warning in key: value format. For
    // example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
    repeated DataItem data = 2 [json_name = "data"];

    // [Output Only] A human-readable description of the warning code.
    optional string message = 3 [json_name = "message"];
  }

  // [Output Only] Informational warning message.
  optional Warning warning = 6 [json_name = "warning"];
}

// All data that is specifically relevant to only network endpoint groups of
// type PRIVATE_SERVICE_CONNECT.
message NetworkEndpointGroupPscData {
  // [Output Only] Address allocated from given subnetwork for PSC. This IP
  // address acts as a VIP for a PSC NEG, allowing it to act as an endpoint in
  // L7 PSC-XLB.
  optional string consumer_psc_address = 1 [json_name = "consumerPscAddress"];

  // [Output Only] The PSC connection id of the PSC Network Endpoint Group
  // Consumer.
  optional string psc_connection_id = 2 [json_name = "pscConnectionId"];

  // [Output Only] The connection status of the PSC Forwarding Rule.
  // ACCEPTED: The connection has been accepted by the producer.
  // CLOSED: The connection has been closed by the producer and will not serve
  // traffic going forward.
  // NEEDS_ATTENTION: The connection has been accepted by the producer, but the
  // producer needs to take further action before the forwarding rule can serve
  // traffic.
  // PENDING: The connection is pending acceptance by the producer.
  // REJECTED: The connection has been rejected by the producer.
  // STATUS_UNSPECIFIED:
  optional string psc_connection_status = 3 [json_name = "pscConnectionStatus"];
}

message NetworkEndpointGroupsListNetworkEndpoints {
  // [Output Only] Unique identifier for the resource; defined by the server.
  optional string id = 1 [json_name = "id"];

  // A list of NetworkEndpointWithHealthStatus resources.
  repeated NetworkEndpointWithHealthStatus items = 2 [json_name = "items"];

  // [Output Only] The resource type, which is always
  // compute#networkEndpointGroupsListNetworkEndpoints for the list of network
  // endpoints in the specified network endpoint group.
  optional string kind = 3 [json_name = "kind"];

  // [Output Only] This token allows you to get the next page of results for
  // list requests. If the number of results is larger than maxResults, use the
  // nextPageToken as a value for the query parameter pageToken in the next list
  // request. Subsequent list requests will have their own nextPageToken to
  // continue paging through the results.
  optional string next_page_token = 4 [json_name = "nextPageToken"];

  message Warning {
    // [Output Only] A warning code, if applicable. For example, Compute Engine
    // returns NO_RESULTS_ON_PAGE if there are no results in the response.
    // CLEANUP_FAILED: Warning about failed cleanup of transient changes made by
    // a failed operation.
    // DEPRECATED_RESOURCE_USED: A link to a deprecated resource was created.
    // DEPRECATED_TYPE_USED: When deploying and at least one of the resources
    // has a type marked as deprecated
    // DISK_SIZE_LARGER_THAN_IMAGE_SIZE: The user created a boot disk that is
    // larger than image size.
    // EXPERIMENTAL_TYPE_USED: When deploying and at least one of the resources
    // has a type marked as experimental
    // EXTERNAL_API_WARNING: Warning that is present in an external api call
    // FIELD_VALUE_OVERRIDEN: Warning that value of a field has been overridden.
    // Deprecated unused field.
    // INJECTED_KERNELS_DEPRECATED: The operation involved use of an injected
    // kernel, which is deprecated.
    // INVALID_HEALTH_CHECK_FOR_DYNAMIC_WIEGHTED_LB: A WEIGHTED_MAGLEV backend
    // service is associated with a health check that is not of type
    // HTTP/HTTPS/HTTP2.
    // LARGE_DEPLOYMENT_WARNING: When deploying a deployment with a exceedingly
    // large number of resources
    // LIST_OVERHEAD_QUOTA_EXCEED: Resource can't be retrieved due to list
    // overhead quota exceed which captures the amount of resources filtered out
    // by user-defined list filter.
    // MISSING_TYPE_DEPENDENCY: A resource depends on a missing type
    // NEXT_HOP_ADDRESS_NOT_ASSIGNED: The route's nextHopIp address is not
    // assigned to an instance on the network.
    // NEXT_HOP_CANNOT_IP_FORWARD: The route's next hop instance cannot ip
    // forward.
    // NEXT_HOP_INSTANCE_HAS_NO_IPV6_INTERFACE: The route's nextHopInstance URL
    // refers to an instance that does not have an ipv6 interface on the same
    // network as the route.
    // NEXT_HOP_INSTANCE_NOT_FOUND: The route's nextHopInstance URL refers to an
    // instance that does not exist.
    // NEXT_HOP_INSTANCE_NOT_ON_NETWORK: The route's nextHopInstance URL refers
    // to an instance that is not on the same network as the route.
    // NEXT_HOP_NOT_RUNNING: The route's next hop instance does not have a
    // status of RUNNING.
    // NOT_CRITICAL_ERROR: Error which is not critical. We decided to continue
    // the process despite the mentioned error.
    // NO_RESULTS_ON_PAGE: No results are present on a particular list page.
    // PARTIAL_SUCCESS: Success is reported, but some results may be missing due
    // to errors
    // REQUIRED_TOS_AGREEMENT: The user attempted to use a resource that
    // requires a TOS they have not accepted.
    // RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING: Warning that a resource is in
    // use.
    // RESOURCE_NOT_DELETED: One or more of the resources set to auto-delete
    // could not be deleted because they were in use.
    // SCHEMA_VALIDATION_IGNORED: When a resource schema validation is ignored.
    // SINGLE_INSTANCE_PROPERTY_TEMPLATE: Instance template used in instance
    // group manager is valid as such, but its application does not make a lot
    // of sense, because it allows only single instance in instance group.
    // UNDECLARED_PROPERTIES: When undeclared properties in the schema are
    // present
    // UNREACHABLE: A given scope cannot be reached.
    optional string code = 1 [json_name = "code"];

    message DataItem {
      // [Output Only] A key that provides more detail on the warning being
      // returned. For example, for warnings where there are no results in a
      // list request for a particular zone, this key might be scope and the key
      // value might be the zone name. Other examples might be a key indicating
      // a deprecated resource and a suggested replacement, or a warning about
      // invalid network settings (for example, if an instance attempts to
      // perform IP forwarding but is not enabled for IP forwarding).
      optional string key = 1 [json_name = "key"];

      // [Output Only] A warning data value corresponding to the key.
      optional string value = 2 [json_name = "value"];
    }

    // [Output Only] Metadata about this warning in key: value format. For
    // example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
    repeated DataItem data = 2 [json_name = "data"];

    // [Output Only] A human-readable description of the warning code.
    optional string message = 3 [json_name = "message"];
  }

  // [Output Only] Informational warning message.
  optional Warning warning = 5 [json_name = "warning"];
}

message NetworkEndpointWithHealthStatus {
  // [Output only] The health status of network endpoint;
  repeated HealthStatusForNetworkEndpoint healths = 1 [json_name = "healths"];

  // [Output only] The network endpoint;
  optional NetworkEndpoint network_endpoint = 2 [json_name = "networkEndpoint"];
}
