Flows API
  • Globus Flows
  • Overview
  • Getting Started
    • How to Run a Flow
    • How to Monitor a Flow Run
    • How to Create a Flow
  • Authoring Flows
    • Introduction
    • Actions
    • Expressions
    • Choice States
    • Wait States
    • Fail States
    • Pass States
    • Protecting Secrets
    • Handling Exceptions
    • Performing Actions as Different Users
    • Run Context
    • Validating Flow Definitions
  • Authoring Input Schemas
  • Authentication and Authorization
  • Consents and Resuming Runs
  • Permissions
  • Limits
  • Hosted Action Providers
    • Hello World
    • Globus Search - Ingest Task
    • Globus Search - Delete Task
    • Send Notification Email
    • Wait For User Selection
    • Expression Evaluation
    • DataCite Mint
    • Transfer APs
    • Compute AP
  • Example Flows
    • Simple Transfer
    • Move (copy and delete) files
    • Transfer and Share Files
    • Two Stage Globus Transfer
    • Transfer After Approval
    • Looping Batched Move
    • Tar and Transfer with Globus Compute
Skip to main content
Globus Docs
  • APIs
    Auth Flows Groups Search Timers Transfer Globus Connect Server Compute Helper Pages
  • Applications
    Globus Connect Personal Globus Connect Server Premium Storage Connectors Compute Command Line Interface Python SDK JavaScript SDK
  • Guides
  • Support
    FAQs Mailing Lists Contact Us Check Support Tickets
  1. Home
  2. Globus Services
  3. Globus Flows
  4. Example Flows
  5. Transfer and Share Files

Transfer and Share Files

Description

Move and share files by transferring them to a Guest Collection.

The source directory or file will be copied, and then a new permission will be created on the destination to give read-only access to a user or group.

Highlights

This flow verifies that the destination is a Guest Collection before starting the data transfer. This ensures that it will be possible to create a permission on the destination later in the flow. In GetDestinationInfo, the flow collects metadata about the collection, and in CheckDestinationCollectionType, it dispatches over that information. The flow jumps to a Fail state, FailBadDestinationCollectionType, if the check does not pass.

The input schema in this example also demonstrates how to accept collection and principal types. The "format": "globus-collection" annotation ensures that source and destination are treated as collections when using guided flow input in the Globus Web App. "format": "globus-principal" does the same for users and groups.

Source code

{
  "Comment": "Transfer files to a guest collection and set permissions.",
  "StartAt": "GetDestinationInfo",
  "States": {
    "GetDestinationInfo": {
      "Type": "Action",
      "ActionUrl": "https://transfer.actions.globus.org/collection_info",
      "Parameters": {
        "endpoint_id.$": "$.destination.id"
      },
      "ResultPath": "$.DestinationInfo",
      "Next": "CheckDestinationCollectionType"
    },
    "CheckDestinationCollectionType": {
      "Type": "Choice",
      "Choices": [
        {
          "Or": [
            {
              "Variable": "$.DestinationInfo.details.entity_type",
              "StringEquals": "GCP_guest_collection"
            },
            {
              "Variable": "$.DestinationInfo.details.entity_type",
              "StringEquals": "GCSv5_guest_collection"
            }
          ],
          "Next": "TransferFiles"
        }
      ],
      "Default": "FailBadDestinationCollectionType"
    },
    "TransferFiles": {
      "Type": "Action",
      "ActionUrl": "https://transfer.actions.globus.org/transfer",
      "Parameters": {
        "source_endpoint.$": "$.source.id",
        "destination_endpoint.$": "$.destination.id",
        "DATA": [
          {
            "DATA_TYPE": "transfer_item",
            "source_path.$": "$.source.path",
            "destination_path.$": "$.destination.path"
          }
        ]
      },
      "ResultPath": "$.TransferFiles",
      "Next": "SetPermission"
    },
    "SetPermission": {
      "Comment": "Grant read permission on the data to a Globus user or group",
      "Type": "Action",
      "ActionUrl": "https://transfer.actions.globus.org/manage_permission",
      "Parameters": {
        "endpoint_id.$": "$.destination.id",
        "path.$": "$.destination.path",
        "operation": "CREATE",
        "permissions": "r",
        "principal_type.$": "$.principal.type",
        "principal.$": "$.principal.id"
      },
      "ResultPath": "$.SetPermission",
      "End": true
    },
    "FailBadDestinationCollectionType": {
      "Comment": "Fail due to an incorrect destination collection type.",
      "Type": "Fail",
      "Cause": "NonGuestDestinationCollection",
      "Error": "The destination collection is not a guest collection, which is a requirement for this flow."
    }
  }
}
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "source",
    "destination",
    "principal"
  ],
  "propertyOrder": [
    "source",
    "destination",
    "principal"
  ],
  "properties": {
    "source": {
      "title": "Source",
      "type": "object",
      "format": "globus-collection",
      "additionalProperties": false,
      "required": [
        "id",
        "path"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "path": {
          "type": "string"
        }
      }
    },
    "destination": {
      "title": "Destination",
      "type": "object",
      "format": "globus-collection",
      "additionalProperties": false,
      "required": [
        "id",
        "path"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "path": {
          "type": "string"
        }
      }
    },
    "principal": {
      "type": "object",
      "format": "globus-principal",
      "title": "User or Group",
      "oneOf": [
        {
          "$ref": "#/definitions/identity-principal"
        },
        {
          "$ref": "#/definitions/group-principal"
        }
      ]
    }
  },
  "definitions": {
    "group-principal": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "type": {
          "type": "string",
          "enum": [
            "group"
          ]
        },
        "urn": {
          "type": "string",
          "pattern": "^urn:globus:groups:id:[0-9a-fA-F-]{36}$"
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false
    },
    "identity-principal": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "type": {
          "type": "string",
          "enum": [
            "identity"
          ]
        },
        "urn": {
          "type": "string",
          "pattern": "^urn:globus:auth:identity:[0-9a-fA-F-]{36}$"
        }
      },
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false
    }
  }
}
{
  "source": {
    "id": "6c54cade-bde5-45c1-bdea-f4bd71dba2cc",
    "path": "/~/source-directory"
  },
  "destination": {
    "id": "31ce9ba0-176d-45a5-add3-f37d233ba47d",
    "path": "/~/destination-directory"
  },
  "principal": {
    "id": "46bd0f56-e24f-11e5-a510-131bef46955c",
    "type": "identity",
    "urn": "urn:globus:auth:identity:46bd0f56-e24f-11e5-a510-131bef46955c"
  }
}
  • Globus Flows
  • Overview
  • Getting Started
    • How to Run a Flow
    • How to Monitor a Flow Run
    • How to Create a Flow
  • Authoring Flows
    • Introduction
    • Actions
    • Expressions
    • Choice States
    • Wait States
    • Fail States
    • Pass States
    • Protecting Secrets
    • Handling Exceptions
    • Performing Actions as Different Users
    • Run Context
    • Validating Flow Definitions
  • Authoring Input Schemas
  • Authentication and Authorization
  • Consents and Resuming Runs
  • Permissions
  • Limits
  • Hosted Action Providers
    • Hello World
    • Globus Search - Ingest Task
    • Globus Search - Delete Task
    • Send Notification Email
    • Wait For User Selection
    • Expression Evaluation
    • DataCite Mint
    • Transfer APs
    • Compute AP
  • Example Flows
    • Simple Transfer
    • Move (copy and delete) files
    • Transfer and Share Files
    • Two Stage Globus Transfer
    • Transfer After Approval
    • Looping Batched Move
    • Tar and Transfer with Globus Compute
© 2010- The University of Chicago Legal Privacy Accessibility