A client to Cloud Storage API
The interfaces provided are listed below, along with usage samples.
StorageClient
Service Description: ## API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs.
Resources are named as follows: - Projects are referred to as they are defined by the Resource
Manager API, using strings like projects/123456
or projects/my-string-id
. - Buckets are named
using string names of the form: projects/{project}/buckets/{bucket}
For globally unique
buckets, _
may be substituted for the project. - Objects are uniquely identified by their name
along with the name of the bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest { bucket: 'projects/_/buckets/my-bucket' object: 'my-object' } Note that
object names can contain /
characters, which are treated as any other character (no special
directory semantics).
Sample for StorageClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageClient storageClient = StorageClient.create()) {
BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
storageClient.deleteBucket(name);
}
Classes
BidiWriteObjectRequest
Request message for BidiWriteObject.
Protobuf type google.storage.v2.BidiWriteObjectRequest
BidiWriteObjectRequest.Builder
Request message for BidiWriteObject.
Protobuf type google.storage.v2.BidiWriteObjectRequest
BidiWriteObjectResponse
Response message for BidiWriteObject.
Protobuf type google.storage.v2.BidiWriteObjectResponse
BidiWriteObjectResponse.Builder
Response message for BidiWriteObject.
Protobuf type google.storage.v2.BidiWriteObjectResponse
Bucket
A bucket.
Protobuf type google.storage.v2.Bucket
Bucket.Autoclass
Configuration for a bucket's Autoclass feature.
Protobuf type google.storage.v2.Bucket.Autoclass
Bucket.Autoclass.Builder
Configuration for a bucket's Autoclass feature.
Protobuf type google.storage.v2.Bucket.Autoclass
Bucket.Billing
Billing properties of a bucket.
Protobuf type google.storage.v2.Bucket.Billing
Bucket.Billing.Builder
Billing properties of a bucket.
Protobuf type google.storage.v2.Bucket.Billing
Bucket.Builder
A bucket.
Protobuf type google.storage.v2.Bucket
Bucket.Cors
Cross-Origin Response sharing (CORS) properties for a bucket. For more on Cloud Storage and CORS, see https://cloud.google.com/storage/docs/cross-origin. For more on CORS in general, see https://tools.ietf.org/html/rfc6454.
Protobuf type google.storage.v2.Bucket.Cors
Bucket.Cors.Builder
Cross-Origin Response sharing (CORS) properties for a bucket. For more on Cloud Storage and CORS, see https://cloud.google.com/storage/docs/cross-origin. For more on CORS in general, see https://tools.ietf.org/html/rfc6454.
Protobuf type google.storage.v2.Bucket.Cors
Bucket.CustomPlacementConfig
Configuration for Custom Dual Regions. It should specify precisely two eligible regions within the same Multiregion. More information on regions may be found https://cloud.google.com/storage/docs/locations.
Protobuf type google.storage.v2.Bucket.CustomPlacementConfig
Bucket.CustomPlacementConfig.Builder
Configuration for Custom Dual Regions. It should specify precisely two eligible regions within the same Multiregion. More information on regions may be found https://cloud.google.com/storage/docs/locations.
Protobuf type google.storage.v2.Bucket.CustomPlacementConfig
Bucket.Encryption
Encryption properties of a bucket.
Protobuf type google.storage.v2.Bucket.Encryption
Bucket.Encryption.Builder
Encryption properties of a bucket.
Protobuf type google.storage.v2.Bucket.Encryption
Bucket.IamConfig
Bucket restriction options.
Protobuf type google.storage.v2.Bucket.IamConfig
Bucket.IamConfig.Builder
Bucket restriction options.
Protobuf type google.storage.v2.Bucket.IamConfig
Bucket.IamConfig.UniformBucketLevelAccess
Settings for Uniform Bucket level access. See https://cloud.google.com/storage/docs/uniform-bucket-level-access.
Protobuf type google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess
Bucket.IamConfig.UniformBucketLevelAccess.Builder
Settings for Uniform Bucket level access. See https://cloud.google.com/storage/docs/uniform-bucket-level-access.
Protobuf type google.storage.v2.Bucket.IamConfig.UniformBucketLevelAccess
Bucket.Lifecycle
Lifecycle properties of a bucket. For more information, see https://cloud.google.com/storage/docs/lifecycle.
Protobuf type google.storage.v2.Bucket.Lifecycle
Bucket.Lifecycle.Builder
Lifecycle properties of a bucket. For more information, see https://cloud.google.com/storage/docs/lifecycle.
Protobuf type google.storage.v2.Bucket.Lifecycle
Bucket.Lifecycle.Rule
A lifecycle Rule, combining an action to take on an object and a condition which will trigger that action.
Protobuf type google.storage.v2.Bucket.Lifecycle.Rule
Bucket.Lifecycle.Rule.Action
An action to take on an object.
Protobuf type google.storage.v2.Bucket.Lifecycle.Rule.Action
Bucket.Lifecycle.Rule.Action.Builder
An action to take on an object.
Protobuf type google.storage.v2.Bucket.Lifecycle.Rule.Action
Bucket.Lifecycle.Rule.Builder
A lifecycle Rule, combining an action to take on an object and a condition which will trigger that action.
Protobuf type google.storage.v2.Bucket.Lifecycle.Rule
Bucket.Lifecycle.Rule.Condition
A condition of an object which triggers some action.
Protobuf type google.storage.v2.Bucket.Lifecycle.Rule.Condition
Bucket.Lifecycle.Rule.Condition.Builder
A condition of an object which triggers some action.
Protobuf type google.storage.v2.Bucket.Lifecycle.Rule.Condition
Bucket.Logging
Logging-related properties of a bucket.
Protobuf type google.storage.v2.Bucket.Logging
Bucket.Logging.Builder
Logging-related properties of a bucket.
Protobuf type google.storage.v2.Bucket.Logging
Bucket.RetentionPolicy
Retention policy properties of a bucket.
Protobuf type google.storage.v2.Bucket.RetentionPolicy
Bucket.RetentionPolicy.Builder
Retention policy properties of a bucket.
Protobuf type google.storage.v2.Bucket.RetentionPolicy
Bucket.SoftDeletePolicy
Soft delete policy properties of a bucket.
Protobuf type google.storage.v2.Bucket.SoftDeletePolicy
Bucket.SoftDeletePolicy.Builder
Soft delete policy properties of a bucket.
Protobuf type google.storage.v2.Bucket.SoftDeletePolicy
Bucket.Versioning
Properties of a bucket related to versioning. For more on Cloud Storage versioning, see https://cloud.google.com/storage/docs/object-versioning.
Protobuf type google.storage.v2.Bucket.Versioning
Bucket.Versioning.Builder
Properties of a bucket related to versioning. For more on Cloud Storage versioning, see https://cloud.google.com/storage/docs/object-versioning.
Protobuf type google.storage.v2.Bucket.Versioning
Bucket.Website
Properties of a bucket related to accessing the contents as a static website. For more on hosting a static website via Cloud Storage, see https://cloud.google.com/storage/docs/hosting-static-website.
Protobuf type google.storage.v2.Bucket.Website
Bucket.Website.Builder
Properties of a bucket related to accessing the contents as a static website. For more on hosting a static website via Cloud Storage, see https://cloud.google.com/storage/docs/hosting-static-website.
Protobuf type google.storage.v2.Bucket.Website
BucketAccessControl
An access-control entry.
Protobuf type google.storage.v2.BucketAccessControl
BucketAccessControl.Builder
An access-control entry.
Protobuf type google.storage.v2.BucketAccessControl
BucketName
BucketName.Builder
Builder for projects/{project}/buckets/{bucket}.
CancelResumableWriteRequest
Message for canceling an in-progress resumable upload.
upload_id
must be set.
Protobuf type google.storage.v2.CancelResumableWriteRequest
CancelResumableWriteRequest.Builder
Message for canceling an in-progress resumable upload.
upload_id
must be set.
Protobuf type google.storage.v2.CancelResumableWriteRequest
CancelResumableWriteResponse
Empty response message for canceling an in-progress resumable upload, will be extended as needed.
Protobuf type google.storage.v2.CancelResumableWriteResponse
CancelResumableWriteResponse.Builder
Empty response message for canceling an in-progress resumable upload, will be extended as needed.
Protobuf type google.storage.v2.CancelResumableWriteResponse
ChecksummedData
Message used to convey content being read or written, along with an optional checksum.
Protobuf type google.storage.v2.ChecksummedData
ChecksummedData.Builder
Message used to convey content being read or written, along with an optional checksum.
Protobuf type google.storage.v2.ChecksummedData
CommonObjectRequestParams
Parameters that can be passed to any object request.
Protobuf type google.storage.v2.CommonObjectRequestParams
CommonObjectRequestParams.Builder
Parameters that can be passed to any object request.
Protobuf type google.storage.v2.CommonObjectRequestParams
ComposeObjectRequest
Request message for ComposeObject.
Protobuf type google.storage.v2.ComposeObjectRequest
ComposeObjectRequest.Builder
Request message for ComposeObject.
Protobuf type google.storage.v2.ComposeObjectRequest
ComposeObjectRequest.SourceObject
Description of a source object for a composition request.
Protobuf type google.storage.v2.ComposeObjectRequest.SourceObject
ComposeObjectRequest.SourceObject.Builder
Description of a source object for a composition request.
Protobuf type google.storage.v2.ComposeObjectRequest.SourceObject
ComposeObjectRequest.SourceObject.ObjectPreconditions
Preconditions for a source object of a composition request.
Protobuf type google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions
ComposeObjectRequest.SourceObject.ObjectPreconditions.Builder
Preconditions for a source object of a composition request.
Protobuf type
google.storage.v2.ComposeObjectRequest.SourceObject.ObjectPreconditions
ContentRange
Specifies a requested range of bytes to download.
Protobuf type google.storage.v2.ContentRange
ContentRange.Builder
Specifies a requested range of bytes to download.
Protobuf type google.storage.v2.ContentRange
CreateBucketRequest
Request message for CreateBucket.
Protobuf type google.storage.v2.CreateBucketRequest
CreateBucketRequest.Builder
Request message for CreateBucket.
Protobuf type google.storage.v2.CreateBucketRequest
CreateHmacKeyRequest
Request message for CreateHmacKey.
Protobuf type google.storage.v2.CreateHmacKeyRequest
CreateHmacKeyRequest.Builder
Request message for CreateHmacKey.
Protobuf type google.storage.v2.CreateHmacKeyRequest
CreateHmacKeyResponse
Create hmac response. The only time the secret for an HMAC will be returned.
Protobuf type google.storage.v2.CreateHmacKeyResponse
CreateHmacKeyResponse.Builder
Create hmac response. The only time the secret for an HMAC will be returned.
Protobuf type google.storage.v2.CreateHmacKeyResponse
CreateNotificationConfigRequest
Request message for CreateNotificationConfig.
Protobuf type google.storage.v2.CreateNotificationConfigRequest
CreateNotificationConfigRequest.Builder
Request message for CreateNotificationConfig.
Protobuf type google.storage.v2.CreateNotificationConfigRequest
CryptoKeyName
CryptoKeyName.Builder
Builder for projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}.
CustomerEncryption
Describes the Customer-Supplied Encryption Key mechanism used to store an Object's data at rest.
Protobuf type google.storage.v2.CustomerEncryption
CustomerEncryption.Builder
Describes the Customer-Supplied Encryption Key mechanism used to store an Object's data at rest.
Protobuf type google.storage.v2.CustomerEncryption
DeleteBucketRequest
Request message for DeleteBucket.
Protobuf type google.storage.v2.DeleteBucketRequest
DeleteBucketRequest.Builder
Request message for DeleteBucket.
Protobuf type google.storage.v2.DeleteBucketRequest
DeleteHmacKeyRequest
Request object to delete a given HMAC key.
Protobuf type google.storage.v2.DeleteHmacKeyRequest
DeleteHmacKeyRequest.Builder
Request object to delete a given HMAC key.
Protobuf type google.storage.v2.DeleteHmacKeyRequest
DeleteNotificationConfigRequest
Request message for DeleteNotificationConfig.
Protobuf type google.storage.v2.DeleteNotificationConfigRequest
DeleteNotificationConfigRequest.Builder
Request message for DeleteNotificationConfig.
Protobuf type google.storage.v2.DeleteNotificationConfigRequest
DeleteObjectRequest
Message for deleting an object.
bucket
and object
must be set.
Protobuf type google.storage.v2.DeleteObjectRequest
DeleteObjectRequest.Builder
Message for deleting an object.
bucket
and object
must be set.
Protobuf type google.storage.v2.DeleteObjectRequest
GetBucketRequest
Request message for GetBucket.
Protobuf type google.storage.v2.GetBucketRequest
GetBucketRequest.Builder
Request message for GetBucket.
Protobuf type google.storage.v2.GetBucketRequest
GetHmacKeyRequest
Request object to get metadata on a given HMAC key.
Protobuf type google.storage.v2.GetHmacKeyRequest
GetHmacKeyRequest.Builder
Request object to get metadata on a given HMAC key.
Protobuf type google.storage.v2.GetHmacKeyRequest
GetNotificationConfigRequest
Request message for GetNotificationConfig.
Protobuf type google.storage.v2.GetNotificationConfigRequest
GetNotificationConfigRequest.Builder
Request message for GetNotificationConfig.
Protobuf type google.storage.v2.GetNotificationConfigRequest
GetObjectRequest
Request message for GetObject.
Protobuf type google.storage.v2.GetObjectRequest
GetObjectRequest.Builder
Request message for GetObject.
Protobuf type google.storage.v2.GetObjectRequest
GetServiceAccountRequest
Request message for GetServiceAccount.
Protobuf type google.storage.v2.GetServiceAccountRequest
GetServiceAccountRequest.Builder
Request message for GetServiceAccount.
Protobuf type google.storage.v2.GetServiceAccountRequest
HmacKeyMetadata
Hmac Key Metadata, which includes all information other than the secret.
Protobuf type google.storage.v2.HmacKeyMetadata
HmacKeyMetadata.Builder
Hmac Key Metadata, which includes all information other than the secret.
Protobuf type google.storage.v2.HmacKeyMetadata
ListBucketsRequest
Request message for ListBuckets.
Protobuf type google.storage.v2.ListBucketsRequest
ListBucketsRequest.Builder
Request message for ListBuckets.
Protobuf type google.storage.v2.ListBucketsRequest
ListBucketsResponse
The result of a call to Buckets.ListBuckets
Protobuf type google.storage.v2.ListBucketsResponse
ListBucketsResponse.Builder
The result of a call to Buckets.ListBuckets
Protobuf type google.storage.v2.ListBucketsResponse
ListHmacKeysRequest
Request to fetch a list of HMAC keys under a given project.
Protobuf type google.storage.v2.ListHmacKeysRequest
ListHmacKeysRequest.Builder
Request to fetch a list of HMAC keys under a given project.
Protobuf type google.storage.v2.ListHmacKeysRequest
ListHmacKeysResponse
Hmac key list response with next page information.
Protobuf type google.storage.v2.ListHmacKeysResponse
ListHmacKeysResponse.Builder
Hmac key list response with next page information.
Protobuf type google.storage.v2.ListHmacKeysResponse
ListNotificationConfigsRequest
Request message for ListNotifications.
Protobuf type google.storage.v2.ListNotificationConfigsRequest
ListNotificationConfigsRequest.Builder
Request message for ListNotifications.
Protobuf type google.storage.v2.ListNotificationConfigsRequest
ListNotificationConfigsResponse
The result of a call to ListNotificationConfigs
Protobuf type google.storage.v2.ListNotificationConfigsResponse
ListNotificationConfigsResponse.Builder
The result of a call to ListNotificationConfigs
Protobuf type google.storage.v2.ListNotificationConfigsResponse
ListObjectsRequest
Request message for ListObjects.
Protobuf type google.storage.v2.ListObjectsRequest
ListObjectsRequest.Builder
Request message for ListObjects.
Protobuf type google.storage.v2.ListObjectsRequest
ListObjectsResponse
The result of a call to Objects.ListObjects
Protobuf type google.storage.v2.ListObjectsResponse
ListObjectsResponse.Builder
The result of a call to Objects.ListObjects
Protobuf type google.storage.v2.ListObjectsResponse
LockBucketRetentionPolicyRequest
Request message for LockBucketRetentionPolicyRequest.
Protobuf type google.storage.v2.LockBucketRetentionPolicyRequest
LockBucketRetentionPolicyRequest.Builder
Request message for LockBucketRetentionPolicyRequest.
Protobuf type google.storage.v2.LockBucketRetentionPolicyRequest
NotificationConfig
A directive to publish Pub/Sub notifications upon changes to a bucket.
Protobuf type google.storage.v2.NotificationConfig
NotificationConfig.Builder
A directive to publish Pub/Sub notifications upon changes to a bucket.
Protobuf type google.storage.v2.NotificationConfig
NotificationConfigName
NotificationConfigName.Builder
Builder for projects/{project}/buckets/{bucket}/notificationConfigs/{notification_config}.
Object
An object.
Protobuf type google.storage.v2.Object
Object.Builder
An object.
Protobuf type google.storage.v2.Object
ObjectAccessControl
An access-control entry.
Protobuf type google.storage.v2.ObjectAccessControl
ObjectAccessControl.Builder
An access-control entry.
Protobuf type google.storage.v2.ObjectAccessControl
ObjectChecksums
Message used for storing full (not subrange) object checksums.
Protobuf type google.storage.v2.ObjectChecksums
ObjectChecksums.Builder
Message used for storing full (not subrange) object checksums.
Protobuf type google.storage.v2.ObjectChecksums
Owner
The owner of a specific resource.
Protobuf type google.storage.v2.Owner
Owner.Builder
The owner of a specific resource.
Protobuf type google.storage.v2.Owner
ProjectName
ProjectName.Builder
Builder for projects/{project}.
ProjectTeam
Represents the Viewers, Editors, or Owners of a given project.
Protobuf type google.storage.v2.ProjectTeam
ProjectTeam.Builder
Represents the Viewers, Editors, or Owners of a given project.
Protobuf type google.storage.v2.ProjectTeam
QueryWriteStatusRequest
Request object for QueryWriteStatus
.
Protobuf type google.storage.v2.QueryWriteStatusRequest
QueryWriteStatusRequest.Builder
Request object for QueryWriteStatus
.
Protobuf type google.storage.v2.QueryWriteStatusRequest
QueryWriteStatusResponse
Response object for QueryWriteStatus
.
Protobuf type google.storage.v2.QueryWriteStatusResponse
QueryWriteStatusResponse.Builder
Response object for QueryWriteStatus
.
Protobuf type google.storage.v2.QueryWriteStatusResponse
ReadObjectRequest
Request message for ReadObject.
Protobuf type google.storage.v2.ReadObjectRequest
ReadObjectRequest.Builder
Request message for ReadObject.
Protobuf type google.storage.v2.ReadObjectRequest
ReadObjectResponse
Response message for ReadObject.
Protobuf type google.storage.v2.ReadObjectResponse
ReadObjectResponse.Builder
Response message for ReadObject.
Protobuf type google.storage.v2.ReadObjectResponse
RestoreObjectRequest
Message for restoring an object.
bucket
, object
, and generation
must be set.
Protobuf type google.storage.v2.RestoreObjectRequest
RestoreObjectRequest.Builder
Message for restoring an object.
bucket
, object
, and generation
must be set.
Protobuf type google.storage.v2.RestoreObjectRequest
RewriteObjectRequest
Request message for RewriteObject. If the source object is encrypted using a Customer-Supplied Encryption Key the key information must be provided in the copy_source_encryption_algorithm, copy_source_encryption_key_bytes, and copy_source_encryption_key_sha256_bytes fields. If the destination object should be encrypted the keying information should be provided in the encryption_algorithm, encryption_key_bytes, and encryption_key_sha256_bytes fields of the common_object_request_params.customer_encryption field.
Protobuf type google.storage.v2.RewriteObjectRequest
RewriteObjectRequest.Builder
Request message for RewriteObject. If the source object is encrypted using a Customer-Supplied Encryption Key the key information must be provided in the copy_source_encryption_algorithm, copy_source_encryption_key_bytes, and copy_source_encryption_key_sha256_bytes fields. If the destination object should be encrypted the keying information should be provided in the encryption_algorithm, encryption_key_bytes, and encryption_key_sha256_bytes fields of the common_object_request_params.customer_encryption field.
Protobuf type google.storage.v2.RewriteObjectRequest
RewriteResponse
A rewrite response.
Protobuf type google.storage.v2.RewriteResponse
RewriteResponse.Builder
A rewrite response.
Protobuf type google.storage.v2.RewriteResponse
ServiceAccount
A service account, owned by Cloud Storage, which may be used when taking action on behalf of a given project, for example to publish Pub/Sub notifications or to retrieve security keys.
Protobuf type google.storage.v2.ServiceAccount
ServiceAccount.Builder
A service account, owned by Cloud Storage, which may be used when taking action on behalf of a given project, for example to publish Pub/Sub notifications or to retrieve security keys.
Protobuf type google.storage.v2.ServiceAccount
ServiceConstants
Shared constants.
Protobuf type google.storage.v2.ServiceConstants
ServiceConstants.Builder
Shared constants.
Protobuf type google.storage.v2.ServiceConstants
StartResumableWriteRequest
Request message StartResumableWrite.
Protobuf type google.storage.v2.StartResumableWriteRequest
StartResumableWriteRequest.Builder
Request message StartResumableWrite.
Protobuf type google.storage.v2.StartResumableWriteRequest
StartResumableWriteResponse
Response object for StartResumableWrite
.
Protobuf type google.storage.v2.StartResumableWriteResponse
StartResumableWriteResponse.Builder
Response object for StartResumableWrite
.
Protobuf type google.storage.v2.StartResumableWriteResponse
StorageClient
Service Description: ## API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs.
Resources are named as follows: - Projects are referred to as they are defined by the Resource
Manager API, using strings like projects/123456
or projects/my-string-id
. - Buckets are named
using string names of the form: projects/{project}/buckets/{bucket}
For globally unique
buckets, _
may be substituted for the project. - Objects are uniquely identified by their name
along with the name of the bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest { bucket: 'projects/_/buckets/my-bucket' object: 'my-object' } Note that
object names can contain /
characters, which are treated as any other character (no special
directory semantics).
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (StorageClient storageClient = StorageClient.create()) {
BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
storageClient.deleteBucket(name);
}
Note: close() needs to be called on the StorageClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of StorageSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageSettings storageSettings =
StorageSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
StorageClient storageClient = StorageClient.create(storageSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageSettings storageSettings = StorageSettings.newBuilder().setEndpoint(myEndpoint).build();
StorageClient storageClient = StorageClient.create(storageSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
StorageClient.ListBucketsFixedSizeCollection
StorageClient.ListBucketsPage
StorageClient.ListBucketsPagedResponse
StorageClient.ListHmacKeysFixedSizeCollection
StorageClient.ListHmacKeysPage
StorageClient.ListHmacKeysPagedResponse
StorageClient.ListNotificationConfigsFixedSizeCollection
StorageClient.ListNotificationConfigsPage
StorageClient.ListNotificationConfigsPagedResponse
StorageClient.ListObjectsFixedSizeCollection
StorageClient.ListObjectsPage
StorageClient.ListObjectsPagedResponse
StorageGrpc
API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs. Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API,
using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the
bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest {
bucket: 'projects/_/buckets/my-bucket'
object: 'my-object'
}
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
StorageGrpc.StorageBlockingStub
A stub to allow clients to do synchronous rpc calls to service Storage.
API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs. Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API,
using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the
bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest {
bucket: 'projects/_/buckets/my-bucket'
object: 'my-object'
}
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
StorageGrpc.StorageFutureStub
A stub to allow clients to do ListenableFuture-style rpc calls to service Storage.
API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs. Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API,
using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the
bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest {
bucket: 'projects/_/buckets/my-bucket'
object: 'my-object'
}
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
StorageGrpc.StorageImplBase
Base class for the server implementation of the service Storage.
API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs. Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API,
using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the
bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest {
bucket: 'projects/_/buckets/my-bucket'
object: 'my-object'
}
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
StorageGrpc.StorageStub
A stub to allow clients to do asynchronous rpc calls to service Storage.
API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs. Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API,
using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the
bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest {
bucket: 'projects/_/buckets/my-bucket'
object: 'my-object'
}
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
StorageProto
StorageSettings
Settings class to configure an instance of StorageClient.
The default instance has everything set to sensible defaults:
- The default service address (storage.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of deleteBucket to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
StorageSettings.Builder storageSettingsBuilder = StorageSettings.newBuilder();
storageSettingsBuilder
.deleteBucketSettings()
.setRetrySettings(
storageSettingsBuilder
.deleteBucketSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
StorageSettings storageSettings = storageSettingsBuilder.build();
StorageSettings.Builder
Builder for StorageSettings.
UpdateBucketRequest
Request for UpdateBucket method.
Protobuf type google.storage.v2.UpdateBucketRequest
UpdateBucketRequest.Builder
Request for UpdateBucket method.
Protobuf type google.storage.v2.UpdateBucketRequest
UpdateHmacKeyRequest
Request object to update an HMAC key state. HmacKeyMetadata.state is required and the only writable field in UpdateHmacKey operation. Specifying fields other than state will result in an error.
Protobuf type google.storage.v2.UpdateHmacKeyRequest
UpdateHmacKeyRequest.Builder
Request object to update an HMAC key state. HmacKeyMetadata.state is required and the only writable field in UpdateHmacKey operation. Specifying fields other than state will result in an error.
Protobuf type google.storage.v2.UpdateHmacKeyRequest
UpdateObjectRequest
Request message for UpdateObject.
Protobuf type google.storage.v2.UpdateObjectRequest
UpdateObjectRequest.Builder
Request message for UpdateObject.
Protobuf type google.storage.v2.UpdateObjectRequest
WriteObjectRequest
Request message for WriteObject.
Protobuf type google.storage.v2.WriteObjectRequest
WriteObjectRequest.Builder
Request message for WriteObject.
Protobuf type google.storage.v2.WriteObjectRequest
WriteObjectResponse
Response message for WriteObject.
Protobuf type google.storage.v2.WriteObjectResponse
WriteObjectResponse.Builder
Response message for WriteObject.
Protobuf type google.storage.v2.WriteObjectResponse
WriteObjectSpec
Describes an attempt to insert an object, possibly over multiple requests.
Protobuf type google.storage.v2.WriteObjectSpec
WriteObjectSpec.Builder
Describes an attempt to insert an object, possibly over multiple requests.
Protobuf type google.storage.v2.WriteObjectSpec
Interfaces
BidiWriteObjectRequestOrBuilder
BidiWriteObjectResponseOrBuilder
Bucket.AutoclassOrBuilder
Bucket.BillingOrBuilder
Bucket.CorsOrBuilder
Bucket.CustomPlacementConfigOrBuilder
Bucket.EncryptionOrBuilder
Bucket.IamConfig.UniformBucketLevelAccessOrBuilder
Bucket.IamConfigOrBuilder
Bucket.Lifecycle.Rule.ActionOrBuilder
Bucket.Lifecycle.Rule.ConditionOrBuilder
Bucket.Lifecycle.RuleOrBuilder
Bucket.LifecycleOrBuilder
Bucket.LoggingOrBuilder
Bucket.RetentionPolicyOrBuilder
Bucket.SoftDeletePolicyOrBuilder
Bucket.VersioningOrBuilder
Bucket.WebsiteOrBuilder
BucketAccessControlOrBuilder
BucketOrBuilder
CancelResumableWriteRequestOrBuilder
CancelResumableWriteResponseOrBuilder
ChecksummedDataOrBuilder
CommonObjectRequestParamsOrBuilder
ComposeObjectRequest.SourceObject.ObjectPreconditionsOrBuilder
ComposeObjectRequest.SourceObjectOrBuilder
ComposeObjectRequestOrBuilder
ContentRangeOrBuilder
CreateBucketRequestOrBuilder
CreateHmacKeyRequestOrBuilder
CreateHmacKeyResponseOrBuilder
CreateNotificationConfigRequestOrBuilder
CustomerEncryptionOrBuilder
DeleteBucketRequestOrBuilder
DeleteHmacKeyRequestOrBuilder
DeleteNotificationConfigRequestOrBuilder
DeleteObjectRequestOrBuilder
GetBucketRequestOrBuilder
GetHmacKeyRequestOrBuilder
GetNotificationConfigRequestOrBuilder
GetObjectRequestOrBuilder
GetServiceAccountRequestOrBuilder
HmacKeyMetadataOrBuilder
ListBucketsRequestOrBuilder
ListBucketsResponseOrBuilder
ListHmacKeysRequestOrBuilder
ListHmacKeysResponseOrBuilder
ListNotificationConfigsRequestOrBuilder
ListNotificationConfigsResponseOrBuilder
ListObjectsRequestOrBuilder
ListObjectsResponseOrBuilder
LockBucketRetentionPolicyRequestOrBuilder
NotificationConfigOrBuilder
ObjectAccessControlOrBuilder
ObjectChecksumsOrBuilder
ObjectOrBuilder
OwnerOrBuilder
ProjectTeamOrBuilder
QueryWriteStatusRequestOrBuilder
QueryWriteStatusResponseOrBuilder
ReadObjectRequestOrBuilder
ReadObjectResponseOrBuilder
RestoreObjectRequestOrBuilder
RewriteObjectRequestOrBuilder
RewriteResponseOrBuilder
ServiceAccountOrBuilder
ServiceConstantsOrBuilder
StartResumableWriteRequestOrBuilder
StartResumableWriteResponseOrBuilder
StorageGrpc.AsyncService
API Overview and Naming Syntax
The Cloud Storage gRPC API allows applications to read and write data through the abstractions of buckets and objects. For a description of these abstractions please see https://cloud.google.com/storage/docs. Resources are named as follows:
- Projects are referred to as they are defined by the Resource Manager API,
using strings like
projects/123456
orprojects/my-string-id
. - Buckets are named using string names of the form:
projects/{project}/buckets/{bucket}
For globally unique buckets,_
may be substituted for the project. - Objects are uniquely identified by their name along with the name of the
bucket they belong to, as separate strings in this API. For example:
ReadObjectRequest {
bucket: 'projects/_/buckets/my-bucket'
object: 'my-object'
}
Note that object names can contain
/
characters, which are treated as any other character (no special directory semantics).
UpdateBucketRequestOrBuilder
UpdateHmacKeyRequestOrBuilder
UpdateObjectRequestOrBuilder
WriteObjectRequestOrBuilder
WriteObjectResponseOrBuilder
WriteObjectSpecOrBuilder
Enums
BidiWriteObjectRequest.DataCase
BidiWriteObjectRequest.FirstMessageCase
BidiWriteObjectResponse.WriteStatusCase
QueryWriteStatusResponse.WriteStatusCase
ServiceConstants.Values
A collection of constant values meaningful to the Storage API.
Protobuf enum google.storage.v2.ServiceConstants.Values