swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: This Swagger was generated by the API Framework.
  title: Azure Media Services
  version: 2019-09-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/mediaservices/resource-manager/Microsoft.Media/preview/2019-09-01-preview/MediaGraphs.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: mediaservices-MediaGraphs
  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
parameters:
  ApiVersion:
    description: The Version of the API to be used with the client request.
    in: query
    name: api-version
    required: true
    type: string
  MediaServicesAccountName:
    description: The Media Services account name.
    in: path
    name: accountName
    required: true
    type: string
    x-ms-parameter-location: method
  ResourceGroupName:
    description: The name of the resource group within the Azure subscription.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionId:
    description: The unique identifier for a Microsoft Azure subscription.
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/mediaGraphs":
    get:
      description: Lists Media Graphs in the Media Services account
      operationId: MediaGraphs_List
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - $ref: "#/parameters/ApiVersion"
        - description: Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n.
          in: query
          name: $top
          required: false
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MediaGraphCollection"
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: List Media Graphs
      x-ms-examples:
        List all Media Graphs:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                value:
                  - name: SampleMediaGraph0
                    properties:
                      created: 2019-09-01T00:00:00Z
                      description: ""
                      lastModified: 2019-09-01T00:00:00Z
                      sinks:
                        - "@odata.type": "#Microsoft.Media.MediaGraphAssetSink"
                          assetName: Sample Asset0
                          inputs:
                            - RTSPSource0
                          name: AssetSink0
                      sources:
                        - "@odata.type": "#Microsoft.Media.MediaGraphRtspSource"
                          name: RTSPSource0
                          rtspUrl: rtsp://contoso.com:554/stream0
                      state: Stopped
                  - name: SampleMediaGraph1
                    properties:
                      created: 2019-09-01T00:00:00Z
                      description: ""
                      lastModified: 2019-09-01T00:00:00Z
                      sinks:
                        - "@odata.type": "#Microsoft.Media.MediaGraphAssetSink"
                          assetName: Sample Asset1
                          inputs:
                            - RTSPSource1
                          name: AssetSink1
                      sources:
                        - "@odata.type": "#Microsoft.Media.MediaGraphRtspSource"
                          name: RTSPSource1
                          rtspUrl: rtsp://contoso.com:554/stream1
                      state: Stopped
                  - name: SampleMediaGraph2
                    properties:
                      created: 2019-09-01T00:00:00Z
                      description: ""
                      lastModified: 2019-09-01T00:00:00Z
                      sinks:
                        - "@odata.type": "#Microsoft.Media.MediaGraphAssetSink"
                          assetName: Sample Asset2
                          inputs:
                            - RTSPSource2
                          name: AssetSink2
                      sources:
                        - "@odata.type": "#Microsoft.Media.MediaGraphRtspSource"
                          name: RTSPSource2
                          rtspUrl: rtsp://contoso.com:554/stream2
                      state: Stopped
      x-ms-pageable:
        nextLinkName: "@odata.nextLink"
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/mediaGraphs/{mediaGraphName}":
    delete:
      description: Deletes a Media Graph in the Media Services account
      operationId: MediaGraphs_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
        "204":
          description: NoContent
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Delete a Media Graph
      x-ms-examples:
        Delete a Media Graph:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200": {}
            "204": {}
    get:
      description: Get the details of a Media Graph in the Media Services account
      operationId: MediaGraphs_Get
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MediaGraph"
        "404":
          description: NotFound
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Get a Media Graph
      x-ms-examples:
        Get a Media Graph by name:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph1
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                name: SampleMediaGraph1
                properties:
                  created: 2019-09-01T00:00:00Z
                  description: ""
                  lastModified: 2019-09-01T00:00:00Z
                  sinks:
                    - "@odata.type": "#Microsoft.Media.MediaGraphAssetSink"
                      assetName: Sample Asset1
                      inputs:
                        - RTSPSource1
                      name: AssetSink1
                  sources:
                    - "@odata.type": "#Microsoft.Media.MediaGraphRtspSource"
                      name: RTSPSource1
                      rtspUrl: rtsp://contoso.com:554/stream1
                  state: Stopped
            "404": {}
    put:
      description: Create or update a Media Graph in the Media Services account
      operationId: MediaGraphs_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - description: The request parameters
          in: body
          name: parameters
          required: true
          schema:
            $ref: "#/definitions/MediaGraph"
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MediaGraph"
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Create or update a Media Graph
      x-ms-examples:
        Create or update a Media Graph:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph
            parameters:
              properties:
                description: updated description
                sinks:
                  - "@odata.type": "#Microsoft.Media.MediaGraphAssetSink"
                    assetName: SampleAsset
                    inputs:
                      - rtspSource
                    name: AssetSink
                sources:
                  - "@odata.type": "#Microsoft.Media.MediaGraphRtspSource"
                    credentials:
                      password: examplepassword
                      username: exampleusername
                    name: rtspSource
                    rtspUrl: rtsp://contoso.com:554/stream1
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                name: SampleMediaGraph
                properties:
                  created: 2019-09-01T00:00:00Z
                  description: updated description
                  lastModified: 2019-09-01T00:00:00Z
                  sinks:
                    - "@odata.type": "#Microsoft.Media.MediaGraphAssetSink"
                      assetName: SampleAsset
                      inputs:
                        - rtspSource
                      name: AssetSink
                  sources:
                    - "@odata.type": "#Microsoft.Media.MediaGraphRtspSource"
                      name: rtspSource
                      rtspUrl: rtsp://contoso.com:554/stream1
                  state: Stopped
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/mediaGraphs/{mediaGraphName}/operationResults/{operationId}":
    get:
      description: Get the operation result of a Media Graph in the Media Services account
      operationId: OperationResults_Get
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - description: The operation ID
          in: path
          name: operationId
          required: true
          type: string
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MediaGraphOperationResult"
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Get the operation result
      x-ms-examples:
        Get the operation result:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph
            operationId: 7877d0da-ae9b-4c5b-a1fa-c9ece3ef5d11
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body: {}
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/mediaGraphs/{mediaGraphName}/operationsStatus/{operationId}":
    get:
      description: Get the operation status of a Media Graph in the media services account
      operationId: OperationsStatus_Get
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - description: The operation ID
          in: path
          name: operationId
          required: true
          type: string
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/MediaGraphOperationStatus"
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Get the operation status
      x-ms-examples:
        Get the operation status:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph
            operationId: 7877d0da-ae9b-4c5b-a1fa-c9ece3ef5d11
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200":
              body:
                name: 7877d0da-ae9b-4c5b-a1fa-c9ece3ef5d11
                status: Succeeded
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/mediaGraphs/{mediaGraphName}/start":
    post:
      description: Start a Media Graph in the Media Services account
      operationId: MediaGraphs_Start
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
        "202":
          description: Accepted
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Start a Media Graph
      x-ms-examples:
        Start Media Graph:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200": {}
            "202": {}
      x-ms-long-running-operation: true
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/mediaGraphs/{mediaGraphName}/stop":
    post:
      description: Stop a Media Graph in the Media Services account
      operationId: MediaGraphs_Stop
      parameters:
        - $ref: "#/parameters/SubscriptionId"
        - $ref: "#/parameters/ResourceGroupName"
        - $ref: "#/parameters/MediaServicesAccountName"
        - description: The Media Graph name.
          in: path
          name: mediaGraphName
          required: true
          type: string
        - $ref: "#/parameters/ApiVersion"
      responses:
        "200":
          description: OK
        "202":
          description: Accepted
        default:
          description: Detailed error information.
          schema:
            $ref: "#/definitions/ApiError"
      summary: Stop a Media Graph
      x-ms-examples:
        Stop Media Graph:
          parameters:
            accountName: contosomedia
            api-version: 2019-09-01-preview
            mediaGraphName: SampleMediaGraph
            resourceGroupName: contoso
            subscriptionId: 00000000-0000-0000-0000-000000000000
          responses:
            "200": {}
            "202": {}
      x-ms-long-running-operation: true
