@@ -13,7 +13,7 @@ import (
1313 "go.uber.org/multierr"
1414
1515 "github.com/temporalio/tcld/protogen/api/auth/v1"
16- "github.com/temporalio/tcld/protogen/api/common /v1"
16+ "github.com/temporalio/tcld/protogen/api/cloud/cloudservice /v1"
1717 "github.com/temporalio/tcld/protogen/api/sink/v1"
1818
1919 "github.com/kylelemons/godebug/diff"
@@ -139,16 +139,18 @@ var (
139139)
140140
141141type NamespaceClient struct {
142- client namespaceservice.NamespaceServiceClient
143- authClient authservice.AuthServiceClient
144- ctx context.Context
142+ client namespaceservice.NamespaceServiceClient
143+ cloudAPIClient cloudservice.CloudServiceClient
144+ authClient authservice.AuthServiceClient
145+ ctx context.Context
145146}
146147
147148func NewNamespaceClient (ctx context.Context , conn * grpc.ClientConn ) * NamespaceClient {
148149 return & NamespaceClient {
149- client : namespaceservice .NewNamespaceServiceClient (conn ),
150- authClient : authservice .NewAuthServiceClient (conn ),
151- ctx : ctx ,
150+ client : namespaceservice .NewNamespaceServiceClient (conn ),
151+ cloudAPIClient : cloudservice .NewCloudServiceClient (conn ),
152+ authClient : authservice .NewAuthServiceClient (conn ),
153+ ctx : ctx ,
152154 }
153155}
154156
@@ -296,19 +298,16 @@ func (c *NamespaceClient) addRegion(ctx *cli.Context) error {
296298 return fmt .Errorf ("namespace cloud provider is required" )
297299 }
298300
299- res , err := c .client .GlobalizeNamespace (c .ctx , & namespaceservice.GlobalizeNamespaceRequest {
300- RequestId : ctx .String (RequestIDFlagName ),
301- Namespace : ctx .String (NamespaceFlagName ),
302- TargetRegion : & common.RegionID {
303- CloudProvider : cloudProvider ,
304- Name : region ,
305- },
306- ResourceVersion : ns .GetResourceVersion (),
301+ res , err := c .cloudAPIClient .AddNamespaceRegion (c .ctx , & cloudservice.AddNamespaceRegionRequest {
302+ Namespace : ctx .String (NamespaceFlagName ),
303+ Region : fmt .Sprintf ("%s-%s" , cloudProvider , region ),
304+ ResourceVersion : ns .GetResourceVersion (),
305+ AsyncOperationId : ctx .String (RequestIDFlagName ),
307306 })
308307 if err != nil {
309308 return err
310309 }
311- return PrintProto (res )
310+ return PrintProto (res . GetAsyncOperation () )
312311}
313312
314313func (c * NamespaceClient ) listNamespaces () error {
@@ -449,18 +448,15 @@ func (c *NamespaceClient) failoverNamespace(ctx *cli.Context) error {
449448 return fmt .Errorf ("cloud provider is required" )
450449 }
451450
452- res , err := c .client .FailoverNamespace (c .ctx , & namespaceservice.FailoverNamespaceRequest {
453- Namespace : namespace ,
454- RequestId : ctx .String (RequestIDFlagName ),
455- TargetRegion : & common.RegionID {
456- CloudProvider : cloudProvider ,
457- Name : ctx .String (namespaceRegionFlagName ),
458- },
451+ res , err := c .cloudAPIClient .FailoverNamespaceRegion (c .ctx , & cloudservice.FailoverNamespaceRegionRequest {
452+ Namespace : namespace ,
453+ Region : fmt .Sprintf ("%s-%s" , cloudProvider , ctx .String (namespaceRegionFlagName )),
454+ AsyncOperationId : ctx .String (RequestIDFlagName ),
459455 })
460456 if err != nil {
461457 return err
462458 }
463- return PrintProto (res )
459+ return PrintProto (res . GetAsyncOperation () )
464460}
465461
466462// ReadCACerts reads ca certs based on cli flags.
0 commit comments