swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Azure Digital Twins Client for managing DigitalTwinsInstance
  title: AzureDigitalTwinsManagementClient
  version: 2020-03-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/digitaltwins/resource-manager/Microsoft.DigitalTwins/preview/2020-03-01-preview/digitaltwins.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: digitaltwins
  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:
  api-version:
    description: Version of the DigitalTwinsInstance Management API.
    enum:
      - 2020-03-01-preview
    in: query
    minLength: 10
    name: api-version
    required: true
    type: string
  endpointName:
    description: Name of Endpoint Resource.
    in: path
    maxLength: 64
    minLength: 1
    name: endpointName
    pattern: ^[A-Za-z0-9-._]{1,64}$
    required: true
    type: string
    x-ms-parameter-location: method
  integrationResourceInfo:
    description: The DigitalTwinsInstance and security metadata.
    in: body
    name: integrationResourceInfo
    required: true
    schema:
      $ref: "#/definitions/IntegrationResource"
    x-ms-parameter-location: method
  integrationResourceName:
    description: Name of IoTHub and DigitalTwinsInstance integration instance.
    in: path
    maxLength: 64
    minLength: 1
    name: integrationResourceName
    required: true
    type: string
    x-ms-parameter-location: method
  integrationResourceUpdateInfo:
    description: The Integration Resource and security metadata.
    in: body
    name: integrationResourceUpdateInfo
    required: true
    schema:
      $ref: "#/definitions/IntegrationResourceUpdateInfo"
    x-ms-parameter-location: method
  location:
    description: Location of DigitalTwinsInstance.
    in: path
    minLength: 3
    name: location
    required: true
    type: string
    x-ms-parameter-location: method
  resourceGroupName:
    description: The name of the resource group that contains the DigitalTwinsInstance.
    in: path
    maxLength: 64
    minLength: 1
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  resourceName:
    description: The name of the DigitalTwinsInstance.
    in: path
    maxLength: 64
    minLength: 1
    name: resourceName
    required: true
    type: string
    x-ms-parameter-location: method
  scope:
    description: The scope of the Digital Twins Integration. The scope has to be an IoTHub resource. For example, /{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IoTHubs/{resourceName}.
    in: path
    name: scope
    required: true
    type: string
    x-ms-parameter-location: method
  subscriptionId:
    description: The subscription identifier.
    format: uuid
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  /providers/Microsoft.DigitalTwins/operations:
    get:
      description: Lists all of the available DigitalTwins service REST API operations.
      operationId: Operations_List
      parameters:
        - $ref: "#/parameters/api-version"
      responses:
        "200":
          description: OK. The request has succeeded.
          schema:
            $ref: "#/definitions/OperationListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Operations
      x-ms-examples:
        Get available operations:
          parameters:
            api-version: 2020-03-01-preview
          responses:
            "200":
              body:
                value:
                  - display:
                      description: Check Digital Twins Service name availability.
                      operation: Check Digital Twins Service name availability.
                      provider: Microsoft Digital Twins Service
                      resource: Microsoft Digital Twins Service instance
                    name: Microsoft.DigitalTwins/checkNameAvailability/action
                  - display:
                      description: Create or update a Digital Twins Service instance.
                      operation: Create or update a Digital Twins Service instance.
                      provider: Microsoft Digital Twins Service
                      resource: Microsoft Digital Twins Service instance
                    name: Microsoft.DigitalTwins/DigitalTwinsInstance/write
                  - display:
                      description: Get a Digital Twins Service instance.
                      operation: Get a Digital Twins Service instance.
                      provider: Microsoft Digital Twins Service
                      resource: Microsoft Digital Twins Service instance
                    name: Microsoft.DigitalTwins/DigitalTwinsInstance/read
                  - display:
                      description: Delete a Digital Twins Service instance.
                      operation: Delete a Digital Twins Service instance.
                      provider: Microsoft Digital Twins Service
                      resource: Microsoft Digital Twins Service instance
                    name: Microsoft.DigitalTwins/DigitalTwinsInstance/delete
              headers: {}
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances":
    get:
      description: Get all the DigitalTwinsInstances in a subscription.
      operationId: DigitalTwins_List
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
      responses:
        "200":
          description: This is a synchronous operation. The body contains a JSON-serialized array of the metadata from all the DigitalTwinsInstances in the subscription.
          schema:
            $ref: "#/definitions/DigitalTwinsDescriptionListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DigitalTwinsInstance
      x-ms-examples:
        Get DigitalTwinsInstance resources by subscription:
          parameters:
            api-version: 2020-03-01-preview
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                    location: westus
                    name: myDigitalTwinsService
                    properties:
                      createdTime: 2019-11-19T12:55:05.229Z
                      hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                      provisioningState: Provisioning
                    sku:
                      name: F1
                    type: Microsoft.DigitalTwins/DigitalTwinsInstance
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg2/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService2
                    location: westus
                    name: myDigitalTwinsService2
                    properties:
                      createdTime: 2019-11-19T12:55:05.229Z
                      hostName: https://myDigitalTwinsService2.api.wus2.ss.azuredigitaltwins-test.net
                      provisioningState: Provisioning
                    sku:
                      name: F1
                    type: Microsoft.DigitalTwins/DigitalTwinsInstance
              headers: {}
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability":
    post:
      description: Check if a DigitalTwinsInstance name is available.
      operationId: DigitalTwins_CheckNameAvailability
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/location"
        - description: Set the name parameter in the DigitalTwinsInstanceCheckName structure to the name of the DigitalTwinsInstance to check.
          in: body
          name: digitalTwinsInstanceCheckName
          required: true
          schema:
            $ref: "#/definitions/CheckNameRequest"
      responses:
        "200":
          description: This is a synchronous operation. The body contains a JSON-serialized response that specifies whether the DigitalTwins service name is available. If the name is not available, the body contains the reason.
          schema:
            $ref: "#/definitions/CheckNameResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - CheckNameAvailability
      x-ms-examples:
        Check name Availability:
          parameters:
            api-version: 2020-03-01-preview
            digitalTwinsInstanceCheckName:
              name: myadtinstance
              type: Microsoft.DigitalTwins/digitalTwinsInstances
            location: WestUS
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                message: Name 'myadtinstance' is already taken. Please specify a different name
                name: myadtinstance
                nameAvailable: false
                reason: AlreadyExists
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances":
    get:
      description: Get all the DigitalTwinsInstances in a resource group.
      operationId: DigitalTwins_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
      responses:
        "200":
          description: This is a synchronous operation. The body contains a JSON-serialized array of the metadata from all the DigitalTwinsInstances in the resource group.
          schema:
            $ref: "#/definitions/DigitalTwinsDescriptionListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DigitalTwinsInstance
      x-ms-examples:
        Get DigitalTwinsInstance resources by resource group:
          parameters:
            api-version: 2020-03-01-preview
            resourceGroupName: resRg
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                    location: westus
                    name: myDigitalTwinsService
                    properties:
                      createdTime: 2019-11-19T12:55:05.229Z
                      hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                      provisioningState: Provisioning
                    sku:
                      name: F1
                    type: Microsoft.DigitalTwins/DigitalTwinsInstance
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService2
                    location: westus
                    name: myDigitalTwinsService2
                    properties:
                      createdTime: 2019-11-19T12:55:05.229Z
                      hostName: https://myDigitalTwinsService2.api.wus2.ss.azuredigitaltwins-test.net
                      provisioningState: Provisioning
                    sku:
                      name: F1
                    type: Microsoft.DigitalTwins/DigitalTwinsInstance
              headers: {}
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}":
    delete:
      description: Delete a DigitalTwinsInstance.
      operationId: DigitalTwins_Delete
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
      responses:
        "200":
          description: This is returned as a response to the status polling request for the delete operation. The body contains the resource representation that indicates a transitional provisioning state.
        "202":
          description: Accepted - Delete request accepted; the operation will complete asynchronously.
          schema:
            $ref: "#/definitions/DigitalTwinsDescription"
        "204":
          description: Once the long running delete operation completes successfully, a 204 No Content status code is returned when the status polling request finds the DigitalTwins service metadata in the service and the status of the delete operation is set to a completed state.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DigitalTwinsInstance
      x-ms-examples:
        Delete a DigitalTwinsInstance resource:
          parameters:
            api-version: 2020-03-01-preview
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200": {}
            "202":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                location: westus
                name: myDigitalTwinsService
                properties:
                  createdTime: 2019-11-19T12:55:05.229Z
                  hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                  lastUpdatedTime: 2019-12-06T12:21:58.610Z
                  provisioningState: Deleting
                sku:
                  name: F1
                type: Microsoft.DigitalTwins/DigitalTwinsInstance
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Get DigitalTwinsInstances resource.
      operationId: DigitalTwins_Get
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
      responses:
        "200":
          description: The body contains all the non-security properties of the DigitalTwinsInstance. Security-related properties are set to null.
          schema:
            $ref: "#/definitions/DigitalTwinsDescription"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DigitalTwinsInstance
      x-ms-examples:
        Get a DigitalTwinsInstance resource:
          parameters:
            api-version: 2020-03-01-preview
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                location: westus
                name: myDigitalTwinsService
                properties:
                  createdTime: 2019-11-19T12:55:05.229Z
                  hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                  lastUpdatedTime: 2019-12-06T12:21:58.610Z
                  provisioningState: Provisioning
                sku:
                  name: F1
                type: Microsoft.DigitalTwins/DigitalTwinsInstance
    patch:
      description: Update metadata of DigitalTwinsInstance.
      operationId: DigitalTwins_Update
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
        - description: The DigitalTwinsInstance and security metadata.
          in: body
          name: digitalTwinsPatchDescription
          required: true
          schema:
            $ref: "#/definitions/DigitalTwinsPatchDescription"
      responses:
        "200":
          description: This is returned as a response to the status polling request for the create or update operation. The body contains the resource representation that indicates a transitional provisioning state.
          schema:
            $ref: "#/definitions/DigitalTwinsDescription"
        "201":
          description: Accepted - Put request accepted; the operation will complete asynchronously.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DigitalTwinsInstance
      x-ms-examples:
        Patch a DigitalTwinsInstance resource:
          parameters:
            api-version: 2020-03-01-preview
            digitalTwinsPatchDescription:
              tags:
                purpose: dev
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                location: westus
                name: myDigitalTwinsService
                properties:
                  createdTime: 2019-11-19T12:55:05.229Z
                  hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                  lastUpdatedTime: 2019-12-06T12:21:58.610Z
                  provisioningState: Provisioning
                sku:
                  name: F1
                tags:
                  purpose: dev
                type: Microsoft.DigitalTwins/DigitalTwinsInstance
            "201": {}
      x-ms-long-running-operation: true
    put:
      description: Create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new body to update the DigitalTwinsInstance.
      operationId: DigitalTwins_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
        - description: The DigitalTwinsInstance and security metadata.
          in: body
          name: digitalTwinsCreate
          required: true
          schema:
            $ref: "#/definitions/DigitalTwinsDescription"
      responses:
        "200":
          description: This is returned as a response to the status polling request for the create or update operation. The body contains the resource representation that indicates a transitional provisioning state.
          schema:
            $ref: "#/definitions/DigitalTwinsDescription"
        "201":
          description: Created - Put request accepted; the operation will complete asynchronously.
          schema:
            $ref: "#/definitions/DigitalTwinsDescription"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - DigitalTwinsInstance
      x-ms-examples:
        Put a DigitalTwinsInstance resource:
          parameters:
            api-version: 2020-03-01-preview
            digitalTwinsCreate:
              location: WestUS
              sku:
                name: F1
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                location: westus
                name: myDigitalTwinsService
                properties:
                  createdTime: 2019-11-19T12:55:05.229Z
                  hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                  lastUpdatedTime: 2019-12-06T12:21:58.610Z
                  provisioningState: Provisioning
                sku:
                  name: F1
                type: Microsoft.DigitalTwins/DigitalTwinsInstance
            "201":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService
                location: westus
                name: myDigitalTwinsService
                properties:
                  createdTime: 2019-11-19T12:55:05.229Z
                  hostName: https://myDigitalTwinsService.api.wus2.ss.azuredigitaltwins-test.net
                  lastUpdatedTime: 2019-12-06T12:21:58.610Z
                  provisioningState: Provisioning
                sku:
                  name: F1
                type: Microsoft.DigitalTwins/DigitalTwinsInstance
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints":
    get:
      description: Get DigitalTwinsInstance Endpoints.
      operationId: DigitalTwinsEndpoint_List
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
      responses:
        "200":
          description: The body contains all the non-security properties of the DigitalTwinsInstance. Security-related properties are set to null.
          schema:
            $ref: "#/definitions/DigitalTwinsEndpointResourceListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Endpoints
      x-ms-examples:
        Get a DigitalTwinsInstance endpoints:
          parameters:
            api-version: 2020-03-01-preview
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService/endpoints/myServiceBus
                    name: myendpoint1
                    properties:
                      createdTime: 2019-11-19T01:10:34.350Z
                      endpointType: ServiceBus
                      primaryConnectionString: "************"
                      provisioningState: Provisioned
                      secondaryConnectionString: "************"
                    type: Microsoft.DigitalTwins/digitalTwinsInstance/endpoints
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService/endpoints/myServiceBus
                    name: myendpoint2
                    properties:
                      connectionString-PrimaryKey: "************"
                      connectionString-SecondaryKey: "************"
                      createdTime: 2019-11-19T01:10:34.350Z
                      endpointType: EventHub
                      provisioningState: Provisioned
                    type: Microsoft.DigitalTwins/digitalTwinsInstance/endpoints
      x-ms-pageable:
        nextLinkName: nextLink
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}":
    delete:
      description: Delete a DigitalTwinsInstance endpoint.
      operationId: DigitalTwinsEndpoint_Delete
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
        - $ref: "#/parameters/endpointName"
      responses:
        "200":
          description: This is returned as a response to the status polling request for the delete operation. The body contains the resource representation that indicates a transitional provisioning state.
        "202":
          description: Accepted - Delete request accepted; the operation will complete asynchronously.
          schema:
            $ref: "#/definitions/DigitalTwinsEndpointResource"
        "204":
          description: Once the long running delete operation completes successfully, a 204 No Content status code is returned when the status polling request finds the DigitalTwins service metadata in the service and the status of the delete operation is set to a completed state.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Endpoints
      x-ms-examples:
        Delete a DigitalTwinsInstance endpoint:
          parameters:
            api-version: 2020-03-01-preview
            endpointName: myendpoint
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200": {}
            "202":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService/endpoints/myServiceBus
                name: myendpoint
                properties:
                  createdTime: 2019-11-19T01:10:34.350Z
                  endpointType: ServiceBus
                  primaryConnectionString: "************"
                  provisioningState: Deleting
                  secondaryConnectionString: "************"
                type: Microsoft.DigitalTwins/digitalTwinsInstance/endpoints
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Get DigitalTwinsInstances Endpoint.
      operationId: DigitalTwinsEndpoint_Get
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
        - $ref: "#/parameters/endpointName"
      responses:
        "200":
          description: The body contains all the non-security properties of the DigitalTwinsInstance. Security-related properties are set to null.
          schema:
            $ref: "#/definitions/DigitalTwinsEndpointResource"
        default:
          description: Default error response
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Endpoints
      x-ms-examples:
        Get a DigitalTwinsInstance endpoint:
          parameters:
            api-version: 2020-03-01-preview
            endpointName: myServiceBus
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService/endpoints/myServiceBus
                name: myendpoint
                properties:
                  createdTime: 2019-11-19T01:10:34.350Z
                  endpointType: ServiceBus
                  primaryConnectionString: "************"
                  provisioningState: Provisioned
                  secondaryConnectionString: "************"
                type: Microsoft.DigitalTwins/digitalTwinsInstance/endpoints
    put:
      description: Create or update DigitalTwinsInstance endpoint.
      operationId: DigitalTwinsEndpoint_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
        - $ref: "#/parameters/endpointName"
        - description: The DigitalTwinsInstance endpoint metadata and security metadata.
          in: body
          name: endpointDescription
          required: true
          schema:
            $ref: "#/definitions/DigitalTwinsEndpointResource"
      responses:
        "200":
          description: This is returned as a response to the status polling request for the create or update operation. The body contains the resource representation that indicates a transitional provisioning state.
          schema:
            $ref: "#/definitions/DigitalTwinsEndpointResource"
        "201":
          description: Created - Put request accepted; the operation will complete asynchronously.
          schema:
            $ref: "#/definitions/DigitalTwinsEndpointResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - Endpoints
      x-ms-examples:
        Put a DigitalTwinsInstance resource:
          parameters:
            api-version: 2020-03-01-preview
            endpointDescription:
              properties:
                endpointType: ServiceBus
                primaryConnectionString: Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=
                secondaryConnectionString: Endpoint=sb://mysb.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=xyzxyzoX4=
            endpointName: myServiceBus
            resourceGroupName: resRg
            resourceName: myDigitalTwinsService
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService/endpoints/myServiceBus
                name: myServiceBus
                properties:
                  createdTime: 2019-11-19T01:10:34.350Z
                  endpointType: ServiceBus
                  primaryConnectionString: "************"
                  secondaryConnectionString: "************"
                type: Microsoft.DigitalTwins/digitalTwinsInstance/endpoints
            "201":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/DigitalTwinsInstance/myDigitalTwinsService/endpoints/myServiceBus
                name: myendpoint
                properties:
                  createdTime: 2019-11-19T01:10:34.350Z
                  endpointType: ServiceBus
                  primaryConnectionString: "************"
                  provisioningState: Provisioning
                  secondaryConnectionString: "************"
                type: Microsoft.DigitalTwins/digitalTwinsInstance/endpoints
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/integrationResources":
    get:
      description: Get DigitalTwinsInstance IoTHubs.
      operationId: DigitalTwinsIoTHubs_List
      parameters:
        - $ref: "#/parameters/api-version"
        - $ref: "#/parameters/subscriptionId"
        - $ref: "#/parameters/resourceGroupName"
        - $ref: "#/parameters/resourceName"
      responses:
        "200":
          description: The body contains all the non-security properties of the DigitalTwinsInstance. Security-related properties are set to null.
          schema:
            $ref: "#/definitions/DigitalTwinsIntegrationResourceListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - IoTHub Integration
      x-ms-examples:
        Get a DigitalTwinsInstance IoTHubs:
          parameters:
            api-version: 2020-03-01-preview
            resourceGroupName: resRg
            resourceName: myAdt
            subscriptionId: 50016170-c839-41ba-a724-51e9df440b9e
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/firstIh/Microsoft.DigitalTwins/integrationResources/myIoTHubLink1
                    name: myIoTHubLink1
                    properties:
                      createdTime: 2019-11-19T12:57:15.452Z
                      provisioningState: Provisioned
                      resourceId: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/digitalTwins/myAdt
                    type: Microsoft.DigitalTwins/integrationResources
                  - id: /subscriptions/f2bc87c8-fa5d-4c74-822e-7fd480f8df00/resourcegroups/anotherrg/providers/Microsoft.Devices/IoTHubs/secondIh/Microsoft.DigitalTwins/integrationResources/myIoTHubLink2
                    name: myIoTHubLink2
                    properties:
                      createdTime: 2019-12-29T12:57:15.452Z
                      provisioningState: Provisioned
                      resourceId: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/digitalTwins/myAdt
                    type: Microsoft.DigitalTwins/integrationResources
      x-ms-pageable:
        nextLinkName: nextLink
  "/{scope}/providers/Microsoft.DigitalTwins/integrationResources/{integrationResourceName}":
    delete:
      description: Deletes a DigitalTwinsInstance link with IoTHub.
      operationId: IoTHub_Delete
      parameters:
        - $ref: "#/parameters/scope"
        - $ref: "#/parameters/integrationResourceName"
      responses:
        "200":
          description: OK. DigitalTwinsInstance IoTHub link has been Deleted.
        "202":
          description: Accepted. Response includes a Location header which points to the DigitalTwins and IoTHub Integration resource.
          schema:
            $ref: "#/definitions/IntegrationResource"
        "204":
          description: NoContent. DigitalTwinsInstance IoTHub link does not exist.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - IoTHub Integration
      x-ms-examples:
        Connect IoTHub with DigitalTwinsInstance:
          parameters:
            api-version: 2020-03-01-preview
            integrationResourceName: myIoTHubLink
            scope: subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/myIoTHub
          responses:
            "200": {}
            "202":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/myIoTHub/provider/Microsoft.DigitalTwins/integrationResources/myIoTHubLink
                name: myIoTHubLink
                properties:
                  createdTime: 2019-11-19T12:57:15.452Z
                  provisioningState: Deleting
                  resourceId: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/digitalTwins/myAdt
                type: Microsoft.DigitalTwins/integrationResources
            "204": {}
      x-ms-long-running-operation: true
    get:
      description: Gets properties of an IoTHub Integration.
      operationId: IoTHub_Get
      parameters:
        - $ref: "#/parameters/scope"
        - $ref: "#/parameters/integrationResourceName"
      responses:
        "200":
          description: This is a synchronous operation. The body contains metadata about IoTHub and DigitalTwinsInstance Integration.
          schema:
            $ref: "#/definitions/IntegrationResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - IoTHub Integration
      x-ms-examples:
        Get IoTHub by DigitalTwinsInstance:
          parameters:
            api-version: 2020-03-01-preview
            integrationResourceName: myIoTHubLink
            scope: subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/myIoTHub
          responses:
            "200":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/myIoTHub/provider/Microsoft.DigitalTwins/integrationResources/myIoTHubLink
                name: myIoTHubLink
                properties:
                  createdTime: 2019-11-19T12:57:15.452Z
                  provisioningState: Provisioned
                  resourceId: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/digitalTwins/myAdt
                type: Microsoft.DigitalTwins/integrationResources
    put:
      description: Creates or Updates an IoTHub Integration with DigitalTwinsInstances.
      operationId: IoTHub_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/scope"
        - $ref: "#/parameters/integrationResourceName"
        - description: The IoTHub metadata.
          in: body
          name: iotHubDescription
          required: true
          schema:
            $ref: "#/definitions/IntegrationResource"
      responses:
        "201":
          description: This is an asynchronous operation. The body contains metadata about IoTHub and DigitalTwinsInstance Integration.
          schema:
            $ref: "#/definitions/IntegrationResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      tags:
        - IoTHub Integration
      x-ms-examples:
        Connect IoTHub with DigitalTwinsInstance:
          parameters:
            api-version: 2020-03-01-preview
            integrationResourceName: myIoTHubLink
            iotHubDescription:
              properties:
                resourceId: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/iotHubs/myih
            scope: subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/myIoTHub
          responses:
            "201":
              body:
                id: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.Devices/IoTHubs/myIoTHub/provider/Microsoft.DigitalTwins/integrationResources/myIoTHubLink
                name: myIoTHubLink
                properties:
                  createdTime: 2019-11-19T12:57:15.452Z
                  provisioningState: Provisioning
                  resourceId: /subscriptions/50016170-c839-41ba-a724-51e9df440b9e/resourcegroups/resRg/providers/Microsoft.DigitalTwins/digitalTwins/myAdt
                type: Microsoft.DigitalTwins/integrationResources
