ebs

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 30 Imported by: 6

Documentation

Overview

Package ebs provides the API client, operations, and parameter types for Amazon Elastic Block Store.

You can use the Amazon Elastic Block Store (Amazon EBS) direct APIs to create EBS snapshots, write data directly to your snapshots, read data on your snapshots, and identify the differences or changes between two snapshots. If you’re an independent software vendor (ISV) who offers backup services for Amazon EBS, the EBS direct APIs make it more efficient and cost-effective to track incremental changes on your EBS volumes through snapshots. This can be done without having to create new volumes from snapshots, and then use Amazon Elastic Compute Cloud (Amazon EC2) instances to compare the differences. You can create incremental snapshots directly from data on-premises into EBS volumes and the cloud to use for quick disaster recovery. With the ability to write and read snapshots, you can write your on-premises data to an EBS snapshot during a disaster. Then after recovery, you can restore it back to AWS or on-premises from the snapshot. You no longer need to build and maintain complex mechanisms to copy data to and from Amazon EBS. This API reference provides detailed information about the actions, data types, parameters, and errors of the EBS direct APIs. For more information about the elements that make up the EBS direct APIs, and examples of how to use them effectively, see Accessing the Contents of an EBS Snapshot (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html) in the Amazon Elastic Compute Cloud User Guide. For more information about the supported AWS Regions, endpoints, and service quotas for the EBS direct APIs, see Amazon Elastic Block Store Endpoints and Quotas (https://docs.aws.amazon.com/general/latest/gr/ebs-service.html) in the AWS General Reference.

Index

Constants

View Source
const ServiceAPIVersion = "2019-11-02"
View Source
const ServiceID = "EBS"

Variables

This section is empty.

Functions

func NewDefaultEndpointResolver

func NewDefaultEndpointResolver() *internalendpoints.Resolver

NewDefaultEndpointResolver constructs a new service endpoint resolver

func WithAPIOptions added in v1.0.0

func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options)

WithAPIOptions returns a functional option for setting the Client's APIOptions option.

func WithEndpointResolver

func WithEndpointResolver(v EndpointResolver) func(*Options)

WithEndpointResolver returns a functional option for setting the Client's EndpointResolver option.

Types

type Client

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

Client provides the API client to make operations call for Amazon Elastic Block Store.

func New

func New(options Options, optFns ...func(*Options)) *Client

New returns an initialized Client based on the functional options. Provide additional functional options to further configure the behavior of the client, such as changing the client's endpoint or adding custom middleware behavior.

func NewFromConfig

func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client

NewFromConfig returns a new client from the provided config.

func (*Client) CompleteSnapshot

func (c *Client) CompleteSnapshot(ctx context.Context, params *CompleteSnapshotInput, optFns ...func(*Options)) (*CompleteSnapshotOutput, error)

Seals and completes the snapshot after all of the required blocks of data have been written to it. Completing the snapshot changes the status to completed. You cannot write new blocks to a snapshot after it has been completed.

func (*Client) GetSnapshotBlock

func (c *Client) GetSnapshotBlock(ctx context.Context, params *GetSnapshotBlockInput, optFns ...func(*Options)) (*GetSnapshotBlockOutput, error)

Returns the data in a block in an Amazon Elastic Block Store snapshot.

func (*Client) ListChangedBlocks

func (c *Client) ListChangedBlocks(ctx context.Context, params *ListChangedBlocksInput, optFns ...func(*Options)) (*ListChangedBlocksOutput, error)

Returns information about the blocks that are different between two Amazon Elastic Block Store snapshots of the same volume/snapshot lineage.

func (*Client) ListSnapshotBlocks

func (c *Client) ListSnapshotBlocks(ctx context.Context, params *ListSnapshotBlocksInput, optFns ...func(*Options)) (*ListSnapshotBlocksOutput, error)

Returns information about the blocks in an Amazon Elastic Block Store snapshot.

func (*Client) PutSnapshotBlock

func (c *Client) PutSnapshotBlock(ctx context.Context, params *PutSnapshotBlockInput, optFns ...func(*Options)) (*PutSnapshotBlockOutput, error)

Writes a block of data to a snapshot. If the specified block contains data, the existing data is overwritten. The target snapshot must be in the pending state. Data written to a snapshot must be aligned with 512-byte sectors.

