// 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.saasplatform.saasservicemgmt.v1beta1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/saasplatform/saasservicemgmt/v1beta1/rollouts_resources.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Cloud.SaasPlatform.SaasServiceMgmt.V1Beta1";
option go_package = "cloud.google.com/go/saasplatform/saasservicemgmt/apiv1beta1/saasservicemgmtpb;saasservicemgmtpb";
option java_multiple_files = true;
option java_outer_classname = "SaasRolloutsServiceProto";
option java_package = "com.google.cloud.saasplatform.saasservicemgmt.v1beta1";
option php_namespace = "Google\\Cloud\\SaasPlatform\\SaasServiceMgmt\\V1beta1";
option ruby_package = "Google::Cloud::SaasPlatform::SaasServiceMgmt::V1beta1";

// Manages the rollout of SaaS services.
service SaasRollouts {
  option (google.api.default_host) = "saasservicemgmt.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/cloud-platform";

  // Retrieve a collection of rollouts.
  rpc ListRollouts(ListRolloutsRequest) returns (ListRolloutsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/rollouts"
    };
    option (google.api.method_signature) = "parent";
  }

  // Retrieve a single rollout.
  rpc GetRollout(GetRolloutRequest) returns (Rollout) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/rollouts/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Create a new rollout.
  rpc CreateRollout(CreateRolloutRequest) returns (Rollout) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*}/rollouts"
      body: "rollout"
    };
    option (google.api.method_signature) = "parent,rollout,rollout_id";
  }

  // Update a single rollout.
  rpc UpdateRollout(UpdateRolloutRequest) returns (Rollout) {
    option (google.api.http) = {
      patch: "/v1beta1/{rollout.name=projects/*/locations/*/rollouts/*}"
      body: "rollout"
    };
    option (google.api.method_signature) = "rollout,update_mask";
  }

  // Delete a single rollout.
  rpc DeleteRollout(DeleteRolloutRequest) returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/rollouts/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Retrieve a collection of rollout kinds.
  rpc ListRolloutKinds(ListRolloutKindsRequest)
      returns (ListRolloutKindsResponse) {
    option (google.api.http) = {
      get: "/v1beta1/{parent=projects/*/locations/*}/rolloutKinds"
    };
    option (google.api.method_signature) = "parent";
  }

  // Retrieve a single rollout kind.
  rpc GetRolloutKind(GetRolloutKindRequest) returns (RolloutKind) {
    option (google.api.http) = {
      get: "/v1beta1/{name=projects/*/locations/*/rolloutKinds/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Create a new rollout kind.
  rpc CreateRolloutKind(CreateRolloutKindRequest) returns (RolloutKind) {
    option (google.api.http) = {
      post: "/v1beta1/{parent=projects/*/locations/*}/rolloutKinds"
      body: "rollout_kind"
    };
    option (google.api.method_signature) =
        "parent,rollout_kind,rollout_kind_id";
  }

  // Update a single rollout kind.
  rpc UpdateRolloutKind(UpdateRolloutKindRequest) returns (RolloutKind) {
    option (google.api.http) = {
      patch: "/v1beta1/{rollout_kind.name=projects/*/locations/*/rolloutKinds/*}"
      body: "rollout_kind"
    };
    option (google.api.method_signature) = "rollout_kind,update_mask";
  }

  // Delete a single rollout kind.
  rpc DeleteRolloutKind(DeleteRolloutKindRequest)
      returns (google.protobuf.Empty) {
    option (google.api.http) = {
      delete: "/v1beta1/{name=projects/*/locations/*/rolloutKinds/*}"
    };
    option (google.api.method_signature) = "name";
  }
}

// The request structure for the ListRollouts method.
message ListRolloutsRequest {
  // Required. The parent of the rollout.
  string parent = 10006 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "saasservicemgmt.googleapis.com/Rollout"
    }
  ];

  // The maximum number of rollouts to send per page.
  int32 page_size = 10505;

  // The page token: If the next_page_token from a previous response
  // is provided, this request will send the subsequent page.
  string page_token = 10506;

  // Filter the list as specified in https://google.aip.dev/160.
  string filter = 10507;

  // Order results as specified in https://google.aip.dev/132.
  string order_by = 10508;
}

