Treat alias values like other required fields in API and CLI (#4404)

* Treat Alias values like other required fields in API and CLI

* Fix protoc versions since we recently rebased on main which uses updated version
This commit is contained in:
Todd committed 2024-02-29 15:52:27 -08:00
1 parent a6c96d69ae
commit 305bb09c35
11 files changed
+51 -68

No files matched your search

+1 -6
View File
@@ -115,7 +115,7 @@ func (c *Client) ApiClient() *api.Client {
return c.client
}
func (c *Client) Create(ctx context.Context, resourceType string, alias string, scopeId string, opt ...Option) (*AliasCreateResult, error) {
func (c *Client) Create(ctx context.Context, resourceType string, scopeId string, opt ...Option) (*AliasCreateResult, error) {
if scopeId == "" {
return nil, fmt.Errorf("empty scopeId value passed into Create request")
}
@@ -130,11 +130,6 @@ func (c *Client) Create(ctx context.Context, resourceType string, alias string,
} else {
opts.postMap["type"] = resourceType
}
if alias == "" {
return nil, fmt.Errorf("empty alias value passed into Create request")
} else {
opts.postMap["value"] = alias
}
opts.postMap["scope_id"] = scopeId
+6
View File
@@ -156,3 +156,9 @@ func WithValue(inValue string) Option {
o.postMap["value"] = inValue
}
}
func DefaultValue() Option {
return func(o *options) {
o.postMap["value"] = nil
}
}