Skip to content

Commit

Permalink
chore(base,vdp): support creating pipeline/connector under organizati…
Browse files Browse the repository at this point in the history
…on (#226)

Because

- we need to allow user to create pipeline/connector under organization
under organization namespace

This commit

- support creating pipeline/connector under organization
- add organization admin endpoints
  • Loading branch information
donch1989 authored Nov 29, 2023
1 parent a8d29d6 commit a138405
Show file tree
Hide file tree
Showing 8 changed files with 2,935 additions and 788 deletions.
77 changes: 62 additions & 15 deletions core/mgmt/v1alpha/mgmt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,6 @@ message ListUsersAdminResponse {
int32 total_size = 3;
}

// CreateUserAdminRequest represents a request to create a user by admin
message CreateUserAdminRequest {
// The user to be created
//
// The user's `name` field is used to identify the user to create.
// Format: users/{user}
User user = 1 [(google.api.field_behavior) = REQUIRED];
}

// CreateUserAdminResponse represents a response for a user response
message CreateUserAdminResponse {
// A user resource
User user = 1;
}

// GetUserAdminRequest represents a request to query a user by admin
message GetUserAdminRequest {
// Resource name of a user. For example:
Expand Down Expand Up @@ -197,6 +182,68 @@ message LookUpUserAdminResponse {
User user = 1;
}

// ListOrganizationsAdminRequest represents a request to list all organizations by admin
message ListOrganizationsAdminRequest {
// Page size: the maximum number of resources to return. The service may
// return fewer than this value. If unspecified, at most 10 organizations will be
// returned. The maximum value is 100; values above 100 will be coereced to
// 100.
optional int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
// Page token
optional string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
// View view (default is VIEW_BASIC)
optional View view = 3 [(google.api.field_behavior) = OPTIONAL];
// Filter expression to list organizations
optional string filter = 4 [(google.api.field_behavior) = OPTIONAL];
}

// ListOrganizationsAdminResponse represents a response for a list of organizations
message ListOrganizationsAdminResponse {
// A list of organizations
repeated Organization organizations = 1;
// Next page token
string next_page_token = 2;
// Total count of organizations
int32 total_size = 3;
}

// GetOrganizationAdminRequest represents a request to query a organization by admin
message GetOrganizationAdminRequest {
// Resource name of a organization. For example:
// "organizations/local-organization"
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference).type = "api.instill.tech/Organization",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "organization.name"}
}
];
// View view (default is VIEW_BASIC)
optional View view = 2 [(google.api.field_behavior) = OPTIONAL];
}

// GetOrganizationAdminResponse represents a response for a organization resource
message GetOrganizationAdminResponse {
// A organization resource
Organization organization = 1;
}

// LookUpOrganizationAdminRequest represents a request to query a organization via permalink by
// admin
message LookUpOrganizationAdminRequest {
// Permalink of a organization. For example:
// "organizations/{uid}"
string permalink = 1 [(google.api.field_behavior) = REQUIRED];
// View view (default is VIEW_BASIC)
optional View view = 2 [(google.api.field_behavior) = OPTIONAL];
}

// LookUpOrganizationAdminResponse represents a response for a organization resource by admin
message LookUpOrganizationAdminResponse {
// A organization resource
Organization organization = 1;
}

// ListUsersRequest represents a request to list all users
message ListUsersRequest {
// Page size: the maximum number of resources to return. The service may
Expand Down
30 changes: 20 additions & 10 deletions core/mgmt/v1alpha/mgmt_private_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ service MgmtPrivateService {
option (google.api.http) = {get: "/v1alpha/admin/users"};
}

// CreateUserAdmin receives a CreateUserAdminRequest message and returns a
// a GetUserAdminResponse
rpc CreateUserAdmin(CreateUserAdminRequest) returns (CreateUserAdminResponse) {
option (google.api.http) = {
post: "/v1alpha/admin/users"
body: "user"
};
option (google.api.method_signature) = "user";
}

// GetUserAdmin method receives a GetUserAdminRequest message and returns
// a GetUserAdminResponse message.
rpc GetUserAdmin(GetUserAdminRequest) returns (GetUserAdminResponse) {
Expand All @@ -38,4 +28,24 @@ service MgmtPrivateService {
option (google.api.http) = {get: "/v1alpha/admin/{permalink=users/*}/lookUp"};
option (google.api.method_signature) = "permalink";
}

// ListOrganizationsAdmin method receives a ListOrganizationsAdminRequest message and returns
// a ListOrganizationsAdminResponse message.
rpc ListOrganizationsAdmin(ListOrganizationsAdminRequest) returns (ListOrganizationsAdminResponse) {
option (google.api.http) = {get: "/v1alpha/admin/organizations"};
}

// GetOrganizationAdmin method receives a GetOrganizationAdminRequest message and returns
// a GetOrganizationAdminResponse message.
rpc GetOrganizationAdmin(GetOrganizationAdminRequest) returns (GetOrganizationAdminResponse) {
option (google.api.http) = {get: "/v1alpha/admin/{name=organizations/*}"};
option (google.api.method_signature) = "name";
}

// LookUpOrganizationAdmin method receives a LookUpOrganizationAdminRequest message and
// returns a LookUpOrganizationAdminResponse
rpc LookUpOrganizationAdmin(LookUpOrganizationAdminRequest) returns (LookUpOrganizationAdminResponse) {
option (google.api.http) = {get: "/v1alpha/admin/{permalink=organizations/*}/lookUp"};
option (google.api.method_signature) = "permalink";
}
}
Loading

0 comments on commit a138405

Please sign in to comment.