첫 번째 워크플로 배포

현재 요일을 Wikipedia API에 검색어로 전달합니다. 관련 Wikipedia 자료 목록이 반환됩니다.

코드 샘플

Node.js

이 샘플을 사용해 보기 전에 Workflows 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Workflows Node.js API 참고 문서를 참조하세요.

Workflows에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

        },
        workflowId: WORKFLOW_ID,
      });
    }
  });

  it('should execute the quickstart', async () => {
    // Execute workflow, with long test timeout
    const result = execSync(
      `node --loader ts-node/esm ./index.ts ${PROJECT_ID} ${LOCATION_ID} ${WORKFLOW_ID}`
    );

    assert.strictEqual(
      result.length > 0,
      true,
      'Quickstart must return non-empty result'
    );
  }).timeout(5000);
});

YAML

- getCurrentTime:
    call: http.get
    args:
      url: https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam
    result: currentTime
- readWikipedia:
    call: http.get
    args:
      url: https://en.wikipedia.org/w/api.php
      query:
        action: opensearch
        search: ${currentTime.body.dayOfWeek}
    result: wikiResult
- returnResult:
    return: ${wikiResult.body[1]}

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저 참조하기