// Copyright 2022 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.cloud.vmwareengine.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.VmwareEngine.V1";
option go_package = "cloud.google.com/go/vmwareengine/apiv1/vmwareenginepb;vmwareenginepb";
option java_multiple_files = true;
option java_outer_classname = "VmwareengineResourcesProto";
option java_package = "com.google.cloud.vmwareengine.v1";
option php_namespace = "Google\\Cloud\\VmwareEngine\\V1";
option ruby_package = "Google::Cloud::VmwareEngine::V1";

// Network configuration in the consumer project
// with which the peering has to be done.
message NetworkConfig {
  // Required. Management CIDR used by VMware management appliances.
  string management_cidr = 4 [(google.api.field_behavior) = REQUIRED];

  // Optional. The relative resource name of the VMware Engine network attached
  // to the private cloud. Specify the name in the following form:
  // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}`
  // where `{project}` can either be a project number or a project ID.
  string vmware_engine_network = 5 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "vmwareengine.googleapis.com/VmwareEngineNetwork"
    }
  ];

  // Output only. The canonical name of the VMware Engine network in the form:
  // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}`
  string vmware_engine_network_canonical = 6 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "vmwareengine.googleapis.com/VmwareEngineNetwork"
    }
  ];

  // Output only. The IP address layout version of the management IP address
  // range. Possible versions include:
  // * `managementIpAddressLayoutVersion=1`: Indicates the legacy IP address
  // layout used by some existing private clouds. This is no longer supported
  // for new private clouds as it does not support all features.
  // * `managementIpAddressLayoutVersion=2`: Indicates the latest IP address
  // layout used by all newly created private clouds. This version supports all
  // current features.
  int32 management_ip_address_layout_version = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Information about the type and number of nodes associated with the cluster.
message NodeTypeConfig {
  // Required. The number of nodes of this type in the cluster
  int32 node_count = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. Customized number of cores available to each node of the type.
  // This number must always be one of `nodeType.availableCustomCoreCounts`.
  // If zero is provided max value from `nodeType.availableCustomCoreCounts`
  // will be used.
  int32 custom_core_count = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Represents a private cloud resource. Private clouds are zonal resources.
message PrivateCloud {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/PrivateCloud"
    pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}"
  };

  // Enum State defines possible states of private clouds.
  enum State {
    // The default value. This value should never be used.
    STATE_UNSPECIFIED = 0;

    // The private cloud is ready.
    ACTIVE = 1;

    // The private cloud is being created.
    CREATING = 2;

    // The private cloud is being updated.
    UPDATING = 3;

    // The private cloud is in failed state.
    FAILED = 5;

    // The private cloud is scheduled for deletion. The deletion process can be
    // cancelled by using the corresponding undelete method.
    DELETED = 6;

    // The private cloud is irreversibly deleted and is being removed from the
    // system.
    PURGING = 7;
  }

  // Management cluster configuration.
  message ManagementCluster {
    // Required. The user-provided identifier of the new `Cluster`.
    // The identifier must meet the following requirements:
    //
    // * Only contains 1-63 alphanumeric characters and hyphens
    // * Begins with an alphabetical character
    // * Ends with a non-hyphen character
    // * Not formatted as a UUID
    // * Complies with [RFC
    // 1034](https://datatracker.ietf.org/doc/html/rfc1034) (section 3.5)
    string cluster_id = 1 [(google.api.field_behavior) = REQUIRED];

    // Required. The map of cluster node types in this cluster, where the key is
    // canonical identifier of the node type (corresponds to the `NodeType`).
    map<string, NodeTypeConfig> node_type_configs = 7
        [(google.api.field_behavior) = REQUIRED];
  }

  // Output only. The resource name of this private cloud.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Creation time of this resource.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last update time of this resource.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when the resource was scheduled for deletion.
  google.protobuf.Timestamp delete_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Time when the resource will be irreversibly deleted.
  google.protobuf.Timestamp expire_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State of the resource. New values may be added to this enum
  // when appropriate.
  State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Network configuration of the private cloud.
  NetworkConfig network_config = 9 [(google.api.field_behavior) = REQUIRED];

  // Required. Input only. The management cluster for this private cloud.
  // This field is required during creation of the private cloud to provide
  // details for the default cluster.
  //
  // The following fields can't be changed after private cloud creation:
  // `ManagementCluster.clusterId`, `ManagementCluster.nodeTypeId`.
  ManagementCluster management_cluster = 10 [
    (google.api.field_behavior) = INPUT_ONLY,
    (google.api.field_behavior) = REQUIRED
  ];

  // User-provided description for this private cloud.
  string description = 11;

  // Output only. HCX appliance.
  Hcx hcx = 17 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. NSX appliance.
  Nsx nsx = 18 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Vcenter appliance.
  Vcenter vcenter = 19 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. System-generated unique identifier for the resource.
  string uid = 20 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A cluster in a private cloud.
