Whatever message this page gives is out now! Go check it out!
component{
this.name ="gcp"
void function onApplicationStart(){
application.gcpCred = {
projectId : "my-project",
credentialJsonFilePath : "path-to-creds.json"
};
alias.gcpConf = {
serviceName : "STORAGE",
alias : "gcpConfig",
retrySettings : {
initialRetryDelay : "2s",
initialRpcTimeout : "2s",
maxAttempts : 5 ,
maxRetryDelay : "30s",
maxRpcTimeout : "30s",
retryDelayMultiplier : 2 ,
rpcTimeoutMultiplier : 2,
totalTimeOut : "60s"
},
transportOptions : {
connectTimeout : "5000",
readTimeout : "5000"
}
};
}
}<cfscript>
// define the credential and the configuration aliases in the ColdFusion Admin
storageObject=getCloudService("gcpCred","gcpConf")
// code below.
...........
</cfscript><cfscript>
// Using credential alias and struct for service config
gcpConf = {
"alias":"gcpConf",
"serviceName" : "STORAGE"
}
storageObject= getCloudService("gcpCred", gcpConf)
// code below
.....................
</cfscript><cfscript>
// Using config alias and struct for service credentials
// GCP credentials
gcpCreds={
"vendorName":"GCP",
"alias": "gcpCred",
"projectId":"1234",
" credentialJsonFilePath ": "file path"
}
storageObject= getCloudService(gcpCreds, "gcpConf")
// code below
.....................................
</cfscript><cfscript>
// Using Structs for both cloud credential and config
gcpCreds={
"vendorName":"GCP",
"alias": "gcpCred",
"projectId":"1234",
" credentialJsonFilePath ": "file path"
}
gcpConf = {
"alias":"gcpConf",
"serviceName" : "STORAGE",
"clientOverrideConfig":{
"retryPolicy":{
"numRetries":4
}
},
"httpClientConfig":{
"maxConnections":50
}
}
storageObject= getCloudService(gcpCreds, gcpConf)
// code below
...................................................................
</cfscript>root(bucketname, createIfNotExists)<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
rootObj=storageService.root("bucket_test",true);
</cfscript>createRoot(requestParameters)Parameter | Description | Required |
name | Name of the bucket to be created. | Yes |
acl | Define who has access to your buckets and objects, as well as what level of access they have. Valid values are:
For more information, see GCP Storage Access Control List. | No |
defaultAcl | Set a default object, if you want to avoid setting up ACLs every time. You can change the default object ACL, and then add objects to the bucket. For more information, see Default ACLs. | No |
enable | Enable versioning of the bucket. True/False. | No |
requesterPays | Enable requester pays on the bucket. | No |
indexPage | The URL of the page that confirms the creation of the bucket. | No |
notFoundPage | The URL of the page that displays when the bucket creation is unsuccessful. | No |
rules | Configure the replication setting of dual-region Cloud Storage buckets. | No |
rpo | Create the bucket with replication. Valid values are:
For more information, see Configure replication. | No |
storageClass | Storage class of the object. Valid values are STANDARD, NEARLINE, COLDLINE, ARCHIVE. For more information, see Storage Class. | No |
location | Location of the bucket to be created. | No |
cors | CORS configuration of the bucket. For more information, see Configure CORS. | No |
labels | The key-value pair assigned to the bucket as a unique label. | No |
defaultKmsKeyName | The Cloud KMS key used to encrypt this object, if the object is encrypted by such a key. | No |
defaultEventBasedHold | Whether or not the object is subject to an event-based hold. | No |
retentionPeriod | The time when the bucket can be deleted, based on the retention policy. | No |
iamConfiguration | Control access to your buckets and objects. | No |
logging | Enable logging on the bucket. | No |
customPlacementConfig | A query string parameter that lets you set or retrieve the regions that make up a dual-region bucket. For more information, see Custom placement. | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
createBucketStruct = {
"name" : "bucket_test",
"storageClass" : "STANDARD",
"location" : "US",
"requesterPays" : "false",
"enable" : "false",
"defaultEventBasedHold" : "false",
"labels" : {
"name" : "test_bucket",
"owner" : "user1"
},
"retentionPeriod" : "10",
"customPlacementConfig" : ["US-EAST1","US-WEST1"],
"iamConfiguration" : {
"isUniformBucketLevelAccessEnabled" : true,
"publicAccessPrevention" : "INHERITED"
}
}
rootObj2=storageService.createRoot(createBucketStruct);
</cfscript>bucket(bucketName,createIfNotExists)<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
</cfscript>createBucket(requestParameters)Parameter | Description | Required |
name | Name of the bucket to be created. | Yes |
acl | Define who has access to your buckets and objects, as well as what level of access they have. Valid values are:
For more information, see GCP Storage Access Control List. | No |
defaultAcl | Set a default object, if you want to avoid setting up ACLs every time. You can change the default object ACL, and then add objects to the bucket. For more information, see Default ACLs. | No |
enable | Enable versioning of the bucket. True/False. | No |
requesterPays | Enable requester pays on the bucket. | No |
indexPage | The URL of the page that confirms the creation of the bucket. | No |
notFoundPage | The URL of the page that displays when the bucket creation is unsuccessful. | No |
rules | Configure the replication setting of dual-region Cloud Storage buckets. | No |
rpo | Create the bucket with replication. Valid values are:
For more information, see Configure replication. | No |
storageClass | Storage class of the object. Valid values are STANDARD, NEARLINE, COLDLINE, ARCHIVE. For more information, see Storage Class. | No |
location | Location of the bucket to be created. | No |
cors | CORS configuration of the bucket. For more information, see Configure CORS. | No |
labels | The key-value pair assigned to the bucket as a unique label. | No |
defaultKmsKeyName | The Cloud KMS key used to encrypt this object, if the object is encrypted by such a key. | No |
defaultEventBasedHold | Whether or not the object is subject to an event-based hold. | No |
retentionPeriod | The time when the bucket can be deleted, based on the retention policy. | No |
iamConfiguration | Control access to your buckets and objects. | No |
logging | Enable logging on the bucket. | No |
customPlacementConfig | A query string parameter that lets you set or retrieve the regions that make up a dual-region bucket. For more information, see Custom placement. | No |
<cfscript >
storageService = getCloudService(application.gcpCred, application.gcpConf)
createBucketStruct = {
"name": "bucket_test",
"storageClass": "STANDARD",
"location": "US",
"rules": [{
"action": {
"type": "delete"
},
"condition": {
"daysSinceNoncurrentTime": 7
}
}],
"acl": [{
"entity": {
"project": {
projectrole: "EDITORS",
projectid: "101345678996"
}
},
"role": "READER"
}],
"defaultAcl": [{
"entity": {
"user": "test@xyz.com"
},
"role": "OWNER"
}]
}
rootObj2 = storageService.createBucket(createBucketStruct);
</cfscript>listAll()<cfscript>
cred = {
projectId : "my-gcp-project",
credentialJsonFilePath : "File-path-creds.json"
};
conf = {
serviceName : "storage"
};
st = getCloudService(cred, conf);
arrayBuckets=st.listall()
writeDump(arrayBuckets)
</cfscript>listAll(requestParameters)Parameter | Description | Required |
fields | Array of fields, like ACL, BILLING, etc. | No |
pageSize | Number to denote the number of buckets to display on a page. | No |
pageToken | Represents a part of the larger results to display. | No |
prefix | Filter those buckets that start with the prefix. | No |
userProject | Set of properties to return.Valid values are:
| No |
<cfscript>
cred = {
projectId : "my-gcp-project",
credentialJsonFilePath : "File-path-creds.json"
};
conf = {
serviceName : "STORAGE"
};
storageService = getCloudService(cred, conf);
paramStruct={"prefix":"cfbucket","pageSize":50}
writeDump("#storageService.listAll(paramStruct)#");
</cfscript>delete(bucketName)<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketList=storageService.delete("bucket_test");
</cfscript><cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketOption = {
bucketName : "bucket_test",
versions : true,
forceDelete : {
timeout : 60,
unit : "SECONDS"
}
}
delresponse= storageService.delete(bucketOption)
</cfscript>listAll()<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketList=storageService.listAll();
</cfscript>Parameter | Description |
fields | Array of fields like ACL, BILLING, CORS, etc. |
pageSize | Number of records to display on a page. |
pageToken | Encoded field containing the name of the last item (bucket) in the returned list. |
prefix | Display buckets whose names begin with this prefix. |
userProject | The name of the GCP project. |
<cfscript >
storageService = getCloudService(application.gcpCred, application.gcpConf)
bucketObj = storageService.bucket("bucket_test", true);
liststruct = {
currentDirectory: true,
prefix: "key",
delimeter: "1",
pagesize: 1,
versions: true,
fields: ["BUCKET", "ETAG"],
userproject: "project_id",
startoffset: "key23/43",
endoffset: "key34"
}
objList1 = bucketObj.listAll(liststruct);
</cfscript>delete(objectKey)<cfscript >
storageService = getCloudService(application.gcpCred, application.gcpConf)
bucketObj = storageService.bucket("bucket_test", true);
uploadStruct = {
"srcFile": SRC_FILE_PATH,
"blobInfo": {
"blobId": {
"name": "key123"
}
}
}
uploadResponse = bucketObj.uploadFile(uploadStruct);
delResponse = bucketObj.delete(key123);
</cfscript>delete(requestParameters)Parameter | Description |
bucketName | The name of the bucket to be deleted. |
metaGenerationMatch | Identifies the metadata version. True if matches. |
metagenerationNotMatch | True/False. |
versions | The version of the object. |
userProject | The name of the GCP project. |
forceDelete | True/false. Forcibly delete the object. |
<cfscript >
storageService = getCloudService(application.gcpCred, application.gcpConf)
bucketObj = storageService.bucket("bucket_test", true);
uploadStruct = {
"srcFile": SRC_FILE_PATH,
"blobInfo": {
"blobId": {
"name": "key123"
}
}
}
uploadResponse = bucketObj.uploadFile(uploadStruct);
deleteOptions = {
blobId: {
name: "key123",
generation: GENERATION_ID
}
}
delResponse = bucketObj.delete(deleteOptions);
</cfscript>getLocation()<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
objLocation=bucketObj.getLocation();
</cfscript>UploadFile(structParameters) Parameter | Description | Required |
srcFile | The path of the file that you want to upload in the bucket. | Yes |
buffersize | The size of the buffer object. | |
key | Unique identifier of the object. | Yes |
blobInfo | Struct of blobId:
| Yes |
acl | Access controls on the bucket. For more information, see this doc. | No |
cacheControl | Specify the caching behavior as defined here. | No |
contentDisposition | Specify the content format of the object as defined here. | No |
contentEncoding | Specify the type of encoding on the object as defined here. | No |
contentLanguage | The language of the object that you want to upload. | No |
contentType | The HTTPS content type of the response object. | No |
crc32 | The crc32 hash for the object. | No |
crc32HexString | The crc32 hex strimg for the object. | No |
eventBasedHold | An object hold that are metadata flags on an object. For more information, see Object holds. There are two types of holds:
| No |
md5 | The md5 checksum of the object. | No |
md5HexString | The md5 hex string of the object. | No |
metadata | The key value pair of the object as a struct. | No |
storageClass | Storage class of the object. Valid values are STANDARD, NEARLINE, COLDLINE, ARCHIVE. For more information, see Storage Class. | No |
temporaryHold | Whether to place a temporary hold on the object. | No |
timestorageclassupdated | The time at which the object's storage class was last changed. | No |
customtime | User-defined timestamp for the object. | No |
blobWriteOption | Struct of:
| No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
uploadRequest={
"srcFile" : <SRC_FILE_PATH>,
"blobInfo" : {
"blobId" : {
"bucket" : "bucket_test",
"name" : "key12"
},
"crc32" : "aR2qLw==",
"crc32HexString" : "615232714c773d3d",
"eventBasedHold" : false,
"md5" : "sQqNsWTgdUEFt6mb5y4/5Q==",
"md5HexString" : "7351714e735754676455454674366d623579342f35513d3d",
"metadata" : {
"key1" : "value1"
},
"storageClass" : "STANDARD",
"temporaryHold" : "false",
"acl" : [{
"entity" : {
"group" : GROUP_ID
},
"role" : "READER"
}]
},
"blobWriteOption" : [{
crc32cMatch : true,
detectContentType : true,
encryptionKey:"TIbv/fjexq+VmtXzAlc63J4z5kFmWJ6NdAPQulQBT7g=",
userProject: "projectid"
}]
}
uploadResponse=bucketObj.uploadFile(uploadRequest);
</cfscript>uploadObject(structParameters)Parameter | Description | Required |
object | Object to be uploaded to the bucket. | Yes |
blobInfo | Struct of "blobId" : { "name" : "" } | Yes |
blobWriteOption | Specify the write options of the blob. | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
uploadStruct = {
"object" : serializeJSON({empName="James", age="26"}),
"blobInfo" : {
"blobId" : {
"name" : "key123"
},
"storageClass" : "STANDARD",
"temporaryHold" : "false"
}
}
uploadResponse=bucketObj.uploadObject(uploadStruct);
</cfscript>downloadToFile(structParameters)Parameter | Description | Required |
destinationfilepath | The path where the file is to be downloaded. | Yes |
key | When you interact with GCP, you specify your GCP security credentials to verify your credentials and check whether you have permission to access the resources that you are requesting. GCP uses the security credentials to authenticate and authorize your requests. For more information, see GCP API Keys Overview. | Yes |
decryptionkey | To download an object stored in cloud storage that is encrypted with a customer-supplied decryptionkey. | No |
userproject | The project id of GCP. | No |
shouldreturnrawinputstream | Whether the request must return a raw input stream, instead of decompressing the data. | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
downloadStruct = {
"destinationfilepath" : DESTINATION_PATH,
"key" : "key12",
"decryptionkey":"TIbv/fjexq+VmtXzAlc63J4z5kFmWJ6NdAPQulQBT7g="
}
downloadResponse=rootObj.downloadToFile(downloadStruct);
</cfscript>downloadObject(structParameters)Parameter | Description | Required |
blobInfo | Struct of { "blobId" : { "name" : "key-name" } } | Yes |
blobSourceOption | Struct of: decryptionKey : "", generationMatch : "", generationNotMatch : "", metatGenerationMatch : "", metaGenerationNotMatch : "", shouldReturnRawInputStream : "", userProject : "" | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
downloadStruct = {
"blobInfo" : {
"blobId" : {
"name" : "key12"
}
},
blobSourceOption : [{
userProject : PROJECT_ID
}]
}
downloadResponse=bucketObj.downloadObject(downloadStruct);
</cfscript>updateBucket(structParameters)Parameter | Description | Required |
bucketinfo | Struct containing:
Note: Data retention policy for a Cloud Storage bucket that governs how long objects in the bucket must be retained. The feature also allows you to lock the data retention policy, permanently preventing the policy from being reduced or removed. | No |
buckettargetOption | Struct of:
| No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
updatestruct= {
bucketinfo:{
"requesterPays" : "false",
"labels" : {
"name" : "bucket_test",
"owner" : "abc"
},
"acl" : [{
"entity" : {
"user" : "xyz@abc.com"
},
"role" : "OWNER"
}
]
},
"buckettargetOption" : {
"userProject": PROJECT_ID
}
}
bucketObj.updateBucket(updatestruct);
</cfscript>updateObject(structParameters)Parameter | Description | Required |
blobInfo | Struct of:
| Yes |
blobTargetOption | Struct of:
|
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
updatestruct={
blobinfo:{
"blobId" :{
"name" : "key123"
},
"contentLanguage" : "en",
"metadata" :{
"owner" : "hannah",
"case" : "1"
}
},
"blobTargetOption" : {
"userProject": PROJECT_ID
}
}
bucketObj.updateObject(updatestruct);
</cfscript>addTags(structParameter)Parameter | Description | Required |
key | The name of the key that identifies the tags. | Yes |
tags | Struct of name and owner. | Yes |
<cfscript>
cred = {
projectId : "project-id",
credentialJsonFilePath : "path-to-creds.json"
};
conf = {
serviceName : "STORAGE"
};
storageService = getCloudService(cred, conf)
createBucketStruct = {
"name" : "b_d_009",
"storageClass" : "STANDARD"
}
bucketObj = storageService.createBucket(createBucketStruct)
src = "#ExpandPath('..')#/files/test.txt";
key = "key12"
uploadStruct = {
"srcFile" : src,
"key" : key
}
uploadResponse=bucketObj.uploadFile(uploadStruct);
writeDump(uploadResponse)
//break;
addTagStruct =
{
"key":"key12",
"tags":
{
"key" : "key12",
"tags" : {"name" : "test_bucket","owner" : "john"}
}
}
tagResponse=bucketObj.addTags(addTagStruct)
writedump(tagResponse);
</cfscript>enableRequesterpay(structParameters)Parameter | Description | Required |
bucketGetOption | A struct containing userProject. | Yes |
buckettargetOption | A struct containing userProject. | Yes |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
rpstruct = {
bucketGetOption : [{
userProject : PROJECT_ID
}],
buckettargetOption : [{
userProject : PROJECT_ID
}]
};
bucketObj.enableRequesterPay(rpstruct);
</cfscript>disableRequesterpay(structParameters)Parameter | Description | Required |
bucketGetOption | A struct containing userProject. | Yes |
buckettargetOption | A struct containing userProject. | Yes |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
rpstruct = {
bucketGetOption : [{
userProject : PROJECT_ID
}],
buckettargetOption : [{
userProject : PROJECT_ID
}]
};
bucketObj.disableRequesterPay(rpstruct);
</cfscript>getRequesterPayStatus(structParameters)Parameter | Description | Required |
bucketGetOption | A struct containing userProject. | Yes |
buckettargetOption | A struct containing userProject. | Yes |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
rpstruct = {
bucketGetOption : [{
userProject : PROJECT_ID
}],
buckettargetOption : [{
userProject : PROJECT_ID
}]
};
writedump(bucketObj.getRequesterPayStatus(rpstruct));
</cfscript>copy(requestParameters)Parameter | Description | Required |
megaBytesCopiedPerChunk | The size of the object being copied per chunk. | No |
source | Struct containing the name of the bucket and the name of the key | Yes |
target | Struct of { "blobId" : { "name" : "key-name" } } | Yes |
blobTargetOption | A struct containing the name of the project and whether the bob exists. blobTargetOption: { userProject, DoesNotExist } | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
copyRequest ={
megaBytesCopiedPerChunk : 2,
source : {
bucket : "source_bucket_name",
name : "source_key"
},
sourceOptions :{
userProject : PROJECT_ID
},
target : {
blobInfo: {
blobId : {
name : "key123"
}
},
blobTargetOption: [{
userProject : PROJECT_ID
}]
}
}
bucketObj.copy(copyRequest);
</cfscript>getObjectMetadata(objectName)<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
uploadRequest={
"srcFile" : <SRC_FILE_PATH>,
"blobInfo" : {
"blobId" : {
"bucket" : "bucket_test",
"name" : "key12"
}
}
}
uploadResponse=bucketObj.uploadFile(uploadRequest);
writedump(bucketObj.getObjectMetadata("key12")):
</cfscript>getObjectDetails(objectName)<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
uploadRequest={
"srcFile" : <SRC_FILE_PATH>,
"blobInfo" : {
"blobId" : {
"bucket" : "bucket_test",
"name" : "key12"
}
}
}
uploadResponse=bucketObj.uploadFile(uploadRequest);
writedump(bucketObj.getObjectDetails("key12")):
</cfscript>getBucketMetadata() <cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
writedump(bucketObj.getBucketMetadata()):
</cfscript>composeObject(structParameters)Parameter | Description | Required |
addSource | Array of the keys of the objects that you want to merge. | Yes |
setTarget | Struct of { "blobId" : { "name" : "key-name" } } | Yes |
setTargetOptions | The name of the GCP project | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
uploadStruct1 = {
"srcFile" : src1,
"blobInfo" : {
"blobId" : {
"name" : "key1"
}
}
}
uploadStruct2 = {
"srcFile" : src2,
"blobInfo" : {
"blobId" : {
"name" : "key2"
}
}
}
bucketObj.uploadFile(uploadStruct1);
bucketObj.uploadFile(uploadStruct2);
composeRequest = {
addSource : ["key1","key2"],
setTarget : {
BlobId : {
Name : "key12"
}
}
}
bucketObj.composeObject(composeRequest);
</cfscript>enableVersioning()<cfscript>
cred = {
projectId : "project-id",
credentialJsonFilePath : "path-to-creds-file.json"
};
conf = {
serviceName : "STORAGE"
};
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test_22",true);
bucketObj.enableVersioning();
list= bucketObj.listallversions();
writedump(bucketObj.getVersioningStatus());
bucketObj.suspendversioning();
</cfscript>listAllVersions() <cfscript>
cred = {
projectId : "project-id",
credentialJsonFilePath : "path-to-creds-file.json"
};
conf = {
serviceName : "STORAGE"
};
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test_22",true);
bucketObj.enableVersioning();
list= bucketObj.listallversions();
writedump(bucketObj.getVersioningStatus());
bucketObj.suspendversioning();
</cfscript>suspendVersioning()<cfscript>
cred = {
projectId : "project-id",
credentialJsonFilePath : "path-to-creds-file.json"
};
conf = {
serviceName : "STORAGE"
};
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test_22",true);
bucketObj.enableVersioning();
list= bucketObj.listallversions();
writedump(bucketObj.getVersioningStatus());
bucketObj.suspendversioning();
</cfscript>getVersioningStatus()<cfscript>
cred = {
projectId : "project-id",
credentialJsonFilePath : "path-to-creds-file.json"
};
conf = {
serviceName : "STORAGE"
};
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test_22",true);
bucketObj.enableVersioning();
list= bucketObj.listallversions();
writedump(bucketObj.getVersioningStatus());
bucketObj.suspendversioning();
</cfscript>setRules(structParameters)Parameter | Description | Required |
rules | The lifecycle configuration that you want to set on a bucket. For more information, see Object Lifecycle Management. | Yes |
action | Specify the action of the object. The supported values are:
| Yes |
condition | The conditions which an object must meet before the action defined in the rule occurs on the object. For more information, see Lifecycle conditions. | Yes |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
rules = { rules :[{
"action" : {
"type" : "delete"
},
"condition" :{
"daysSinceNoncurrentTime": 7
}
},
{
"action" : {
"type": "SetStorageClass",
"storageClass": "NEARLINE"
},
"condition" : {
"age" : 11,
"matchesPrefix" : ["blob","delete"],
"matchesSuffix" : ["test","edu"]
}
}]}
bucketObj.setRules(rules);
</cfscript>deleteRules()<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
bucketObj.deleteRules();
</cfscript>getRules()<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
writedump(bucketObj.getRules());
</cfscript>setIamPolicy(structParameters)Parameter | Description | Required |
addIdentity | Struct of: { role : <>, identity : [{<identity_Type> : <identity_Value>} ] } | No |
removeIdentity | Struct of: { role : <>, identity : [{<identity_Type> : <identity_Value>} ] } | No |
bindings | A connection between principals who have a role, which has a set of permissions, and that position. | No |
etag | HTTP 1.1 Entity tag for the policy. | No |
version | The IAM policy version. | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
addMemberRequest ={
addIdentity : {
Identity: [{"user":"mukumar@adobe.com"}],role: "roles/storage.objectViewer"
}
}
writedump(bucketObj.setIamPolicy(addMemberRequest));
writeDump(bucketObj.getIamPolicy())
</cfscript>getIamPolicies()<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj=storageService.bucket("bucket_test",true);
addMemberRequest ={
addIdentity : {
Identity: [{"user":"mukumar@adobe.com"}],role: "roles/storage.objectViewer"
}
}
writedump(bucketObj.setIamPolicy(addMemberRequest));
writeDump(bucketObj.getIamPolicy())
</cfscript>signUrl(structParameters)Parameter | Description | Required |
key | The key to identify the object in the bucket. | No |
duration | The duration that the signed URL should be valid for | No |
timeUnit | The time unit for the duration. | No |
httpMethod | The HTTP method to use with the signed URL. The default is GET. | No |
version | The version of the object. | No |
signer | The service account signer to sign the URL. | No |
withBucketBoundHostname | A bucket-bound hostname. For more information, see this doc. | No |
withContentType | Specify if the signature should include the blob's content-type. | No |
withExtHeaders | Specify if the signature should contain the blob’s headers. | No |
hostName | The host name to be used for the bucket. | No |
withMd5 | Specify if the signature must include the blob's md5. | No |
withPathStyle | Generate a path-style URL. | No |
queryParams | Specify if the URL must contain additional query parameters. | No |
signatureVersion | Use the version of the signature, v2 or v4. | No |
withVirtualHostedStyle | Use a virtual hosted-style hostname. | No |
<cfscript>
storageService = getCloudService(application.gcpCred,application.gcpConf)
bucketObj = storageService.bucket("<bucketName>");
// Generate a V4-signed URL to download an object.
signUrlOption = {
key : "<objectName>",
duration : 15,
timeUnit : "MINUTES",
signatureVersion : "V4"
}
writedump(bucketObj.signUrl(signUrlOption));
// Generate a PUT-signed URL that is used to upload an object.
signUrlOption = {
key : "abc.txt",
duration : 15,
timeUnit : "MINUTES",
httpMethod : "PUT",
withExtHeaders : {
"Content-Type": "application/octet-stream"
},
signatureVersion : "V4"
}
writedump(bucketObj.signUrl(signUrlOption))
</cfscript>