// Copyright 2026 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.numberregistry.v1alpha;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/cloud/numberregistry/v1alpha/core.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.NumberRegistry.V1Alpha";
option go_package = "cloud.google.com/go/numberregistry/apiv1alpha/numberregistrypb;numberregistrypb";
option java_multiple_files = true;
option java_outer_classname = "ServiceProto";
option java_package = "com.google.cloud.numberregistry.v1alpha";
option php_namespace = "Google\\Cloud\\NumberRegistry\\V1alpha";
option ruby_package = "Google::Cloud::NumberRegistry::V1alpha";

// The Cloud Number Registry service manages IP address space visibility and
// tracking. It enables the discovery, organization, and monitoring of IP
// address ranges across different cloud infrastructure platforms.
service CloudNumberRegistry {
  option (google.api.default_host) = "cloudnumberregistry.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Lists IpamAdminScopes in a given project and location.
  rpc ListIpamAdminScopes(ListIpamAdminScopesRequest)
      returns (ListIpamAdminScopesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/ipamAdminScopes"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single IpamAdminScope.
  rpc GetIpamAdminScope(GetIpamAdminScopeRequest) returns (IpamAdminScope) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/ipamAdminScopes/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Checks the availability of IpamAdminScopes in a given project and
  // location.
  rpc CheckAvailabilityIpamAdminScopes(CheckAvailabilityIpamAdminScopesRequest)
      returns (CheckAvailabilityIpamAdminScopesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/ipamAdminScopes:checkAvailability"
    };
    option (google.api.method_signature) = "parent,scopes";
  }

  // Creates a new IpamAdminScope in a given project and location.
  rpc CreateIpamAdminScope(CreateIpamAdminScopeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{parent=projects/*/locations/*}/ipamAdminScopes"
      body: "ipam_admin_scope"
    };
    option (google.api.method_signature) =
        "parent,ipam_admin_scope,ipam_admin_scope_id";
    option (google.longrunning.operation_info) = {
      response_type: "IpamAdminScope"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single IpamAdminScope.
  rpc UpdateIpamAdminScope(UpdateIpamAdminScopeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1alpha/{ipam_admin_scope.name=projects/*/locations/*/ipamAdminScopes/*}"
      body: "ipam_admin_scope"
    };
    option (google.api.method_signature) = "ipam_admin_scope,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "IpamAdminScope"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single IpamAdminScope.
  rpc DeleteIpamAdminScope(DeleteIpamAdminScopeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1alpha/{name=projects/*/locations/*/ipamAdminScopes/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Disables a single IpamAdminScope.
  rpc DisableIpamAdminScope(DisableIpamAdminScopeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{name=projects/*/locations/*/ipamAdminScopes/*}:disable"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "IpamAdminScope"
      metadata_type: "OperationMetadata"
    };
  }

  // Cleans up a single IpamAdminScope.
  rpc CleanupIpamAdminScope(CleanupIpamAdminScopeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{name=projects/*/locations/*/ipamAdminScopes/*}:cleanup"
      body: "*"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "IpamAdminScope"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists RegistryBooks in a given project and location.
  rpc ListRegistryBooks(ListRegistryBooksRequest)
      returns (ListRegistryBooksResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/registryBooks"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single RegistryBook.
  rpc GetRegistryBook(GetRegistryBookRequest) returns (RegistryBook) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/registryBooks/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Searches IP resources in a given RegistryBook.
  rpc SearchIpResources(SearchIpResourcesRequest)
      returns (SearchIpResourcesResponse) {
    option (google.api.http) = {
      post: "/v1alpha/{name=projects/*/locations/*/registryBooks/*}:searchIpResources"
      body: "*"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new RegistryBook in a given project and location.
  rpc CreateRegistryBook(CreateRegistryBookRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{parent=projects/*/locations/*}/registryBooks"
      body: "registry_book"
    };
    option (google.api.method_signature) =
        "parent,registry_book,registry_book_id";
    option (google.longrunning.operation_info) = {
      response_type: "RegistryBook"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single RegistryBook.
  rpc UpdateRegistryBook(UpdateRegistryBookRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1alpha/{registry_book.name=projects/*/locations/*/registryBooks/*}"
      body: "registry_book"
    };
    option (google.api.method_signature) = "registry_book,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "RegistryBook"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single RegistryBook.
  rpc DeleteRegistryBook(DeleteRegistryBookRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1alpha/{name=projects/*/locations/*/registryBooks/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists Realms in a given project and location.
  rpc ListRealms(ListRealmsRequest) returns (ListRealmsResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/realms"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single Realm.
  rpc GetRealm(GetRealmRequest) returns (Realm) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/realms/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Creates a new Realm in a given project and location.
  rpc CreateRealm(CreateRealmRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{parent=projects/*/locations/*}/realms"
      body: "realm"
    };
    option (google.api.method_signature) = "parent,realm,realm_id";
    option (google.longrunning.operation_info) = {
      response_type: "Realm"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single Realm.
  rpc UpdateRealm(UpdateRealmRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1alpha/{realm.name=projects/*/locations/*/realms/*}"
      body: "realm"
    };
    option (google.api.method_signature) = "realm,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "Realm"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single Realm.
  rpc DeleteRealm(DeleteRealmRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1alpha/{name=projects/*/locations/*/realms/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }

  // Lists DiscoveredRanges in a given project and location.
  rpc ListDiscoveredRanges(ListDiscoveredRangesRequest)
      returns (ListDiscoveredRangesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/discoveredRanges"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single DiscoveredRange.
  rpc GetDiscoveredRange(GetDiscoveredRangeRequest) returns (DiscoveredRange) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/discoveredRanges/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Finds free IP ranges in a single DiscoveredRange.
  rpc FindDiscoveredRangeFreeIpRanges(FindDiscoveredRangeFreeIpRangesRequest)
      returns (FindDiscoveredRangeFreeIpRangesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/discoveredRanges/*}:findFreeIpRanges"
    };
    option (google.api.method_signature) = "name,cidr_prefix_length";
  }

  // Lists CustomRanges in a given project and location.
  rpc ListCustomRanges(ListCustomRangesRequest)
      returns (ListCustomRangesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{parent=projects/*/locations/*}/customRanges"
    };
    option (google.api.method_signature) = "parent";
  }

  // Gets details of a single CustomRange.
  rpc GetCustomRange(GetCustomRangeRequest) returns (CustomRange) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/customRanges/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Gets the details of a single CustomRange and its utilization.
  rpc ShowCustomRangeUtilization(ShowCustomRangeUtilizationRequest)
      returns (ShowCustomRangeUtilizationResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/customRanges/*}:showUtilization"
    };
    option (google.api.method_signature) = "name";
  }

  // Gets the details of a single DiscoveredRange and its utilization.
  rpc ShowDiscoveredRangeUtilization(ShowDiscoveredRangeUtilizationRequest)
      returns (ShowDiscoveredRangeUtilizationResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/discoveredRanges/*}:showUtilization"
    };
    option (google.api.method_signature) = "name";
  }

  // Finds free IP ranges in a single CustomRange.
  rpc FindCustomRangeFreeIpRanges(FindCustomRangeFreeIpRangesRequest)
      returns (FindCustomRangeFreeIpRangesResponse) {
    option (google.api.http) = {
      get: "/v1alpha/{name=projects/*/locations/*/customRanges/*}:findFreeIpRanges"
    };
    option (google.api.method_signature) = "name,cidr_prefix_length";
  }

  // Creates a new CustomRange in a given project and location.
  rpc CreateCustomRange(CreateCustomRangeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      post: "/v1alpha/{parent=projects/*/locations/*}/customRanges"
      body: "custom_range"
    };
    option (google.api.method_signature) =
        "parent,custom_range,custom_range_id";
    option (google.longrunning.operation_info) = {
      response_type: "CustomRange"
      metadata_type: "OperationMetadata"
    };
  }

  // Updates the parameters of a single CustomRange.
  rpc UpdateCustomRange(UpdateCustomRangeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      patch: "/v1alpha/{custom_range.name=projects/*/locations/*/customRanges/*}"
      body: "custom_range"
    };
    option (google.api.method_signature) = "custom_range,update_mask";
    option (google.longrunning.operation_info) = {
      response_type: "CustomRange"
      metadata_type: "OperationMetadata"
    };
  }

  // Deletes a single CustomRange.
  rpc DeleteCustomRange(DeleteCustomRangeRequest)
      returns (google.longrunning.Operation) {
    option (google.api.http) = {
      delete: "/v1alpha/{name=projects/*/locations/*/customRanges/*}"
    };
    option (google.api.method_signature) = "name";
    option (google.longrunning.operation_info) = {
      response_type: "google.protobuf.Empty"
      metadata_type: "OperationMetadata"
    };
  }
}

// Represents the metadata of the long-running operation.
message OperationMetadata {
  // Output only. The time the operation was created.
  google.protobuf.Timestamp create_time = 1
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The time the operation finished running.
  google.protobuf.Timestamp end_time = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Server-defined resource path for the target of the operation.
  string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Name of the verb executed by the operation.
  string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Human-readable status of the operation, if any.
  string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Identifies whether the user has requested cancellation
  // of the operation. Operations that have been cancelled successfully
  // have [Operation.error][] value with a
  // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
  // `Code.CANCELLED`.
  bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. API version used to start the operation.
  string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}