func (*Client) StartSnapshot

func (c *Client) StartSnapshot(ctx context.Context, params *StartSnapshotInput, optFns ...func(*Options)) (*StartSnapshotOutput, error)

Creates a new Amazon EBS snapshot. The new snapshot enters the pending state after the request completes. After creating the snapshot, use PutSnapshotBlock (https://docs.aws.amazon.com/ebs/latest/APIReference/API_PutSnapshotBlock.html) to write blocks of data to the snapshot.

type CompleteSnapshotInput

type CompleteSnapshotInput struct {

	// The number of blocks that were written to the snapshot.
	//
	// This member is required.
	ChangedBlocksCount *int32

	// The ID of the snapshot.
	//
	// This member is required.
	SnapshotId *string

	// An aggregated Base-64 SHA256 checksum based on the checksums of each written
	// block. To generate the aggregated checksum using the linear aggregation method,
	// arrange the checksums for each written block in ascending order of their block
	// index, concatenate them to form a single string, and then generate the checksum
	// on the entire string using the SHA256 algorithm.
	Checksum *string

	// The aggregation method used to generate the checksum. Currently, the only
	// supported aggregation method is LINEAR.
	ChecksumAggregationMethod types.ChecksumAggregationMethod

	// The algorithm used to generate the checksum. Currently, the only supported
	// algorithm is SHA256.
	ChecksumAlgorithm types.ChecksumAlgorithm
}

type CompleteSnapshotOutput

type CompleteSnapshotOutput struct {

	// The status of the snapshot.
	Status types.Status

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

type EndpointResolver

type EndpointResolver interface {
	ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
}

EndpointResolver interface for resolving service endpoints.

func EndpointResolverFromURL added in v1.1.0

func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver

EndpointResolverFromURL returns an EndpointResolver configured using the provided endpoint url. By default, the resolved endpoint resolver uses the client region as signing region, and the endpoint source is set to EndpointSourceCustom.You can provide functional options to configure endpoint values for the resolved endpoint.

type EndpointResolverFunc

type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)

EndpointResolverFunc is a helper utility that wraps a function so it satisfies the EndpointResolver interface. This is useful when you want to add additional endpoint resolving logic, or stub out specific endpoints with custom values.

func (EndpointResolverFunc) ResolveEndpoint

func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error)

type EndpointResolverOptions added in v0.29.0

type EndpointResolverOptions = internalendpoints.Options

EndpointResolverOptions is the service endpoint resolver options

type GetSnapshotBlockInput

type GetSnapshotBlockInput struct {

	// The block index of the block from which to get data. Obtain the BlockIndex by
	// running the ListChangedBlocks or ListSnapshotBlocks operations.
	//
	// This member is required.
	BlockIndex *int32

	// The block token of the block from which to get data. Obtain the BlockToken by
	// running the ListChangedBlocks or ListSnapshotBlocks operations.
	//
	// This member is required.
	BlockToken *string

	// The ID of the snapshot containing the block from which to get data.
	//
	// This member is required.
	SnapshotId *string
}

type GetSnapshotBlockOutput

