syntax = "proto3";

package global.nextgen.v1;

import "google/api/field_behavior.proto";

// CloudStorage defines the destination configuration for exported data.
message CloudStorage {
  CloudStorageType.Enum type = 1 [(google.api.field_behavior) = REQUIRED];
  oneof storage {
    S3CloudStorage s3 = 2 [(google.api.field_behavior) = OPTIONAL];
    GCSCloudStorage gcs = 3 [(google.api.field_behavior) = OPTIONAL];
    AzureBlobCloudStorage azure_blob = 4 [(google.api.field_behavior) = OPTIONAL];
    OSSCloudStorage oss = 5 [(google.api.field_behavior) = OPTIONAL];
  }
}

message CloudStorageType {
  enum Enum {
    // Unspecified cloud storage type.
    CLOUD_STORAGE_TYPE_UNSPECIFIED = 0;
    // Amazon S3 cloud storage.
    S3 = 1;
    // Google Cloud Storage.
    GCS = 2;
    // Azure Blob Storage.
    AZURE_BLOB = 3;
    // Alibaba Cloud OSS.
    OSS = 4;
  }
}

message GCSCloudStorage {
  enum GCSAuthType {
    GCS_AUTH_TYPE_UNSPECIFIED = 0;
    SERVICE_ACCOUNT_KEY = 1;
  }

  string uri = 1 [(google.api.field_behavior) = REQUIRED];
  GCSAuthType auth_type = 2 [(google.api.field_behavior) = REQUIRED];
  oneof auth {
    string service_account_key = 3 [(google.api.field_behavior) = INPUT_ONLY];
  }
}

message AzureBlobCloudStorage {
  enum AzureBlobAuthType {
    AZURE_BLOB_AUTH_TYPE_UNSPECIFIED = 0;
    SAS_TOKEN = 1;
  }

  string uri = 1 [(google.api.field_behavior) = REQUIRED];
  AzureBlobAuthType auth_type = 2 [(google.api.field_behavior) = REQUIRED];
  oneof auth {
    string sas_token = 3 [(google.api.field_behavior) = INPUT_ONLY];
  }
}

message S3CloudStorage {
  message AccessKey {
    string id = 1 [(google.api.field_behavior) = REQUIRED];
    string secret = 2 [
      (google.api.field_behavior) = REQUIRED,
      (google.api.field_behavior) = INPUT_ONLY
    ];
  }
  enum S3AuthType {
    S3_AUTH_TYPE_UNSPECIFIED = 0;
    ROLE_ARN = 1;
    ACCESS_KEY = 2;
  }

  string uri = 1 [(google.api.field_behavior) = REQUIRED];
  S3AuthType auth_type = 2 [(google.api.field_behavior) = REQUIRED];
  oneof auth {
    AccessKey access_key = 3 [(google.api.field_behavior) = OPTIONAL];
    string role_arn = 4 [(google.api.field_behavior) = OPTIONAL];
  }
}

message OSSCloudStorage {
  message AccessKey {
    string id = 1 [(google.api.field_behavior) = REQUIRED];
    string secret = 2 [
      (google.api.field_behavior) = REQUIRED,
      (google.api.field_behavior) = INPUT_ONLY
    ];
  }
  enum OSSAuthType {
    OSS_AUTH_TYPE_UNSPECIFIED = 0;
    ACCESS_KEY = 1;
    ROLE_ARN = 2;
  }

  string uri = 1 [(google.api.field_behavior) = REQUIRED];
  OSSAuthType auth_type = 2 [(google.api.field_behavior) = REQUIRED];
  oneof auth {
    AccessKey access_key = 3 [(google.api.field_behavior) = OPTIONAL];
    string role_arn = 4 [(google.api.field_behavior) = OPTIONAL];
  }
}