message Cluster {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/Cluster"
    pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/clusters/{cluster}"
  };

  // Enum State defines possible states of private cloud clusters.
  enum State {
    // The default value. This value should never be used.
    STATE_UNSPECIFIED = 0;

    // The Cluster is operational and can be used by the user.
    ACTIVE = 1;

    // The Cluster is being deployed.
    CREATING = 2;

    // Adding or removing of a node to the cluster, any other cluster specific
    // updates.
    UPDATING = 3;

    // The Cluster is being deleted.
    DELETING = 4;

    // The Cluster is undergoing maintenance, for example: a failed node is
    // getting replaced.
    REPAIRING = 5;
  }

  // Output only. The resource name of this cluster.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/clusters/my-cluster`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Creation time of this resource.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last update time of this resource.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State of the resource.
  State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. True if the cluster is a management cluster; false otherwise.
  // There can only be one management cluster in a private cloud
  // and it has to be the first one.
  bool management = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. System-generated unique identifier for the resource.
  string uid = 14 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. The map of cluster node types in this cluster, where the key is
  // canonical identifier of the node type (corresponds to the `NodeType`).
  map<string, NodeTypeConfig> node_type_configs = 16
      [(google.api.field_behavior) = REQUIRED];
}

// Subnet in a private cloud. Either `management` subnets (such as vMotion) that
// are read-only, or `userDefined`, which can also be updated.
message Subnet {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/Subnet"
    pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/subnets/{subnet}"
  };

  // Defines possible states of subnets.
  enum State {
    // The default value. This value should never be used.
    STATE_UNSPECIFIED = 0;

    // The subnet is ready.
    ACTIVE = 1;

    // The subnet is being created.
    CREATING = 2;

    // The subnet is being updated.
    UPDATING = 3;

    // The subnet is being deleted.
    DELETING = 4;
  }

  // Output only. The resource name of this subnet.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/subnets/my-subnet`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // The IP address range of the subnet in CIDR format '10.0.0.0/24'.
  string ip_cidr_range = 7;

  // The IP address of the gateway of this subnet.
  // Must fall within the IP prefix defined above.
  string gateway_ip = 8;

  // Output only. The type of the subnet. For example "management" or
  // "userDefined".
  string type = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The state of the resource.
  State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Describes node type.
message NodeType {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/NodeType"
    pattern: "projects/{project}/locations/{location}/nodeTypes/{node_type}"
  };

  // Output only. The resource name of this node type.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-proj/locations/us-central1-a/nodeTypes/standard-72`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The canonical identifier of the node type
  // (corresponds to the `NodeType`). For example: standard-72.
  string node_type_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The friendly name for this node type.
  // For example: ve1-standard-72
  string display_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The total number of virtual CPUs in a single node.
  int32 virtual_cpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The total number of CPU cores in a single node.
  int32 total_core_count = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The amount of physical memory available, defined in GB.
  int32 memory_gb = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The amount of storage available, defined in GB.
  int32 disk_size_gb = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. List of possible values of custom core count.
  repeated int32 available_custom_core_counts = 11
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Credentials for a private cloud.
message Credentials {
  // Initial username.
  string username = 1;

  // Initial password.
  string password = 2;
}

