lrotesting

package
v0.90.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Test service for Long Running Operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelOperationRequest

type CancelOperationRequest struct {
	// The name of the operation resource to be cancelled.
	Name string `json:"-" url:"-"`
}

type CreateTestResourceOperation

type CreateTestResourceOperation struct {
	// contains filtered or unexported fields
}

func (*CreateTestResourceOperation) Cancel

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed.

func (*CreateTestResourceOperation) Done

func (a *CreateTestResourceOperation) Done() (bool, error)

Done reports whether the long-running operation has completed.

func (*CreateTestResourceOperation) Metadata

Metadata returns metadata associated with the long-running operation. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateTestResourceOperation) Name

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateTestResourceOperation) Wait

Wait blocks until the long-running operation is completed with default 20 min timeout, the timeout can be overridden in the opts. If the operation didn't finished within the timeout, this function will through an error of type ErrTimedOut, otherwise successful response and any errors encountered.

type CreateTestResourceOperationInterface added in v0.87.0

type CreateTestResourceOperationInterface interface {
	// Wait blocks until the long-running operation is completed with default 20 min
	// timeout, the timeout can be overridden in the opts. If the operation didn't
	// finished within the timeout, this function will through an error of type
	// ErrTimedOut, otherwise successful response and any errors encountered.
	Wait(ctx context.Context, opts *lro.LroOptions) (*TestResource, error)

	// Starts asynchronous cancellation on a long-running operation. The server
	// makes a best effort to cancel the operation, but success is not guaranteed.
	Cancel(ctx context.Context) error

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*TestResourceOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type CreateTestResourceRequest

type CreateTestResourceRequest struct {
	// The resource to create
	Resource TestResource `json:"resource"`
}

type DatabricksServiceExceptionWithDetailsProto added in v0.86.0

type DatabricksServiceExceptionWithDetailsProto struct {
	// @pbjson-skip
	Details []json.RawMessage `json:"details,omitempty"`

	ErrorCode ErrorCode `json:"error_code,omitempty"`

	Message string `json:"message,omitempty"`

	StackTrace string `json:"stack_trace,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

Serialization format for DatabricksServiceException with error details. This message doesn't work for ScalaPB-04 as google.protobuf.Any is only available to ScalaPB-09. Note the definition of this message should be in sync with DatabricksServiceExceptionProto defined in /api-base/proto/legacy/databricks.proto except the later one doesn't have the error details field defined.

func (DatabricksServiceExceptionWithDetailsProto) MarshalJSON added in v0.86.0

func (*DatabricksServiceExceptionWithDetailsProto) UnmarshalJSON added in v0.86.0

type DeleteTestResourceOperation added in v0.88.0

type DeleteTestResourceOperation struct {
	// contains filtered or unexported fields
}

func (*DeleteTestResourceOperation) Cancel added in v0.88.0

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed.

func (*DeleteTestResourceOperation) Done added in v0.88.0

func (a *DeleteTestResourceOperation) Done() (bool, error)

Done reports whether the long-running operation has completed.

func (*DeleteTestResourceOperation) Metadata added in v0.88.0

Metadata returns metadata associated with the long-running operation. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteTestResourceOperation) Name added in v0.88.0

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteTestResourceOperation) Wait added in v0.88.0

Wait blocks until the long-running operation is completed with default 20 min timeout, the timeout can be overridden in the opts. If the operation didn't finished within the timeout, this function will through an error of type ErrTimedOut, otherwise successful response and any errors encountered.

type DeleteTestResourceOperationInterface added in v0.88.0

type DeleteTestResourceOperationInterface interface {
	// Wait blocks until the long-running operation is completed with default 20 min
	// timeout, the timeout can be overridden in the opts. If the operation didn't
	// finished within the timeout, this function will through an error of type
	// ErrTimedOut, otherwise successful response and any errors encountered.
	Wait(ctx context.Context, opts *lro.LroOptions) error

	// Starts asynchronous cancellation on a long-running operation. The server
	// makes a best effort to cancel the operation, but success is not guaranteed.
	Cancel(ctx context.Context) error

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*TestResourceOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type DeleteTestResourceRequest added in v0.88.0

type DeleteTestResourceRequest struct {
	// Resource ID to delete
	ResourceId string `json:"-" url:"-"`
}

type ErrorCode added in v0.86.0

type ErrorCode string

Legacy definition of the ErrorCode enum. Please keep in sync with api-base/proto/error_code.proto (except status code mapping annotations as this file doesn't have them). Will be removed eventually, pending the ScalaPB 0.4 cleanup.

const ErrorCodeAborted ErrorCode = `ABORTED`
const ErrorCodeAlreadyExists ErrorCode = `ALREADY_EXISTS`
const ErrorCodeBadRequest ErrorCode = `BAD_REQUEST`
const ErrorCodeCancelled ErrorCode = `CANCELLED`
const ErrorCodeCatalogAlreadyExists ErrorCode = `CATALOG_ALREADY_EXISTS`
const ErrorCodeCatalogDoesNotExist ErrorCode = `CATALOG_DOES_NOT_EXIST`
const ErrorCodeCatalogNotEmpty ErrorCode = `CATALOG_NOT_EMPTY`
const ErrorCodeCouldNotAcquireLock ErrorCode = `COULD_NOT_ACQUIRE_LOCK`
const ErrorCodeCustomerUnauthorized ErrorCode = `CUSTOMER_UNAUTHORIZED`
const ErrorCodeDacAlreadyExists ErrorCode = `DAC_ALREADY_EXISTS`
const ErrorCodeDacDoesNotExist ErrorCode = `DAC_DOES_NOT_EXIST`
const ErrorCodeDataLoss ErrorCode = `DATA_LOSS`
const ErrorCodeDeadlineExceeded ErrorCode = `DEADLINE_EXCEEDED`
const ErrorCodeDeploymentTimeout ErrorCode = `DEPLOYMENT_TIMEOUT`
const ErrorCodeDirectoryNotEmpty ErrorCode = `DIRECTORY_NOT_EMPTY`
const ErrorCodeDirectoryProtected ErrorCode = `DIRECTORY_PROTECTED`
const ErrorCodeDryRunFailed ErrorCode = `DRY_RUN_FAILED`
const ErrorCodeEndpointNotFound ErrorCode = `ENDPOINT_NOT_FOUND`
const ErrorCodeExternalLocationAlreadyExists ErrorCode = `EXTERNAL_LOCATION_ALREADY_EXISTS`
const ErrorCodeExternalLocationDoesNotExist ErrorCode = `EXTERNAL_LOCATION_DOES_NOT_EXIST`
const ErrorCodeFeatureDisabled ErrorCode = `FEATURE_DISABLED`
const ErrorCodeGitConflict ErrorCode = `GIT_CONFLICT`
const ErrorCodeGitRemoteError ErrorCode = `GIT_REMOTE_ERROR`
const ErrorCodeGitSensitiveTokenDetected ErrorCode = `GIT_SENSITIVE_TOKEN_DETECTED`
const ErrorCodeGitUnknownRef ErrorCode = `GIT_UNKNOWN_REF`
const ErrorCodeGitUrlNotOnAllowList ErrorCode = `GIT_URL_NOT_ON_ALLOW_LIST`
const ErrorCodeInsecurePartnerResponse ErrorCode = `INSECURE_PARTNER_RESPONSE`
const ErrorCodeInternalError ErrorCode = `INTERNAL_ERROR`
const ErrorCodeInvalidParameterValue ErrorCode = `INVALID_PARAMETER_VALUE`
const ErrorCodeInvalidState ErrorCode = `INVALID_STATE`
const ErrorCodeInvalidStateTransition ErrorCode = `INVALID_STATE_TRANSITION`
const ErrorCodeIoError ErrorCode = `IO_ERROR`
const ErrorCodeIpynbFileInRepo ErrorCode = `IPYNB_FILE_IN_REPO`
const ErrorCodeMalformedPartnerResponse ErrorCode = `MALFORMED_PARTNER_RESPONSE`
const ErrorCodeMalformedRequest ErrorCode = `MALFORMED_REQUEST`
const ErrorCodeManagedResourceGroupDoesNotExist ErrorCode = `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST`
const ErrorCodeMaxBlockSizeExceeded ErrorCode = `MAX_BLOCK_SIZE_EXCEEDED`
const ErrorCodeMaxChildNodeSizeExceeded ErrorCode = `MAX_CHILD_NODE_SIZE_EXCEEDED`
const ErrorCodeMaxListSizeExceeded ErrorCode = `MAX_LIST_SIZE_EXCEEDED`
const ErrorCodeMaxNotebookSizeExceeded ErrorCode = `MAX_NOTEBOOK_SIZE_EXCEEDED`
const ErrorCodeMaxReadSizeExceeded ErrorCode = `MAX_READ_SIZE_EXCEEDED`
const ErrorCodeMetastoreAlreadyExists ErrorCode = `METASTORE_ALREADY_EXISTS`
const ErrorCodeMetastoreDoesNotExist ErrorCode = `METASTORE_DOES_NOT_EXIST`
const ErrorCodeMetastoreNotEmpty ErrorCode = `METASTORE_NOT_EMPTY`
const ErrorCodeNotFound ErrorCode = `NOT_FOUND`
const ErrorCodeNotImplemented ErrorCode = `NOT_IMPLEMENTED`
const ErrorCodePartialDelete ErrorCode = `PARTIAL_DELETE`
const ErrorCodePermissionDenied ErrorCode = `PERMISSION_DENIED`
const ErrorCodePermissionNotPropagated ErrorCode = `PERMISSION_NOT_PROPAGATED`
const ErrorCodePrincipalDoesNotExist ErrorCode = `PRINCIPAL_DOES_NOT_EXIST`
const ErrorCodeProjectsOperationTimeout ErrorCode = `PROJECTS_OPERATION_TIMEOUT`
const ErrorCodeProviderAlreadyExists ErrorCode = `PROVIDER_ALREADY_EXISTS`
const ErrorCodeProviderDoesNotExist ErrorCode = `PROVIDER_DOES_NOT_EXIST`
const ErrorCodeProviderShareNotAccessible ErrorCode = `PROVIDER_SHARE_NOT_ACCESSIBLE`
const ErrorCodeQuotaExceeded ErrorCode = `QUOTA_EXCEEDED`
const ErrorCodeRecipientAlreadyExists ErrorCode = `RECIPIENT_ALREADY_EXISTS`
const ErrorCodeRecipientDoesNotExist ErrorCode = `RECIPIENT_DOES_NOT_EXIST`
const ErrorCodeRequestLimitExceeded ErrorCode = `REQUEST_LIMIT_EXCEEDED`
const ErrorCodeResourceAlreadyExists ErrorCode = `RESOURCE_ALREADY_EXISTS`
const ErrorCodeResourceConflict ErrorCode = `RESOURCE_CONFLICT`
const ErrorCodeResourceDoesNotExist ErrorCode = `RESOURCE_DOES_NOT_EXIST`
const ErrorCodeResourceExhausted ErrorCode = `RESOURCE_EXHAUSTED`
const ErrorCodeResourceLimitExceeded ErrorCode = `RESOURCE_LIMIT_EXCEEDED`
const ErrorCodeSchemaAlreadyExists ErrorCode = `SCHEMA_ALREADY_EXISTS`
const ErrorCodeSchemaDoesNotExist ErrorCode = `SCHEMA_DOES_NOT_EXIST`
const ErrorCodeSchemaNotEmpty ErrorCode = `SCHEMA_NOT_EMPTY`
const ErrorCodeSearchQueryTooLong ErrorCode = `SEARCH_QUERY_TOO_LONG`
const ErrorCodeSearchQueryTooShort ErrorCode = `SEARCH_QUERY_TOO_SHORT`
const ErrorCodeServiceUnderMaintenance ErrorCode = `SERVICE_UNDER_MAINTENANCE`
const ErrorCodeShareAlreadyExists ErrorCode = `SHARE_ALREADY_EXISTS`
const ErrorCodeShareDoesNotExist ErrorCode = `SHARE_DOES_NOT_EXIST`
const ErrorCodeStorageCredentialAlreadyExists ErrorCode = `STORAGE_CREDENTIAL_ALREADY_EXISTS`
const ErrorCodeStorageCredentialDoesNotExist ErrorCode = `STORAGE_CREDENTIAL_DOES_NOT_EXIST`
const ErrorCodeTableAlreadyExists ErrorCode = `TABLE_ALREADY_EXISTS`
const ErrorCodeTableDoesNotExist ErrorCode = `TABLE_DOES_NOT_EXIST`
const ErrorCodeTemporarilyUnavailable ErrorCode = `TEMPORARILY_UNAVAILABLE`
const ErrorCodeUnauthenticated ErrorCode = `UNAUTHENTICATED`
const ErrorCodeUnavailable ErrorCode = `UNAVAILABLE`
const ErrorCodeUnknown ErrorCode = `UNKNOWN`
const ErrorCodeUnparseableHttpError ErrorCode = `UNPARSEABLE_HTTP_ERROR`
const ErrorCodeWorkspaceTemporarilyUnavailable ErrorCode = `WORKSPACE_TEMPORARILY_UNAVAILABLE`

func (*ErrorCode) Set added in v0.86.0

func (f *ErrorCode) Set(v string) error

Set raw string value and validate it against allowed values

func (*ErrorCode) String added in v0.86.0

func (f *ErrorCode) String() string

String representation for fmt.Print

func (*ErrorCode) Type added in v0.86.0

func (f *ErrorCode) Type() string

Type always returns ErrorCode to satisfy [pflag.Value] interface

func (*ErrorCode) Values added in v0.86.0

func (f *ErrorCode) Values() []ErrorCode

Values returns all possible values for ErrorCode.

There is no guarantee on the order of the values in the slice.

type GetOperationRequest

type GetOperationRequest struct {
	// The name of the operation resource.
	Name string `json:"-" url:"-"`
}

type GetTestResourceRequest

type GetTestResourceRequest struct {
	// Resource ID to get
	ResourceId string `json:"-" url:"-"`
}

type LroTestingAPI

type LroTestingAPI struct {
	// contains filtered or unexported fields
}

Test service for Long Running Operations

func NewLroTesting

func NewLroTesting(client *client.DatabricksClient) *LroTestingAPI

func (*LroTestingAPI) CancelOperation

func (a *LroTestingAPI) CancelOperation(ctx context.Context, request CancelOperationRequest) error

func (*LroTestingAPI) CreateTestResource

func (*LroTestingAPI) DeleteTestResource added in v0.88.0

func (*LroTestingAPI) GetOperation

func (a *LroTestingAPI) GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error)

func (*LroTestingAPI) GetTestResource

func (a *LroTestingAPI) GetTestResource(ctx context.Context, request GetTestResourceRequest) (*TestResource, error)

type LroTestingInterface

type LroTestingInterface interface {
	CancelOperation(ctx context.Context, request CancelOperationRequest) error

	CreateTestResource(ctx context.Context, request CreateTestResourceRequest) (CreateTestResourceOperationInterface, error)

	DeleteTestResource(ctx context.Context, request DeleteTestResourceRequest) (DeleteTestResourceOperationInterface, error)

	GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error)

	// Simple method to get test resource
	GetTestResource(ctx context.Context, request GetTestResourceRequest) (*TestResource, error)
}

type Operation added in v0.86.0

type Operation struct {
	// If the value is `false`, it means the operation is still in progress. If
	// `true`, the operation is completed, and either `error` or `response` is
	// available.
	Done bool `json:"done,omitempty"`
	// The error result of the operation in case of failure or cancellation.
	Error *DatabricksServiceExceptionWithDetailsProto `json:"error,omitempty"`
	// Service-specific metadata associated with the operation. It typically
	// contains progress information and common metadata such as create time.
	// Some services might not provide such metadata. Any method that returns a
	// long-running operation should document the metadata type, if any.
	Metadata json.RawMessage `json:"metadata,omitempty"`
	// The server-assigned name, which is only unique within the same service
	// that originally returns it. If you use the default HTTP mapping, the
	// `name` should be a resource name ending with `operations/{unique_id}`.
	//
	// Note: multi-segment resource names are not yet supported in the RPC
	// framework and SDK/TF. Until that support is added, `name` must be string
	// without internal `/` separators.
	Name string `json:"name,omitempty"`
	// The normal, successful response of the operation. If the original method
	// returns no data on success, such as `Delete`, the response is
	// `google.protobuf.Empty`. If the original method is standard
	// `Get`/`Create`/`Update`, the response should be the resource. For other
	// methods, the response should have the type `XxxResponse`, where `Xxx` is
	// the original method name. For example, if the original method name is
	// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
	Response json.RawMessage `json:"response,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

This resource represents a long-running operation that is the result of a network API call.

func (Operation) MarshalJSON added in v0.86.0

func (s Operation) MarshalJSON() ([]byte, error)

func (*Operation) UnmarshalJSON added in v0.86.0

func (s *Operation) UnmarshalJSON(b []byte) error

type TestResource

type TestResource struct {
	// Unique identifier for the resource
	Id string `json:"id,omitempty"`
	// Name of the resource
	Name string `json:"name,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

Test resource for LRO operations

func (TestResource) MarshalJSON

func (s TestResource) MarshalJSON() ([]byte, error)

func (*TestResource) UnmarshalJSON

func (s *TestResource) UnmarshalJSON(b []byte) error

type TestResourceOperationMetadata

type TestResourceOperationMetadata struct {
	// Progress percentage (0-100)
	ProgressPercent int `json:"progress_percent,omitempty"`
	// ID of the resource being operated on
	ResourceId string `json:"resource_id,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

Metadata for test resource operations

func (TestResourceOperationMetadata) MarshalJSON

func (s TestResourceOperationMetadata) MarshalJSON() ([]byte, error)

func (*TestResourceOperationMetadata) UnmarshalJSON

func (s *TestResourceOperationMetadata) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL