Google Cloud Platform · Arazzo Workflow

Google Cloud Platform Move Folder and Poll Operation

Version 1.0.0

Read a folder, move it under a new parent, poll the operation, then confirm the new parent.

1 workflow 1 source API 1 provider
View Spec View on GitHub API ManagementCloud ComputingInfrastructurePlatform as a ServiceArazzoWorkflows

Provider

google-cloud-platform

Workflows

move-folder-and-poll
Move a Google Cloud folder to a new parent and wait for completion.
Captures the current parent, moves the folder to a new destination parent, polls the operation until done, then re-reads the folder.
4 steps inputs: destinationParent, folderId outputs: newParent, operationName, previousParent
1
getFolderBefore
cloudresourcemanager.folders.get
Read the folder to capture its current parent before the move.
2
moveFolder
cloudresourcemanager.folders.move
Move the folder under the destination parent. Returns a long-running Operation whose name is used to poll for completion.
3
pollOperation
cloudresourcemanager.operations.get
Poll the long-running operation by name until the done flag is true. Branches back to itself while the operation is still in progress.
4
getFolderAfter
cloudresourcemanager.folders.get
Re-read the folder to confirm the new parent took effect after the move.

Source API Descriptions

Arazzo Workflow Specification

google-cloud-platform-move-folder-and-poll-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: Google Cloud Platform Move Folder and Poll Operation
  summary: Read a folder, move it under a new parent, poll the operation, then confirm the new parent.
  description: >-
    Relocates a folder within the resource hierarchy. The workflow first reads
    the folder to capture its current parent, submits a move to a new
    destination parent, polls the returned long-running Operation until done,
    and finally re-reads the folder to confirm the new parent took effect.
    Every step spells out its request inline so the flow can be read and
    executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: cloudResourceManagerApi
  url: ../openapi/cloud-resource-manager-openapi.yml
  type: openapi
workflows:
- workflowId: move-folder-and-poll
  summary: Move a Google Cloud folder to a new parent and wait for completion.
  description: >-
    Captures the current parent, moves the folder to a new destination parent,
    polls the operation until done, then re-reads the folder.
  inputs:
    type: object
    required:
    - folderId
    - destinationParent
    properties:
      folderId:
        type: string
        description: The resource id of the folder to move (e.g. 500123).
      destinationParent:
        type: string
        description: The new parent resource, e.g. folders/456 or organizations/987.
  steps:
  - stepId: getFolderBefore
    description: >-
      Read the folder to capture its current parent before the move.
    operationId: cloudresourcemanager.folders.get
    parameters:
    - name: folderId
      in: path
      value: $inputs.folderId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      currentParent: $response.body#/parent
      displayName: $response.body#/displayName
  - stepId: moveFolder
    description: >-
      Move the folder under the destination parent. Returns a long-running
      Operation whose name is used to poll for completion.
    operationId: cloudresourcemanager.folders.move
    parameters:
    - name: folderId
      in: path
      value: $inputs.folderId
    requestBody:
      contentType: application/json
      payload:
        destinationParent: $inputs.destinationParent
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      operationName: $response.body#/name
  - stepId: pollOperation
    description: >-
      Poll the long-running operation by name until the done flag is true.
      Branches back to itself while the operation is still in progress.
    operationId: cloudresourcemanager.operations.get
    parameters:
    - name: name
      in: path
      value: $steps.moveFolder.outputs.operationName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      done: $response.body#/done
    onSuccess:
    - name: operationComplete
      type: goto
      stepId: getFolderAfter
      criteria:
      - context: $response.body
        condition: $.done == true
        type: jsonpath
    - name: stillRunning
      type: goto
      stepId: pollOperation
      criteria:
      - context: $response.body
        condition: $.done == false
        type: jsonpath
  - stepId: getFolderAfter
    description: >-
      Re-read the folder to confirm the new parent took effect after the move.
    operationId: cloudresourcemanager.folders.get
    parameters:
    - name: folderId
      in: path
      value: $inputs.folderId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      newParent: $response.body#/parent
  outputs:
    previousParent: $steps.getFolderBefore.outputs.currentParent
    newParent: $steps.getFolderAfter.outputs.newParent
    operationName: $steps.moveFolder.outputs.operationName