public class StorageClient extends Object
Constructor and Description |
---|
StorageClient(com.google.api.services.storage.Storage storage)
Constructs a new
StorageClient instance. |
Modifier and Type | Method and Description |
---|---|
void |
deleteBucket(String bucket)
Delete bucket from GCS with name bucket.
|
com.google.api.services.storage.Storage.Buckets.Delete |
deleteBucketRequest(String bucket)
Helper method to return the delete request.
|
void |
deleteFromBucket(String bucket,
String pattern)
Delete object matching pattern from Google Cloud Storage bucket of name bucket.
|
com.google.api.services.storage.Storage.Objects.Delete |
deleteFromBucketRequest(String bucket,
String pattern)
Helper method to return the delete request.
|
com.google.api.services.storage.model.StorageObject |
uploadToBucket(String pattern,
String bucket,
com.google.api.client.http.InputStreamContent content)
Uploads item with path pattern to Google Cloud Storage bucket of name bucket.
|
com.google.api.services.storage.Storage.Objects.Insert |
uploadToBucketRequest(String pattern,
String bucket,
com.google.api.client.http.InputStreamContent content)
Helper method to return the insert request.
|
public StorageClient(com.google.api.services.storage.Storage storage)
StorageClient
instance.storage
- The Storage
instance this class will utilize for interacting with the
GCS API.public void deleteFromBucket(String bucket, String pattern) throws IOException
bucket
- GCS bucket to delete from.pattern
- Pattern to match object name to delete from bucket.IOException
- If there was an issue calling the GCS API.public com.google.api.services.storage.Storage.Objects.Delete deleteFromBucketRequest(String bucket, String pattern) throws IOException
bucket
- GCS bucket to delete from.pattern
- Pattern to match object name to delete from bucket.IOException
- If there was an issue calling the GCS API.public com.google.api.services.storage.model.StorageObject uploadToBucket(String pattern, String bucket, com.google.api.client.http.InputStreamContent content) throws IOException
pattern
- Pattern to match object name to upload to bucket.bucket
- Name of the bucket to upload to.content
- InputStreamContent of desired file to upload.IOException
- If there was an issue calling the GCS API.public com.google.api.services.storage.Storage.Objects.Insert uploadToBucketRequest(String pattern, String bucket, com.google.api.client.http.InputStreamContent content) throws IOException
pattern
- Pattern to match object name to upload to bucket.bucket
- Name of the bucket to upload to.content
- InputStreamContent of desired file to upload.IOException
- If there was an issue calling the GCS API.public void deleteBucket(String bucket) throws IOException
bucket
- Name of GCS bucket to delete.IOException
- If there was an issue calling the GCS API.public com.google.api.services.storage.Storage.Buckets.Delete deleteBucketRequest(String bucket) throws IOException
bucket
- Name of GCS bucket to delete.IOException
- If there was an issue calling the GCS API.Copyright © 2016–2020. All rights reserved.