// HCX activation key. A default key is created during
// private cloud provisioning, but this behavior is subject to change
// and you should always verify active keys.
// Use
// [VmwareEngine.ListHcxActivationKeys][google.cloud.vmwareengine.v1.VmwareEngine.ListHcxActivationKeys]
// to retrieve existing keys and
// [VmwareEngine.CreateHcxActivationKey][google.cloud.vmwareengine.v1.VmwareEngine.CreateHcxActivationKey]
// to create new ones.
message HcxActivationKey {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/HcxActivationKey"
    pattern: "projects/{project}/locations/{location}/privateClouds/{private_cloud}/hcxActivationKeys/{hcx_activation_key}"
  };

  // State of HCX activation key
  enum State {
    // Unspecified state.
    STATE_UNSPECIFIED = 0;

    // State of a newly generated activation key.
    AVAILABLE = 1;

    // State of key when it has been used to activate HCX appliance.
    CONSUMED = 2;

    // State of key when it is being created.
    CREATING = 3;
  }

  // Output only. The resource name of this HcxActivationKey.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-project/locations/us-central1/privateClouds/my-cloud/hcxActivationKeys/my-key`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Creation time of HCX activation key.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State of HCX activation key.
  State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. HCX activation key.
  string activation_key = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. System-generated unique identifier for the resource.
  string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Details about a HCX Cloud Manager appliance.
message Hcx {
  // State of the appliance
  enum State {
    // Unspecified appliance state. This is the default value.
    STATE_UNSPECIFIED = 0;

    // The appliance is operational and can be used.
    ACTIVE = 1;

    // The appliance is being deployed.
    CREATING = 2;
  }

  // Internal IP address of the appliance.
  string internal_ip = 2;

  // Version of the appliance.
  string version = 4;

  // Output only. The state of the appliance.
  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Fully qualified domain name of the appliance.
  string fqdn = 6;
}

// Details about a NSX Manager appliance.
message Nsx {
  // State of the appliance
  enum State {
    // Unspecified appliance state. This is the default value.
    STATE_UNSPECIFIED = 0;

    // The appliance is operational and can be used.
    ACTIVE = 1;

    // The appliance is being deployed.
    CREATING = 2;
  }

  // Internal IP address of the appliance.
  string internal_ip = 2;

  // Version of the appliance.
  string version = 4;

  // Output only. The state of the appliance.
  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Fully qualified domain name of the appliance.
  string fqdn = 6;
}

// Details about a vCenter Server management appliance.
message Vcenter {
  // State of the appliance
  enum State {
    // Unspecified appliance state. This is the default value.
    STATE_UNSPECIFIED = 0;

    // The appliance is operational and can be used.
    ACTIVE = 1;

    // The appliance is being deployed.
    CREATING = 2;
  }

  // Internal IP address of the appliance.
  string internal_ip = 2;

  // Version of the appliance.
  string version = 4;

  // Output only. The state of the appliance.
  State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Fully qualified domain name of the appliance.
  string fqdn = 6;
}

// Represents a network policy resource. Network policies are regional
// resources. You can use a network policy to enable or disable internet access
// and external IP access. Network policies are associated with a VMware Engine
// network, which might span across regions. For a given region, a network
// policy applies to all private clouds in the VMware Engine network associated
// with the policy.
message NetworkPolicy {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/NetworkPolicy"
    pattern: "projects/{project}/locations/{location}/networkPolicies/{network_policy}"
  };

  // Represents a network service that is managed by a `NetworkPolicy` resource.
  // A network service provides a way to control an aspect of external access to
  // VMware workloads. For example, whether the VMware workloads in the
  // private clouds governed by a network policy can access or be accessed from
  // the internet.
  message NetworkService {
    // Enum State defines possible states of a network policy controlled
    // service.
    enum State {
      // Unspecified service state. This is the default value.
      STATE_UNSPECIFIED = 0;

      // Service is not provisioned.
      UNPROVISIONED = 1;

      // Service is in the process of being provisioned/deprovisioned.
      RECONCILING = 2;

      // Service is active.
      ACTIVE = 3;
    }

    // True if the service is enabled; false otherwise.
    bool enabled = 1;

    // Output only. State of the service. New values may be added to this enum
    // when appropriate.
    State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  }

  // Output only. The resource name of this network policy.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-project/locations/us-central1/networkPolicies/my-network-policy`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Creation time of this resource.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last update time of this resource.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Network service that allows VMware workloads to access the internet.
  NetworkService internet_access = 6;

  // Network service that allows External IP addresses to be assigned to VMware
  // workloads. This service can only be enabled when `internet_access` is also
  // enabled.
  NetworkService external_ip = 7;

  // Required. IP address range in CIDR notation used to create internet access
  // and external IP access. An RFC 1918 CIDR block, with a "/26" prefix, is
  // required. The range cannot overlap with any prefixes either in the consumer
  // VPC network or in use by the private clouds attached to that VPC network.
  string edge_services_cidr = 9 [(google.api.field_behavior) = REQUIRED];

  // Output only. System-generated unique identifier for the resource.
  string uid = 10 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The relative resource name of the VMware Engine network.
  // Specify the name in the following form:
  // `projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}`
  // where `{project}` can either be a project number or a project ID.
  string vmware_engine_network = 12 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "vmwareengine.googleapis.com/VmwareEngineNetwork"
    }
  ];

  // Optional. User-provided description for this network policy.
  string description = 13 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The canonical name of the VMware Engine network in the form:
  // `projects/{project_number}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network_id}`
  string vmware_engine_network_canonical = 14 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "vmwareengine.googleapis.com/VmwareEngineNetwork"
    }
  ];
}

