Convert SDK to the new options API (#238)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-08-07 12:55:02 -04:00
1 parent b5acf6afdf
commit 908a299ea3
162 files changed
+6440 -5891

No files matched your search

@@ -1,14 +1,14 @@
syntax = "proto3";
package controller.api.resources.auth.v1;
package controller.api.resources.authmethods.v1;
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/auth;auth";
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/authmethods;authmethods";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
// Account contains all fields related to an auth Account resource
message Account {
@@ -25,10 +25,10 @@ message Account {
string auth_method_id = 3 [json_name="auth_method_id"];
// Optional name for identification purposes
google.protobuf.StringValue name = 4 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
google.protobuf.StringValue name = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
// Optional user-set descripton for identification purposes
google.protobuf.StringValue description = 5 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
google.protobuf.StringValue description = 5 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
// The time this resource was created
// Output only.
@@ -39,18 +39,18 @@ message Account {
google.protobuf.Timestamp updated_time = 7 [json_name="updated_time"];
// Whether the resource is disabled
google.protobuf.BoolValue disabled = 8;
google.protobuf.BoolValue disabled = 8 [(custom_options.v1.generate_sdk_option) = true];
// The type of this account. Possible values are: "password", "oidc".
string type = 9;
// The attributes that are applicable for the specific Account type.
google.protobuf.Struct attributes = 10;
google.protobuf.Struct attributes = 10 [(custom_options.v1.generate_sdk_option) = true];
}
message PasswordAccountAttributes {
// The username of this account. This is unique per auth method.
string username = 1;
string username = 1 [(custom_options.v1.generate_sdk_option) = true];
// The password for this account.
google.protobuf.StringValue password = 2;
google.protobuf.StringValue password = 2 [(custom_options.v1.generate_sdk_option) = true];
}
@@ -1,14 +1,14 @@
syntax = "proto3";
package controller.api.resources.auth.v1;
package controller.api.resources.authmethods.v1;
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/auth;auth";
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/authmethods;authmethods";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
// AuthMethod contains all fields related to a AuthMethod resource
message AuthMethod {
@@ -21,10 +21,10 @@ message AuthMethod {
resources.scopes.v1.ScopeInfo scope = 2;
// Optional name for identification purposes
google.protobuf.StringValue name = 3 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
google.protobuf.StringValue name = 3 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
// Optional user-set descripton for identification purposes
google.protobuf.StringValue description = 4 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
google.protobuf.StringValue description = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
// The time this resource was created
// Output only.
@@ -35,16 +35,16 @@ message AuthMethod {
google.protobuf.Timestamp updated_time = 6 [json_name="updated_time"];
// The auth method type. This can be "password" or "oidc".
string type = 7;
string type = 7 [(custom_options.v1.generate_sdk_option) = true];
// The attributes that are applied for the specific Auth Method type.
google.protobuf.Struct attributes = 8;
google.protobuf.Struct attributes = 8 [(custom_options.v1.generate_sdk_option) = true];
}
message PasswordAuthMethodAttributes {
// The minimum length allowed for user names for accounts in this auth method.
uint32 min_user_name_length = 1;
uint32 min_user_name_length = 1 [(custom_options.v1.generate_sdk_option) = true];
// The minimum length allowed for passwords for accounts in this auth method.
uint32 min_password_length = 2;
uint32 min_password_length = 2 [(custom_options.v1.generate_sdk_option) = true];
}
@@ -7,7 +7,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
message Member {
// The ID of the member.
@@ -34,10 +34,10 @@ message Group {
resources.scopes.v1.ScopeInfo scope = 2;
// Optional name for identification purposes
google.protobuf.StringValue name = 3 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
google.protobuf.StringValue name = 3 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
// Optional user-set descripton for identification purposes
google.protobuf.StringValue description = 4 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
google.protobuf.StringValue description = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
// The time this resource was created
// Output only.
@@ -48,9 +48,9 @@ message Group {
google.protobuf.Timestamp updated_time = 6 [json_name="updated_time"];
// Whether the resource is disabled
google.protobuf.BoolValue disabled = 7;
google.protobuf.BoolValue disabled = 7 [(custom_options.v1.generate_sdk_option) = true];
// The version can be used in subsiquent write requests to ensure this resource
// The version can be used in subsequent write requests to ensure this resource
// has not changed and to fail the write if it has.
// Output only.
uint32 version = 8;
@@ -7,6 +7,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/options.proto";
// Host contains all fields related to a Host resource
message Host {
@@ -22,10 +23,10 @@ message Host {
google.protobuf.StringValue type = 3;
// Optional name for identification purposes
google.protobuf.StringValue name = 4;
google.protobuf.StringValue name = 4 [(custom_options.v1.generate_sdk_option) = true];
// Optional user-set description for identification purposes
google.protobuf.StringValue description = 5;
google.protobuf.StringValue description = 5 [(custom_options.v1.generate_sdk_option) = true];
// The time this resource was created
// Output only.
@@ -36,8 +37,8 @@ message Host {
google.protobuf.Timestamp updated_time = 7 [json_name="updated_time"];
// Whether the host is disabled
google.protobuf.BoolValue disabled = 8;
google.protobuf.BoolValue disabled = 8 [(custom_options.v1.generate_sdk_option) = true];
// The address (DNS or IP name) used to reach the host
google.protobuf.StringValue address = 9;
google.protobuf.StringValue address = 9 [(custom_options.v1.generate_sdk_option) = true];
}
@@ -8,7 +8,7 @@ import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
// HostCatalog manages Hosts and HostSets
message HostCatalog {
@@ -21,13 +21,13 @@ message HostCatalog {
resources.scopes.v1.ScopeInfo scope = 2;
// The type of the resource, to help differentiate schemas
google.protobuf.StringValue type = 3;
google.protobuf.StringValue type = 3 [(custom_options.v1.generate_sdk_option) = true];
// Optional name for identification purposes
google.protobuf.StringValue name = 4 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
google.protobuf.StringValue name = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
// Optional user-set description for identification purposes
google.protobuf.StringValue description = 5 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
google.protobuf.StringValue description = 5 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
// The time this resource was created
// Output only.
@@ -38,10 +38,10 @@ message HostCatalog {
google.protobuf.Timestamp updated_time = 7 [json_name="updated_time"];
// Whether the catalog is disabled
google.protobuf.BoolValue disabled = 8;
google.protobuf.BoolValue disabled = 8 [(custom_options.v1.generate_sdk_option) = true];
// Attributes specific to the catalog type
google.protobuf.Struct attributes = 9;
google.protobuf.Struct attributes = 9 [(custom_options.v1.generate_sdk_option) = true];
}
message StaticHostCatalogDetails {
@@ -8,6 +8,7 @@ import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/hosts/v1/host.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/options.proto";
// HostSet is a collection of Hosts created and managed by a HostCatalog
message HostSet {
@@ -20,13 +21,13 @@ message HostSet {
resources.scopes.v1.ScopeInfo scope = 2;
// The type of the resource, to help differentiate schemas
google.protobuf.StringValue type = 3;
google.protobuf.StringValue type = 3 [(custom_options.v1.generate_sdk_option) = true];
// Optional name for identification purposes
google.protobuf.StringValue name = 4;
google.protobuf.StringValue name = 4 [(custom_options.v1.generate_sdk_option) = true];
// Optional user-set description for identification purposes
google.protobuf.StringValue description = 5;
google.protobuf.StringValue description = 5 [(custom_options.v1.generate_sdk_option) = true];
// The time this resource was created
// Output only.
@@ -37,7 +38,7 @@ message HostSet {
google.protobuf.Timestamp updated_time = 7 [json_name="updated_time"];
// Whether the host set is disabled
google.protobuf.BoolValue disabled = 8;
google.protobuf.BoolValue disabled = 8 [(custom_options.v1.generate_sdk_option) = true];
// The total count of hosts in this host set
// Output only.
@@ -7,7 +7,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
message Principal {
// The ID of the principal.
@@ -62,10 +62,10 @@ message Role {
resources.scopes.v1.ScopeInfo scope = 2;
// Optional name for identification purposes
google.protobuf.StringValue name = 3 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
google.protobuf.StringValue name = 3 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
// Optional user-set description for identification purposes
google.protobuf.StringValue description = 4 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
google.protobuf.StringValue description = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
// The time this resource was created
// Output only.
@@ -76,16 +76,16 @@ message Role {
google.protobuf.Timestamp updated_time = 6 [json_name="updated_time"];
// Whether the resource is disabled
google.protobuf.BoolValue disabled = 7;
google.protobuf.BoolValue disabled = 7 [(custom_options.v1.generate_sdk_option) = true];
// The scope the grants will apply to. If the role is at the global scope,
// this can be an org or project. If the role is at an org
// scope, this can be a project within the org. It is invalid for
// this to be anything other than the role's scope when the role's scope is
// a project.
google.protobuf.StringValue grant_scope_id = 8 [json_name="grant_scope_id", (custom_options.v1.mask_mapping) = {this:"grant_scope_id" that: "GrantScopeId"}];
google.protobuf.StringValue grant_scope_id = 8 [json_name="grant_scope_id", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"grant_scope_id" that: "GrantScopeId"}];
// The version can be used in subsiquent write requests to ensure this resource
// The version can be used in subsequent write requests to ensure this resource
// has not changed and to fail the write if it has.
// Output only.
uint32 version = 9;
@@ -6,7 +6,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
message ScopeInfo {
// The ID of the Scope
@@ -41,10 +41,10 @@ message Scope {
ScopeInfo scope = 2;
// Optional name for identification purposes
google.protobuf.StringValue name = 3 [(custom_options.v1.mask_mapping) = {this: "name" that: "name"}];
google.protobuf.StringValue name = 3 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this: "name" that: "name"}];
// Optional user-set descripton for identification purposes
google.protobuf.StringValue description = 4 [(custom_options.v1.mask_mapping) = {this: "description" that: "description"}];
google.protobuf.StringValue description = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this: "description" that: "description"}];
// The time this resource was created
// Output only.
@@ -55,5 +55,10 @@ message Scope {
google.protobuf.Timestamp updated_time = 6 [json_name="updated_time"];
// Whether the resource is disabled
google.protobuf.BoolValue disabled = 7;
google.protobuf.BoolValue disabled = 7 [(custom_options.v1.generate_sdk_option) = true];
// The version can be used in subsequent write requests to ensure this
// resource has not changed and to fail the write if it has.
// Output only.
uint32 version = 8;
}
@@ -7,7 +7,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/masks.proto";
import "controller/custom_options/v1/options.proto";
// User contains all fields related to a User resource
message User {
@@ -20,10 +20,10 @@ message User {
resources.scopes.v1.ScopeInfo scope = 2;
// Optional name for identification purposes
google.protobuf.StringValue name = 3 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
google.protobuf.StringValue name = 3 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
// Optional user-set descripton for identification purposes
google.protobuf.StringValue description = 4 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
google.protobuf.StringValue description = 4 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
// The time this resource was created
// Output only.
@@ -34,5 +34,10 @@ message User {
google.protobuf.Timestamp updated_time = 6 [json_name="updated_time"];
// Whether the resource is disabled
google.protobuf.BoolValue disabled = 7;
google.protobuf.BoolValue disabled = 7 [(custom_options.v1.generate_sdk_option) = true];
// The version can be used in subsequent write requests to ensure this
// resource has not changed and to fail the write if it has.
// Output only.
uint32 version = 8;
}
@@ -7,7 +7,7 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "controller/api/resources/auth/v1/auth_method.proto";
import "controller/api/resources/authmethods/v1/auth_method.proto";
service AuthMethodService {
// GetAuthMethod returns a stored AuthMethod if present. The provided request
@@ -93,7 +93,7 @@ message GetAuthMethodRequest {
}
message GetAuthMethodResponse {
resources.auth.v1.AuthMethod item = 1;
resources.authmethods.v1.AuthMethod item = 1;
}
message ListAuthMethodsRequest {
@@ -101,26 +101,26 @@ message ListAuthMethodsRequest {
}
message ListAuthMethodsResponse {
repeated resources.auth.v1.AuthMethod items = 1;
repeated resources.authmethods.v1.AuthMethod items = 1;
}
message CreateAuthMethodRequest {
resources.auth.v1.AuthMethod item = 1;
resources.authmethods.v1.AuthMethod item = 1;
}
message CreateAuthMethodResponse {
string uri = 1;
resources.auth.v1.AuthMethod item = 2;
resources.authmethods.v1.AuthMethod item = 2;
}
message UpdateAuthMethodRequest {
string id = 1;
resources.auth.v1.AuthMethod item = 2;
resources.authmethods.v1.AuthMethod item = 2;
google.protobuf.FieldMask update_mask = 3;
}
message UpdateAuthMethodResponse {
resources.auth.v1.AuthMethod item = 1;
resources.authmethods.v1.AuthMethod item = 1;
}
message DeleteAuthMethodRequest {
@@ -8,7 +8,7 @@ import "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/wrappers.proto";
import "controller/api/resources/auth/v1/account.proto";
import "controller/api/resources/authmethods/v1/account.proto";
service AccountService {
@@ -96,7 +96,7 @@ message GetAccountRequest {
}
message GetAccountResponse {
resources.auth.v1.Account item = 1;
resources.authmethods.v1.Account item = 1;
}
message ListAccountsRequest {
@@ -105,28 +105,28 @@ message ListAccountsRequest {
}
message ListAccountsResponse {
repeated resources.auth.v1.Account items = 1;
repeated resources.authmethods.v1.Account items = 1;
}
message CreateAccountRequest {
string auth_method_id = 1;
resources.auth.v1.Account item = 2;
resources.authmethods.v1.Account item = 2;
}
message CreateAccountResponse {
string uri = 1;
resources.auth.v1.Account item = 2;
resources.authmethods.v1.Account item = 2;
}
message UpdateAccountRequest {
string auth_method_id = 1;
string id = 2;
resources.auth.v1.Account item = 3;
resources.authmethods.v1.Account item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateAccountResponse {
resources.auth.v1.Account item = 1;
resources.authmethods.v1.Account item = 1;
}
message DeleteAccountRequest {
@@ -164,8 +164,9 @@ message CreateGroupResponse {
message UpdateGroupRequest {
string id = 1;
resources.groups.v1.Group item = 2;
google.protobuf.FieldMask update_mask = 3;
uint32 version = 2;
resources.groups.v1.Group item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateGroupResponse {
@@ -184,7 +185,7 @@ message AddGroupMembersRequest {
string id = 1;
// The version ensures the group hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string member_ids = 3 [json_name="member_ids"];
}
@@ -196,7 +197,7 @@ message SetGroupMembersRequest {
string id = 1;
// The version ensures the group hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string member_ids = 3 [json_name="member_ids"];
}
@@ -208,7 +209,7 @@ message RemoveGroupMembersRequest {
string id = 1;
// The version ensures the group hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string member_ids = 3 [json_name="member_ids"];
}
@@ -213,8 +213,9 @@ message CreateRoleResponse {
// TODO: Add versions to Update and Delete role requests.
message UpdateRoleRequest {
string id = 1;
resources.roles.v1.Role item = 2;
google.protobuf.FieldMask update_mask = 3;
uint32 version = 2;
resources.roles.v1.Role item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateRoleResponse {
@@ -233,7 +234,7 @@ message AddRolePrincipalsRequest {
string role_id = 1;
// The version ensures the role hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string principal_ids = 3 [json_name="principal_ids"];
}
@@ -245,7 +246,7 @@ message SetRolePrincipalsRequest {
string role_id = 1;
// The version ensures the role hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string principal_ids = 3 [json_name="principal_ids"];
}
@@ -257,7 +258,7 @@ message RemoveRolePrincipalsRequest {
string role_id = 1;
// The version ensures the role hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string principal_ids = 3 [json_name="principal_ids"];
}
@@ -269,7 +270,7 @@ message AddRoleGrantsRequest {
string role_id = 1;
// The version ensures the role hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string grant_strings = 3 [json_name="grant_strings"];
}
@@ -281,7 +282,7 @@ message SetRoleGrantsRequest {
string role_id = 1;
// The version ensures the role hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string grant_strings = 3 [json_name="grant_strings"];
}
@@ -293,7 +294,7 @@ message RemoveRoleGrantsRequest {
string role_id = 1;
// The version ensures the role hasn't changed since it was last retrieved and if
// it has the request will fail.
google.protobuf.UInt32Value version = 2;
uint32 version = 2;
repeated string grant_strings = 3 [json_name="grant_strings"];
}
@@ -116,8 +116,9 @@ message CreateScopeResponse {
message UpdateScopeRequest {
string id = 1;
resources.scopes.v1.Scope item = 2;
google.protobuf.FieldMask update_mask = 3;
uint32 version = 2;
resources.scopes.v1.Scope item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateScopeResponse {
@@ -116,8 +116,9 @@ message CreateUserResponse {
message UpdateUserRequest {
string id = 1;
resources.users.v1.User item = 2;
google.protobuf.FieldMask update_mask = 3;
uint32 version = 2;
resources.users.v1.User item = 3;
google.protobuf.FieldMask update_mask = 4;
}
message UpdateUserResponse {