Cloud Run용 커넥터

워크플로 내에서 Cloud Run에 액세스하는 데 사용되는 기본 제공 함수를 정의하는 Workflows 커넥터입니다.

더 살펴보기

이 코드 샘플이 포함된 자세한 문서는 다음을 참조하세요.

코드 샘플

YAML

# This workflow demonstrates how to use the Cloud Run connector:
# Create a new service and then delete it
# A location must be specified
# Expected output is the `delete_service` response with a "Success" status
- init:
    assign:
      - service_name: "test-service"
      - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
- create_service:
    call: googleapis.run.v1.namespaces.services.create
    args:
      location: "us-central1"
      parent: ${"namespaces/" + project}
      body:
        apiVersion: "serving.knative.dev/v1"
        kind: "Service"
        metadata:
          name: ${service_name}
          namespace: ${project}
        spec:
          traffic:
            latest_revision: true
            percent: 100
          template:
            metadata:
              labels:
                serving.knative.dev/type: "container"
            spec:
              containers:
                - image: "us-docker.pkg.dev/cloudrun/container/hello:latest"
    result: create_response
- get_service:
    call: googleapis.run.v1.namespaces.services.get
    args:
      name: ${"namespaces/" + project + "/services/" + service_name}
      location: "us-central1"
    result: get_response
- delete_service:
    call: googleapis.run.v1.namespaces.services.delete
    args:
      location: "us-central1"
      name: ${"namespaces/" + project + "/services/" + service_name}
    result: delete_response
- return:
    return: ${delete_response}

다음 단계

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