fix: do not require remoteOrgID for remote connection creation (#451)

This commit is contained in:
Dane Strandboge
2022-10-28 11:16:53 -05:00
committed by GitHub
parent 121864a550
commit 3285a03e9e
52 changed files with 2942 additions and 587 deletions

View File

@ -94,7 +94,7 @@ func TestBucketsUpdate(t *testing.T) {
assert.Nil(t, body.Description) &&
assert.Len(t, body.GetRetentionRules(), 1) &&
assert.Nil(t, body.GetRetentionRules()[0].ShardGroupDurationSeconds) &&
assert.Equal(t, int64(3*7*24*3600), *body.GetRetentionRules()[0].EverySeconds)
assert.Equal(t, int64(3*7*24*3600), body.GetRetentionRules()[0].EverySeconds)
})).Return(api.Bucket{
Id: api.PtrString("123"),
Name: "my-bucket",
@ -122,7 +122,6 @@ func TestBucketsUpdate(t *testing.T) {
assert.Nil(t, body.Name) &&
assert.Nil(t, body.Description) &&
assert.Len(t, body.GetRetentionRules(), 1) &&
assert.Nil(t, body.GetRetentionRules()[0].EverySeconds) &&
assert.Equal(t, int64(10*3600+30*60), *body.GetRetentionRules()[0].ShardGroupDurationSeconds)
})).Return(api.Bucket{
Id: api.PtrString("123"),

View File

@ -44,13 +44,18 @@ func (c Client) Create(ctx context.Context, params *CreateParams) error {
OrgID: orgID,
RemoteURL: params.RemoteURL,
RemoteAPIToken: params.RemoteAPIToken,
RemoteOrgID: params.RemoteOrgID,
AllowInsecureTLS: params.AllowInsecureTLS,
}
if params.Description != "" {
body.Description = &params.Description
}
if params.RemoteOrgID != "" {
body.RemoteOrgID = &params.RemoteOrgID
} else {
fmt.Fprintln(c.StdIO, "RemoteOrgID is required for remote connections to Cloud or OSS 2.x!")
fmt.Fprintln(c.StdIO, "Ignore this message if this remote connection is to a 1.x instance")
}
// send post request
res, err := c.PostRemoteConnection(ctx).RemoteConnectionCreationRequest(body).Execute()
@ -215,7 +220,7 @@ func (c Client) printRemote(opts printRemoteOpts) error {
"Name": r.GetName(),
"Org ID": r.OrgID,
"Remote URL": r.RemoteURL,
"Remote Org ID": r.RemoteOrgID,
"Remote Org ID": r.GetRemoteOrgID(),
"Allow Insecure TLS": r.AllowInsecureTLS,
}
if opts.deleted {