본문 바로가기
WIKI 기술 지식 베이스

데이터베이스 설정 업데이트

원문 보기 위키 갱신

조직 또는 사용자 소유의 데이터베이스 설정을 업데이트하는 API예요.

출처: 문서

본문

요청 예시:

curl -L -X PATCH 'https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/configuration' \
  -H 'Authorization: Bearer ***' \
  -H 'Content-Type: application/json' \
  -d '{
      "size_limit": "500mb",
      "delete_protection": true,
      "block_reads": false,
      "block_writes": false,
      "allowed_ips": ["203.0.113.7", "10.0.0.0/8"],
      "allowed_aws_vpc_ids": ["vpce-0fe6c8807461bba49"]
  }'

OpenAPI

openapi: 3.0.1
info:
  title: Turso Platform API
  description: API description here
  license:
    name: MIT
  version: 0.1.0
servers:
  - url: https://api.turso.tech
    description: Turso's Platform API
security: []
paths:
  /v1/organizations/{organizationSlug}/databases/{databaseName}/configuration:
    patch:
      summary: Update Database Configuration
      description: Update a database configuration belonging to the organization or user.
      operationId: updateDatabaseConfiguration
      parameters:
        - $ref: '#/components/parameters/organizationSlug'
        - $ref: '#/components/parameters/databaseName'
      requestBody:
        description: The configuration to be applied to the chosen database.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConfigurationInput'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseConfigurationResponse'
components:
  parameters:
    organizationSlug:
      in: path
      name: organizationSlug
      required: true
      schema:
        type: string
      description: The slug of the organization or user account.
    databaseName:
      name: databaseName
      in: path
      required: true
      schema:
        type: string
      description: The name of the database.
  schemas:
    DatabaseConfigurationInput:
      type: object
      properties:
        size_limit:
          type: string
          description: >-
            The maximum size of the database in bytes. Values with units are
            also accepted, e.g. 1mb, 256mb, 1gb.
        allow_attach:
          type: boolean
          description: Allow or disallow attaching databases to the current database.
          deprecated: true
        block_reads:
          type: boolean
          description: Block all database reads.
          example: false
        block_writes:
          type: boolean
          description: Block all database writes.
          example: false
        delete_protection:
          type: boolean
          description: Prevent the database from being deleted.
          example: true
        allowed_ips:
          type: array
          items:
            type: string
          description: >-
            List of allowed IP addresses and CIDR blocks. Only connections from
            these sources are accepted. Pass an empty array to clear the list.
            Omit to leave unchanged.
          example:
            - 203.0.113.7
            - 10.0.0.0/8
        allowed_aws_vpc_ids:
          type: array
          items:
            type: string
          description: >-
            List of allowed AWS VPC endpoint IDs (vpce-...). Only connections
            arriving through these endpoints are accepted. Pass an empty array
            to clear the list. Omit to leave unchanged.
          example:
            - vpce-0fe6c8807461bba49
    DatabaseConfigurationResponse:
      type: object
      properties:
        size_limit:
          type: string
          description: >-
            The maximum size of the database in bytes. Values with units are
            also accepted, e.g. 1mb, 256mb, 1gb.
          example: '10000'
        allow_attach:
          type: boolean
          description: Allow or disallow attaching databases to the current database.
          example: true
          deprecated: true
        block_reads:
          type: boolean
          description: The current status for blocked reads.
          example: false
        block_writes:
          type: boolean
          description: The current status for blocked writes.
          example: false
        delete_protection:
          type: boolean
          description: Prevent the database from being deleted.
          example: true
        allowed_ips:
          type: array
          items:
            type: string
          description: >-
            List of allowed IP addresses and CIDR blocks. Empty means no IP
            restriction.
          example:
            - 203.0.113.7
            - 10.0.0.0/8
        allowed_aws_vpc_ids:
          type: array
          items:
            type: string
          description: >-
            List of allowed AWS VPC endpoint IDs. Empty means no VPC endpoint
            restriction.
          example:
            - vpce-0fe6c8807461bba49

더 알아보기 (Learn more)