// The response structure for the ListRollouts method.
message ListRolloutsResponse {
  // The resulting rollouts.
  repeated Rollout rollouts = 10509;

  // If present, the next page token can be provided to a subsequent
  // ListRollouts call to list the next page.
  // If empty, there are no more pages.
  string next_page_token = 10510;

  // Locations that could not be reached.
  repeated string unreachable = 10511;
}

// The request structure for the GetRollout method.
message GetRolloutRequest {
  // Required. The resource name of the resource within a service.
  string name = 10001 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "saasservicemgmt.googleapis.com/Rollout"
    }
  ];
}

// The request structure for the CreateRollout method.
message CreateRolloutRequest {
  // Required. The parent of the rollout.
  string parent = 10006 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "saasservicemgmt.googleapis.com/Rollout"
    }
  ];

  // Required. The ID value for the new rollout.
  string rollout_id = 10503 [(google.api.field_behavior) = REQUIRED];

  // Required. The desired state for the rollout.
  Rollout rollout = 10504 [(google.api.field_behavior) = REQUIRED];

  // If "validate_only" is set to true, the service will try to validate
  // that this request would succeed, but will not actually make changes.
  bool validate_only = 10501;

  // An optional request ID to identify requests. Specify a unique request ID
  // so that if you must retry your request, the server will know to ignore
  // the request if it has already been completed. The server will guarantee
  // that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 10502;
}

// The request structure for the UpdateRollout method.
message UpdateRolloutRequest {
  // Required. The desired state for the rollout.
  Rollout rollout = 10504 [(google.api.field_behavior) = REQUIRED];

  // If "validate_only" is set to true, the service will try to validate
  // that this request would succeed, but will not actually make changes.
  bool validate_only = 10501;

  // An optional request ID to identify requests. Specify a unique request ID
  // so that if you must retry your request, the server will know to ignore
  // the request if it has already been completed. The server will guarantee
  // that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 10502;

  // Field mask is used to specify the fields to be overwritten in the
  // Rollout resource by the update.
  //
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  //
  // If the user does not provide a mask then all fields in the
  // Rollout will be overwritten.
  google.protobuf.FieldMask update_mask = 10512;
}

// The request structure for the DeleteRollout method.
message DeleteRolloutRequest {
  // Required. The resource name of the resource within a service.
  string name = 10001 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "saasservicemgmt.googleapis.com/Rollout"
    }
  ];

  // The etag known to the client for the expected state of the rollout. This is
  // used with state-changing methods to prevent accidental overwrites when
  // multiple user agents might be acting in parallel on the same resource.
  //
  // An etag wildcard provide optimistic concurrency based on the expected
  // existence of the rollout. The Any wildcard (`*`) requires that the resource
  // must already exists, and the Not Any wildcard (`!*`) requires that it must
  // not.
  string etag = 10202;

  // If "validate_only" is set to true, the service will try to validate
  // that this request would succeed, but will not actually make changes.
  bool validate_only = 10501;

  // An optional request ID to identify requests. Specify a unique request ID
  // so that if you must retry your request, the server will know to ignore
  // the request if it has already been completed. The server will guarantee
  // that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 10502;
}

// The request structure for the ListRolloutKinds method.
message ListRolloutKindsRequest {
  // Required. The parent of the rollout kind.
  string parent = 10006 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "saasservicemgmt.googleapis.com/RolloutKind"
    }
  ];

  // The maximum number of rollout kinds to send per page.
  int32 page_size = 10505;

  // The page token: If the next_page_token from a previous response
  // is provided, this request will send the subsequent page.
  string page_token = 10506;

  // Filter the list as specified in https://google.aip.dev/160.
  string filter = 10507;

  // Order results as specified in https://google.aip.dev/132.
  string order_by = 10508;
}

