Skip to content

Commit

Permalink
Merge 1961d20 into be0db8c
Browse files Browse the repository at this point in the history
  • Loading branch information
donch1989 authored Apr 15, 2024
2 parents be0db8c + 1961d20 commit ecf7b6a
Show file tree
Hide file tree
Showing 3 changed files with 342 additions and 4 deletions.
16 changes: 12 additions & 4 deletions vdp/pipeline/v1beta/pipeline.proto
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,25 @@ message NestedComponent {
}
}

// Trigger
message Trigger {
// Trigger Method
oneof trigger {
// Triggered by reqeust.
TriggerByRequest trigger_by_request = 1;
}
}

// Recipe describes the components of a Pipeline and how they are connected.
message Recipe {
// Recipe schema version.
string version = 1;
// List of pipeline components.
repeated Component components = 2;
// The component trigger method.
oneof trigger {
// Triggered by reqeust.
TriggerByRequest trigger_by_request = 3;
}
Trigger trigger = 3;
// Local secrets
map<string, string> secrets = 4;
}

// State describes the state of a pipeline.
Expand Down
104 changes: 104 additions & 0 deletions vdp/pipeline/v1beta/pipeline_public_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "protoc-gen-openapiv2/options/annotations.proto";
import "vdp/pipeline/v1beta/common.proto";
import "vdp/pipeline/v1beta/component_definition.proto";
import "vdp/pipeline/v1beta/pipeline.proto";
import "vdp/pipeline/v1beta/secret.proto";

// VDP
//
Expand Down Expand Up @@ -633,4 +634,107 @@ service PipelinePublicService {
};
option (google.api.method_signature) = "name";
}

// Create a new user secret
//
// Creates a new secret under the parenthood of an user.
rpc CreateUserSecret(CreateUserSecretRequest) returns (CreateUserSecretResponse) {
option (google.api.http) = {
post: "/v1beta/user/secrets"
body: "secret"
};
option (google.api.method_signature) = "secret";
}

// List user secrets
//
// Returns a paginated list of secrets that belong to the specified
// user.
rpc ListUserSecrets(ListUserSecretsRequest) returns (ListUserSecretsResponse) {
option (google.api.http) = {get: "/v1beta/user/secrets"};
}

// Get a secret owned by an user
//
// Returns the details of an user-owned secret by its resource name,
// which is defined by the parent user and the ID of the secret.
rpc GetUserSecret(GetUserSecretRequest) returns (GetUserSecretResponse) {
option (google.api.http) = {get: "/v1beta/{name=user/secrets/*}"};
option (google.api.method_signature) = "name";
}

// Update a secret owned by an user
//
// Udpates a secret, accessing it by its resource name, which is defined by
//
// In REST requests, only the supplied secret fields will be taken into
// account when updating the resource.
rpc UpdateUserSecret(UpdateUserSecretRequest) returns (UpdateUserSecretResponse) {
option (google.api.http) = {
patch: "/v1beta/{secret.name=user/secrets/*}"
body: "secret"
};
option (google.api.method_signature) = "secret,update_mask";
}

// Delete a secret owned by an user
//
// Deletes a secret, accesing it by its resource name, which is defined by
// the parent user and the ID of the secret.
rpc DeleteUserSecret(DeleteUserSecretRequest) returns (DeleteUserSecretResponse) {
option (google.api.http) = {delete: "/v1beta/{name=user/secrets/*}"};
option (google.api.method_signature) = "name";
}

// Create a new organization secret
//
// Creates a new secret under the parenthood of an organization.
rpc CreateOrganizationSecret(CreateOrganizationSecretRequest) returns (CreateOrganizationSecretResponse) {
option (google.api.http) = {
post: "/v1beta/{parent=organizations/*}/secrets"
body: "secret"
};
option (google.api.method_signature) = "parent,secret";
}

