Don't require type for children of subtyped resources. (#285)
This commit is contained in:
1 parent
a11ca2e3a8
commit
eaae887bbe
18 files changed
+278
-246
No files matched your search
@@ -39,7 +39,7 @@ func TestAccounts_List(t *testing.T) {
|
||||
|
||||
expected = append(expected, &authmethods.Account{Attributes: map[string]interface{}{"login_name": "loginname1"}})
|
||||
|
||||
expected[1], apiErr, err = accountClient.Create(tc.Context(), amId, authmethods.WithType("password"), authmethods.WithPasswordAccountLoginName(expected[1].Attributes["login_name"].(string)))
|
||||
expected[1], apiErr, err = accountClient.Create(tc.Context(), amId, authmethods.WithPasswordAccountLoginName(expected[1].Attributes["login_name"].(string)))
|
||||
assert.NoError(err)
|
||||
assert.Nil(apiErr)
|
||||
|
||||
@@ -49,7 +49,7 @@ func TestAccounts_List(t *testing.T) {
|
||||
assert.ElementsMatch(comparableSlice(expected[:2]), comparableSlice(ul))
|
||||
|
||||
for i := 2; i < 10; i++ {
|
||||
newAcct, apiErr, err := accountClient.Create(tc.Context(), amId, authmethods.WithType("password"), authmethods.WithPasswordAccountLoginName(fmt.Sprintf("loginname%d", i)))
|
||||
newAcct, apiErr, err := accountClient.Create(tc.Context(), amId, authmethods.WithPasswordAccountLoginName(fmt.Sprintf("loginname%d", i)))
|
||||
expected = append(expected, newAcct)
|
||||
assert.NoError(err)
|
||||
assert.Nil(apiErr)
|
||||
@@ -107,7 +107,7 @@ func TestAccount_Crud(t *testing.T) {
|
||||
assert.EqualValues(wantedVersion, u.Version)
|
||||
}
|
||||
|
||||
u, apiErr, err := accountClient.Create(tc.Context(), amId, authmethods.WithType("password"), authmethods.WithName("foo"), authmethods.WithPasswordAccountLoginName("loginname"))
|
||||
u, apiErr, err := accountClient.Create(tc.Context(), amId, authmethods.WithName("foo"), authmethods.WithPasswordAccountLoginName("loginname"))
|
||||
checkAccount("create", u, apiErr, err, "foo", 1)
|
||||
|
||||
u, apiErr, err = accountClient.Read(tc.Context(), amId, u.Id)
|
||||
@@ -184,13 +184,13 @@ func TestAccount_Errors(t *testing.T) {
|
||||
|
||||
accountClient := authmethods.NewAccountsClient(client)
|
||||
|
||||
u, apiErr, err := accountClient.Create(tc.Context(), amId, authmethods.WithType("password"), authmethods.WithPasswordAccountLoginName("first"))
|
||||
u, apiErr, err := accountClient.Create(tc.Context(), amId, authmethods.WithPasswordAccountLoginName("first"))
|
||||
require.NoError(err)
|
||||
assert.Nil(apiErr)
|
||||
assert.NotNil(u)
|
||||
|
||||
// Create another resource with the same name.
|
||||
_, apiErr, err = accountClient.Create(tc.Context(), amId, authmethods.WithType("password"), authmethods.WithPasswordAccountLoginName("first"))
|
||||
_, apiErr, err = accountClient.Create(tc.Context(), amId, authmethods.WithPasswordAccountLoginName("first"))
|
||||
require.NoError(err)
|
||||
assert.NotNil(apiErr)
|
||||
|
||||
|
||||
@@ -184,15 +184,3 @@ func DefaultPasswordAccountPassword() Option {
|
||||
o.valueMap["attributes"] = val
|
||||
}
|
||||
}
|
||||
|
||||
func WithType(inType string) Option {
|
||||
return func(o *options) {
|
||||
o.valueMap["type"] = inType
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultType() Option {
|
||||
return func(o *options) {
|
||||
o.valueMap["type"] = nil
|
||||
}
|
||||
}
|
||||
@@ -103,9 +103,4 @@ func TestCatalogs_Errors(t *testing.T) {
|
||||
require.NoError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusForbidden, apiErr.Status)
|
||||
|
||||
_, apiErr, err = pc.Update(tc.Context(), hc.Id, hc.Version, hosts.WithType("Cant Update"))
|
||||
require.NoError(err)
|
||||
assert.NotNil(apiErr)
|
||||
assert.EqualValues(http.StatusBadRequest, apiErr.Status)
|
||||
}
|
||||
@@ -100,15 +100,3 @@ func DefaultName() Option {
|
||||
o.valueMap["name"] = nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithType(inType string) Option {
|
||||
return func(o *options) {
|
||||
o.valueMap["type"] = inType
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultType() Option {
|
||||
return func(o *options) {
|
||||
o.valueMap["type"] = nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/auth/password"
|
||||
)
|
||||
|
||||
type SubType int
|
||||
|
||||
const (
|
||||
UnknownSubtype SubType = iota
|
||||
PasswordSubtype
|
||||
)
|
||||
|
||||
func (t SubType) String() string {
|
||||
switch t {
|
||||
case PasswordSubtype:
|
||||
return "password"
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
// SubtypeFromType converts a string to a SubType.
|
||||
// returns UnknownSubtype if no SubType with that name is found.
|
||||
func SubtypeFromType(t string) SubType {
|
||||
switch {
|
||||
case strings.EqualFold(strings.TrimSpace(t), PasswordSubtype.String()):
|
||||
return PasswordSubtype
|
||||
}
|
||||
return UnknownSubtype
|
||||
}
|
||||
|
||||
// SubtypeFromId takes any public id in the auth subsystem and uses the prefix to determine
|
||||
// what subtype the id is for.
|
||||
// Returns UnknownSubtype if no SubType with this id's prefix is found.
|
||||
func SubtypeFromId(id string) SubType {
|
||||
switch {
|
||||
case strings.HasPrefix(strings.TrimSpace(id), password.AuthMethodPrefix):
|
||||
fallthrough
|
||||
case strings.HasPrefix(strings.TrimSpace(id), password.AccountPrefix):
|
||||
return PasswordSubtype
|
||||
}
|
||||
return UnknownSubtype
|
||||
}
|
||||
@@ -234,7 +234,7 @@ var file_controller_api_resources_authmethods_v1_auth_method_proto_rawDesc = []b
|
||||
0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f,
|
||||
0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x80, 0x04, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e,
|
||||
0xfa, 0x03, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43,
|
||||
0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72,
|
||||
@@ -260,35 +260,35 @@ var file_controller_api_resources_authmethods_v1_auth_method_proto_rawDesc = []b
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
|
||||
0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d,
|
||||
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x04, 0x74,
|
||||
0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
|
||||
0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74,
|
||||
0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
|
||||
0x65, 0x73, 0x22, 0xfe, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41,
|
||||
0x75, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
|
||||
0x74, 0x65, 0x73, 0x12, 0x71, 0x0a, 0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e,
|
||||
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x42, 0x3e, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x36, 0x0a, 0x20, 0x61, 0x74,
|
||||
0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12,
|
||||
0x4d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x4c, 0x65, 0x6e, 0x67,
|
||||
0x74, 0x68, 0x52, 0x12, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x6b, 0x0a, 0x13, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x42, 0x3b, 0xa0, 0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x33, 0x0a, 0x1e, 0x61,
|
||||
0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61,
|
||||
0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x11, 0x4d,
|
||||
0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68,
|
||||
0x52, 0x11, 0x6d, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x65, 0x6e,
|
||||
0x67, 0x74, 0x68, 0x42, 0x5d, 0x5a, 0x5b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e,
|
||||
0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65,
|
||||
0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69,
|
||||
0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6d,
|
||||
0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x3b, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f,
|
||||
0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a,
|
||||
0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01,
|
||||
0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xfe, 0x01, 0x0a,
|
||||
0x1c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x41, 0x75, 0x74, 0x68, 0x4d, 0x65, 0x74,
|
||||
0x68, 0x6f, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x71, 0x0a,
|
||||
0x15, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f,
|
||||
0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x3e, 0xa0, 0xda,
|
||||
0x29, 0x01, 0xc2, 0xdd, 0x29, 0x36, 0x0a, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
|
||||
0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x5f, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x12, 0x4d, 0x69, 0x6e, 0x4c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x52, 0x12, 0x6d, 0x69,
|
||||
0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68,
|
||||
0x12, 0x6b, 0x0a, 0x13, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x3b, 0xa0,
|
||||
0xda, 0x29, 0x01, 0xc2, 0xdd, 0x29, 0x33, 0x0a, 0x1e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
|
||||
0x74, 0x65, 0x73, 0x2e, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x11, 0x4d, 0x69, 0x6e, 0x50, 0x61, 0x73, 0x73,
|
||||
0x77, 0x6f, 0x72, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x50,
|
||||
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x42, 0x5d, 0x5a,
|
||||
0x5b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68,
|
||||
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75,
|
||||
0x72, 0x63, 0x65, 0x73, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73,
|
||||
0x3b, 0x61, 0x75, 0x74, 0x68, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -56,7 +56,7 @@ type HostCatalog struct {
|
||||
// has not changed and to fail the write if it has.
|
||||
Version uint32 `protobuf:"varint,70,opt,name=version,proto3" json:"version,omitempty"`
|
||||
// The type of the resource, to help differentiate schemas
|
||||
Type *wrappers.StringValue `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Type string `protobuf:"bytes,80,opt,name=type,proto3" json:"type,omitempty"`
|
||||
// Attributes specific to the catalog type
|
||||
Attributes *_struct.Struct `protobuf:"bytes,90,opt,name=attributes,proto3" json:"attributes,omitempty"`
|
||||
}
|
||||
@@ -142,11 +142,11 @@ func (x *HostCatalog) GetVersion() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *HostCatalog) GetType() *wrappers.StringValue {
|
||||
func (x *HostCatalog) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return nil
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HostCatalog) GetAttributes() *_struct.Struct {
|
||||
@@ -289,7 +289,7 @@ var file_controller_api_resources_hosts_v1_host_catalog_proto_rawDesc = []byte{
|
||||
0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
||||
0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9f, 0x04, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfb, 0x03, 0x0a, 0x0b, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74,
|
||||
0x61, 0x6c, 0x6f, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
|
||||
@@ -316,36 +316,33 @@ var file_controller_api_resources_hosts_v1_host_catalog_proto_rawDesc = []byte{
|
||||
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x36, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x04, 0xa0, 0xda, 0x29,
|
||||
0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69,
|
||||
0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74,
|
||||
0x72, 0x75, 0x63, 0x74, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72,
|
||||
0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63,
|
||||
0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69,
|
||||
0x6c, 0x73, 0x22, 0xe4, 0x01, 0x0a, 0x18, 0x41, 0x77, 0x73, 0x45, 0x63, 0x32, 0x48, 0x6f, 0x73,
|
||||
0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09,
|
||||
0x52, 0x07, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x0a, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65,
|
||||
0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74,
|
||||
0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65,
|
||||
0x74, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x18,
|
||||
0x28, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x52, 0x06, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x42, 0x51, 0x5a, 0x4f, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72,
|
||||
0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c,
|
||||
0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
|
||||
0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x50, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
|
||||
0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
|
||||
0x73, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74,
|
||||
0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
|
||||
0x65, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x48, 0x6f, 0x73, 0x74,
|
||||
0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xe4,
|
||||
0x01, 0x0a, 0x18, 0x41, 0x77, 0x73, 0x45, 0x63, 0x32, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x74,
|
||||
0x61, 0x6c, 0x6f, 0x67, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x72,
|
||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65,
|
||||
0x67, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3c, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
|
||||
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69,
|
||||
0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f,
|
||||
0x6b, 0x65, 0x79, 0x12, 0x3c, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65,
|
||||
0x79, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67,
|
||||
0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65,
|
||||
0x79, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x72,
|
||||
0x6f, 0x74, 0x61, 0x74, 0x65, 0x42, 0x51, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f,
|
||||
0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f,
|
||||
0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73,
|
||||
0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -372,21 +369,20 @@ var file_controller_api_resources_hosts_v1_host_catalog_proto_goTypes = []interf
|
||||
(*wrappers.BoolValue)(nil), // 7: google.protobuf.BoolValue
|
||||
}
|
||||
var file_controller_api_resources_hosts_v1_host_catalog_proto_depIdxs = []int32{
|
||||
3, // 0: controller.api.resources.hosts.v1.HostCatalog.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo
|
||||
4, // 1: controller.api.resources.hosts.v1.HostCatalog.name:type_name -> google.protobuf.StringValue
|
||||
4, // 2: controller.api.resources.hosts.v1.HostCatalog.description:type_name -> google.protobuf.StringValue
|
||||
5, // 3: controller.api.resources.hosts.v1.HostCatalog.created_time:type_name -> google.protobuf.Timestamp
|
||||
5, // 4: controller.api.resources.hosts.v1.HostCatalog.updated_time:type_name -> google.protobuf.Timestamp
|
||||
4, // 5: controller.api.resources.hosts.v1.HostCatalog.type:type_name -> google.protobuf.StringValue
|
||||
6, // 6: controller.api.resources.hosts.v1.HostCatalog.attributes:type_name -> google.protobuf.Struct
|
||||
4, // 7: controller.api.resources.hosts.v1.AwsEc2HostCatalogDetails.access_key:type_name -> google.protobuf.StringValue
|
||||
4, // 8: controller.api.resources.hosts.v1.AwsEc2HostCatalogDetails.secret_key:type_name -> google.protobuf.StringValue
|
||||
7, // 9: controller.api.resources.hosts.v1.AwsEc2HostCatalogDetails.rotate:type_name -> google.protobuf.BoolValue
|
||||
10, // [10:10] is the sub-list for method output_type
|
||||
10, // [10:10] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
3, // 0: controller.api.resources.hosts.v1.HostCatalog.scope:type_name -> controller.api.resources.scopes.v1.ScopeInfo
|
||||
4, // 1: controller.api.resources.hosts.v1.HostCatalog.name:type_name -> google.protobuf.StringValue
|
||||
4, // 2: controller.api.resources.hosts.v1.HostCatalog.description:type_name -> google.protobuf.StringValue
|
||||
5, // 3: controller.api.resources.hosts.v1.HostCatalog.created_time:type_name -> google.protobuf.Timestamp
|
||||
5, // 4: controller.api.resources.hosts.v1.HostCatalog.updated_time:type_name -> google.protobuf.Timestamp
|
||||
6, // 5: controller.api.resources.hosts.v1.HostCatalog.attributes:type_name -> google.protobuf.Struct
|
||||
4, // 6: controller.api.resources.hosts.v1.AwsEc2HostCatalogDetails.access_key:type_name -> google.protobuf.StringValue
|
||||
4, // 7: controller.api.resources.hosts.v1.AwsEc2HostCatalogDetails.secret_key:type_name -> google.protobuf.StringValue
|
||||
7, // 8: controller.api.resources.hosts.v1.AwsEc2HostCatalogDetails.rotate:type_name -> google.protobuf.BoolValue
|
||||
9, // [9:9] is the sub-list for method output_type
|
||||
9, // [9:9] is the sub-list for method input_type
|
||||
9, // [9:9] is the sub-list for extension type_name
|
||||
9, // [9:9] is the sub-list for extension extendee
|
||||
0, // [0:9] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_controller_api_resources_hosts_v1_host_catalog_proto_init() }
|
||||
|
||||
@@ -190,7 +190,7 @@ var file_controller_api_resources_hosts_v1_host_set_proto_rawDesc = []byte{
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
|
||||
0x2f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0xaf, 0x04, 0x0a, 0x07, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x22, 0xa9, 0x04, 0x0a, 0x07, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x69, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x43, 0x0a, 0x05,
|
||||
0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73,
|
||||
@@ -216,21 +216,21 @@ var file_controller_api_resources_hosts_v1_host_set_proto_rawDesc = []byte{
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
|
||||
0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x46, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
|
||||
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
|
||||
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
|
||||
0x50, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x42, 0x04, 0xa0, 0xda, 0x29, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73,
|
||||
0x69, 0x7a, 0x65, 0x12, 0x3d, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x64, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f,
|
||||
0x73, 0x74, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x05, 0x68, 0x6f, 0x73,
|
||||
0x74, 0x73, 0x42, 0x51, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64,
|
||||
0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f,
|
||||
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3b,
|
||||
0x68, 0x6f, 0x73, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6c, 0x75, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a,
|
||||
0x65, 0x18, 0x5a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x3d, 0x0a,
|
||||
0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x64, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65,
|
||||
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x42, 0x51, 0x5a, 0x4f,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69,
|
||||
0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
|
||||
0x63, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x3b, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package host
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/host/static"
|
||||
)
|
||||
|
||||
type SubType int
|
||||
|
||||
const (
|
||||
UnknownSubtype SubType = iota
|
||||
StaticSubtype
|
||||
)
|
||||
|
||||
func (t SubType) String() string {
|
||||
switch t {
|
||||
case StaticSubtype:
|
||||
return "static"
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
// Subtype uses the provided subtype
|
||||
func SubtypeFromType(t string) SubType {
|
||||
switch {
|
||||
case strings.EqualFold(strings.TrimSpace(t), StaticSubtype.String()):
|
||||
return StaticSubtype
|
||||
}
|
||||
return UnknownSubtype
|
||||
}
|
||||
|
||||
func SubtypeFromId(id string) SubType {
|
||||
switch {
|
||||
case strings.HasPrefix(strings.TrimSpace(id), static.HostPrefix):
|
||||
fallthrough
|
||||
case strings.HasPrefix(strings.TrimSpace(id), static.HostSetPrefix):
|
||||
fallthrough
|
||||
case strings.HasPrefix(strings.TrimSpace(id), static.HostCatalogPrefix):
|
||||
return StaticSubtype
|
||||
}
|
||||
return UnknownSubtype
|
||||
}
|
||||
@@ -39,7 +39,7 @@ message AuthMethod {
|
||||
uint32 version = 7;
|
||||
|
||||
// The auth method type. This can be "password" or "oidc".
|
||||
string type = 8 [(custom_options.v1.generate_sdk_option) = true];
|
||||
string type = 8;
|
||||
|
||||
// The attributes that are applied for the specific Auth Method type.
|
||||
google.protobuf.Struct attributes = 9 [(custom_options.v1.generate_sdk_option) = true];
|
||||
|
||||
@@ -39,7 +39,7 @@ message HostCatalog {
|
||||
uint32 version = 70;
|
||||
|
||||
// The type of the resource, to help differentiate schemas
|
||||
google.protobuf.StringValue type = 80 [(custom_options.v1.generate_sdk_option) = true];
|
||||
string type = 80;
|
||||
|
||||
// Attributes specific to the catalog type
|
||||
google.protobuf.Struct attributes = 90 [(custom_options.v1.generate_sdk_option) = true];
|
||||
|
||||
@@ -40,7 +40,7 @@ message HostSet {
|
||||
uint32 version = 70;
|
||||
|
||||
// The type of the resource, to help differentiate schemas
|
||||
google.protobuf.StringValue type = 80 [(custom_options.v1.generate_sdk_option) = true];
|
||||
google.protobuf.StringValue type = 80;
|
||||
|
||||
// The total count of hosts in this host set
|
||||
// Output only.
|
||||
|
||||
@@ -74,6 +74,7 @@ func TestHandleImplementedPaths(t *testing.T) {
|
||||
"v1/scopes/someid/users",
|
||||
"v1/scopes/someid/auth-methods",
|
||||
"v1/scopes/someid/auth-methods/someid/accounts",
|
||||
"v1/scopes/someid/host-catalogs",
|
||||
|
||||
// custom methods
|
||||
"v1/scopes/someid/auth-methods/someid:authenticate",
|
||||
@@ -97,6 +98,7 @@ func TestHandleImplementedPaths(t *testing.T) {
|
||||
"v1/scopes/someid/auth-tokens/someid",
|
||||
"v1/scopes/someid/auth-methods/someid",
|
||||
"v1/scopes/someid/auth-methods/someid/accounts/someid",
|
||||
"v1/scopes/someid/host-catalogs/someid",
|
||||
},
|
||||
"PATCH": {
|
||||
"v1/scopes/someid",
|
||||
@@ -104,6 +106,7 @@ func TestHandleImplementedPaths(t *testing.T) {
|
||||
"v1/scopes/someid/roles/someid",
|
||||
"v1/scopes/someid/groups/someid",
|
||||
"v1/scopes/someid/auth-methods/someid",
|
||||
"v1/scopes/someid/host-catalogs/someid",
|
||||
},
|
||||
} {
|
||||
for _, p := range paths {
|
||||
|
||||
@@ -331,7 +331,7 @@ func toProto(in *password.Account) (*pb.Account, error) {
|
||||
UpdatedTime: in.GetUpdateTime().GetTimestamp(),
|
||||
AuthMethodId: in.GetAuthMethodId(),
|
||||
Version: in.GetVersion(),
|
||||
Type: "password",
|
||||
Type: auth.PasswordSubtype.String(),
|
||||
}
|
||||
if in.GetDescription() != "" {
|
||||
out.Description = &wrapperspb.StringValue{Value: in.GetDescription()}
|
||||
@@ -387,8 +387,11 @@ func validateCreateRequest(req *pbs.CreateAccountRequest) error {
|
||||
if item.GetUpdatedTime() != nil {
|
||||
badFields["updated_time"] = "This is a read only field."
|
||||
}
|
||||
switch item.GetType() {
|
||||
case "password":
|
||||
switch auth.SubtypeFromId(req.GetAuthMethodId()) {
|
||||
case auth.PasswordSubtype:
|
||||
if item.GetType() != "" && item.GetType() != auth.PasswordSubtype.String() {
|
||||
badFields["type"] = "Doesn't match the parent resource's type."
|
||||
}
|
||||
pwAttrs := &pb.PasswordAccountAttributes{}
|
||||
if err := handlers.StructToProto(item.GetAttributes(), pwAttrs); err != nil {
|
||||
badFields["attributes"] = "Attribute fields do not match the expected format."
|
||||
@@ -396,8 +399,6 @@ func validateCreateRequest(req *pbs.CreateAccountRequest) error {
|
||||
if pwAttrs.GetLoginName() == "" {
|
||||
badFields["login_name"] = "This is a required field for this type."
|
||||
}
|
||||
default:
|
||||
badFields["type"] = "This is a required field."
|
||||
}
|
||||
if len(badFields) > 0 {
|
||||
return handlers.InvalidArgumentErrorf("Argument errors found in the request.", badFields)
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"google.golang.org/genproto/protobuf/field_mask"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
@@ -304,10 +303,15 @@ func TestCreate(t *testing.T) {
|
||||
defaultCreated, err := ptypes.Timestamp(defaultAccount.GetCreateTime().GetTimestamp())
|
||||
require.NoError(t, err, "Error converting proto to timestamp.")
|
||||
|
||||
structNoPw, err := handlers.ProtoToStruct(&pb.PasswordAccountAttributes{LoginName: "thetestloginname"})
|
||||
require.NoError(t, err, "Error converting proto to struct.")
|
||||
structWithPw, err := handlers.ProtoToStruct(&pb.PasswordAccountAttributes{LoginName: "adifferentusername", Password: wrapperspb.String("somerandompassword")})
|
||||
require.NoError(t, err, "Error converting proto to struct.")
|
||||
createAttr := func(un, pw string) *structpb.Struct {
|
||||
attr := &pb.PasswordAccountAttributes{LoginName: un}
|
||||
if pw != "" {
|
||||
attr.Password = wrapperspb.String(pw)
|
||||
}
|
||||
ret, err := handlers.ProtoToStruct(attr)
|
||||
require.NoError(t, err, "Error converting proto to struct.")
|
||||
return ret
|
||||
}
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
@@ -323,7 +327,7 @@ func TestCreate(t *testing.T) {
|
||||
Name: &wrapperspb.StringValue{Value: "name"},
|
||||
Description: &wrapperspb.StringValue{Value: "desc"},
|
||||
Type: "password",
|
||||
Attributes: structNoPw,
|
||||
Attributes: createAttr("validaccount", ""),
|
||||
},
|
||||
},
|
||||
res: &pbs.CreateAccountResponse{
|
||||
@@ -335,7 +339,27 @@ func TestCreate(t *testing.T) {
|
||||
Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String()},
|
||||
Version: 1,
|
||||
Type: "password",
|
||||
Attributes: structNoPw,
|
||||
Attributes: createAttr("validaccount", ""),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
},
|
||||
{
|
||||
name: "Create a valid Account without type defined",
|
||||
req: &pbs.CreateAccountRequest{
|
||||
AuthMethodId: defaultAccount.GetAuthMethodId(),
|
||||
Item: &pb.Account{
|
||||
Attributes: createAttr("notypedefined", ""),
|
||||
},
|
||||
},
|
||||
res: &pbs.CreateAccountResponse{
|
||||
Uri: fmt.Sprintf("scopes/%s/auth-methods/%s/accounts/%s_", o.GetPublicId(), defaultAccount.GetAuthMethodId(), password.AccountPrefix),
|
||||
Item: &pb.Account{
|
||||
AuthMethodId: defaultAccount.GetAuthMethodId(),
|
||||
Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String()},
|
||||
Version: 1,
|
||||
Type: "password",
|
||||
Attributes: createAttr("notypedefined", ""),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -347,8 +371,7 @@ func TestCreate(t *testing.T) {
|
||||
Item: &pb.Account{
|
||||
Name: &wrapperspb.StringValue{Value: "name_with_password"},
|
||||
Description: &wrapperspb.StringValue{Value: "desc"},
|
||||
Type: "password",
|
||||
Attributes: structWithPw,
|
||||
Attributes: createAttr("haspassword", "somepassword"),
|
||||
},
|
||||
},
|
||||
res: &pbs.CreateAccountResponse{
|
||||
@@ -360,15 +383,23 @@ func TestCreate(t *testing.T) {
|
||||
Scope: &scopepb.ScopeInfo{Id: o.GetPublicId(), Type: scope.Org.String()},
|
||||
Version: 1,
|
||||
Type: "password",
|
||||
Attributes: func() *structpb.Struct {
|
||||
newSt := proto.Clone(structWithPw).(*structpb.Struct)
|
||||
delete(newSt.Fields, "password")
|
||||
return newSt
|
||||
}(),
|
||||
Attributes: createAttr("haspassword", ""),
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
},
|
||||
{
|
||||
name: "Cant specify mismatching type",
|
||||
req: &pbs.CreateAccountRequest{
|
||||
AuthMethodId: defaultAccount.GetAuthMethodId(),
|
||||
Item: &pb.Account{
|
||||
Type: "wrong",
|
||||
Attributes: createAttr("nopwprovided", ""),
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
errCode: codes.InvalidArgument,
|
||||
},
|
||||
{
|
||||
name: "Can't specify Id",
|
||||
req: &pbs.CreateAccountRequest{
|
||||
@@ -376,7 +407,7 @@ func TestCreate(t *testing.T) {
|
||||
Item: &pb.Account{
|
||||
Id: password.AccountPrefix + "_notallowed",
|
||||
Type: "password",
|
||||
Attributes: structNoPw,
|
||||
Attributes: createAttr("cantprovideid", ""),
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
@@ -389,7 +420,7 @@ func TestCreate(t *testing.T) {
|
||||
Item: &pb.Account{
|
||||
AuthMethodId: defaultAccount.GetAuthMethodId(),
|
||||
Type: "password",
|
||||
Attributes: structNoPw,
|
||||
Attributes: createAttr("noauthmethod", ""),
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
@@ -402,7 +433,7 @@ func TestCreate(t *testing.T) {
|
||||
Item: &pb.Account{
|
||||
CreatedTime: ptypes.TimestampNow(),
|
||||
Type: "password",
|
||||
Attributes: structNoPw,
|
||||
Attributes: createAttr("nocreatedtime", ""),
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
@@ -415,18 +446,7 @@ func TestCreate(t *testing.T) {
|
||||
Item: &pb.Account{
|
||||
UpdatedTime: ptypes.TimestampNow(),
|
||||
Type: "password",
|
||||
Attributes: structNoPw,
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
errCode: codes.InvalidArgument,
|
||||
},
|
||||
{
|
||||
name: "Must specify type",
|
||||
req: &pbs.CreateAccountRequest{
|
||||
AuthMethodId: defaultAccount.GetAuthMethodId(),
|
||||
Item: &pb.Account{
|
||||
Attributes: structNoPw,
|
||||
Attributes: createAttr("noupdatetime", ""),
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
|
||||
@@ -261,7 +261,7 @@ func toProto(in *password.AuthMethod) (*pb.AuthMethod, error) {
|
||||
CreatedTime: in.GetCreateTime().GetTimestamp(),
|
||||
UpdatedTime: in.GetUpdateTime().GetTimestamp(),
|
||||
Version: in.GetVersion(),
|
||||
Type: "password",
|
||||
Type: auth.PasswordSubtype.String(),
|
||||
}
|
||||
if in.GetDescription() != "" {
|
||||
out.Description = wrapperspb.String(in.GetDescription())
|
||||
@@ -319,14 +319,14 @@ func validateCreateRequest(req *pbs.CreateAuthMethodRequest) error {
|
||||
if item.GetVersion() != 0 {
|
||||
badFields["version"] = "Cannot specify this field in a create request."
|
||||
}
|
||||
switch item.GetType() {
|
||||
case "password":
|
||||
switch auth.SubtypeFromType(item.GetType()) {
|
||||
case auth.PasswordSubtype:
|
||||
pwAttrs := &pb.PasswordAuthMethodAttributes{}
|
||||
if err := handlers.StructToProto(item.GetAttributes(), pwAttrs); err != nil {
|
||||
badFields["attributes"] = "Attribute fields do not match the expected format."
|
||||
}
|
||||
default:
|
||||
badFields["type"] = "This is a required field and must be \"password\"."
|
||||
badFields["type"] = fmt.Sprintf("This is a required field and must be %q.", auth.PasswordSubtype.String())
|
||||
}
|
||||
if len(badFields) > 0 {
|
||||
return handlers.InvalidArgumentErrorf("Argument errors found in the request.", badFields)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/auth"
|
||||
pb "github.com/hashicorp/boundary/internal/gen/controller/api/resources/hosts"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/controller/api/services"
|
||||
"github.com/hashicorp/boundary/internal/host"
|
||||
"github.com/hashicorp/boundary/internal/host/static"
|
||||
"github.com/hashicorp/boundary/internal/host/static/store"
|
||||
"github.com/hashicorp/boundary/internal/servers/controller/common"
|
||||
@@ -18,45 +19,6 @@ import (
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
type catalogType int
|
||||
|
||||
const (
|
||||
unknownType catalogType = iota
|
||||
staticType
|
||||
)
|
||||
|
||||
func (t catalogType) String() string {
|
||||
switch t {
|
||||
case staticType:
|
||||
return "Static"
|
||||
}
|
||||
return "Unknown"
|
||||
}
|
||||
|
||||
func (t catalogType) idPrefix() string {
|
||||
switch t {
|
||||
case staticType:
|
||||
return static.HostCatalogPrefix + "_"
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
func typeFromTypeField(t string) catalogType {
|
||||
switch {
|
||||
case strings.EqualFold(strings.TrimSpace(t), staticType.String()):
|
||||
return staticType
|
||||
}
|
||||
return unknownType
|
||||
}
|
||||
|
||||
func typeFromId(id string) catalogType {
|
||||
switch {
|
||||
case strings.HasPrefix(id, staticType.idPrefix()):
|
||||
return staticType
|
||||
}
|
||||
return unknownType
|
||||
}
|
||||
|
||||
var (
|
||||
maskManager handlers.MaskManager
|
||||
reInvalidID = regexp.MustCompile("[^A-Za-z0-9]")
|
||||
@@ -94,11 +56,7 @@ func (s Service) GetHostCatalog(ctx context.Context, req *pbs.GetHostCatalogRequ
|
||||
if authResults.Error != nil {
|
||||
return nil, authResults.Error
|
||||
}
|
||||
ct := typeFromId(req.GetId())
|
||||
if ct == unknownType {
|
||||
return nil, handlers.InvalidArgumentErrorf("Invalid argument provided.", map[string]string{"id": "Improperly formatted identifier used."})
|
||||
}
|
||||
if err := validateGetRequest(req, ct); err != nil {
|
||||
if err := validateGetRequest(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hc, err := s.getFromRepo(ctx, req.GetId())
|
||||
@@ -135,11 +93,7 @@ func (s Service) UpdateHostCatalog(ctx context.Context, req *pbs.UpdateHostCatal
|
||||
if authResults.Error != nil {
|
||||
return nil, authResults.Error
|
||||
}
|
||||
ct := typeFromId(req.GetId())
|
||||
if ct == unknownType {
|
||||
return nil, handlers.InvalidArgumentErrorf("Invalid argument provided.", map[string]string{"id": "Improperly formatted identifier used."})
|
||||
}
|
||||
if err := validateUpdateRequest(req, ct); err != nil {
|
||||
if err := validateUpdateRequest(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hc, err := s.updateInRepo(ctx, authResults.Scope.GetId(), req.GetId(), req.GetUpdateMask().GetPaths(), req.GetItem())
|
||||
@@ -156,11 +110,7 @@ func (s Service) DeleteHostCatalog(ctx context.Context, req *pbs.DeleteHostCatal
|
||||
if authResults.Error != nil {
|
||||
return nil, authResults.Error
|
||||
}
|
||||
ct := typeFromId(req.GetId())
|
||||
if ct == unknownType {
|
||||
return nil, handlers.InvalidArgumentErrorf("Invalid argument provided.", map[string]string{"id": "Improperly formatted identifier used."})
|
||||
}
|
||||
if err := validateDeleteRequest(req, ct); err != nil {
|
||||
if err := validateDeleteRequest(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
existed, err := s.deleteFromRepo(ctx, req.GetId())
|
||||
@@ -258,10 +208,10 @@ func (s Service) deleteFromRepo(ctx context.Context, id string) (bool, error) {
|
||||
func toProto(in *static.HostCatalog) *pb.HostCatalog {
|
||||
out := pb.HostCatalog{
|
||||
Id: in.GetPublicId(),
|
||||
Type: &wrapperspb.StringValue{Value: staticType.String()},
|
||||
CreatedTime: in.GetCreateTime().GetTimestamp(),
|
||||
UpdatedTime: in.GetUpdateTime().GetTimestamp(),
|
||||
Version: in.GetVersion(),
|
||||
Type: host.StaticSubtype.String(),
|
||||
}
|
||||
if in.GetDescription() != "" {
|
||||
out.Description = &wrapperspb.StringValue{Value: in.GetDescription()}
|
||||
@@ -279,9 +229,9 @@ func toProto(in *static.HostCatalog) *pb.HostCatalog {
|
||||
// * There are no conflicting parameters provided
|
||||
// * The type asserted by the ID and/or field is known
|
||||
// * If relevant, the type derived from the id prefix matches what is claimed by the type field
|
||||
func validateGetRequest(req *pbs.GetHostCatalogRequest, ct catalogType) error {
|
||||
func validateGetRequest(req *pbs.GetHostCatalogRequest) error {
|
||||
badFields := map[string]string{}
|
||||
if !validId(req.GetId(), ct.idPrefix()) {
|
||||
if !validId(req.GetId(), static.HostCatalogPrefix+"_") {
|
||||
badFields["id"] = "Invalid formatted identifier."
|
||||
}
|
||||
if len(badFields) > 0 {
|
||||
@@ -299,11 +249,14 @@ func validateCreateRequest(req *pbs.CreateHostCatalogRequest) error {
|
||||
if item.GetVersion() != 0 {
|
||||
badFields["version"] = "Cannot specify this field in a create request."
|
||||
}
|
||||
if item.GetType() == nil {
|
||||
badFields["type"] = "This field is required."
|
||||
}
|
||||
if typeFromTypeField(item.GetType().GetValue()) == unknownType {
|
||||
badFields["type"] = "Provided type is unknown."
|
||||
switch host.SubtypeFromType(item.GetType()) {
|
||||
case host.StaticSubtype:
|
||||
shcAttrs := &pb.StaticHostCatalogDetails{}
|
||||
if err := handlers.StructToProto(item.GetAttributes(), shcAttrs); err != nil {
|
||||
badFields["attributes"] = "Attribute fields do not match the expected format."
|
||||
}
|
||||
default:
|
||||
badFields["type"] = fmt.Sprintf("This is a required field and must be %q.", host.StaticSubtype.String())
|
||||
}
|
||||
if item.GetId() != "" {
|
||||
badFields["id"] = "This field is read only."
|
||||
@@ -320,9 +273,9 @@ func validateCreateRequest(req *pbs.CreateHostCatalogRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest, ct catalogType) error {
|
||||
func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest) error {
|
||||
badFields := map[string]string{}
|
||||
if !validId(req.GetId(), ct.idPrefix()) {
|
||||
if !validId(req.GetId(), static.HostCatalogPrefix+"_") {
|
||||
badFields["id"] = "The field is incorrectly formatted."
|
||||
}
|
||||
|
||||
@@ -339,7 +292,7 @@ func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest, ct catalogType) er
|
||||
if item.GetVersion() == 0 {
|
||||
badFields["version"] = "Existing resource version is required for an update."
|
||||
}
|
||||
if item.GetType() != nil {
|
||||
if item.GetType() != "" {
|
||||
badFields["type"] = "This is a read only field and cannot be specified in an update request."
|
||||
}
|
||||
if item.GetId() != "" {
|
||||
@@ -358,9 +311,9 @@ func validateUpdateRequest(req *pbs.UpdateHostCatalogRequest, ct catalogType) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateDeleteRequest(req *pbs.DeleteHostCatalogRequest, ct catalogType) error {
|
||||
func validateDeleteRequest(req *pbs.DeleteHostCatalogRequest) error {
|
||||
badFields := map[string]string{}
|
||||
if !validId(req.GetId(), ct.idPrefix()) {
|
||||
if !validId(req.GetId(), static.HostCatalogPrefix+"_") {
|
||||
badFields["id"] = "The field is incorrectly formatted."
|
||||
}
|
||||
if len(badFields) > 0 {
|
||||
|
||||
@@ -64,7 +64,7 @@ func TestGet(t *testing.T) {
|
||||
Description: &wrappers.StringValue{Value: hc.GetDescription()},
|
||||
CreatedTime: hc.CreateTime.GetTimestamp(),
|
||||
UpdatedTime: hc.UpdateTime.GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
}
|
||||
|
||||
cases := []struct {
|
||||
@@ -236,7 +236,7 @@ func TestCreate(t *testing.T) {
|
||||
req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{
|
||||
Name: &wrappers.StringValue{Value: "name"},
|
||||
Description: &wrappers.StringValue{Value: "desc"},
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
}},
|
||||
res: &pbs.CreateHostCatalogResponse{
|
||||
Uri: fmt.Sprintf("scopes/%s/host-catalogs/%s_", proj.GetPublicId(), static.HostCatalogPrefix),
|
||||
@@ -244,7 +244,7 @@ func TestCreate(t *testing.T) {
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
Name: &wrappers.StringValue{Value: "name"},
|
||||
Description: &wrappers.StringValue{Value: "desc"},
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -254,7 +254,7 @@ func TestCreate(t *testing.T) {
|
||||
req: &pbs.CreateHostCatalogRequest{Item: &pb.HostCatalog{
|
||||
Name: &wrappers.StringValue{Value: "name"},
|
||||
Description: &wrappers.StringValue{Value: "desc"},
|
||||
Type: &wrappers.StringValue{Value: "ThisIsMadeUp"},
|
||||
Type: "thisismadeup",
|
||||
}},
|
||||
errCode: codes.InvalidArgument,
|
||||
},
|
||||
@@ -374,7 +374,7 @@ func TestUpdate(t *testing.T) {
|
||||
Name: &wrappers.StringValue{Value: "new"},
|
||||
Description: &wrappers.StringValue{Value: "desc"},
|
||||
CreatedTime: hc.GetCreateTime().GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -397,7 +397,7 @@ func TestUpdate(t *testing.T) {
|
||||
Name: &wrappers.StringValue{Value: "new"},
|
||||
Description: &wrappers.StringValue{Value: "desc"},
|
||||
CreatedTime: hc.GetCreateTime().GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -450,7 +450,7 @@ func TestUpdate(t *testing.T) {
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
Description: &wrappers.StringValue{Value: "default"},
|
||||
CreatedTime: hc.GetCreateTime().GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -471,7 +471,7 @@ func TestUpdate(t *testing.T) {
|
||||
Scope: &scopes.ScopeInfo{Id: proj.GetPublicId(), Type: scope.Project.String()},
|
||||
Name: &wrappers.StringValue{Value: "default"},
|
||||
CreatedTime: hc.GetCreateTime().GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -494,7 +494,7 @@ func TestUpdate(t *testing.T) {
|
||||
Name: &wrappers.StringValue{Value: "updated"},
|
||||
Description: &wrappers.StringValue{Value: "default"},
|
||||
CreatedTime: hc.GetCreateTime().GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -517,7 +517,7 @@ func TestUpdate(t *testing.T) {
|
||||
Name: &wrappers.StringValue{Value: "default"},
|
||||
Description: &wrappers.StringValue{Value: "notignored"},
|
||||
CreatedTime: hc.GetCreateTime().GetTimestamp(),
|
||||
Type: &wrappers.StringValue{Value: "Static"},
|
||||
Type: "static",
|
||||
},
|
||||
},
|
||||
errCode: codes.OK,
|
||||
@@ -588,7 +588,7 @@ func TestUpdate(t *testing.T) {
|
||||
Paths: []string{"name"},
|
||||
},
|
||||
Item: &pb.HostCatalog{
|
||||
Type: &wrappers.StringValue{Value: "Unknown"},
|
||||
Type: "unknown",
|
||||
},
|
||||
},
|
||||
res: nil,
|
||||
|
||||
Reference in new issue
Block a user