definitions:
  CheckNameRequest:
    description: The result returned from a database check name availability request.
    properties:
      name:
        description: Resource name.
        type: string
      type:
        description: The type of resource, for instance Microsoft.DigitalTwins/digitalTwinsInstances.
        enum:
          - Microsoft.DigitalTwins/digitalTwinsInstances
        type: string
        x-ms-enum:
          modelAsString: false
          name: Type
    required:
      - name
      - type
    type: object
  CheckNameResult:
    description: The result returned from a check name availability request.
    properties:
      message:
        description: Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated.
        type: string
      name:
        description: The name that was checked.
        type: string
      nameAvailable:
        description: Specifies a Boolean value that indicates if the name is available.
        type: boolean
      reason:
        description: Message providing the reason why the given name is invalid.
        enum:
          - Invalid
          - AlreadyExists
        type: string
        x-ms-enum:
          modelAsString: true
          name: reason
    type: object
  DigitalTwinsDescription:
    allOf:
      - $ref: "#/definitions/DigitalTwinsResource"
    description: The description of the DigitalTwins service.
    properties:
      properties:
        $ref: "#/definitions/DigitalTwinsProperties"
        description: DigitalTwins instance properties.
        x-ms-client-flatten: true
    required:
      - sku
    type: object
  DigitalTwinsDescriptionListResult:
    description: A list of DigitalTwins description objects with a next link.
    properties:
      nextLink:
        description: The link used to get the next page of DigitalTwins description objects.
        type: string
      value:
        description: A list of DigitalTwins description objects.
        items:
          $ref: "#/definitions/DigitalTwinsDescription"
        type: array
    type: object
  DigitalTwinsEndpointResource:
    allOf:
      - $ref: "#/definitions/ExternalResource"
    description: DigitalTwinsInstance endpoint resource.
    properties:
      properties:
        $ref: "#/definitions/DigitalTwinsEndpointResourceProperties"
        description: DigitalTwinsInstance endpoint resource properties.
        x-ms-client-flatten: true
    x-ms-azure-resource: true
  DigitalTwinsEndpointResourceListResult:
    description: A list of DigitalTwinsInstance Endpoints with a next link.
    properties:
      nextLink:
        description: The link used to get the next page of DigitalTwinsInstance Endpoints.
        type: string
      value:
        description: A list of DigitalTwinsInstance Endpoints.
        items:
          $ref: "#/definitions/DigitalTwinsEndpointResource"
        type: array
    type: object
  DigitalTwinsEndpointResourceProperties:
    description: Properties related to Digital Twins Endpoint
    discriminator: endpointType
    properties:
      createdTime:
        description: Time when the Endpoint was added to DigitalTwinsInstance.
        format: date-time
        readOnly: true
        type: string
      endpointType:
        description: The type of Digital Twins endpoint
        enum:
          - EventHub
          - EventGrid
          - ServiceBus
        type: string
        x-ms-enum:
          modelAsString: true
          name: endpointType
      provisioningState:
        description: The provisioning state.
        enum:
          - Provisioning
          - Deleting
          - Succeeded
          - Failed
          - Canceled
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: EndpointProvisioningState
      tags:
        additionalProperties:
          type: string
        description: The resource tags.
        type: object
    required:
      - endpointType
  DigitalTwinsIntegrationResourceListResult:
    description: A list of DigitalTwinsInstance IoTHubs with a next link.
    properties:
      nextLink:
        description: The link used to get the next page of DigitalTwinsInstance IoTHubs.
        type: string
      value:
        description: A list of DigitalTwinsInstance IoTHubs.
        items:
          $ref: "#/definitions/IntegrationResource"
        type: array
    type: object
  DigitalTwinsPatchDescription:
    description: The description of the DigitalTwins service.
    properties:
      tags:
        additionalProperties:
          type: string
        description: Instance tags
        type: object
    type: object
  DigitalTwinsProperties:
    description: The properties of a DigitalTwinsInstance.
    properties:
      createdTime:
        description: Time when DigitalTwinsInstance was created.
        format: date-time
        readOnly: true
        type: string
      hostName:
        description: Api endpoint to work with DigitalTwinsInstance.
        readOnly: true
        type: string
      lastUpdatedTime:
        description: Time when DigitalTwinsInstance was created.
        format: date-time
        readOnly: true
        type: string
      provisioningState:
        description: The provisioning state.
        enum:
          - Provisioning
          - Deleting
          - Succeeded
          - Failed
          - Canceled
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: provisioningState
    type: object
  DigitalTwinsResource:
    description: The common properties of a DigitalTwinsInstance.
    properties:
      id:
        description: The resource identifier.
        readOnly: true
        type: string
      location:
        description: The resource location.
        type: string
        x-ms-mutability:
          - create
          - read
      name:
        description: The resource name.
        pattern: ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$
        readOnly: true
        type: string
      sku:
        $ref: "#/definitions/DigitalTwinsSkuInfo"
        description: The resource sku.
      tags:
        additionalProperties:
          type: string
        description: The resource tags.
        type: object
      type:
        description: The resource type.
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
  DigitalTwinsSkuInfo:
    description: Information about the SKU of the DigitalTwinsInstance.
    properties:
      name:
        description: The name of the SKU.
        enum:
          - F1
        type: string
        x-ms-enum:
          modelAsString: true
          name: DigitalTwinsSku
    required:
      - name
    type: object
  ErrorDefinition:
    description: Error definition.
    properties:
      code:
        description: Service specific error code which serves as the substatus for the HTTP error code.
        readOnly: true
        type: string
      details:
        description: Internal error details.
        items:
          $ref: "#/definitions/ErrorDefinition"
        readOnly: true
        type: array
      message:
        description: Description of the error.
        readOnly: true
        type: string
  ErrorResponse:
    description: Error response.
    properties:
      error:
        $ref: "#/definitions/ErrorDefinition"
        description: Error description
  EventGrid:
    allOf:
      - $ref: "#/definitions/DigitalTwinsEndpointResourceProperties"
      - properties:
          TopicEndpoint:
            description: EventGrid Topic Endpoint
            type: string
          accessKey1:
            description: EventGrid secondary accesskey. Will be obfuscated during read
            type: string
          accessKey2:
            description: EventGrid secondary accesskey. Will be obfuscated during read
            type: string
        type: object
    description: properties related to eventgrid.
    required:
      - accessKey1
      - accessKey2
    x-ms-discriminator-value: EventGrid
  EventHub:
    allOf:
      - properties:
          connectionString-PrimaryKey:
            description: PrimaryConnectionString of the endpoint. Will be obfuscated during read
            type: string
          connectionString-SecondaryKey:
            description: SecondaryConnectionString of the endpoint. Will be obfuscated during read
            type: string
        type: object
      - $ref: "#/definitions/DigitalTwinsEndpointResourceProperties"
    description: properties related to eventhub.
    required:
      - connectionString-PrimaryKey
      - connectionString-SecondaryKey
    x-ms-discriminator-value: EventHub
  ExternalResource:
    description: Definition of a Resource.
    properties:
      id:
        description: The resource identifier.
        readOnly: true
        type: string
      name:
        description: Extension resource name.
        pattern: ^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$
        readOnly: true
        type: string
      type:
        description: The resource type.
        readOnly: true
        type: string
    type: object
  IntegrationResource:
    allOf:
      - $ref: "#/definitions/ExternalResource"
    description: IoTHub integration resource.
    properties:
      properties:
        $ref: "#/definitions/IntegrationResourceProperties"
        description: IoTHub integration resource properties.
        x-ms-client-flatten: true
    type: object
  IntegrationResourceProperties:
    allOf:
      - $ref: "#/definitions/IntegrationResourceState"
    description: Properties related to the IoTHub DigitalTwinsInstance Integration Resource.
    properties:
      createdTime:
        description: Time when the IoTHub was added to DigitalTwinsInstance.
        format: date-time
        readOnly: true
        type: string
      resourceId:
        description: Fully qualified resource identifier of the DigitalTwins Azure resource.
        type: string
    type: object
  IntegrationResourceState:
    description: Properties related to the IoTHub DigitalTwinsInstance Integration Resource.
    properties:
      provisioningState:
        description: DigitalTwinsInstance - IoTHub link state.
        enum:
          - Provisioning
          - Deleting
          - Succeeded
          - Failed
          - Canceled
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: IntegrationResourceState
    type: object
  IntegrationResourceUpdateInfo:
    allOf:
      - $ref: "#/definitions/ExternalResource"
    description: IoTHub integration resource.
    properties:
      properties:
        $ref: "#/definitions/IntegrationResourceUpdateProperties"
        description: IoTHub integration resource properties to be updated.
        x-ms-client-flatten: true
    type: object
  IntegrationResourceUpdateProperties:
    allOf:
      - $ref: "#/definitions/IntegrationResourceState"
    description: Updatable properties related to the IoTHub DigitalTwinsInstance Integration Resource.
    type: object
  Operation:
    description: DigitalTwins service REST API operation
    properties:
      display:
        $ref: "#/definitions/OperationDisplay"
        description: Operation properties display
      name:
        description: "Operation name: {provider}/{resource}/{read | write | action | delete}"
        readOnly: true
        type: string
    type: object
  OperationDisplay:
    description: The object that represents the operation.
    properties:
      description:
        description: Friendly description for the operation,
        readOnly: true
        type: string
      operation:
        description: Name of the operation
        readOnly: true
        type: string
      provider:
        description: "Service provider: Microsoft DigitalTwins"
        readOnly: true
        type: string
      resource:
        description: "Resource Type: DigitalTwinsInstances"
        readOnly: true
        type: string
    type: object
  OperationListResult:
    description: A list of DigitalTwins service operations. It contains a list of operations and a URL link to get the next set of results.
    properties:
      nextLink:
        description: The link used to get the next page of DigitalTwins description objects.
        type: string
      value:
        description: A list of DigitalTwins operations supported by the Microsoft.DigitalTwins resource provider.
        items:
          $ref: "#/definitions/Operation"
        readOnly: true
        type: array
    type: object
  ServiceBus:
    allOf:
      - $ref: "#/definitions/DigitalTwinsEndpointResourceProperties"
      - properties:
          primaryConnectionString:
            description: PrimaryConnectionString of the endpoint. Will be obfuscated during read
            type: string
          secondaryConnectionString:
            description: SecondaryConnectionString of the endpoint. Will be obfuscated during read
            type: string
        type: object
    description: properties related to servicebus.
    required:
      - primaryConnectionString
      - secondaryConnectionString
    x-ms-discriminator-value: ServiceBus
