Skip to content

Commit

Permalink
Remove cloud ops client (#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz authored Feb 18, 2025
1 parent 617de7e commit 623badd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 253 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ jobs:
TEMPORAL_NAMESPACE: sdk-ci.a2dd6
TEMPORAL_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: 2024-05-13-00
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -115,9 +113,6 @@ jobs:
- name: Single integration test against cloud
run: 'go test -v --count 1 -p 1 . -run "TestIntegrationSuite/TestBasic$"'
working-directory: test
- name: Cloud operations tests
run: 'go test -v --count 1 -p 1 . -run "TestCloudOperationsSuite/.*" -cloud-operations-tests'
working-directory: test

features-test:
uses: temporalio/features/.github/workflows/go.yaml@main
Expand Down
35 changes: 4 additions & 31 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import (
"crypto/tls"
"io"

"go.temporal.io/api/cloud/cloudservice/v1"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
historypb "go.temporal.io/api/history/v1"
Expand Down Expand Up @@ -173,11 +172,6 @@ type (
// Options are optional parameters for Client creation.
Options = internal.ClientOptions

// CloudOperationsClientOptions are parameters for CloudOperationsClient creation.
//
// WARNING: Cloud operations client is currently experimental.
CloudOperationsClientOptions = internal.CloudOperationsClientOptions

// ConnectionOptions are optional parameters that can be specified in ClientOptions
ConnectionOptions = internal.ConnectionOptions

Expand Down Expand Up @@ -1010,17 +1004,6 @@ type (
Close()
}

// CloudOperationsClient is the client for cloud operations.
//
// WARNING: Cloud operations client is currently experimental.
CloudOperationsClient interface {
// CloudService provides access to the underlying gRPC service.
CloudService() cloudservice.CloudServiceClient

// Close client and clean up underlying resources.
Close()
}

// NamespaceClient is the client for managing operations on the namespace.
// CLI, tools, ... can use this layer to manager operations on namespace.
NamespaceClient interface {
Expand Down Expand Up @@ -1137,14 +1120,6 @@ func NewClientFromExistingWithContext(ctx context.Context, existingClient Client
return internal.NewClientFromExisting(ctx, existingClient, options)
}

// DialCloudOperationsClient creates a cloud client to perform cloud-management
// operations. Users should provide Credentials in the options.
//
// WARNING: Cloud operations client is currently experimental.
func DialCloudOperationsClient(ctx context.Context, options CloudOperationsClientOptions) (CloudOperationsClient, error) {
return internal.DialCloudOperationsClient(ctx, options)
}

// NewNamespaceClient creates an instance of a namespace client, to manage
// lifecycle of namespaces. This will not attempt to connect to the server
// eagerly and therefore may not fail for an unreachable server until a call is
Expand All @@ -1155,12 +1130,10 @@ func NewNamespaceClient(options Options) (NamespaceClient, error) {

// make sure if new methods are added to internal.Client they are also added to public Client.
var (
_ Client = internal.Client(nil)
_ internal.Client = Client(nil)
_ CloudOperationsClient = internal.CloudOperationsClient(nil)
_ internal.CloudOperationsClient = CloudOperationsClient(nil)
_ NamespaceClient = internal.NamespaceClient(nil)
_ internal.NamespaceClient = NamespaceClient(nil)
_ Client = internal.Client(nil)
_ internal.Client = Client(nil)
_ NamespaceClient = internal.NamespaceClient(nil)
_ internal.NamespaceClient = NamespaceClient(nil)
)

// NewValue creates a new [converter.EncodedValue] which can be used to decode binary data returned by Temporal. For example:
Expand Down
100 changes: 0 additions & 100 deletions internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
"sync/atomic"
"time"

"go.temporal.io/api/cloud/cloudservice/v1"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/api/operatorservice/v1"
Expand Down Expand Up @@ -525,50 +524,6 @@ type (
DisableErrorCodeMetricTags bool
}

CloudOperationsClient interface {
CloudService() cloudservice.CloudServiceClient
Close()
}

// CloudOperationsClientOptions are parameters for CloudOperationsClient creation.
//
// WARNING: Cloud operations client is currently experimental.
//
// Exposed as: [go.temporal.io/sdk/client.CloudOperationsClientOptions]
CloudOperationsClientOptions struct {
// Optional: The credentials for this client. This is essentially required.
// See [go.temporal.io/sdk/client.NewAPIKeyStaticCredentials],
// [go.temporal.io/sdk/client.NewAPIKeyDynamicCredentials], and
// [go.temporal.io/sdk/client.NewMTLSCredentials].
// Default: No credentials.
Credentials Credentials

// Optional: Version header for safer mutations. May or may not be required
// depending on cloud settings.
// Default: No header.
Version string

// Optional: Advanced server connection options such as TLS settings. Not
// usually needed.
ConnectionOptions ConnectionOptions

// Optional: Logger framework can use to log.
// Default: Default logger provided.
Logger log.Logger

// Optional: Metrics handler for reporting metrics.
// Default: No metrics
MetricsHandler metrics.Handler

// Optional: Overrides the specific host to connect to. Not usually needed.
// Default: saas-api.tmprl.cloud:443
HostPort string

// Optional: Disable TLS.
// Default: false (i.e. TLS enabled)
DisableTLS bool
}

// HeadersProvider returns a map of gRPC headers that should be used on every request.
HeadersProvider interface {
GetHeaders(ctx context.Context) (map[string]string, error)
Expand Down Expand Up @@ -1053,61 +1008,6 @@ func NewServiceClient(workflowServiceClient workflowservice.WorkflowServiceClien
return client
}

// DialCloudOperationsClient creates a cloud client to perform cloud-management
// operations.
//
// Exposed as: [go.temporal.io/sdk/client.DialCloudOperationsClient]
func DialCloudOperationsClient(ctx context.Context, options CloudOperationsClientOptions) (CloudOperationsClient, error) {
// Set defaults
if options.MetricsHandler == nil {
options.MetricsHandler = metrics.NopHandler
}
if options.Logger == nil {
options.Logger = ilog.NewDefaultLogger()
}
if options.HostPort == "" {
options.HostPort = "saas-api.tmprl.cloud:443"
}
if options.Version != "" {
options.ConnectionOptions.DialOptions = append(
options.ConnectionOptions.DialOptions,
grpc.WithChainUnaryInterceptor(func(
ctx context.Context, method string, req, reply any,
cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption,
) error {
ctx = metadata.AppendToOutgoingContext(ctx, "temporal-cloud-api-version", options.Version)
return invoker(ctx, method, req, reply, cc, opts...)
}),
)
}
if options.Credentials != nil {
if err := options.Credentials.applyToOptions(&options.ConnectionOptions); err != nil {
return nil, err
}
}
if options.ConnectionOptions.TLS == nil && !options.DisableTLS {
options.ConnectionOptions.TLS = &tls.Config{}
}
// Exclude internal from retry by default
options.ConnectionOptions.excludeInternalFromRetry = &atomic.Bool{}
options.ConnectionOptions.excludeInternalFromRetry.Store(true)
// TODO(cretz): Pass through context on dial
conn, err := dial(newDialParameters(&ClientOptions{
HostPort: options.HostPort,
ConnectionOptions: options.ConnectionOptions,
MetricsHandler: options.MetricsHandler,
Credentials: options.Credentials,
}, options.ConnectionOptions.excludeInternalFromRetry))
if err != nil {
return nil, err
}
return &cloudOperationsClient{
conn: conn,
logger: options.Logger,
cloudServiceClient: cloudservice.NewCloudServiceClient(conn),
}, nil
}

func (op *withStartWorkflowOperationImpl) Get(ctx context.Context) (WorkflowRun, error) {
select {
case <-op.doneCh:
Expand Down
18 changes: 0 additions & 18 deletions internal/internal_workflow_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/durationpb"

"go.temporal.io/api/cloud/cloudservice/v1"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
historypb "go.temporal.io/api/history/v1"
Expand Down Expand Up @@ -106,13 +105,6 @@ type (
unclosedClients *int32
}

// cloudOperationsClient is the client for managing cloud.
cloudOperationsClient struct {
conn *grpc.ClientConn
logger log.Logger
cloudServiceClient cloudservice.CloudServiceClient
}

// namespaceClient is the client for managing namespaces.
namespaceClient struct {
workflowService workflowservice.WorkflowServiceClient
Expand Down Expand Up @@ -1362,16 +1354,6 @@ func (wc *WorkflowClient) Close() {
}
}

func (c *cloudOperationsClient) CloudService() cloudservice.CloudServiceClient {
return c.cloudServiceClient
}

func (c *cloudOperationsClient) Close() {
if err := c.conn.Close(); err != nil {
c.logger.Warn("unable to close connection", tagError, err)
}
}

// Register a namespace with temporal server
// The errors it can throw:
// - NamespaceAlreadyExistsError
Expand Down
99 changes: 0 additions & 99 deletions test/cloud_operations_test.go

This file was deleted.

0 comments on commit 623badd

Please sign in to comment.