// The response structure for the ListRolloutKinds method.
message ListRolloutKindsResponse {
  // The resulting rollout kinds.
  repeated RolloutKind rollout_kinds = 10509;

  // If present, the next page token can be provided to a subsequent
  // ListRolloutKinds call to list the next page.
  // If empty, there are no more pages.
  string next_page_token = 10510;

  // Locations that could not be reached.
  repeated string unreachable = 10511;
}

// The request structure for the GetRolloutKind method.
message GetRolloutKindRequest {
  // Required. The resource name of the resource within a service.
  string name = 10001 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "saasservicemgmt.googleapis.com/RolloutKind"
    }
  ];
}

// The request structure for the CreateRolloutKind method.
message CreateRolloutKindRequest {
  // Required. The parent of the rollout kind.
  string parent = 10006 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "saasservicemgmt.googleapis.com/RolloutKind"
    }
  ];

  // Required. The ID value for the new rollout kind.
  string rollout_kind_id = 10503 [(google.api.field_behavior) = REQUIRED];

  // Required. The desired state for the rollout kind.
  RolloutKind rollout_kind = 10504 [(google.api.field_behavior) = REQUIRED];

  // If "validate_only" is set to true, the service will try to validate
  // that this request would succeed, but will not actually make changes.
  bool validate_only = 10501;

  // An optional request ID to identify requests. Specify a unique request ID
  // so that if you must retry your request, the server will know to ignore
  // the request if it has already been completed. The server will guarantee
  // that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 10502;
}

// The request structure for the UpdateRolloutKind method.
message UpdateRolloutKindRequest {
  // Required. The desired state for the rollout kind.
  RolloutKind rollout_kind = 10504 [(google.api.field_behavior) = REQUIRED];

  // If "validate_only" is set to true, the service will try to validate
  // that this request would succeed, but will not actually make changes.
  bool validate_only = 10501;

  // An optional request ID to identify requests. Specify a unique request ID
  // so that if you must retry your request, the server will know to ignore
  // the request if it has already been completed. The server will guarantee
  // that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 10502;

  // Field mask is used to specify the fields to be overwritten in the
  // RolloutKind resource by the update.
  //
  // The fields specified in the update_mask are relative to the resource, not
  // the full request. A field will be overwritten if it is in the mask.
  //
  // If the user does not provide a mask then all fields in the
  // RolloutKind will be overwritten.
  google.protobuf.FieldMask update_mask = 10512;
}

// The request structure for the DeleteRolloutKind method.
message DeleteRolloutKindRequest {
  // Required. The resource name of the resource within a service.
  string name = 10001 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "saasservicemgmt.googleapis.com/RolloutKind"
    }
  ];

  // The etag known to the client for the expected state of the rollout kind.
  // This is used with state-changing methods to prevent accidental overwrites
  // when multiple user agents might be acting in parallel on the same resource.
  //
  // An etag wildcard provide optimistic concurrency based on the expected
  // existence of the rollout kind. The Any wildcard (`*`) requires that the
  // resource must already exists, and the Not Any wildcard (`!*`) requires that
  // it must not.
  string etag = 10202;

  // If "validate_only" is set to true, the service will try to validate
  // that this request would succeed, but will not actually make changes.
  bool validate_only = 10501;

  // An optional request ID to identify requests. Specify a unique request ID
  // so that if you must retry your request, the server will know to ignore
  // the request if it has already been completed. The server will guarantee
  // that for at least 60 minutes since the first request.
  //
  // For example, consider a situation where you make an initial request and the
  // request times out. If you make the request again with the same request
  // ID, the server can check if original operation with the same request ID
  // was received, and if so, will ignore the second request. This prevents
  // clients from accidentally creating duplicate commitments.
  //
  // The request ID must be a valid UUID with the exception that zero UUID is
  // not supported (00000000-0000-0000-0000-000000000000).
  string request_id = 10502;
}