definitions:
  ApiError:
    description: The API error.
    properties:
      error:
        $ref: "#/definitions/ODataError"
        description: The error properties.
    type: object
  MediaGraph:
    allOf:
      - allOf:
          - description: The core properties of ARM resources.
            properties:
              id:
                description: Fully qualified resource ID for the resource.
                readOnly: true
                type: string
              name:
                description: The name of the resource.
                readOnly: true
                type: string
              type:
                description: The type of the resource.
                readOnly: true
                type: string
            x-ms-azure-resource: true
        description: The resource model definition for a ARM proxy resource.
    description: The Media Graph.
    properties:
      properties:
        $ref: "#/definitions/MediaGraphProperties"
        x-ms-client-flatten: true
    type: object
  MediaGraphAssetSink:
    allOf:
      - $ref: "#/definitions/MediaGraphSink"
    description: Asset sink
    properties:
      assetName:
        description: Asset name
        type: string
    required:
      - assetName
    type: object
    x-ms-discriminator-value: "#Microsoft.Media.MediaGraphAssetSink"
  MediaGraphCollection:
    description: A collection of MediaGraph items.
    properties:
      "@odata.nextLink":
        description: A link to the next page of the collection (when the collection contains too many results to return in one response).
        type: string
      value:
        description: A collection of MediaGraph items.
        items:
          $ref: "#/definitions/MediaGraph"
        type: array
    type: object
  MediaGraphOperationError:
    description: The operation error
    properties:
      code:
        description: The operation error code
        type: string
      message:
        description: The operation error message
        type: string
    type: object
  MediaGraphOperationResult:
    description: The result of the Media Graph operation
    properties: {}
    type: object
  MediaGraphOperationStatus:
    description: The status of the Media Graph operation
    properties:
      error:
        $ref: "#/definitions/MediaGraphOperationError"
        description: The error for the Media Graph operation
      name:
        description: The name of the Media Graph operation
        type: string
      status:
        description: The status of the Media Graph operation
        type: string
    required:
      - name
    type: object
  MediaGraphProperties:
    description: Class for Media Graph properties
    properties:
      created:
        description: Date the Media Graph was created
        format: date-time
        readOnly: true
        type: string
        x-nullable: false
      description:
        description: Media Graph  description
        type: string
      lastModified:
        description: Date the Media Graph was last modified
        format: date-time
        readOnly: true
        type: string
        x-nullable: false
      sinks:
        description: Media Graph sinks
        items:
          $ref: "#/definitions/MediaGraphSink"
        type: array
      sources:
        description: Media Graph sources
        items:
          $ref: "#/definitions/MediaGraphSource"
        type: array
      state:
        description: Media Graph state
        enum:
          - Running
          - Starting
          - Stopped
          - Stopping
        readOnly: true
        type: string
        x-ms-enum:
          modelAsString: true
          name: MediaGraphState
          values:
            - description: Media Graph is Running
              value: Running
            - description: Media Graph is Starting
              value: Starting
            - description: Media Graph has Stopped
              value: Stopped
            - description: Media Graph is Stopping
              value: Stopping
        x-nullable: false
    required:
      - sources
      - sinks
    type: object
  MediaGraphRtspSource:
    allOf:
      - $ref: "#/definitions/MediaGraphSource"
    description: RTSP source
    properties:
      credentials:
        $ref: "#/definitions/MediaGraphUserCredentials"
        description: RTSP Credentials
      rtspUrl:
        description: RTSP URL
        type: string
    required:
      - rtspUrl
    type: object
    x-ms-discriminator-value: "#Microsoft.Media.MediaGraphRtspSource"
  MediaGraphSink:
    description: Media Sink
    discriminator: "@odata.type"
    properties:
      "@odata.type":
        description: The discriminator for derived types.
        type: string
      inputs:
        description: Sink inputs
        items:
          type: string
        type: array
      name:
        description: Sink name
        type: string
    required:
      - "@odata.type"
      - name
      - inputs
    type: object
  MediaGraphSource:
    description: Media source
    discriminator: "@odata.type"
    properties:
      "@odata.type":
        description: The discriminator for derived types.
        type: string
      name:
        description: Source name
        type: string
    required:
      - "@odata.type"
      - name
    type: object
  MediaGraphUserCredentials:
    description: Credentials to authenticate to Media Graph sources
    properties:
      password:
        description: Password credential
        type: string
      username:
        description: User name
        type: string
    required:
      - username
      - password
    type: object
  ODataError:
    description: Information about an error.
    properties:
      code:
        description: A language-independent error name.
        type: string
      details:
        description: The error details.
        items:
          $ref: "#/definitions/ODataError"
        type: array
      message:
        description: The error message.
        type: string
      target:
        description: The target of the error (for example, the name of the property in error).
        type: string
    type: object