// List organization secrets
//
// Returns a paginated list of secrets that belong to the specified
// organization.
rpc ListOrganizationSecrets(ListOrganizationSecretsRequest) returns (ListOrganizationSecretsResponse) {
option (google.api.http) = {get: "/v1beta/{parent=organizations/*}/secrets"};
option (google.api.method_signature) = "parent";
}

// Get a secret owned by an organization
//
// Returns the details of an organization-owned secret by its resource name,
// which is defined by the parent organization and the ID of the secret.
rpc GetOrganizationSecret(GetOrganizationSecretRequest) returns (GetOrganizationSecretResponse) {
option (google.api.http) = {get: "/v1beta/{name=organizations/*/secrets/*}"};
option (google.api.method_signature) = "name";
}

// Update a secret owned by an organization
//
// Udpates a secret, accessing it by its resource name, which is defined by
//
// In REST requests, only the supplied secret fields will be taken into
// account when updating the resource.
rpc UpdateOrganizationSecret(UpdateOrganizationSecretRequest) returns (UpdateOrganizationSecretResponse) {
option (google.api.http) = {
patch: "/v1beta/{secret.name=organizations/*/secrets/*}"
body: "secret"
};
option (google.api.method_signature) = "secret,update_mask";
}

// Delete a secret owned by an organization
//
// Deletes a secret, accesing it by its resource name, which is defined by
// the parent organization and the ID of the secret.
rpc DeleteOrganizationSecret(DeleteOrganizationSecretRequest) returns (DeleteOrganizationSecretResponse) {
option (google.api.http) = {delete: "/v1beta/{name=organizations/*/secrets/*}"};
option (google.api.method_signature) = "name";
}
}
226 changes: 226 additions & 0 deletions vdp/pipeline/v1beta/secret.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
syntax = "proto3";

package vdp.pipeline.v1beta;

// Google API
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
// Protocol Buffers Well-Known Types
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
// OpenAPI definition
import "protoc-gen-openapiv2/options/annotations.proto";

// API secrets allow users to make requests to the Instill AI API.
message Secret {
option (google.api.resource) = {
type: "api.instill.tech/Secret"
pattern: "user/secrets/{secret.id}"
pattern: "organizations/{organization.id}/secrets/{secret.id}"
};

// The name of the secret, define by its ID.
// - Format: `secrets/{secret.id}`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Secret UUID.
string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Secret resource ID (used in `name` as the last segment). This conforms
// to RFC-1034, which restricts to letters, numbers, and hyphen, with the
// first character a letter, the last a letter or a number, and a 63
// character maximum.
string id = 3 [(google.api.field_behavior) = IMMUTABLE];
// Creation time.
google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
// Update time.
google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
// The value of the secret, which is input-only and will never be returned in API responses.
optional string value = 6 [(google.api.field_behavior) = INPUT_ONLY];
// Description
string description = 7 [(google.api.field_behavior) = OPTIONAL];
}

// CreateUserSecretRequest represents a request to create a secret.
message CreateUserSecretRequest {
// The properties of the secret to be created.
Secret secret = 1;
}

// CreateUserSecretResponse contains the created secret.
message CreateUserSecretResponse {
// The created secret resource.
Secret secret = 1;
}

// ListUserSecretsRequest represents a request to list the secrets of a user.
message ListUserSecretsRequest {
// The maximum number of secrets to return. If this parameter is unspecified,
// at most 10 pipelines will be returned. The cap value for this parameter is
// 100 (i.e. any value above that will be coerced to 100).
optional int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Page secret.
optional string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
}

// ListUserSecretsResponse contains a list of secrets.
message ListUserSecretsResponse {
// A list of secret resources.
repeated Secret secrets = 1;
// Next page secret.
string next_page_token = 2;
// Total number of secret resources.
int32 total_size = 3;
}

// GetUserSecretRequest represents a request to fetch the details of a secret
message GetUserSecretRequest {
// The resource name of the secret, which allows its access by ID.
// - Format: `user/secrets/{secret.id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {type: "api.instill.tech/Secret"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "user_secret_name"}
}
];
}

