/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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";

option java_multiple_files = true;
package org.apache.airavata.mft.resource.service;

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";

// SCP Storage

message SCPStorage {
    string storageId = 1;
    string host = 2;
    int32 port = 3;
    string user = 4;
}

message SCPStorageGetRequest {
    string storageId = 1;
}

message SCPStorageCreateRequest {
    string host = 1;
    int32 port = 2;
    string user = 3;
}

message SCPStorageUpdateRequest {
    string storageId = 1;
    string host = 2;
    int32 port = 3;
    string user = 4;
}

message SCPStorageDeleteRequest {
    string storageId = 1;
}

// SCP Resource

message SCPResource {
    string resourceId = 1;
    SCPStorage scpStorage = 2;
    string resourcePath = 3;
}

message SCPResourceGetRequest {
    string resourceId = 1;
}

message SCPResourceCreateRequest {
    string scpStorageId = 1;
    string resourcePath = 2;
}

message SCPResourceUpdateRequest {
    string resourceId = 1;
    string scpStorageId = 2;
    string resourcePath = 3;
}

message SCPResourceDeleteRequest {
    string resourceId = 1;
}

// Local Resource

message LocalResource {
    string resourceId = 1;
    string resourcePath = 2;
}

message LocalResourceGetRequest {
    string resourceId = 1;
}

message LocalResourceCreateRequest {
    string resourcePath = 1;
}

message LocalResourceUpdateRequest {
    string resourceId = 1;
    string resourcePath = 2;
}

message LocalResourceDeleteRequest {
    string resourceId = 1;
}

// S3 Resource

message S3Resource {
    string resourceId = 1;
    string bucketName = 2;
    string region = 3;
    string resourcePath = 4;
}

message S3ResourceGetRequest {
    string resourceId = 1;
}

message S3ResourceCreateRequest {
    string bucketName = 1;
    string region = 2;
    string resourcePath = 3;
}

message S3ResourceUpdateRequest {
    string resourceId = 1;
    string bucketName = 2;
    string region = 3;
    string resourcePath = 4;
}

message S3ResourceDeleteRequest {
    string resourceId = 1;
}

// Azure Resource

message AzureResource {
    string resourceId = 1;
    string container = 2;
    string blobName = 3;
}

message AzureResourceGetRequest {
    string resourceId = 1;
}

message AzureResourceCreateRequest {
    string container = 1;
    string blobName = 2;
}

message AzureResourceUpdateRequest {
    string resourceId = 1;
    string container = 2;
    string blobName = 3;
}

message AzureResourceDeleteRequest {
    string resourceId = 1;
}

// GCS Resource

message GCSResource {
    string resourceId = 1;
    string bucketName = 2;
    string resourcePath = 3;
}

message GCSResourceGetRequest {
    string resourceId = 1;
}

message GCSResourceCreateRequest {
    string bucketName = 1;
    string resourcePath = 2;
}

message GCSResourceUpdateRequest {
    string resourceId = 1;
    string bucketName = 2;
    string resourcePath = 3;
}

message GCSResourceDeleteRequest {
    string resourceId = 1;
}

// Box Resource

message BoxResource {
    string resourceId = 1;
    string boxFileId = 2;
}

message BoxResourceGetRequest {
    string resourceId = 1;
}

message BoxResourceCreateRequest {
    string boxFileId = 1;
}

message BoxResourceUpdateRequest {
    string resourceId = 1;
    string boxFileId = 2;
}

message BoxResourceDeleteRequest {
    string resourceId = 1;
}

// FTP Storage

message FTPStorage {
    string storageId = 1;
    string host = 2;
    int32 port = 3;
}

message FTPStorageGetRequest {
    string storageId = 1;
}

message FTPStorageCreateRequest {
    string host = 1;
    int32 port = 2;
}

message FTPStorageUpdateRequest {
    string storageId = 1;
    string host = 2;
    int32 port = 3;
}

message FTPStorageDeleteRequest {
    string storageId = 1;
}

// FTP Resource

message FTPResource {
    string resourceId = 1;
    FTPStorage ftpStorage = 2;
    string resourcePath = 3;
}

message FTPResourceGetRequest {
    string resourceId = 1;
}

message FTPResourceCreateRequest {
    string ftpStorageId = 1;
    string resourcePath = 2;
}

message FTPResourceUpdateRequest {
    string resourceId = 1;
    string FTPStorageId = 2;
    string resourcePath = 3;
}

message FTPResourceDeleteRequest {
    string resourceId = 1;
}

