swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Azure Cosmos DB Database Service Resource Provider REST API
  title: Cosmos DB
  version: 2019-08-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2019-08-01-preview/privateEndpointConnection.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: cosmos-db-privateEndpointConnection
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: Impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  PrivateEndpointConnectionNameParameter:
    description: The name of the private endpoint connection.
    in: path
    name: privateEndpointConnectionName
    required: true
    type: string
    x-ms-parameter-location: method
  accountNameParameter:
    description: Cosmos DB database account name.
    in: path
    maxLength: 50
    minLength: 3
    name: accountName
    pattern: ^[a-z0-9]+(-[a-z0-9]+)*
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections":
    get:
      description: List all private endpoint connections on a Cosmos DB account.
      operationId: PrivateEndpointConnections_ListByDatabaseAccount
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/accountNameParameter"
      responses:
        "200":
          description: Successfully retrieved private endpoint connections.
          schema:
            $ref: "#/definitions/PrivateEndpointConnectionListResult"
      tags:
        - PrivateEndpointConnections
      x-ms-examples:
        Gets private endpoint connection.:
          parameters:
            accountName: ddb1
            api-version: 2019-08-01-preview
            resourceGroupName: rg1
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName
                    name: privateEndpointConnectionName
                    properties:
                      privateEndpoint:
                        id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName
                      privateLinkServiceConnectionState:
                        actionsRequired: None
                        description: Auto-approved
                        status: Approved
                    type: Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections
                  - id: /subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName2
                    name: privateEndpointConnectionName
                    properties:
                      privateEndpoint:
                        id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName2
                      privateLinkServiceConnectionState:
                        actionsRequired: None
                        description: Auto-approved
                        status: Approved
                    type: Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}":
    delete:
      description: Deletes a private endpoint connection with a given name.
      operationId: PrivateEndpointConnections_Delete
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/accountNameParameter"
        - $ref: "#/parameters/PrivateEndpointConnectionNameParameter"
      responses:
        "202":
          description: Accepted. The private endpoint connection delete will complete asynchronously.
        "204":
          description: Private endpoint connection does not exist.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - PrivateEndpointConnections
      x-ms-examples:
        Deletes a private endpoint connection with a given name.:
          parameters:
            accountName: ddb1
            api-version: 2019-08-01-preview
            privateEndpointConnectionName: privateEndpointConnectionName
            resourceGroupName: rg1
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "202": {}
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Gets a private endpoint connection.
      operationId: PrivateEndpointConnections_Get
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/accountNameParameter"
        - $ref: "#/parameters/PrivateEndpointConnectionNameParameter"
      responses:
        "200":
          description: Successfully retrieved a specified private endpoint connection.
          schema:
            $ref: "#/definitions/PrivateEndpointConnection"
      tags:
        - PrivateEndpointConnections
      x-ms-examples:
        Gets private endpoint connection.:
          parameters:
            accountName: ddb1
            api-version: 2019-08-01-preview
            privateEndpointConnectionName: privateEndpointConnectionName
            resourceGroupName: rg1
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName
                name: privateEndpointConnectionName
                properties:
                  privateEndpoint:
                    id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName
                  privateLinkServiceConnectionState:
                    actionsRequired: None
                    description: Auto-approved
                    status: Approved
                type: Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections
    put:
      description: Approve or reject a private endpoint connection with a given name.
      operationId: PrivateEndpointConnections_CreateOrUpdate
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/accountNameParameter"
        - $ref: "#/parameters/PrivateEndpointConnectionNameParameter"
        - in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/PrivateEndpointConnection"
      responses:
        "200":
          description: Successfully approved or rejected private endpoint connection.
          schema:
            $ref: "#/definitions/PrivateEndpointConnection"
        "202":
          description: Accepted. The private endpoint connection update will complete asynchronously.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - PrivateEndpointConnections
      x-ms-examples:
        Approve or reject a private endpoint connection with a given name.:
          parameters:
            accountName: ddb1
            api-version: 2019-08-01-preview
            parameters:
              properties:
                privateLinkServiceConnectionState:
                  description: Approved by johndoe@contoso.com
                  status: Approved
            privateEndpointConnectionName: privateEndpointConnectionName
            resourceGroupName: rg1
            subscriptionId: 00000000-1111-2222-3333-444444444444
          responses:
            "200":
              body:
                id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1/providers/Microsoft.DocumentDb/databaseAccounts/ddb1/privateEndpointConnections/privateEndpointConnectionName
                name: privateEndpointConnectionName
                properties:
                  privateEndpoint:
                    id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName
                  privateLinkServiceConnectionState:
                    actionsRequired: None
                    description: Auto-approved
                    status: Approved
                type: Microsoft.DocumentDb/databaseAccounts/privateEndpointConnections
            "202": {}
      x-ms-long-running-operation: true
definitions:
  ErrorResponse:
    description: Error Response.
    properties:
      code:
        description: Error code.
        type: string
      message:
        description: Error message indicating why the operation failed.
        type: string
  PrivateEndpointConnection:
    allOf:
      - allOf:
          - properties:
              id:
                description: Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
                readOnly: true
                type: string
              name:
                description: The name of the resource
                readOnly: true
                type: string
              type:
                description: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
                readOnly: true
                type: string
            x-ms-azure-resource: true
        description: The resource model definition for a ARM proxy resource. It will have everything other than required location and tags
    description: A private endpoint connection
    properties:
      properties:
        $ref: "#/definitions/PrivateEndpointConnectionProperties"
        description: Resource properties.
        x-ms-client-flatten: true
    type: object
  PrivateEndpointConnectionListResult:
    description: A list of private endpoint connections
    properties:
      value:
        description: Array of private endpoint connections
        items:
          $ref: "#/definitions/PrivateEndpointConnection"
        type: array
    type: object
  PrivateEndpointConnectionProperties:
    description: Properties of a private endpoint connection.
    properties:
      privateEndpoint:
        $ref: "#/definitions/PrivateEndpointProperty"
        description: Private endpoint which the connection belongs to.
      privateLinkServiceConnectionState:
        $ref: "#/definitions/PrivateLinkServiceConnectionStateProperty"
        description: Connection State of the Private Endpoint Connection.
    type: object
  PrivateEndpointProperty:
    description: Private endpoint which the connection belongs to.
    properties:
      id:
        description: Resource id of the private endpoint.
        type: string
    type: object
  PrivateLinkServiceConnectionStateProperty:
    description: Connection State of the Private Endpoint Connection.
    properties:
      actionsRequired:
        description: Any action that is required beyond basic workflow (approve/ reject/ disconnect)
        readOnly: true
        type: string
      description:
        description: The private link service connection description.
        type: string
      status:
        description: The private link service connection status.
        type: string
    type: object