// GetUserSecretResponse contains the requested secret.
message GetUserSecretResponse {
// The secret resource.
Secret secret = 1;
}

// UpdateUserSecretRequest represents a request to update a user secret.
message UpdateUserSecretRequest {
// The secret fields to update.
Secret secret = 1 [(google.api.field_behavior) = REQUIRED];
// The update mask specifies the subset of fields that should be modified.
//
// For more information about this field, see
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#field-mask.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}

// UpdateUserSecretResponse contains the updated secret.
message UpdateUserSecretResponse {
// The updated secret resource.
Secret secret = 1;
}

// DeleteUserSecretRequest represents a request to delete a secret resource.
message DeleteUserSecretRequest {
// The resource name of the secret, which allows its access by ID.
// - Format: `user/secrets/{secret.id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {type: "api.instill.tech/Secret"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "user_secret_name"}
}
];
}

// DeleteUserSecretResponse is an empty response.
message DeleteUserSecretResponse {}

// CreateOrganizationSecretRequest represents a request to create a secret.
message CreateOrganizationSecretRequest {
// The properties of the secret to be created.
Secret secret = 1;
// The parent resource, i.e., the organization that creates the secret.
// - Format: `organizations/{organization.id}`.
string parent = 2 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {child_type: "api.instill.tech/Secret"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "organization_name"}
}
];
}

// CreateOrganizationSecretResponse contains the created secret.
message CreateOrganizationSecretResponse {
// The created secret resource.
Secret secret = 1;
}

// ListOrganizationSecretsRequest represents a request to list the secrets of a user.
message ListOrganizationSecretsRequest {
// The maximum number of secrets to return. If this parameter is unspecified,
// at most 10 pipelines will be returned. The cap value for this parameter is
// 100 (i.e. any value above that will be coerced to 100).
optional int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Page secret.
optional string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// The parent resource, i.e., the organization that creates the secret.
// - Format: `organizations/{organization.id}`.
string parent = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {child_type: "api.instill.tech/Secret"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "organization_name"}
}
];
}

// ListOrganizationSecretsResponse contains a list of secrets.
message ListOrganizationSecretsResponse {
// A list of secret resources.
repeated Secret secrets = 1;
// Next page secret.
string next_page_token = 2;
// Total number of secret resources.
int32 total_size = 3;
}

// GetOrganizationSecretRequest represents a request to fetch the details of a secret
message GetOrganizationSecretRequest {
// The resource name of the secret, which allows its access by ID.
// - Format: `organizations/{organization.id}/secrets/{secret.id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {type: "api.instill.tech/Secret"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "organization_secret_name"}
}
];
}

// GetOrganizationSecretResponse contains the requested secret.
message GetOrganizationSecretResponse {
// The secret resource.
Secret secret = 1;
}

// UpdateOrganizationSecretRequest represents a request to update a user secret.
message UpdateOrganizationSecretRequest {
// The secret fields to update.
Secret secret = 1 [(google.api.field_behavior) = REQUIRED];
// The update mask specifies the subset of fields that should be modified.
//
// For more information about this field, see
// https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#field-mask.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}

// UpdateOrganizationSecretResponse contains the updated secret.
message UpdateOrganizationSecretResponse {
// The updated secret resource.
Secret secret = 1;
}

// DeleteOrganizationSecretRequest represents a request to delete a secret resource.
message DeleteOrganizationSecretRequest {
// The resource name of the secret, which allows its access by ID.
// - Format: `organizations/{organization.id}/secrets/{secret.id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {type: "api.instill.tech/Secret"},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "organization_secret_name"}
}
];
}

// DeleteOrganizationSecretResponse is an empty response.
message DeleteOrganizationSecretResponse {}

0 comments on commit ecf7b6a

Please sign in to comment.