# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/documentation/api-scenario/references/v1.2/schema.json
scope: ResourceGroup
variables:
  accountName:
    type: string
    prefix: accountn
  assetName:
    type: string
    prefix: assetnam
  liveEventName:
    type: string
    prefix: liveeven
  operationId:
    type: string
    prefix: operatio
  transformName:
    type: string
    prefix: transfor
  streamingEndpointName:
    type: string
    prefix: streamin
  filterName:
    type: string
    prefix: filterna
  trackName:
    type: string
    prefix: tracknam
  contentKeyPolicyName:
    type: string
    prefix: contentk
  jobName:
    type: string
    prefix: jobname
  streamingLocatorName:
    type: string
    prefix: streamin
  name:
    type: string
    prefix: name
  liveOutputName:
    type: string
    prefix: liveoutp
  locationName:
    type: string
    prefix: location
  testStorageAccount:
    type: string
    prefix: teststorageaccount
prepareSteps:
  - step: CreateStorageAccount
    operationId: StorageAccounts_Create
    readmeTag: ../../../../../../../storage/resource-manager/readme.md
    parameters:
      accountName: $(testStorageAccount)
      parameters:
        kind: StorageV2
        location: $(location)
        sku:
          name: Standard_LRS
          tier: "Standard"
  - step: CreateAccount
    operationId: Mediaservices_CreateOrUpdate
    exampleFile: ../../../../Accounts/stable/2021-11-01/examples/async-accounts-create.json
    requestUpdate:
      - replace: /parameters/properties/storageAccounts/0/id
        value: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Storage/storageAccounts/$(testStorageAccount)

scenarios:
  - scenario: MetadataTests
    steps:
      - operationId: Assets_CreateOrUpdate
        exampleFile: ../examples/assets-create.json
        requestUpdate:
          - replace: /parameters/properties/storageAccountName
            value: $(testStorageAccount)
      - operationId: Assets_List
        exampleFile: ../examples/assets-list-all.json
      - operationId: Assets_Get
        exampleFile: >-
          ../examples/assets-get-by-name.json
      - operationId: Assets_Update
        exampleFile: ../examples/assets-update.json
      - operationId: Assets_ListContainerSas
        exampleFile: >-
          ../examples/assets-list-sas-urls.json
      - operationId: Assets_ListStreamingLocators
        exampleFile: >-
          ../examples/assets-list-streaming-locators.json
      # cannot test Tracks API because we need the asset be encoded(need ism file)
      # - operationId: Tracks_CreateOrUpdate
      #   exampleFile: >-
      #     ../examples/asset-tracks-create.json
      # - operationId: Tracks_List
      #   exampleFile: >-
      #     ../examples/asset-tracks-list-all.json
      # - operationId: Tracks_Get
      #   exampleFile: >-
      #     ../examples/asset-tracks-get-by-name.json
      # - operationId: Tracks_Update
      #   exampleFile: >-
      #     ../examples/asset-tracks-update.json
      # - operationId: Tracks_UpdateTrackData
      #   exampleFile: >-
      #     ../examples/asset-tracks-update-data.json
      - operationId: StreamingPolicies_Create
        exampleFile: >-
          ../examples/streaming-policies-create-clear.json
      - operationId: StreamingPolicies_List
        exampleFile: >-
          ../examples/streaming-policies-list.json
      - operationId: StreamingPolicies_Get
        exampleFile: >-
          ../examples/streaming-policy-get-by-name.json
      - operationId: StreamingLocators_Create
        exampleFile: >-
          ../examples/streaming-locators-create-clear.json
        requestUpdate:
          - replace: /parameters/properties/assetName
            value: $(assetName)
      - operationId: StreamingLocators_List
        exampleFile: >-
          ../examples/streaming-locators-list.json
      - operationId: StreamingLocators_Get
        exampleFile: >-
          ../examples/streaming-locators-get-by-name.json
      - operationId: StreamingLocators_ListContentKeys
        exampleFile: >-
          ../examples/streaming-locators-list-content-keys.json
      - operationId: StreamingLocators_ListPaths
        exampleFile: >-
          ../examples/streaming-locators-list-paths-streaming-only.json
      - operationId: ContentKeyPolicies_CreateOrUpdate
        exampleFile: >-
          ../examples/content-key-policies-create-playready-open.json
      - operationId: ContentKeyPolicies_List
        exampleFile: >-
          ../examples/content-key-policies-list-all.json
      - operationId: ContentKeyPolicies_Get
        exampleFile: >-
          ../examples/content-key-policies-get-by-name.json
      - operationId: ContentKeyPolicies_Update
        exampleFile: >-
          ../examples/content-key-policies-update.json
      - operationId: ContentKeyPolicies_GetPolicyPropertiesWithSecrets
        exampleFile: >-
          ../examples/content-key-policies-get-with-secrets.json
      - operationId: AssetFilters_CreateOrUpdate
        exampleFile: >-
          ../examples/assetFilters-create.json
      - operationId: AssetFilters_List
        exampleFile: >-
          ../examples/assetFilters-list-all.json
      - operationId: AssetFilters_Get
        exampleFile: >-
          ../examples/assetFilters-get-by-name.json
      - operationId: AssetFilters_Update
        exampleFile: >-
          ../examples/assetFilters-update.json
      - operationId: AccountFilters_CreateOrUpdate
        exampleFile: >-
          ../examples/accountFilters-create.json
      - operationId: AccountFilters_List
        exampleFile: >-
          ../examples/accountFilters-list-all.json
      - operationId: AccountFilters_Get
        exampleFile: >-
          ../examples/accountFilters-get-by-name.json
      - operationId: AccountFilters_Update
        exampleFile: >-
          ../examples/accountFilters-update.json
      - operationId: StreamingPolicies_Delete
        exampleFile: >-
          ../examples/streaming-policies-delete.json
      - operationId: AccountFilters_Delete
        exampleFile: >-
          ../examples/accountFilters-delete.json
      - operationId: AssetFilters_Delete
        exampleFile: >-
          ../examples/assetFilters-delete.json
      - operationId: ContentKeyPolicies_Delete
        exampleFile: >-
          ../examples/content-key-policies-delete.json
      - operationId: StreamingLocators_Delete
        exampleFile: >-
          ../examples/streaming-locators-delete.json
      - operationId: Assets_Delete
        exampleFile: ../examples/assets-delete.json
      - operationId: Mediaservices_Delete