type GetSnapshotBlockOutput struct {

	// The data content of the block.
	BlockData io.ReadCloser

	// The checksum generated for the block, which is Base64 encoded.
	Checksum *string

	// The algorithm used to generate the checksum for the block, such as SHA256.
	ChecksumAlgorithm types.ChecksumAlgorithm

	// The size of the data in the block.
	DataLength *int32

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type HTTPSignerV4

type HTTPSignerV4 interface {
	SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
}

type IdempotencyTokenProvider

type IdempotencyTokenProvider interface {
	GetIdempotencyToken() (string, error)
}

IdempotencyTokenProvider interface for providing idempotency token

type ListChangedBlocksAPIClient added in v0.30.0

type ListChangedBlocksAPIClient interface {
	ListChangedBlocks(context.Context, *ListChangedBlocksInput, ...func(*Options)) (*ListChangedBlocksOutput, error)
}

ListChangedBlocksAPIClient is a client that implements the ListChangedBlocks operation.

type ListChangedBlocksInput

type ListChangedBlocksInput struct {

	// The ID of the second snapshot to use for the comparison. The SecondSnapshotId
	// parameter must be specified with a FirstSnapshotID parameter; otherwise, an
	// error occurs.
	//
	// This member is required.
	SecondSnapshotId *string

	// The ID of the first snapshot to use for the comparison. The FirstSnapshotID
	// parameter must be specified with a SecondSnapshotId parameter; otherwise, an
	// error occurs.
	FirstSnapshotId *string

	// The number of results to return.
	MaxResults *int32

	// The token to request the next page of results.
	NextToken *string

	// The block index from which the comparison should start. The list in the response
	// will start from this block index or the next valid block index in the snapshots.
	StartingBlockIndex *int32
}

type ListChangedBlocksOutput

type ListChangedBlocksOutput struct {

	// The size of the block.
	BlockSize *int32

	// An array of objects containing information about the changed blocks.
	ChangedBlocks []types.ChangedBlock

	// The time when the BlockToken expires.
	ExpiryTime *time.Time

	// The token to use to retrieve the next page of results. This value is null when
	// there are no more results to return.
	NextToken *string

	// The size of the volume in GB.
	VolumeSize *int64

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

type ListChangedBlocksPaginator added in v0.30.0

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

ListChangedBlocksPaginator is a paginator for ListChangedBlocks

func NewListChangedBlocksPaginator added in v0.30.0

func NewListChangedBlocksPaginator(client ListChangedBlocksAPIClient, params *ListChangedBlocksInput, optFns ...func(*ListChangedBlocksPaginatorOptions)) *ListChangedBlocksPaginator

NewListChangedBlocksPaginator returns a new ListChangedBlocksPaginator

func (*ListChangedBlocksPaginator) HasMorePages added in v0.30.0

func (p *ListChangedBlocksPaginator) HasMorePages() bool

HasMorePages returns a boolean indicating whether more pages are available

func (*ListChangedBlocksPaginator) NextPage added in v0.30.0

func (p *ListChangedBlocksPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListChangedBlocksOutput, error)

NextPage retrieves the next ListChangedBlocks page.

type ListChangedBlocksPaginatorOptions added in v0.30.0

type ListChangedBlocksPaginatorOptions struct {
	// The number of results to return.
	Limit int32

	// Set to true if pagination should stop if the service returns a pagination token
	// that matches the most recent token provided to the service.
	StopOnDuplicateToken bool
}

ListChangedBlocksPaginatorOptions is the paginator options for ListChangedBlocks

type ListSnapshotBlocksAPIClient added in v0.30.0

type ListSnapshotBlocksAPIClient interface {
	ListSnapshotBlocks(context.Context, *ListSnapshotBlocksInput, ...func(*Options)) (*ListSnapshotBlocksOutput, error)
}

ListSnapshotBlocksAPIClient is a client that implements the ListSnapshotBlocks operation.

type ListSnapshotBlocksInput

type ListSnapshotBlocksInput struct {

	// The ID of the snapshot from which to get block indexes and block tokens.
	//
	// This member is required.
	SnapshotId *string

	// The number of results to return.
	MaxResults *int32

	// The token to request the next page of results.
	NextToken *string

	// The block index from which the list should start. The list in the response will
	// start from this block index or the next valid block index in the snapshot.
	StartingBlockIndex *int32
}

type ListSnapshotBlocksOutput

type ListSnapshotBlocksOutput struct {

	// The size of the block.
	BlockSize *int32

	// An array of objects containing information about the blocks.
	Blocks []types.Block

	// The time when the BlockToken expires.
	ExpiryTime *time.Time

	// The token to use to retrieve the next page of results. This value is null when
	// there are no more results to return.
	NextToken *string

	// The size of the volume in GB.
	VolumeSize *int64

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

type ListSnapshotBlocksPaginator added in v0.30.0

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

ListSnapshotBlocksPaginator is a paginator for ListSnapshotBlocks

func NewListSnapshotBlocksPaginator added in v0.30.0

func NewListSnapshotBlocksPaginator(client ListSnapshotBlocksAPIClient, params *ListSnapshotBlocksInput, optFns ...func(*ListSnapshotBlocksPaginatorOptions)) *ListSnapshotBlocksPaginator

NewListSnapshotBlocksPaginator returns a new ListSnapshotBlocksPaginator

func (*ListSnapshotBlocksPaginator) HasMorePages added in v0.30.0

func (p *ListSnapshotBlocksPaginator) HasMorePages() bool

HasMorePages returns a boolean indicating whether more pages are available

func (*ListSnapshotBlocksPaginator) NextPage added in v0.30.0

func (p *ListSnapshotBlocksPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSnapshotBlocksOutput, error)

NextPage retrieves the next ListSnapshotBlocks page.

type ListSnapshotBlocksPaginatorOptions added in v0.30.0

type ListSnapshotBlocksPaginatorOptions struct {
	// The number of results to return.
	Limit int32

	// Set to true if pagination should stop if the service returns a pagination token
	// that matches the most recent token provided to the service.
	StopOnDuplicateToken bool
}

ListSnapshotBlocksPaginatorOptions is the paginator options for ListSnapshotBlocks

type Options

type Options struct {
	// Set of options to modify how an operation is invoked. These apply to all
	// operations invoked for this client. Use functional options on operation call to
	// modify this list for per operation behavior.
	APIOptions []func(*middleware.Stack) error

	// Configures the events that will be sent to the configured logger.
	ClientLogMode aws.ClientLogMode

	// The credentials object to use when signing requests.
	Credentials aws.CredentialsProvider

	// The endpoint options to be used when attempting to resolve an endpoint.
	EndpointOptions EndpointResolverOptions

	// The service endpoint resolver.
	EndpointResolver EndpointResolver

	// Signature Version 4 (SigV4) Signer
	HTTPSignerV4 HTTPSignerV4

	// Provides idempotency tokens values that will be automatically populated into
	// idempotent API operations.
	IdempotencyTokenProvider IdempotencyTokenProvider

	// The logger writer interface to write logging messages to.
	Logger logging.Logger

	// The region to send requests to. (Required)
	Region string

	// Retryer guides how HTTP requests should be retried in case of recoverable
	// failures. When nil the API client will use a default retryer.
	Retryer aws.Retryer

	// The HTTP client to invoke API calls with. Defaults to client's default HTTP
	// implementation if nil.
	HTTPClient HTTPClient
}

func (Options) Copy

func (o Options) Copy() Options

Copy creates a clone where the APIOptions list is deep copied.

type PutSnapshotBlockInput

type PutSnapshotBlockInput struct {

	// The data to write to the block. The block data is not signed as part of the
	// Signature Version 4 signing process. As a result, you must generate and provide
	// a Base64-encoded SHA256 checksum for the block data using the x-amz-Checksum
	// header. Also, you must specify the checksum algorithm using the
	// x-amz-Checksum-Algorithm header. The checksum that you provide is part of the
	// Signature Version 4 signing process. It is validated against a checksum
	// generated by Amazon EBS to ensure the validity and authenticity of the data. If
	// the checksums do not correspond, the request fails. For more information, see
	// Using checksums with the EBS direct APIs
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-checksums)
	// in the Amazon Elastic Compute Cloud User Guide.
	//
	// This member is required.
	BlockData io.Reader

	// The block index of the block in which to write the data. A block index is a
	// logical index in units of 512 KiB blocks. To identify the block index, divide
	// the logical offset of the data in the logical volume by the block size (logical
	// offset of data/524288). The logical offset of the data must be 512 KiB aligned.
	//
	// This member is required.
	BlockIndex *int32

	// A Base64-encoded SHA256 checksum of the data. Only SHA256 checksums are
	// supported.
	//
	// This member is required.
	Checksum *string

	// The algorithm used to generate the checksum. Currently, the only supported
	// algorithm is SHA256.
	//
	// This member is required.
	ChecksumAlgorithm types.ChecksumAlgorithm

	// The size of the data to write to the block, in bytes. Currently, the only
	// supported size is 524288. Valid values: 524288
	//
	// This member is required.
	DataLength *int32

	// The ID of the snapshot.
	//
	// This member is required.
	SnapshotId *string

	// The progress of the write process, as a percentage.
	Progress *int32
}

type PutSnapshotBlockOutput

type PutSnapshotBlockOutput struct {

	// The SHA256 checksum generated for the block data by Amazon EBS.
	Checksum *string

	// The algorithm used by Amazon EBS to generate the checksum.
	ChecksumAlgorithm types.ChecksumAlgorithm

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

type ResolveEndpoint

type ResolveEndpoint struct {
	Resolver EndpointResolver
	Options  EndpointResolverOptions
}

func (*ResolveEndpoint) HandleSerialize

func (*ResolveEndpoint) ID

func (*ResolveEndpoint) ID() string

type StartSnapshotInput

type StartSnapshotInput struct {

	// The size of the volume, in GiB. The maximum size is 16384 GiB (16 TiB).
	//
	// This member is required.
	VolumeSize *int64

	// A unique, case-sensitive identifier that you provide to ensure the idempotency
	// of the request. Idempotency ensures that an API request completes only once.
	// With an idempotent request, if the original request completes successfully. The
	// subsequent retries with the same client token return the result from the
	// original successful request and they have no additional effect. If you do not
	// specify a client token, one is automatically generated by the AWS SDK. For more
	// information, see  Idempotency for StartSnapshot API
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-direct-api-idempotency.html)
	// in the Amazon Elastic Compute Cloud User Guide.
	ClientToken *string

	// A description for the snapshot.
	Description *string

	// Indicates whether to encrypt the snapshot. To create an encrypted snapshot,
	// specify true. To create an unencrypted snapshot, omit this parameter. If you
	// specify a value for ParentSnapshotId, omit this parameter. If you specify true,
	// the snapshot is encrypted using the CMK specified using the KmsKeyArn parameter.
	// If no value is specified for KmsKeyArn, the default CMK for your account is
	// used. If no default CMK has been specified for your account, the AWS managed CMK
	// is used. To set a default CMK for your account, use  ModifyEbsDefaultKmsKeyId
	// (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyEbsDefaultKmsKeyId.html).
	// If your account is enabled for encryption by default, you cannot set this
	// parameter to false. In this case, you can omit this parameter. For more
	// information, see  Using encryption
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-accessing-snapshot.html#ebsapis-using-encryption)
	// in the Amazon Elastic Compute Cloud User Guide.
	Encrypted *bool

	// The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS)
	// customer master key (CMK) to be used to encrypt the snapshot. If you do not
	// specify a CMK, the default AWS managed CMK is used. If you specify a
	// ParentSnapshotId, omit this parameter; the snapshot will be encrypted using the
	// same CMK that was used to encrypt the parent snapshot. If Encrypted is set to
	// true, you must specify a CMK ARN.
	KmsKeyArn *string

	// The ID of the parent snapshot. If there is no parent snapshot, or if you are
	// creating the first snapshot for an on-premises volume, omit this parameter. If
	// your account is enabled for encryption by default, you cannot use an unencrypted
	// snapshot as a parent snapshot. You must first create an encrypted copy of the
	// parent snapshot using CopySnapshot
	// (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopySnapshot.html).
	ParentSnapshotId *string

	// The tags to apply to the snapshot.
	Tags []types.Tag

	// The amount of time (in minutes) after which the snapshot is automatically
	// cancelled if:
	//
	// * No blocks are written to the snapshot.
	//
	// * The snapshot is not
	// completed after writing the last block of data.
	//
	// If no value is specified, the
	// timeout defaults to 60 minutes.
	Timeout *int32
}

type StartSnapshotOutput

type StartSnapshotOutput struct {

	// The size of the blocks in the snapshot, in bytes.
	BlockSize *int32

	// The description of the snapshot.
	Description *string

	// The Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS)
	// customer master key (CMK) used to encrypt the snapshot.
	KmsKeyArn *string

	// The AWS account ID of the snapshot owner.
	OwnerId *string

	// The ID of the parent snapshot.
	ParentSnapshotId *string

	// The ID of the snapshot.
	SnapshotId *string

	// The timestamp when the snapshot was created.
	StartTime *time.Time

	// The status of the snapshot.
	Status types.Status

	// The tags applied to the snapshot. You can specify up to 50 tags per snapshot.
	// For more information, see  Tagging your Amazon EC2 resources
	// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) in the
	// Amazon Elastic Compute Cloud User Guide.
	Tags []types.Tag

	// The size of the volume, in GiB.
	VolumeSize *int64

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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