// VMware Engine network resource that provides connectivity for VMware Engine
// private clouds.
message VmwareEngineNetwork {
  option (google.api.resource) = {
    type: "vmwareengine.googleapis.com/VmwareEngineNetwork"
    pattern: "projects/{project}/locations/{location}/vmwareEngineNetworks/{vmware_engine_network}"
  };

  // Represents a VMware Engine VPC network that is managed by a
  // VMware Engine network resource.
  message VpcNetwork {
    // Enum Type defines possible types of a VMware Engine network controlled
    // service.
    enum Type {
      // The default value. This value should never be used.
      TYPE_UNSPECIFIED = 0;

      // VPC network that will be peered with a consumer VPC network or the
      // intranet VPC of another VMware Engine network. Access a private cloud
      // through Compute Engine VMs on a peered VPC network or an on-premises
      // resource connected to a peered consumer VPC network.
      INTRANET = 1;

      // VPC network used for internet access to and from a private cloud.
      INTERNET = 2;

      // VPC network used for access to Google Cloud services like
      // Cloud Storage.
      GOOGLE_CLOUD = 3;
    }

    // Output only. Type of VPC network (INTRANET, INTERNET, or
    // GOOGLE_CLOUD)
    Type type = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

    // Output only. The relative resource name of the service VPC network this
    // VMware Engine network is attached to. For example:
    // `projects/123123/global/networks/my-network`
    string network = 2 [
      (google.api.field_behavior) = OUTPUT_ONLY,
      (google.api.resource_reference) = {
        type: "compute.googleapis.com/Network"
      }
    ];
  }

  // Enum State defines possible states of VMware Engine network.
  enum State {
    // The default value. This value is used if the state is omitted.
    STATE_UNSPECIFIED = 0;

    // The VMware Engine network is being created.
    CREATING = 1;

    // The VMware Engine network is ready.
    ACTIVE = 2;

    // The VMware Engine network is being updated.
    UPDATING = 3;

    // The VMware Engine network is being deleted.
    DELETING = 4;
  }

  // Enum Type defines possible types of VMware Engine network.
  enum Type {
    // The default value. This value should never be used.
    TYPE_UNSPECIFIED = 0;

    // Network type used by private clouds created in projects without a network
    // of type `STANDARD`. This network type is no longer used for new VMware
    // Engine private cloud deployments.
    LEGACY = 1;
  }

  // Output only. The resource name of the VMware Engine network.
  // Resource names are schemeless URIs that follow the conventions in
  // https://cloud.google.com/apis/design/resource_names.
  // For example:
  // `projects/my-project/locations/global/vmwareEngineNetworks/my-network`
  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Creation time of this resource.
  google.protobuf.Timestamp create_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Last update time of this resource.
  google.protobuf.Timestamp update_time = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // User-provided description for this VMware Engine network.
  string description = 5;

  // Output only. VMware Engine service VPC networks that provide connectivity
  // from a private cloud to customer projects, the internet, and other Google
  // Cloud services.
  repeated VpcNetwork vpc_networks = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. State of the VMware Engine network.
  State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. VMware Engine network type.
  Type type = 8 [(google.api.field_behavior) = REQUIRED];

  // Output only. System-generated unique identifier for the resource.
  string uid = 9 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Checksum that may be sent on update and delete requests to ensure that the
  // user-provided value is up to date before the server processes a request.
  // The server computes checksums based on the value of other fields in the
  // request.
  string etag = 10;
}
