Cloud SQL Admin용 커넥터

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

더 살펴보기

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

코드 샘플

YAML

# This workflow demonstrates how to use the Cloud SQL connector.
# The workflow creates an SQL instance and an SQL database in the SQL instance.
# Then it deletes the database and the instance. Each of these steps waits
# until the long-running operation of creating or deleting the SQL database completes.
# Expected successful output: "SUCCESS"

- init:
    assign:
      - project: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
      - instance: "[fill in an instance name]"
      - tier: "db-n1-standard-1"
      - database_name: "[fill in an instance name]"
- create_instance:
    call: googleapis.sqladmin.v1beta4.instances.insert
    args:
      project: ${project}
      body:
        kind: "sql#database"
        settings:
          tier: ${tier}
        project: ${project}
        backendType: "SECOND_GEN"
        name: ${instance}
- create_database:
    call: googleapis.sqladmin.v1beta4.databases.insert
    args:
      project: ${project}
      instance: ${instance}
      body:
        kind: "sql#database"
        charset: "utf8"
        collation: "utf8_general_ci"
        name: ${database_name}
        instance: ${instance}
        project: ${project}
        sqlserverDatabaseDetails:
          compatibilityLevel: 5
          recoveryModel: "Simple"
- get_database:
    call: googleapis.sqladmin.v1beta4.databases.get
    args:
      project: ${project}
      instance: ${instance}
      database: ${database_name}
- delete_database:
    call: googleapis.sqladmin.v1beta4.databases.delete
    args:
      project: ${project}
      instance: ${instance}
      database: ${database_name}
- delete_instance:
    call: googleapis.sqladmin.v1beta4.instances.delete
    args:
      project: ${project}
      instance: ${instance}
- the_end:
    return: "SUCCESS"

다음 단계

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