Insert Data into Google Cloud Storage

The connector's insert fetch action inserts information into Google Cloud Storage.

To use the insert action, you must construct some XML that specifies where to add each item, and the information to insert. You must add the XML to the action as the value of the insertXML action parameter. The exact structure of the XML depends on the type of item that you want to insert.

The XML contained in the insertXml parameter must be URL encoded before being used in the action command. For example:

http://host:port/action=Fetch&FetchAction=Insert
                             &ConfigSection=MyTask
                             &InsertXML=[URL encoded XML]

For more information about using the insert fetch action, refer to the Google Cloud Storage Connector Reference.

Insert a Bucket

To insert a bucket, your XML must include the following properties:

PROJECT The ID of the project to create the bucket in.
BUCKET The name of the new bucket. The bucket name must be unique. If a bucket with the given name already exists, the operation fails.

You can also include optional metadata, to set metadata fields on the bucket. Each metadata field name must be unique.

The following example inserts a bucket named "MyNewBucket":

<insertXML>
    <insert>
        <reference>ExampleProject_MyNewBucket</reference>
        <property name="PROJECT" value="ExampleProject"/>
        <property name="BUCKET" value="MyNewBucket"/>
        <metadata name="BucketMetaField1" value="Some Value"/>
        <metadata name="BucketMetaField2" value="Other Value"/>
    </insert>
</insertXML>

Insert an Object

To insert an object, your XML must include the following properties:

PROJECT The ID of the project to create the object in.
BUCKET The name of the bucket to create the object in.
OBJECT The name of the new object. If an object with the same name already exists, a new generation of the object is created.
CONTENTTYPE The MIME type of the object content.

You can also include optional metadata, to set metadata fields on the object. Each metadata field name must be unique.

The following example inserts an object named "Object1" into the bucket "MyNewBucket":

<insertXML>
    <insert>
        <reference>ExampleProject_MyNewBucket_Object1</reference>    
        <property name="PROJECT" value="ExampleProject"/>
        <property name="BUCKET" value="MyNewBucket"/>
        <property name="OBJECT" value="Object1"/>
        <property name="CONTENTTYPE" value="text/plain"/>
        <metadata name="ObjectMetaField1" value="Some Value"/>
        <metadata name="ObjectMetaField2" value="Other Value"/>
        <file>
            <type>content</type>
            <content>BASE64FILE==</content>
        </file>
    </insert>
</insertXML>