ZipFile Write

In this article

Overview

You can use this Snap to read binary data passed as binary objects from its input view and create a .zip file at a specified file destination.

The archive format is automatically detected by examining the file header.  The supported formats are PKZIP and 7-Zip. 

Snap Type

The ZipFile Write Snap is a Write-type Snap that writes files from archive files.

Prerequisites

IAM Roles for Amazon EC2

The 'IAM_CREDENTIAL_FOR_S3' feature is used to access S3 files from EC2 Groundplex, without Access-key ID and Secret key in the AWS S3 account in the Snap. The IAM credential stored in the EC2 metadata is used to gain access rights to the S3 buckets. To enable this feature, the following line should be added to global.properties, and the jcc (node) restarted: jcc.jvm_options = -DIAM_CREDENTIAL_FOR_S3=TRUE

Please note this feature is supported in the EC2-type Groundplex only.

For more information on IAM Roles, see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html


Support for Ultra Pipelines

 Does not support Ultra Pipelines

Limitations

This Snap does not create an output file when using the input from SAS Generator Snap configured with only the DELETE SAS permission. This is not the case when the target file exists.

Known Issues

  • This Snap Pack no longer natively supports RSA-SHA1 authentication with the Secure File Transfer Protocol (SFTP). To enable support for RSA-SHA1 authentication, set the following property from the Node Properties section of the Snaplex UI:

-Djsch.server_host_key=ssh-rsa -Djsch.client_pubkey=ssh-rsa

With the 4.33 GA release of the Binary Snap Pack, support for some algorithms for SFTP connection negotiation is removed for improved security and because we’ve updated the library used to connect to SFTP sources. If you want to revert to the previous settings, you can set the following jcc.jvm_options from the Node Properties section of the Snaplex UI. To update Cloudplexes, contact SnapLogic Support.

-Djsch.kex=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
-Djsch.server_host_key=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
-Djsch.client_pubkey=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
-Djsch.cipher=aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
-Djsch.check_ciphers=aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
-Djsch.check_kexes=diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
-Djsch.check_signatures=ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

 

 

  • Min: 1

  • Max: ∞

Downstream Snap is optional. Any Snap with a document input view can be connected downstream.

The Snap does not require input data. Input documents may be used to evaluate any JavaScript expression in the File property. It may contain value(s) to evaluate the JavaScript expression in the File property.

Output

Binary

 

 

  • Min: 0

  • Max: 1

  • File Writer

  • Binary Router

  • JSON Parser

Binary data read from the source specified in the File property with header information about the binary stream.

Each file extracted from the provided zip file is written as binary object to this output view. The header of the binary object has details about the file extracted like content-location, content-type, content-length, last-modified, and zip-filename.

Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Account

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. This Snap supports a Basic auth account, an AWS S3 auth account, SSH Auth account, SMB account, or no account. See Configuring Binary Accounts for information on setting up accounts that work with this Snap.

Account types supported by each protocol are as follows:

Protocol

 Account types

Protocol

 Account types

sldb

no account

s3

AWS S3

ftp

Basic Auth

sftp

Basic Auth, SSH Auth 

ftps

Basic Auth

hdfs

no account

http

no account

https

no account

smb

SMB

wasb

Azure Storage

wasbs

Azure Storage

gs

Google Storage

Required settings for account types are as follows:

Account Type

 Settings

Account Type

 Settings

Basic Auth

Username, Password

AWS S3

Access-key ID, Secret key

SSH Auth

Username, Private key, Key Passphrase

SMB

Domain, Username, Password

Azure Storage

Account name, Primary access key

Google Storage

Approval prompt, Application scope, Auto-refresh token
(Read-only properties are Access token, Refresh token, Access token expiration, OAuth2 Endpoint, OAuth2 token and Access type.)

Snap Settings

  • Asterisk ( * ): Indicates a mandatory field.

  • Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon (): Indicates that you can add fields in the field set.

  • Remove icon (): Indicates that you can remove fields from the field set.

Field Name

Field Type

Description

Label* 

 

Default ValueZipFile Write
ExampleZipFile Write

String

Specify a unique name for the Snap.

File name*


Default Value: N/A
Example: contact.zip

String/Expression

Specifies the URL of the file where the output binary data is written. The supported file protocols are:

  • sldb:

  • http:

  • sftp:

  • ftp:

  • ftps:

  • s3:

  • hdfs:

  • webdhfs:

  • smb:

  • wasb:

  • wasbs:

  • gs:

This Snap supports S3 Virtual Private Cloud (VPC) endpoint. For example, s3://my-bucket@bucket.vpce-028b7814794578709-vu0vvauy.s3.us-west-2.vpce.amazonaws.com
This property works similar to the File name property of the File Writer Snap. For additional information refer the Settings section of the File Writer Snap.

When using expressions to build a file name, ensure that the resulting file name does not contain characters that are not supported by the target platform. For example, a file name that contains the special character ":" is not supported in SMB.

  • Ensure the file name does not contain '?' character because it is not supported. The Snap fails with an error if you include the '?' character.

  • When the Snap zips multiple binary data and when the File name property is an expression (such as $Filename), all file name values in the headers of the binary data should be the same. Otherwise, the Snap will throw an exception.

File action*

 

Default valueOverwrite
Example: Ignore

String/Expression

The action to perform if the file already exists. The options available include:

  • Overwrite: If Overwrite is selected, the Snap attempts to write the file without checking for the file's existence for  better performance and the "fileAction" field will be "overwritten" in the output view data.

  • Ignore: The Snap does not overwrite the existing file and will do nothing but write the status and file name to its output view.

  • Error:  If Error is selected, the error displays in the Pipeline Run Log. If an error view is defined, the error will be written there as well.

Base directory

 

Default Value: N/A
Example: testFolder

String

The root directory for all the files added to .zip file.

Use input view label

 

Default Value: Deselected  

Checkbox

If true, the input view label is used for all names of the files added to the zip file. Otherwise, the input view ID is used instead, when input binary stream does not have its content-location in its header. When this option is selected, if there are more than one binary input streams in an input view, for the second input stream and after, the file names will be the input view label appended with '_n'. If the label is in the format of 'name.ext', '_n' will be append to the 'name', e.g. name_2.ext for the second input stream.

 

Number of retries

 

Default Value: 0
Example3

Integer/Expression

Specifies the maximum number of retry attempts when the Snap fails to write. If the value is larger than 0, the Snap first stores the input data in a temporary zip file before writing to the target file.

Minimum value: 0

Retry interval (seconds)

 

Default Value: 1
Example: 3

Integer/Expression

Specifies the minimum number of seconds for which the Snap must wait before attempting recovery from a network failure.

Minimum value: 1

AWS Canned ACL

 

Default Value: 1
Example: PublicRead

 

 

The predefined ACL grants (from AWS) to use when writing a file to S3. Choose a Canned ACL from the available options:

  • None

  • Private

  • PublicRead

  • PublicReadWrite

  • AuthenticatedRead

  • LogDeliveryWrite

  • BucketOwnerRead

  • BucketOwnerFullControl

  • AwsExecRead

Watch the video for more information about AWS Canned ACL.

Learn more about AWS Canned ACLs.

Advanced properties

Use this field set to define additional properties for the Snap.

SAS URI

Dropdown

The URI of the Shared Access Storage (SAS) to be accessed. Supported SAS types are:

  • Service SAS on container

  • Service SAS on blob

  • Account SAS

Values

String/Expression

Provide a value for the SAS URI.

 

Default ValueExecute only
Example: Validate & Execute

Dropdown list

Select one of the following three modes in which the Snap executes:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.