service  ResourceService {
    // SCP Storage

    rpc getSCPStorage (SCPStorageGetRequest) returns (SCPStorage) {
        option (google.api.http) = {
           get: "/v1.0/resource/scp/storage"
        };
    }

    rpc createSCPStorage (SCPStorageCreateRequest) returns (SCPStorage) {
        option (google.api.http) = {
           post: "/v1.0/resource/scp/storage"
        };
    }

    rpc updateSCPStorage (SCPStorageUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/scp/storage"
        };
    }

    rpc deleteSCPStorage (SCPStorageDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/scp/storage"
        };
    }

    // SCP Resource

    rpc getSCPResource (SCPResourceGetRequest) returns (SCPResource) {
        option (google.api.http) = {
           get: "/v1.0/resource/scp"
        };
    }

    rpc createSCPResource (SCPResourceCreateRequest) returns (SCPResource) {
        option (google.api.http) = {
           post: "/v1.0/resource/scp"
        };
    }

    rpc updateSCPResource (SCPResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/scp"
        };
    }

    rpc deleteSCPResource (SCPResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/scp"
        };
    }

    // Local Resource

    rpc getLocalResource (LocalResourceGetRequest) returns (LocalResource) {
        option (google.api.http) = {
           get: "/v1.0/resource/local"
        };
    }

    rpc createLocalResource (LocalResourceCreateRequest) returns (LocalResource) {
        option (google.api.http) = {
           post: "/v1.0/resource/local"
        };
    }

    rpc updateLocalResource (LocalResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/local"
        };
    }

    rpc deleteLocalResource (LocalResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/local"
        };
    }

    // S3 Resource

    rpc getS3Resource (S3ResourceGetRequest) returns (S3Resource) {
        option (google.api.http) = {
           get: "/v1.0/resource/s3"
        };
    }

    rpc createS3Resource (S3ResourceCreateRequest) returns (S3Resource) {
        option (google.api.http) = {
           post: "/v1.0/resource/s3"
        };
    }

    rpc updateS3Resource (S3ResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/s3"
        };
    }

    rpc deleteS3Resource (S3ResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/s3"
        };
    }

    // Box Resource

    rpc getBoxResource (BoxResourceGetRequest) returns (BoxResource) {
        option (google.api.http) = {
           get: "/v1.0/resource/box"
        };
    }

    rpc createBoxResource (BoxResourceCreateRequest) returns (BoxResource) {
        option (google.api.http) = {
           post: "/v1.0/resource/box"
        };
    }

    rpc updateBoxResource (BoxResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/box"
        };
    }

    rpc deleteBoxResource (BoxResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/box"
        };
    }

    // Azure Resource

    rpc getAzureResource (AzureResourceGetRequest) returns (AzureResource) {
        option (google.api.http) = {
           get: "/v1.0/resource/azure"
        };
    }

    rpc createAzureResource (AzureResourceCreateRequest) returns (AzureResource) {
        option (google.api.http) = {
           post: "/v1.0/resource/azure"
        };
    }

    rpc updateAzureResource (AzureResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/azure"
        };
    }

    rpc deleteAzureResource (AzureResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/azure"
        };
    }

    // GCS Resource

    rpc getGCSResource (GCSResourceGetRequest) returns (GCSResource) {
        option (google.api.http) = {
            get: "/v1.0/resource/gcs"
        };
    }

    rpc createGCSResource (GCSResourceCreateRequest) returns (GCSResource) {
        option (google.api.http) = {
            post: "/v1.0/resource/gcs"
        };
    }

    rpc updateGCSResource (GCSResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            put: "/v1.0/resource/gcs"
        };
    }

    rpc deleteGCSResource (GCSResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
            delete: "/v1.0/resource/gcs"
        };
    }

    // FTP Storage

    rpc getFTPStorage (FTPStorageGetRequest) returns (FTPStorage) {
        option (google.api.http) = {
           get: "/v1.0/resource/ftp/storage"
        };
    }

    rpc createFTPStorage (FTPStorageCreateRequest) returns (FTPStorage) {
        option (google.api.http) = {
           post: "/v1.0/resource/ftp/storage"
        };
    }

    rpc updateFTPStorage (FTPStorageUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/ftp/storage"
        };
    }

    rpc deleteFTPStorage (FTPStorageDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/ftp/storage"
        };
    }

    // FTP Resource

    rpc getFTPResource (FTPResourceGetRequest) returns (FTPResource) {
        option (google.api.http) = {
           get: "/v1.0/resource/ftp"
        };
    }

    rpc createFTPResource (FTPResourceCreateRequest) returns (FTPResource) {
        option (google.api.http) = {
           post: "/v1.0/resource/ftp"
        };
    }

    rpc updateFTPResource (FTPResourceUpdateRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           put: "/v1.0/resource/ftp"
        };
    }

    rpc deleteFTPResource (FTPResourceDeleteRequest) returns (google.protobuf.Empty) {
        option (google.api.http) = {
           delete: "/v1.0/resource/ftp"
        };
    }
}