diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md b/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md new file mode 100644 index 000000000000..f3d80a0b8362 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-10-26) + +- Initial preview release. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/LICENSE.txt b/sdk/resourcemanager/mediaservices/armmediaservices/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/README.md b/sdk/resourcemanager/mediaservices/armmediaservices/README.md new file mode 100644 index 000000000000..59d2b3101e54 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/README.md @@ -0,0 +1,76 @@ +# Azure Media Services Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices) + +The `armmediaservices` module provides operations for working with Azure Media Services. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/mediaservices/armmediaservices) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.13 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Media Services module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Media Services. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Connecting to Azure Media Services + +Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. + +```go +con := arm.NewDefaultConnection(cred, nil) +``` + +For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +## Clients + +Azure Media Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. + +```go +client := armmediaservices.NewMediaservicesClient(con, "") +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Media Services` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md b/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md new file mode 100644 index 000000000000..b7fc4b3f3366 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md @@ -0,0 +1,12 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/c4d19b8362dfa8001c78062659ab88c529ece7b6/specification/mediaservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/c4d19b8362dfa8001c78062659ab88c529ece7b6/specification/mediaservices/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 +``` \ No newline at end of file diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/build.go b/sdk/resourcemanager/mediaservices/armmediaservices/build.go new file mode 100644 index 000000000000..eb6d2010cdab --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/mediaservices/armmediaservices + +package armmediaservices diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/ci.yml b/sdk/resourcemanager/mediaservices/armmediaservices/ci.yml new file mode 100644 index 000000000000..fa0bee0d64e5 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mediaservices/armmediaservices/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/mediaservices/armmediaservices/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/mediaservices/armmediaservices' diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go.mod b/sdk/resourcemanager/mediaservices/armmediaservices/go.mod new file mode 100644 index 000000000000..25a425916f0e --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go.mod @@ -0,0 +1,8 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v58.2.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 +) diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go.sum b/sdk/resourcemanager/mediaservices/armmediaservices/go.sum new file mode 100644 index 000000000000..c8ff7a2143ad --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go.sum @@ -0,0 +1,30 @@ +github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= +github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go_mod_tidy_hack.go b/sdk/resourcemanager/mediaservices/armmediaservices/go_mod_tidy_hack.go new file mode 100644 index 000000000000..3703fe755035 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armmediaservices + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go new file mode 100644 index 000000000000..a8009fff16ea --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go @@ -0,0 +1,364 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// AccountFiltersClient contains the methods for the AccountFilters group. +// Don't use this type directly, use NewAccountFiltersClient() instead. +type AccountFiltersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAccountFiltersClient creates a new instance of AccountFiltersClient with the specified values. +func NewAccountFiltersClient(con *arm.Connection, subscriptionID string) *AccountFiltersClient { + return &AccountFiltersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates an Account Filter in the Media Services account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AccountFiltersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, filterName string, parameters AccountFilter, options *AccountFiltersCreateOrUpdateOptions) (AccountFiltersCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, filterName, parameters, options) + if err != nil { + return AccountFiltersCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountFiltersCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AccountFiltersCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AccountFiltersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, filterName string, parameters AccountFilter, options *AccountFiltersCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AccountFiltersClient) createOrUpdateHandleResponse(resp *http.Response) (AccountFiltersCreateOrUpdateResponse, error) { + result := AccountFiltersCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { + return AccountFiltersCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *AccountFiltersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes an Account Filter in the Media Services account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AccountFiltersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, filterName string, options *AccountFiltersDeleteOptions) (AccountFiltersDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, filterName, options) + if err != nil { + return AccountFiltersDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountFiltersDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AccountFiltersDeleteResponse{}, client.deleteHandleError(resp) + } + return AccountFiltersDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AccountFiltersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, filterName string, options *AccountFiltersDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AccountFiltersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of an Account Filter in the Media Services account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AccountFiltersClient) Get(ctx context.Context, resourceGroupName string, accountName string, filterName string, options *AccountFiltersGetOptions) (AccountFiltersGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, filterName, options) + if err != nil { + return AccountFiltersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountFiltersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountFiltersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AccountFiltersClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, filterName string, options *AccountFiltersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AccountFiltersClient) getHandleResponse(resp *http.Response) (AccountFiltersGetResponse, error) { + result := AccountFiltersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { + return AccountFiltersGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AccountFiltersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - List Account Filters in the Media Services account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AccountFiltersClient) List(resourceGroupName string, accountName string, options *AccountFiltersListOptions) *AccountFiltersListPager { + return &AccountFiltersListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp AccountFiltersListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AccountFilterCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *AccountFiltersClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountFiltersListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AccountFiltersClient) listHandleResponse(resp *http.Response) (AccountFiltersListResponse, error) { + result := AccountFiltersListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilterCollection); err != nil { + return AccountFiltersListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *AccountFiltersClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates an existing Account Filter in the Media Services account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AccountFiltersClient) Update(ctx context.Context, resourceGroupName string, accountName string, filterName string, parameters AccountFilter, options *AccountFiltersUpdateOptions) (AccountFiltersUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, filterName, parameters, options) + if err != nil { + return AccountFiltersUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AccountFiltersUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AccountFiltersUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *AccountFiltersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, filterName string, parameters AccountFilter, options *AccountFiltersUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/accountFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *AccountFiltersClient) updateHandleResponse(resp *http.Response) (AccountFiltersUpdateResponse, error) { + result := AccountFiltersUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { + return AccountFiltersUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *AccountFiltersClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go new file mode 100644 index 000000000000..fbdc8ce546fd --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go @@ -0,0 +1,384 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// AssetFiltersClient contains the methods for the AssetFilters group. +// Don't use this type directly, use NewAssetFiltersClient() instead. +type AssetFiltersClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAssetFiltersClient creates a new instance of AssetFiltersClient with the specified values. +func NewAssetFiltersClient(con *arm.Connection, subscriptionID string) *AssetFiltersClient { + return &AssetFiltersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates an Asset Filter associated with the specified Asset. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetFiltersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, parameters AssetFilter, options *AssetFiltersCreateOrUpdateOptions) (AssetFiltersCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, assetName, filterName, parameters, options) + if err != nil { + return AssetFiltersCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetFiltersCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AssetFiltersCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AssetFiltersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, parameters AssetFilter, options *AssetFiltersCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AssetFiltersClient) createOrUpdateHandleResponse(resp *http.Response) (AssetFiltersCreateOrUpdateResponse, error) { + result := AssetFiltersCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { + return AssetFiltersCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *AssetFiltersClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes an Asset Filter associated with the specified Asset. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetFiltersClient) Delete(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, options *AssetFiltersDeleteOptions) (AssetFiltersDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, assetName, filterName, options) + if err != nil { + return AssetFiltersDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetFiltersDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AssetFiltersDeleteResponse{}, client.deleteHandleError(resp) + } + return AssetFiltersDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AssetFiltersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, options *AssetFiltersDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AssetFiltersClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of an Asset Filter associated with the specified Asset. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetFiltersClient) Get(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, options *AssetFiltersGetOptions) (AssetFiltersGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, assetName, filterName, options) + if err != nil { + return AssetFiltersGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetFiltersGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetFiltersGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AssetFiltersClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, options *AssetFiltersGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AssetFiltersClient) getHandleResponse(resp *http.Response) (AssetFiltersGetResponse, error) { + result := AssetFiltersGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { + return AssetFiltersGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AssetFiltersClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - List Asset Filters associated with the specified Asset. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetFiltersClient) List(resourceGroupName string, accountName string, assetName string, options *AssetFiltersListOptions) *AssetFiltersListPager { + return &AssetFiltersListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + }, + advancer: func(ctx context.Context, resp AssetFiltersListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AssetFilterCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *AssetFiltersClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetFiltersListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AssetFiltersClient) listHandleResponse(resp *http.Response) (AssetFiltersListResponse, error) { + result := AssetFiltersListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilterCollection); err != nil { + return AssetFiltersListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *AssetFiltersClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates an existing Asset Filter associated with the specified Asset. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetFiltersClient) Update(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, parameters AssetFilter, options *AssetFiltersUpdateOptions) (AssetFiltersUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, assetName, filterName, parameters, options) + if err != nil { + return AssetFiltersUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetFiltersUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetFiltersUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *AssetFiltersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, filterName string, parameters AssetFilter, options *AssetFiltersUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/assetFilters/{filterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + if filterName == "" { + return nil, errors.New("parameter filterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{filterName}", url.PathEscape(filterName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *AssetFiltersClient) updateHandleResponse(resp *http.Response) (AssetFiltersUpdateResponse, error) { + result := AssetFiltersUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { + return AssetFiltersUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *AssetFiltersClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go new file mode 100644 index 000000000000..b22519a586ea --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go @@ -0,0 +1,582 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// AssetsClient contains the methods for the Assets group. +// Don't use this type directly, use NewAssetsClient() instead. +type AssetsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewAssetsClient creates a new instance of AssetsClient with the specified values. +func NewAssetsClient(con *arm.Connection, subscriptionID string) *AssetsClient { + return &AssetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates an Asset in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, assetName string, parameters Asset, options *AssetsCreateOrUpdateOptions) (AssetsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, assetName, parameters, options) + if err != nil { + return AssetsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AssetsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AssetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, parameters Asset, options *AssetsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AssetsClient) createOrUpdateHandleResponse(resp *http.Response) (AssetsCreateOrUpdateResponse, error) { + result := AssetsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { + return AssetsCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *AssetsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes an Asset in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsDeleteOptions) (AssetsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + if err != nil { + return AssetsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AssetsDeleteResponse{}, client.deleteHandleError(resp) + } + return AssetsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AssetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *AssetsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of an Asset in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) Get(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsGetOptions) (AssetsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + if err != nil { + return AssetsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AssetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AssetsClient) getHandleResponse(resp *http.Response) (AssetsGetResponse, error) { + result := AssetsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { + return AssetsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *AssetsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GetEncryptionKey - Gets the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) GetEncryptionKey(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsGetEncryptionKeyOptions) (AssetsGetEncryptionKeyResponse, error) { + req, err := client.getEncryptionKeyCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + if err != nil { + return AssetsGetEncryptionKeyResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsGetEncryptionKeyResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetsGetEncryptionKeyResponse{}, client.getEncryptionKeyHandleError(resp) + } + return client.getEncryptionKeyHandleResponse(resp) +} + +// getEncryptionKeyCreateRequest creates the GetEncryptionKey request. +func (client *AssetsClient) getEncryptionKeyCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsGetEncryptionKeyOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/getEncryptionKey" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getEncryptionKeyHandleResponse handles the GetEncryptionKey response. +func (client *AssetsClient) getEncryptionKeyHandleResponse(resp *http.Response) (AssetsGetEncryptionKeyResponse, error) { + result := AssetsGetEncryptionKeyResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageEncryptedAssetDecryptionData); err != nil { + return AssetsGetEncryptionKeyResponse{}, err + } + return result, nil +} + +// getEncryptionKeyHandleError handles the GetEncryptionKey error response. +func (client *AssetsClient) getEncryptionKeyHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - List Assets in the Media Services account with optional filtering and ordering +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) List(resourceGroupName string, accountName string, options *AssetsListOptions) *AssetsListPager { + return &AssetsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp AssetsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AssetCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *AssetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AssetsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AssetsClient) listHandleResponse(resp *http.Response) (AssetsListResponse, error) { + result := AssetsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssetCollection); err != nil { + return AssetsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *AssetsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListContainerSas - Lists storage container URLs with shared access signatures (SAS) for uploading and downloading Asset content. The signatures are derived +// from the storage account keys. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) ListContainerSas(ctx context.Context, resourceGroupName string, accountName string, assetName string, parameters ListContainerSasInput, options *AssetsListContainerSasOptions) (AssetsListContainerSasResponse, error) { + req, err := client.listContainerSasCreateRequest(ctx, resourceGroupName, accountName, assetName, parameters, options) + if err != nil { + return AssetsListContainerSasResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsListContainerSasResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetsListContainerSasResponse{}, client.listContainerSasHandleError(resp) + } + return client.listContainerSasHandleResponse(resp) +} + +// listContainerSasCreateRequest creates the ListContainerSas request. +func (client *AssetsClient) listContainerSasCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, parameters ListContainerSasInput, options *AssetsListContainerSasOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listContainerSas" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listContainerSasHandleResponse handles the ListContainerSas response. +func (client *AssetsClient) listContainerSasHandleResponse(resp *http.Response) (AssetsListContainerSasResponse, error) { + result := AssetsListContainerSasResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AssetContainerSas); err != nil { + return AssetsListContainerSasResponse{}, err + } + return result, nil +} + +// listContainerSasHandleError handles the ListContainerSas error response. +func (client *AssetsClient) listContainerSasHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListStreamingLocators - Lists Streaming Locators which are associated with this asset. +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) ListStreamingLocators(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsListStreamingLocatorsOptions) (AssetsListStreamingLocatorsResponse, error) { + req, err := client.listStreamingLocatorsCreateRequest(ctx, resourceGroupName, accountName, assetName, options) + if err != nil { + return AssetsListStreamingLocatorsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsListStreamingLocatorsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetsListStreamingLocatorsResponse{}, client.listStreamingLocatorsHandleError(resp) + } + return client.listStreamingLocatorsHandleResponse(resp) +} + +// listStreamingLocatorsCreateRequest creates the ListStreamingLocators request. +func (client *AssetsClient) listStreamingLocatorsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, options *AssetsListStreamingLocatorsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}/listStreamingLocators" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listStreamingLocatorsHandleResponse handles the ListStreamingLocators response. +func (client *AssetsClient) listStreamingLocatorsHandleResponse(resp *http.Response) (AssetsListStreamingLocatorsResponse, error) { + result := AssetsListStreamingLocatorsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListStreamingLocatorsResponse); err != nil { + return AssetsListStreamingLocatorsResponse{}, err + } + return result, nil +} + +// listStreamingLocatorsHandleError handles the ListStreamingLocators error response. +func (client *AssetsClient) listStreamingLocatorsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates an existing Asset in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *AssetsClient) Update(ctx context.Context, resourceGroupName string, accountName string, assetName string, parameters Asset, options *AssetsUpdateOptions) (AssetsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, assetName, parameters, options) + if err != nil { + return AssetsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssetsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssetsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *AssetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, assetName string, parameters Asset, options *AssetsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/assets/{assetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if assetName == "" { + return nil, errors.New("parameter assetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assetName}", url.PathEscape(assetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *AssetsClient) updateHandleResponse(resp *http.Response) (AssetsUpdateResponse, error) { + result := AssetsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { + return AssetsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *AssetsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go new file mode 100644 index 000000000000..acf9ba2d989d --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go @@ -0,0 +1,1737 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +const ( + module = "armmediaservices" + version = "v0.1.0" +) + +// AacAudioProfile - The encoding profile to be used when encoding audio with AAC. +type AacAudioProfile string + +const ( + // AacAudioProfileAacLc - Specifies that the output audio is to be encoded into AAC Low Complexity profile (AAC-LC). + AacAudioProfileAacLc AacAudioProfile = "AacLc" + // AacAudioProfileHeAacV1 - Specifies that the output audio is to be encoded into HE-AAC v1 profile. + AacAudioProfileHeAacV1 AacAudioProfile = "HeAacV1" + // AacAudioProfileHeAacV2 - Specifies that the output audio is to be encoded into HE-AAC v2 profile. + AacAudioProfileHeAacV2 AacAudioProfile = "HeAacV2" +) + +// PossibleAacAudioProfileValues returns the possible values for the AacAudioProfile const type. +func PossibleAacAudioProfileValues() []AacAudioProfile { + return []AacAudioProfile{ + AacAudioProfileAacLc, + AacAudioProfileHeAacV1, + AacAudioProfileHeAacV2, + } +} + +// ToPtr returns a *AacAudioProfile pointing to the current value. +func (c AacAudioProfile) ToPtr() *AacAudioProfile { + return &c +} + +// AccountEncryptionKeyType - The type of key used to encrypt the Account Key. +type AccountEncryptionKeyType string + +const ( + // AccountEncryptionKeyTypeCustomerKey - The Account Key is encrypted with a Customer Key. + AccountEncryptionKeyTypeCustomerKey AccountEncryptionKeyType = "CustomerKey" + // AccountEncryptionKeyTypeSystemKey - The Account Key is encrypted with a System Key. + AccountEncryptionKeyTypeSystemKey AccountEncryptionKeyType = "SystemKey" +) + +// PossibleAccountEncryptionKeyTypeValues returns the possible values for the AccountEncryptionKeyType const type. +func PossibleAccountEncryptionKeyTypeValues() []AccountEncryptionKeyType { + return []AccountEncryptionKeyType{ + AccountEncryptionKeyTypeCustomerKey, + AccountEncryptionKeyTypeSystemKey, + } +} + +// ToPtr returns a *AccountEncryptionKeyType pointing to the current value. +func (c AccountEncryptionKeyType) ToPtr() *AccountEncryptionKeyType { + return &c +} + +// ActionType - Indicates the action type. +type ActionType string + +const ( + // ActionTypeInternal - An internal action. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// ToPtr returns a *ActionType pointing to the current value. +func (c ActionType) ToPtr() *ActionType { + return &c +} + +// AnalysisResolution - Specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," which will keep the +// input video at its original resolution when analyzed. Using +// "StandardDefinition" will resize input videos to standard definition while preserving the appropriate aspect ratio. It will only resize if the video +// is of higher resolution. For example, a 1920x1080 +// input would be scaled to 640x360 before processing. Switching to "StandardDefinition" will reduce the time it takes to process high resolution video. +// It may also reduce the cost of using this +// component (see https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). However, faces that end up being too small in +// the resized video may not be detected. +type AnalysisResolution string + +const ( + AnalysisResolutionSourceResolution AnalysisResolution = "SourceResolution" + AnalysisResolutionStandardDefinition AnalysisResolution = "StandardDefinition" +) + +// PossibleAnalysisResolutionValues returns the possible values for the AnalysisResolution const type. +func PossibleAnalysisResolutionValues() []AnalysisResolution { + return []AnalysisResolution{ + AnalysisResolutionSourceResolution, + AnalysisResolutionStandardDefinition, + } +} + +// ToPtr returns a *AnalysisResolution pointing to the current value. +func (c AnalysisResolution) ToPtr() *AnalysisResolution { + return &c +} + +// AssetContainerPermission - The permissions to set on the SAS URL. +type AssetContainerPermission string + +const ( + // AssetContainerPermissionRead - The SAS URL will allow read access to the container. + AssetContainerPermissionRead AssetContainerPermission = "Read" + // AssetContainerPermissionReadWrite - The SAS URL will allow read and write access to the container. + AssetContainerPermissionReadWrite AssetContainerPermission = "ReadWrite" + // AssetContainerPermissionReadWriteDelete - The SAS URL will allow read, write and delete access to the container. + AssetContainerPermissionReadWriteDelete AssetContainerPermission = "ReadWriteDelete" +) + +// PossibleAssetContainerPermissionValues returns the possible values for the AssetContainerPermission const type. +func PossibleAssetContainerPermissionValues() []AssetContainerPermission { + return []AssetContainerPermission{ + AssetContainerPermissionRead, + AssetContainerPermissionReadWrite, + AssetContainerPermissionReadWriteDelete, + } +} + +// ToPtr returns a *AssetContainerPermission pointing to the current value. +func (c AssetContainerPermission) ToPtr() *AssetContainerPermission { + return &c +} + +// AssetStorageEncryptionFormat - The Asset encryption format. One of None or MediaStorageEncryption. +type AssetStorageEncryptionFormat string + +const ( + // AssetStorageEncryptionFormatMediaStorageClientEncryption - The Asset is encrypted with Media Services client-side encryption. + AssetStorageEncryptionFormatMediaStorageClientEncryption AssetStorageEncryptionFormat = "MediaStorageClientEncryption" + // AssetStorageEncryptionFormatNone - The Asset does not use client-side storage encryption (this is the only allowed value for new Assets). + AssetStorageEncryptionFormatNone AssetStorageEncryptionFormat = "None" +) + +// PossibleAssetStorageEncryptionFormatValues returns the possible values for the AssetStorageEncryptionFormat const type. +func PossibleAssetStorageEncryptionFormatValues() []AssetStorageEncryptionFormat { + return []AssetStorageEncryptionFormat{ + AssetStorageEncryptionFormatMediaStorageClientEncryption, + AssetStorageEncryptionFormatNone, + } +} + +// ToPtr returns a *AssetStorageEncryptionFormat pointing to the current value. +func (c AssetStorageEncryptionFormat) ToPtr() *AssetStorageEncryptionFormat { + return &c +} + +// AttributeFilter - The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. +type AttributeFilter string + +const ( + // AttributeFilterAll - All tracks will be included. + AttributeFilterAll AttributeFilter = "All" + // AttributeFilterBottom - The first track will be included when the attribute is sorted in ascending order. Generally used to select the smallest bitrate. + AttributeFilterBottom AttributeFilter = "Bottom" + // AttributeFilterTop - The first track will be included when the attribute is sorted in descending order. Generally used to select the largest bitrate. + AttributeFilterTop AttributeFilter = "Top" + // AttributeFilterValueEquals - Any tracks that have an attribute equal to the value given will be included. + AttributeFilterValueEquals AttributeFilter = "ValueEquals" +) + +// PossibleAttributeFilterValues returns the possible values for the AttributeFilter const type. +func PossibleAttributeFilterValues() []AttributeFilter { + return []AttributeFilter{ + AttributeFilterAll, + AttributeFilterBottom, + AttributeFilterTop, + AttributeFilterValueEquals, + } +} + +// ToPtr returns a *AttributeFilter pointing to the current value. +func (c AttributeFilter) ToPtr() *AttributeFilter { + return &c +} + +// AudioAnalysisMode - Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. +type AudioAnalysisMode string + +const ( + // AudioAnalysisModeBasic - This mode performs speech-to-text transcription and generation of a VTT subtitle/caption file. The output of this mode includes + // an Insights JSON file including only the keywords, transcription,and timing information. Automatic language detection and speaker diarization are not + // included in this mode. + AudioAnalysisModeBasic AudioAnalysisMode = "Basic" + // AudioAnalysisModeStandard - Performs all operations included in the Basic mode, additionally performing language detection and speaker diarization. + AudioAnalysisModeStandard AudioAnalysisMode = "Standard" +) + +// PossibleAudioAnalysisModeValues returns the possible values for the AudioAnalysisMode const type. +func PossibleAudioAnalysisModeValues() []AudioAnalysisMode { + return []AudioAnalysisMode{ + AudioAnalysisModeBasic, + AudioAnalysisModeStandard, + } +} + +// ToPtr returns a *AudioAnalysisMode pointing to the current value. +func (c AudioAnalysisMode) ToPtr() *AudioAnalysisMode { + return &c +} + +// BlurType - Blur type +type BlurType string + +const ( + // BlurTypeBlack - Black: Black out filter + BlurTypeBlack BlurType = "Black" + // BlurTypeBox - Box: debug filter, bounding box only + BlurTypeBox BlurType = "Box" + // BlurTypeHigh - High: Confuse blur filter + BlurTypeHigh BlurType = "High" + // BlurTypeLow - Low: box-car blur filter + BlurTypeLow BlurType = "Low" + // BlurTypeMed - Med: Gaussian blur filter + BlurTypeMed BlurType = "Med" +) + +// PossibleBlurTypeValues returns the possible values for the BlurType const type. +func PossibleBlurTypeValues() []BlurType { + return []BlurType{ + BlurTypeBlack, + BlurTypeBox, + BlurTypeHigh, + BlurTypeLow, + BlurTypeMed, + } +} + +// ToPtr returns a *BlurType pointing to the current value. +func (c BlurType) ToPtr() *BlurType { + return &c +} + +// ChannelMapping - Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or multi-channel audio tracks. +type ChannelMapping string + +const ( + // ChannelMappingBackLeft - The Back Left Channel. Sometimes referred to as the Left Surround Channel. + ChannelMappingBackLeft ChannelMapping = "BackLeft" + // ChannelMappingBackRight - The Back Right Channel. Sometimes referred to as the Right Surround Channel. + ChannelMappingBackRight ChannelMapping = "BackRight" + // ChannelMappingCenter - The Center Channel. + ChannelMappingCenter ChannelMapping = "Center" + // ChannelMappingFrontLeft - The Front Left Channel. + ChannelMappingFrontLeft ChannelMapping = "FrontLeft" + // ChannelMappingFrontRight - The Front Right Channel. + ChannelMappingFrontRight ChannelMapping = "FrontRight" + // ChannelMappingLowFrequencyEffects - Low Frequency Effects Channel. Sometimes referred to as the Subwoofer. + ChannelMappingLowFrequencyEffects ChannelMapping = "LowFrequencyEffects" + // ChannelMappingStereoLeft - The Left Stereo channel. Sometimes referred to as Down Mix Left. + ChannelMappingStereoLeft ChannelMapping = "StereoLeft" + // ChannelMappingStereoRight - The Right Stereo channel. Sometimes referred to as Down Mix Right. + ChannelMappingStereoRight ChannelMapping = "StereoRight" +) + +// PossibleChannelMappingValues returns the possible values for the ChannelMapping const type. +func PossibleChannelMappingValues() []ChannelMapping { + return []ChannelMapping{ + ChannelMappingBackLeft, + ChannelMappingBackRight, + ChannelMappingCenter, + ChannelMappingFrontLeft, + ChannelMappingFrontRight, + ChannelMappingLowFrequencyEffects, + ChannelMappingStereoLeft, + ChannelMappingStereoRight, + } +} + +// ToPtr returns a *ChannelMapping pointing to the current value. +func (c ChannelMapping) ToPtr() *ChannelMapping { + return &c +} + +// Complexity - Allows you to configure the encoder settings to control the balance between speed and quality. Example: set Complexity as Speed for faster +// encoding but less compression efficiency. +type Complexity string + +const ( + // ComplexityBalanced - Configures the encoder to use settings that achieve a balance between speed and quality. + ComplexityBalanced Complexity = "Balanced" + // ComplexityQuality - Configures the encoder to use settings optimized to produce higher quality output at the expense of slower overall encode time. + ComplexityQuality Complexity = "Quality" + // ComplexitySpeed - Configures the encoder to use settings optimized for faster encoding. Quality is sacrificed to decrease encoding time. + ComplexitySpeed Complexity = "Speed" +) + +// PossibleComplexityValues returns the possible values for the Complexity const type. +func PossibleComplexityValues() []Complexity { + return []Complexity{ + ComplexityBalanced, + ComplexityQuality, + ComplexitySpeed, + } +} + +// ToPtr returns a *Complexity pointing to the current value. +func (c Complexity) ToPtr() *Complexity { + return &c +} + +// ContentKeyPolicyFairPlayRentalAndLeaseKeyType - The rental and lease key type. +type ContentKeyPolicyFairPlayRentalAndLeaseKeyType string + +const ( + // ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeDualExpiry - Dual expiry for offline rental. + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeDualExpiry ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "DualExpiry" + // ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentLimited - Content key can be persisted and the valid duration is limited by the Rental Duration + // value + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentLimited ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "PersistentLimited" + // ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentUnlimited - Content key can be persisted with an unlimited duration + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentUnlimited ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "PersistentUnlimited" + // ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUndefined - Key duration is not specified. + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUndefined ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "Undefined" + // ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUnknown - Represents a ContentKeyPolicyFairPlayRentalAndLeaseKeyType that is unavailable in current API + // version. + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUnknown ContentKeyPolicyFairPlayRentalAndLeaseKeyType = "Unknown" +) + +// PossibleContentKeyPolicyFairPlayRentalAndLeaseKeyTypeValues returns the possible values for the ContentKeyPolicyFairPlayRentalAndLeaseKeyType const type. +func PossibleContentKeyPolicyFairPlayRentalAndLeaseKeyTypeValues() []ContentKeyPolicyFairPlayRentalAndLeaseKeyType { + return []ContentKeyPolicyFairPlayRentalAndLeaseKeyType{ + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeDualExpiry, + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentLimited, + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypePersistentUnlimited, + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUndefined, + ContentKeyPolicyFairPlayRentalAndLeaseKeyTypeUnknown, + } +} + +// ToPtr returns a *ContentKeyPolicyFairPlayRentalAndLeaseKeyType pointing to the current value. +func (c ContentKeyPolicyFairPlayRentalAndLeaseKeyType) ToPtr() *ContentKeyPolicyFairPlayRentalAndLeaseKeyType { + return &c +} + +// ContentKeyPolicyPlayReadyContentType - The PlayReady content type. +type ContentKeyPolicyPlayReadyContentType string + +const ( + // ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload - Ultraviolet download content type. + ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload ContentKeyPolicyPlayReadyContentType = "UltraVioletDownload" + // ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming - Ultraviolet streaming content type. + ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming ContentKeyPolicyPlayReadyContentType = "UltraVioletStreaming" + // ContentKeyPolicyPlayReadyContentTypeUnknown - Represents a ContentKeyPolicyPlayReadyContentType that is unavailable in current API version. + ContentKeyPolicyPlayReadyContentTypeUnknown ContentKeyPolicyPlayReadyContentType = "Unknown" + // ContentKeyPolicyPlayReadyContentTypeUnspecified - Unspecified content type. + ContentKeyPolicyPlayReadyContentTypeUnspecified ContentKeyPolicyPlayReadyContentType = "Unspecified" +) + +// PossibleContentKeyPolicyPlayReadyContentTypeValues returns the possible values for the ContentKeyPolicyPlayReadyContentType const type. +func PossibleContentKeyPolicyPlayReadyContentTypeValues() []ContentKeyPolicyPlayReadyContentType { + return []ContentKeyPolicyPlayReadyContentType{ + ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload, + ContentKeyPolicyPlayReadyContentTypeUltraVioletStreaming, + ContentKeyPolicyPlayReadyContentTypeUnknown, + ContentKeyPolicyPlayReadyContentTypeUnspecified, + } +} + +// ToPtr returns a *ContentKeyPolicyPlayReadyContentType pointing to the current value. +func (c ContentKeyPolicyPlayReadyContentType) ToPtr() *ContentKeyPolicyPlayReadyContentType { + return &c +} + +// ContentKeyPolicyPlayReadyLicenseType - The license type. +type ContentKeyPolicyPlayReadyLicenseType string + +const ( + // ContentKeyPolicyPlayReadyLicenseTypeNonPersistent - Non persistent license. + ContentKeyPolicyPlayReadyLicenseTypeNonPersistent ContentKeyPolicyPlayReadyLicenseType = "NonPersistent" + // ContentKeyPolicyPlayReadyLicenseTypePersistent - Persistent license. Allows offline playback. + ContentKeyPolicyPlayReadyLicenseTypePersistent ContentKeyPolicyPlayReadyLicenseType = "Persistent" + // ContentKeyPolicyPlayReadyLicenseTypeUnknown - Represents a ContentKeyPolicyPlayReadyLicenseType that is unavailable in current API version. + ContentKeyPolicyPlayReadyLicenseTypeUnknown ContentKeyPolicyPlayReadyLicenseType = "Unknown" +) + +// PossibleContentKeyPolicyPlayReadyLicenseTypeValues returns the possible values for the ContentKeyPolicyPlayReadyLicenseType const type. +func PossibleContentKeyPolicyPlayReadyLicenseTypeValues() []ContentKeyPolicyPlayReadyLicenseType { + return []ContentKeyPolicyPlayReadyLicenseType{ + ContentKeyPolicyPlayReadyLicenseTypeNonPersistent, + ContentKeyPolicyPlayReadyLicenseTypePersistent, + ContentKeyPolicyPlayReadyLicenseTypeUnknown, + } +} + +// ToPtr returns a *ContentKeyPolicyPlayReadyLicenseType pointing to the current value. +func (c ContentKeyPolicyPlayReadyLicenseType) ToPtr() *ContentKeyPolicyPlayReadyLicenseType { + return &c +} + +// ContentKeyPolicyPlayReadyUnknownOutputPassingOption - Configures Unknown output handling settings of the license. +type ContentKeyPolicyPlayReadyUnknownOutputPassingOption string + +const ( + // ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed - Passing the video portion of protected content to an Unknown Output is allowed. + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "Allowed" + // ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction - Passing the video portion of protected content to an Unknown Output + // is allowed but with constrained resolution. + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "AllowedWithVideoConstriction" + // ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed - Passing the video portion of protected content to an Unknown Output is not allowed. + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "NotAllowed" + // ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown - Represents a ContentKeyPolicyPlayReadyUnknownOutputPassingOption that is unavailable in + // current API version. + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown ContentKeyPolicyPlayReadyUnknownOutputPassingOption = "Unknown" +) + +// PossibleContentKeyPolicyPlayReadyUnknownOutputPassingOptionValues returns the possible values for the ContentKeyPolicyPlayReadyUnknownOutputPassingOption const type. +func PossibleContentKeyPolicyPlayReadyUnknownOutputPassingOptionValues() []ContentKeyPolicyPlayReadyUnknownOutputPassingOption { + return []ContentKeyPolicyPlayReadyUnknownOutputPassingOption{ + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowed, + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionAllowedWithVideoConstriction, + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed, + ContentKeyPolicyPlayReadyUnknownOutputPassingOptionUnknown, + } +} + +// ToPtr returns a *ContentKeyPolicyPlayReadyUnknownOutputPassingOption pointing to the current value. +func (c ContentKeyPolicyPlayReadyUnknownOutputPassingOption) ToPtr() *ContentKeyPolicyPlayReadyUnknownOutputPassingOption { + return &c +} + +// ContentKeyPolicyRestrictionTokenType - The type of token. +type ContentKeyPolicyRestrictionTokenType string + +const ( + // ContentKeyPolicyRestrictionTokenTypeJwt - JSON Web Token. + ContentKeyPolicyRestrictionTokenTypeJwt ContentKeyPolicyRestrictionTokenType = "Jwt" + // ContentKeyPolicyRestrictionTokenTypeSwt - Simple Web Token. + ContentKeyPolicyRestrictionTokenTypeSwt ContentKeyPolicyRestrictionTokenType = "Swt" + // ContentKeyPolicyRestrictionTokenTypeUnknown - Represents a ContentKeyPolicyRestrictionTokenType that is unavailable in current API version. + ContentKeyPolicyRestrictionTokenTypeUnknown ContentKeyPolicyRestrictionTokenType = "Unknown" +) + +// PossibleContentKeyPolicyRestrictionTokenTypeValues returns the possible values for the ContentKeyPolicyRestrictionTokenType const type. +func PossibleContentKeyPolicyRestrictionTokenTypeValues() []ContentKeyPolicyRestrictionTokenType { + return []ContentKeyPolicyRestrictionTokenType{ + ContentKeyPolicyRestrictionTokenTypeJwt, + ContentKeyPolicyRestrictionTokenTypeSwt, + ContentKeyPolicyRestrictionTokenTypeUnknown, + } +} + +// ToPtr returns a *ContentKeyPolicyRestrictionTokenType pointing to the current value. +func (c ContentKeyPolicyRestrictionTokenType) ToPtr() *ContentKeyPolicyRestrictionTokenType { + return &c +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// DefaultAction - The behavior for IP access control in Key Delivery. +type DefaultAction string + +const ( + // DefaultActionAllow - All public IP addresses are allowed. + DefaultActionAllow DefaultAction = "Allow" + // DefaultActionDeny - Public IP addresses are blocked. + DefaultActionDeny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns the possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{ + DefaultActionAllow, + DefaultActionDeny, + } +} + +// ToPtr returns a *DefaultAction pointing to the current value. +func (c DefaultAction) ToPtr() *DefaultAction { + return &c +} + +// DeinterlaceMode - The deinterlacing mode. Defaults to AutoPixelAdaptive. +type DeinterlaceMode string + +const ( + // DeinterlaceModeAutoPixelAdaptive - Apply automatic pixel adaptive de-interlacing on each frame in the input video. + DeinterlaceModeAutoPixelAdaptive DeinterlaceMode = "AutoPixelAdaptive" + // DeinterlaceModeOff - Disables de-interlacing of the source video. + DeinterlaceModeOff DeinterlaceMode = "Off" +) + +// PossibleDeinterlaceModeValues returns the possible values for the DeinterlaceMode const type. +func PossibleDeinterlaceModeValues() []DeinterlaceMode { + return []DeinterlaceMode{ + DeinterlaceModeAutoPixelAdaptive, + DeinterlaceModeOff, + } +} + +// ToPtr returns a *DeinterlaceMode pointing to the current value. +func (c DeinterlaceMode) ToPtr() *DeinterlaceMode { + return &c +} + +// DeinterlaceParity - The field parity for de-interlacing, defaults to Auto. +type DeinterlaceParity string + +const ( + // DeinterlaceParityAuto - Automatically detect the order of fields + DeinterlaceParityAuto DeinterlaceParity = "Auto" + // DeinterlaceParityBottomFieldFirst - Apply bottom field first processing of input video. + DeinterlaceParityBottomFieldFirst DeinterlaceParity = "BottomFieldFirst" + // DeinterlaceParityTopFieldFirst - Apply top field first processing of input video. + DeinterlaceParityTopFieldFirst DeinterlaceParity = "TopFieldFirst" +) + +// PossibleDeinterlaceParityValues returns the possible values for the DeinterlaceParity const type. +func PossibleDeinterlaceParityValues() []DeinterlaceParity { + return []DeinterlaceParity{ + DeinterlaceParityAuto, + DeinterlaceParityBottomFieldFirst, + DeinterlaceParityTopFieldFirst, + } +} + +// ToPtr returns a *DeinterlaceParity pointing to the current value. +func (c DeinterlaceParity) ToPtr() *DeinterlaceParity { + return &c +} + +// EncoderNamedPreset - The built-in preset to be used for encoding videos. +type EncoderNamedPreset string + +const ( + // EncoderNamedPresetAACGoodQualityAudio - Produces a single MP4 file containing only stereo audio encoded at 192 kbps. + EncoderNamedPresetAACGoodQualityAudio EncoderNamedPreset = "AACGoodQualityAudio" + // EncoderNamedPresetAdaptiveStreaming - Produces a set of GOP aligned MP4 files with H.264 video and stereo AAC audio. Auto-generates a bitrate ladder + // based on the input resolution, bitrate and frame rate. The auto-generated preset will never exceed the input resolution. For example, if the input is + // 720p, output will remain 720p at best. + EncoderNamedPresetAdaptiveStreaming EncoderNamedPreset = "AdaptiveStreaming" + // EncoderNamedPresetContentAwareEncoding - Produces a set of GOP-aligned MP4s by using content-aware encoding. Given any input content, the service performs + // an initial lightweight analysis of the input content, and uses the results to determine the optimal number of layers, appropriate bitrate and resolution + // settings for delivery by adaptive streaming. This preset is particularly effective for low and medium complexity videos, where the output files will + // be at lower bitrates but at a quality that still delivers a good experience to viewers. The output will contain MP4 files with video and audio interleaved. + EncoderNamedPresetContentAwareEncoding EncoderNamedPreset = "ContentAwareEncoding" + // EncoderNamedPresetContentAwareEncodingExperimental - Exposes an experimental preset for content-aware encoding. Given any input content, the service + // attempts to automatically determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. The + // underlying algorithms will continue to evolve over time. The output will contain MP4 files with video and audio interleaved. + EncoderNamedPresetContentAwareEncodingExperimental EncoderNamedPreset = "ContentAwareEncodingExperimental" + // EncoderNamedPresetCopyAllBitrateNonInterleaved - Copy all video and audio streams from the input asset as non-interleaved video and audio output files. + // This preset can be used to clip an existing asset or convert a group of key frame (GOP) aligned MP4 files as an asset that can be streamed. + EncoderNamedPresetCopyAllBitrateNonInterleaved EncoderNamedPreset = "CopyAllBitrateNonInterleaved" + // EncoderNamedPresetH264MultipleBitrate1080P - Produces a set of 8 GOP-aligned MP4 files, ranging from 6000 kbps to 400 kbps, and stereo AAC audio. Resolution + // starts at 1080p and goes down to 180p. + EncoderNamedPresetH264MultipleBitrate1080P EncoderNamedPreset = "H264MultipleBitrate1080p" + // EncoderNamedPresetH264MultipleBitrate720P - Produces a set of 6 GOP-aligned MP4 files, ranging from 3400 kbps to 400 kbps, and stereo AAC audio. Resolution + // starts at 720p and goes down to 180p. + EncoderNamedPresetH264MultipleBitrate720P EncoderNamedPreset = "H264MultipleBitrate720p" + // EncoderNamedPresetH264MultipleBitrateSD - Produces a set of 5 GOP-aligned MP4 files, ranging from 1900kbps to 400 kbps, and stereo AAC audio. Resolution + // starts at 480p and goes down to 240p. + EncoderNamedPresetH264MultipleBitrateSD EncoderNamedPreset = "H264MultipleBitrateSD" + // EncoderNamedPresetH264SingleBitrate1080P - Produces an MP4 file where the video is encoded with H.264 codec at 6750 kbps and a picture height of 1080 + // pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. + EncoderNamedPresetH264SingleBitrate1080P EncoderNamedPreset = "H264SingleBitrate1080p" + // EncoderNamedPresetH264SingleBitrate720P - Produces an MP4 file where the video is encoded with H.264 codec at 4500 kbps and a picture height of 720 pixels, + // and the stereo audio is encoded with AAC-LC codec at 128 kbps. + EncoderNamedPresetH264SingleBitrate720P EncoderNamedPreset = "H264SingleBitrate720p" + // EncoderNamedPresetH264SingleBitrateSD - Produces an MP4 file where the video is encoded with H.264 codec at 2200 kbps and a picture height of 480 pixels, + // and the stereo audio is encoded with AAC-LC codec at 128 kbps. + EncoderNamedPresetH264SingleBitrateSD EncoderNamedPreset = "H264SingleBitrateSD" + // EncoderNamedPresetH265AdaptiveStreaming - Produces a set of GOP aligned MP4 files with H.265 video and stereo AAC audio. Auto-generates a bitrate ladder + // based on the input resolution, bitrate and frame rate. The auto-generated preset will never exceed the input resolution. For example, if the input is + // 720p, output will remain 720p at best. + EncoderNamedPresetH265AdaptiveStreaming EncoderNamedPreset = "H265AdaptiveStreaming" + // EncoderNamedPresetH265ContentAwareEncoding - Produces a set of GOP-aligned MP4s by using content-aware encoding. Given any input content, the service + // performs an initial lightweight analysis of the input content, and uses the results to determine the optimal number of layers, appropriate bitrate and + // resolution settings for delivery by adaptive streaming. This preset is particularly effective for low and medium complexity videos, where the output + // files will be at lower bitrates but at a quality that still delivers a good experience to viewers. The output will contain MP4 files with video and audio + // interleaved. + EncoderNamedPresetH265ContentAwareEncoding EncoderNamedPreset = "H265ContentAwareEncoding" + // EncoderNamedPresetH265SingleBitrate1080P - Produces an MP4 file where the video is encoded with H.265 codec at 3500 kbps and a picture height of 1080 + // pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. + EncoderNamedPresetH265SingleBitrate1080P EncoderNamedPreset = "H265SingleBitrate1080p" + // EncoderNamedPresetH265SingleBitrate4K - Produces an MP4 file where the video is encoded with H.265 codec at 9500 kbps and a picture height of 2160 pixels, + // and the stereo audio is encoded with AAC-LC codec at 128 kbps. + EncoderNamedPresetH265SingleBitrate4K EncoderNamedPreset = "H265SingleBitrate4K" + // EncoderNamedPresetH265SingleBitrate720P - Produces an MP4 file where the video is encoded with H.265 codec at 1800 kbps and a picture height of 720 pixels, + // and the stereo audio is encoded with AAC-LC codec at 128 kbps. + EncoderNamedPresetH265SingleBitrate720P EncoderNamedPreset = "H265SingleBitrate720p" +) + +// PossibleEncoderNamedPresetValues returns the possible values for the EncoderNamedPreset const type. +func PossibleEncoderNamedPresetValues() []EncoderNamedPreset { + return []EncoderNamedPreset{ + EncoderNamedPresetAACGoodQualityAudio, + EncoderNamedPresetAdaptiveStreaming, + EncoderNamedPresetContentAwareEncoding, + EncoderNamedPresetContentAwareEncodingExperimental, + EncoderNamedPresetCopyAllBitrateNonInterleaved, + EncoderNamedPresetH264MultipleBitrate1080P, + EncoderNamedPresetH264MultipleBitrate720P, + EncoderNamedPresetH264MultipleBitrateSD, + EncoderNamedPresetH264SingleBitrate1080P, + EncoderNamedPresetH264SingleBitrate720P, + EncoderNamedPresetH264SingleBitrateSD, + EncoderNamedPresetH265AdaptiveStreaming, + EncoderNamedPresetH265ContentAwareEncoding, + EncoderNamedPresetH265SingleBitrate1080P, + EncoderNamedPresetH265SingleBitrate4K, + EncoderNamedPresetH265SingleBitrate720P, + } +} + +// ToPtr returns a *EncoderNamedPreset pointing to the current value. +func (c EncoderNamedPreset) ToPtr() *EncoderNamedPreset { + return &c +} + +// EncryptionScheme - Encryption scheme +type EncryptionScheme string + +const ( + // EncryptionSchemeCommonEncryptionCbcs - CommonEncryptionCbcs scheme + EncryptionSchemeCommonEncryptionCbcs EncryptionScheme = "CommonEncryptionCbcs" + // EncryptionSchemeCommonEncryptionCenc - CommonEncryptionCenc scheme + EncryptionSchemeCommonEncryptionCenc EncryptionScheme = "CommonEncryptionCenc" + // EncryptionSchemeEnvelopeEncryption - EnvelopeEncryption scheme + EncryptionSchemeEnvelopeEncryption EncryptionScheme = "EnvelopeEncryption" + // EncryptionSchemeNoEncryption - NoEncryption scheme + EncryptionSchemeNoEncryption EncryptionScheme = "NoEncryption" +) + +// PossibleEncryptionSchemeValues returns the possible values for the EncryptionScheme const type. +func PossibleEncryptionSchemeValues() []EncryptionScheme { + return []EncryptionScheme{ + EncryptionSchemeCommonEncryptionCbcs, + EncryptionSchemeCommonEncryptionCenc, + EncryptionSchemeEnvelopeEncryption, + EncryptionSchemeNoEncryption, + } +} + +// ToPtr returns a *EncryptionScheme pointing to the current value. +func (c EncryptionScheme) ToPtr() *EncryptionScheme { + return &c +} + +// EntropyMode - The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. +type EntropyMode string + +const ( + // EntropyModeCabac - Context Adaptive Binary Arithmetic Coder (CABAC) entropy encoding. + EntropyModeCabac EntropyMode = "Cabac" + // EntropyModeCavlc - Context Adaptive Variable Length Coder (CAVLC) entropy encoding. + EntropyModeCavlc EntropyMode = "Cavlc" +) + +// PossibleEntropyModeValues returns the possible values for the EntropyMode const type. +func PossibleEntropyModeValues() []EntropyMode { + return []EntropyMode{ + EntropyModeCabac, + EntropyModeCavlc, + } +} + +// ToPtr returns a *EntropyMode pointing to the current value. +func (c EntropyMode) ToPtr() *EntropyMode { + return &c +} + +// FaceRedactorMode - This mode provides the ability to choose between the following settings: 1) Analyze - For detection only.This mode generates a metadata +// JSON file marking appearances of faces throughout the +// video.Where possible, appearances of the same person are assigned the same ID. 2) Combined - Additionally redacts(blurs) detected faces. 3) Redact - +// This enables a 2-pass process, allowing for +// selective redaction of a subset of detected faces.It takes in the metadata file from a prior analyze pass, along with the source video, and a user-selected +// subset of IDs that require redaction. +type FaceRedactorMode string + +const ( + // FaceRedactorModeAnalyze - Analyze mode detects faces and outputs a metadata file with the results. Allows editing of the metadata file before faces are + // blurred with Redact mode. + FaceRedactorModeAnalyze FaceRedactorMode = "Analyze" + // FaceRedactorModeCombined - Combined mode does the Analyze and Redact steps in one pass when editing the analyzed faces is not desired. + FaceRedactorModeCombined FaceRedactorMode = "Combined" + // FaceRedactorModeRedact - Redact mode consumes the metadata file from Analyze mode and redacts the faces found. + FaceRedactorModeRedact FaceRedactorMode = "Redact" +) + +// PossibleFaceRedactorModeValues returns the possible values for the FaceRedactorMode const type. +func PossibleFaceRedactorModeValues() []FaceRedactorMode { + return []FaceRedactorMode{ + FaceRedactorModeAnalyze, + FaceRedactorModeCombined, + FaceRedactorModeRedact, + } +} + +// ToPtr returns a *FaceRedactorMode pointing to the current value. +func (c FaceRedactorMode) ToPtr() *FaceRedactorMode { + return &c +} + +// FilterTrackPropertyCompareOperation - The track property condition operation. +type FilterTrackPropertyCompareOperation string + +const ( + // FilterTrackPropertyCompareOperationEqual - The equal operation. + FilterTrackPropertyCompareOperationEqual FilterTrackPropertyCompareOperation = "Equal" + // FilterTrackPropertyCompareOperationNotEqual - The not equal operation. + FilterTrackPropertyCompareOperationNotEqual FilterTrackPropertyCompareOperation = "NotEqual" +) + +// PossibleFilterTrackPropertyCompareOperationValues returns the possible values for the FilterTrackPropertyCompareOperation const type. +func PossibleFilterTrackPropertyCompareOperationValues() []FilterTrackPropertyCompareOperation { + return []FilterTrackPropertyCompareOperation{ + FilterTrackPropertyCompareOperationEqual, + FilterTrackPropertyCompareOperationNotEqual, + } +} + +// ToPtr returns a *FilterTrackPropertyCompareOperation pointing to the current value. +func (c FilterTrackPropertyCompareOperation) ToPtr() *FilterTrackPropertyCompareOperation { + return &c +} + +// FilterTrackPropertyType - The track property type. +type FilterTrackPropertyType string + +const ( + // FilterTrackPropertyTypeBitrate - The bitrate. + FilterTrackPropertyTypeBitrate FilterTrackPropertyType = "Bitrate" + // FilterTrackPropertyTypeFourCC - The fourCC. + FilterTrackPropertyTypeFourCC FilterTrackPropertyType = "FourCC" + // FilterTrackPropertyTypeLanguage - The language. + FilterTrackPropertyTypeLanguage FilterTrackPropertyType = "Language" + // FilterTrackPropertyTypeName - The name. + FilterTrackPropertyTypeName FilterTrackPropertyType = "Name" + // FilterTrackPropertyTypeType - The type. + FilterTrackPropertyTypeType FilterTrackPropertyType = "Type" + // FilterTrackPropertyTypeUnknown - The unknown track property type. + FilterTrackPropertyTypeUnknown FilterTrackPropertyType = "Unknown" +) + +// PossibleFilterTrackPropertyTypeValues returns the possible values for the FilterTrackPropertyType const type. +func PossibleFilterTrackPropertyTypeValues() []FilterTrackPropertyType { + return []FilterTrackPropertyType{ + FilterTrackPropertyTypeBitrate, + FilterTrackPropertyTypeFourCC, + FilterTrackPropertyTypeLanguage, + FilterTrackPropertyTypeName, + FilterTrackPropertyTypeType, + FilterTrackPropertyTypeUnknown, + } +} + +// ToPtr returns a *FilterTrackPropertyType pointing to the current value. +func (c FilterTrackPropertyType) ToPtr() *FilterTrackPropertyType { + return &c +} + +// H264Complexity - Tells the encoder how to choose its encoding settings. The default value is Balanced. +type H264Complexity string + +const ( + // H264ComplexityBalanced - Tells the encoder to use settings that achieve a balance between speed and quality. + H264ComplexityBalanced H264Complexity = "Balanced" + // H264ComplexityQuality - Tells the encoder to use settings that are optimized to produce higher quality output at the expense of slower overall encode + // time. + H264ComplexityQuality H264Complexity = "Quality" + // H264ComplexitySpeed - Tells the encoder to use settings that are optimized for faster encoding. Quality is sacrificed to decrease encoding time. + H264ComplexitySpeed H264Complexity = "Speed" +) + +// PossibleH264ComplexityValues returns the possible values for the H264Complexity const type. +func PossibleH264ComplexityValues() []H264Complexity { + return []H264Complexity{ + H264ComplexityBalanced, + H264ComplexityQuality, + H264ComplexitySpeed, + } +} + +// ToPtr returns a *H264Complexity pointing to the current value. +func (c H264Complexity) ToPtr() *H264Complexity { + return &c +} + +// H264VideoProfile - We currently support Baseline, Main, High, High422, High444. Default is Auto. +type H264VideoProfile string + +const ( + // H264VideoProfileAuto - Tells the encoder to automatically determine the appropriate H.264 profile. + H264VideoProfileAuto H264VideoProfile = "Auto" + // H264VideoProfileBaseline - Baseline profile + H264VideoProfileBaseline H264VideoProfile = "Baseline" + // H264VideoProfileHigh - High profile. + H264VideoProfileHigh H264VideoProfile = "High" + // H264VideoProfileHigh422 - High 4:2:2 profile. + H264VideoProfileHigh422 H264VideoProfile = "High422" + // H264VideoProfileHigh444 - High 4:4:4 predictive profile. + H264VideoProfileHigh444 H264VideoProfile = "High444" + // H264VideoProfileMain - Main profile + H264VideoProfileMain H264VideoProfile = "Main" +) + +// PossibleH264VideoProfileValues returns the possible values for the H264VideoProfile const type. +func PossibleH264VideoProfileValues() []H264VideoProfile { + return []H264VideoProfile{ + H264VideoProfileAuto, + H264VideoProfileBaseline, + H264VideoProfileHigh, + H264VideoProfileHigh422, + H264VideoProfileHigh444, + H264VideoProfileMain, + } +} + +// ToPtr returns a *H264VideoProfile pointing to the current value. +func (c H264VideoProfile) ToPtr() *H264VideoProfile { + return &c +} + +// H265Complexity - Tells the encoder how to choose its encoding settings. Quality will provide for a higher compression ratio but at a higher cost and +// longer compute time. Speed will produce a relatively larger file but +// is faster and more economical. The default value is Balanced. +type H265Complexity string + +const ( + // H265ComplexityBalanced - Tells the encoder to use settings that achieve a balance between speed and quality. + H265ComplexityBalanced H265Complexity = "Balanced" + // H265ComplexityQuality - Tells the encoder to use settings that are optimized to produce higher quality output at the expense of slower overall encode + // time. + H265ComplexityQuality H265Complexity = "Quality" + // H265ComplexitySpeed - Tells the encoder to use settings that are optimized for faster encoding. Quality is sacrificed to decrease encoding time. + H265ComplexitySpeed H265Complexity = "Speed" +) + +// PossibleH265ComplexityValues returns the possible values for the H265Complexity const type. +func PossibleH265ComplexityValues() []H265Complexity { + return []H265Complexity{ + H265ComplexityBalanced, + H265ComplexityQuality, + H265ComplexitySpeed, + } +} + +// ToPtr returns a *H265Complexity pointing to the current value. +func (c H265Complexity) ToPtr() *H265Complexity { + return &c +} + +// H265VideoProfile - We currently support Main. Default is Auto. +type H265VideoProfile string + +const ( + // H265VideoProfileAuto - Tells the encoder to automatically determine the appropriate H.265 profile. + H265VideoProfileAuto H265VideoProfile = "Auto" + // H265VideoProfileMain - Main profile (https://x265.readthedocs.io/en/default/cli.html?highlight=profile#profile-level-tier) + H265VideoProfileMain H265VideoProfile = "Main" +) + +// PossibleH265VideoProfileValues returns the possible values for the H265VideoProfile const type. +func PossibleH265VideoProfileValues() []H265VideoProfile { + return []H265VideoProfile{ + H265VideoProfileAuto, + H265VideoProfileMain, + } +} + +// ToPtr returns a *H265VideoProfile pointing to the current value. +func (c H265VideoProfile) ToPtr() *H265VideoProfile { + return &c +} + +// InsightsType - Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and +// 'AllInsights'. The default is AllInsights. If you set this to +// AllInsights and the input is audio only, then only audio insights are generated. Similarly if the input is video only, then only video insights are generated. +// It is recommended that you not use +// AudioInsightsOnly if you expect some of your inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to be audio only. Your +// Jobs in such conditions would error out. +type InsightsType string + +const ( + // InsightsTypeAllInsights - Generate both audio and video insights. Fails if either audio or video Insights fail. + InsightsTypeAllInsights InsightsType = "AllInsights" + // InsightsTypeAudioInsightsOnly - Generate audio only insights. Ignore video even if present. Fails if no audio is present. + InsightsTypeAudioInsightsOnly InsightsType = "AudioInsightsOnly" + // InsightsTypeVideoInsightsOnly - Generate video only insights. Ignore audio if present. Fails if no video is present. + InsightsTypeVideoInsightsOnly InsightsType = "VideoInsightsOnly" +) + +// PossibleInsightsTypeValues returns the possible values for the InsightsType const type. +func PossibleInsightsTypeValues() []InsightsType { + return []InsightsType{ + InsightsTypeAllInsights, + InsightsTypeAudioInsightsOnly, + InsightsTypeVideoInsightsOnly, + } +} + +// ToPtr returns a *InsightsType pointing to the current value. +func (c InsightsType) ToPtr() *InsightsType { + return &c +} + +// InterleaveOutput - Sets the interleave mode of the output to control how audio and video are stored in the container format. Example: set InterleavedOutput +// as NonInterleavedOutput to produce audio-only and video-only +// outputs in separate MP4 files. +type InterleaveOutput string + +const ( + // InterleaveOutputInterleavedOutput - The output includes both audio and video. + InterleaveOutputInterleavedOutput InterleaveOutput = "InterleavedOutput" + // InterleaveOutputNonInterleavedOutput - The output is video-only or audio-only. + InterleaveOutputNonInterleavedOutput InterleaveOutput = "NonInterleavedOutput" +) + +// PossibleInterleaveOutputValues returns the possible values for the InterleaveOutput const type. +func PossibleInterleaveOutputValues() []InterleaveOutput { + return []InterleaveOutput{ + InterleaveOutputInterleavedOutput, + InterleaveOutputNonInterleavedOutput, + } +} + +// ToPtr returns a *InterleaveOutput pointing to the current value. +func (c InterleaveOutput) ToPtr() *InterleaveOutput { + return &c +} + +// JobErrorCategory - Helps with categorization of errors. +type JobErrorCategory string + +const ( + // JobErrorCategoryConfiguration - The error is configuration related. + JobErrorCategoryConfiguration JobErrorCategory = "Configuration" + // JobErrorCategoryContent - The error is related to data in the input files. + JobErrorCategoryContent JobErrorCategory = "Content" + // JobErrorCategoryDownload - The error is download related. + JobErrorCategoryDownload JobErrorCategory = "Download" + // JobErrorCategoryService - The error is service related. + JobErrorCategoryService JobErrorCategory = "Service" + // JobErrorCategoryUpload - The error is upload related. + JobErrorCategoryUpload JobErrorCategory = "Upload" +) + +// PossibleJobErrorCategoryValues returns the possible values for the JobErrorCategory const type. +func PossibleJobErrorCategoryValues() []JobErrorCategory { + return []JobErrorCategory{ + JobErrorCategoryConfiguration, + JobErrorCategoryContent, + JobErrorCategoryDownload, + JobErrorCategoryService, + JobErrorCategoryUpload, + } +} + +// ToPtr returns a *JobErrorCategory pointing to the current value. +func (c JobErrorCategory) ToPtr() *JobErrorCategory { + return &c +} + +// JobErrorCode - Error code describing the error. +type JobErrorCode string + +const ( + // JobErrorCodeConfigurationUnsupported - There was a problem with the combination of input files and the configuration settings applied, fix the configuration + // settings and retry with the same input, or change input to match the configuration. + JobErrorCodeConfigurationUnsupported JobErrorCode = "ConfigurationUnsupported" + // JobErrorCodeContentMalformed - There was a problem with the input content (for example: zero byte files, or corrupt/non-decodable files), check the input + // files. + JobErrorCodeContentMalformed JobErrorCode = "ContentMalformed" + // JobErrorCodeContentUnsupported - There was a problem with the format of the input (not valid media file, or an unsupported file/codec), check the validity + // of the input files. + JobErrorCodeContentUnsupported JobErrorCode = "ContentUnsupported" + // JobErrorCodeDownloadNotAccessible - While trying to download the input files, the files were not accessible, please check the availability of the source. + JobErrorCodeDownloadNotAccessible JobErrorCode = "DownloadNotAccessible" + // JobErrorCodeDownloadTransientError - While trying to download the input files, there was an issue during transfer (storage service, network errors), + // see details and check your source. + JobErrorCodeDownloadTransientError JobErrorCode = "DownloadTransientError" + // JobErrorCodeServiceError - Fatal service error, please contact support. + JobErrorCodeServiceError JobErrorCode = "ServiceError" + // JobErrorCodeServiceTransientError - Transient error, please retry, if retry is unsuccessful, please contact support. + JobErrorCodeServiceTransientError JobErrorCode = "ServiceTransientError" + // JobErrorCodeUploadNotAccessible - While trying to upload the output files, the destination was not reachable, please check the availability of the destination. + JobErrorCodeUploadNotAccessible JobErrorCode = "UploadNotAccessible" + // JobErrorCodeUploadTransientError - While trying to upload the output files, there was an issue during transfer (storage service, network errors), see + // details and check your destination. + JobErrorCodeUploadTransientError JobErrorCode = "UploadTransientError" +) + +// PossibleJobErrorCodeValues returns the possible values for the JobErrorCode const type. +func PossibleJobErrorCodeValues() []JobErrorCode { + return []JobErrorCode{ + JobErrorCodeConfigurationUnsupported, + JobErrorCodeContentMalformed, + JobErrorCodeContentUnsupported, + JobErrorCodeDownloadNotAccessible, + JobErrorCodeDownloadTransientError, + JobErrorCodeServiceError, + JobErrorCodeServiceTransientError, + JobErrorCodeUploadNotAccessible, + JobErrorCodeUploadTransientError, + } +} + +// ToPtr returns a *JobErrorCode pointing to the current value. +func (c JobErrorCode) ToPtr() *JobErrorCode { + return &c +} + +// JobRetry - Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. +type JobRetry string + +const ( + // JobRetryDoNotRetry - Issue needs to be investigated and then the job resubmitted with corrections or retried once the underlying issue has been corrected. + JobRetryDoNotRetry JobRetry = "DoNotRetry" + // JobRetryMayRetry - Issue may be resolved after waiting for a period of time and resubmitting the same Job. + JobRetryMayRetry JobRetry = "MayRetry" +) + +// PossibleJobRetryValues returns the possible values for the JobRetry const type. +func PossibleJobRetryValues() []JobRetry { + return []JobRetry{ + JobRetryDoNotRetry, + JobRetryMayRetry, + } +} + +// ToPtr returns a *JobRetry pointing to the current value. +func (c JobRetry) ToPtr() *JobRetry { + return &c +} + +// JobState - Describes the state of the JobOutput. +type JobState string + +const ( + // JobStateCanceled - The job was canceled. This is a final state for the job. + JobStateCanceled JobState = "Canceled" + // JobStateCanceling - The job is in the process of being canceled. This is a transient state for the job. + JobStateCanceling JobState = "Canceling" + // JobStateError - The job has encountered an error. This is a final state for the job. + JobStateError JobState = "Error" + // JobStateFinished - The job is finished. This is a final state for the job. + JobStateFinished JobState = "Finished" + // JobStateProcessing - The job is processing. This is a transient state for the job. + JobStateProcessing JobState = "Processing" + // JobStateQueued - The job is in a queued state, waiting for resources to become available. This is a transient state. + JobStateQueued JobState = "Queued" + // JobStateScheduled - The job is being scheduled to run on an available resource. This is a transient state, between queued and processing states. + JobStateScheduled JobState = "Scheduled" +) + +// PossibleJobStateValues returns the possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{ + JobStateCanceled, + JobStateCanceling, + JobStateError, + JobStateFinished, + JobStateProcessing, + JobStateQueued, + JobStateScheduled, + } +} + +// ToPtr returns a *JobState pointing to the current value. +func (c JobState) ToPtr() *JobState { + return &c +} + +// LiveEventEncodingType - Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the service simply passes through the incoming +// video and audio layer(s) to the output. When encodingType is set to +// Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers. See https://go.microsoft.com/fwlink/?linkid=2095101 +// for more information. This property cannot +// be modified after the live event is created. +type LiveEventEncodingType string + +const ( + // LiveEventEncodingTypeNone - This is the same as PassthroughStandard, please see description below. This enumeration value is being deprecated. + LiveEventEncodingTypeNone LiveEventEncodingType = "None" + // LiveEventEncodingTypePassthroughBasic - The ingested stream passes through the live event from the contribution encoder without any further processing. + // In the PassthroughBasic mode, ingestion is limited to up to 5Mbps and only 1 concurrent live output is allowed. Live transcription is not available. + LiveEventEncodingTypePassthroughBasic LiveEventEncodingType = "PassthroughBasic" + // LiveEventEncodingTypePassthroughStandard - The ingested stream passes through the live event from the contribution encoder without any further processing. + // Live transcription is available. Ingestion bitrate limits are much higher and up to 3 concurrent live outputs are allowed. + LiveEventEncodingTypePassthroughStandard LiveEventEncodingType = "PassthroughStandard" + // LiveEventEncodingTypePremium1080P - A contribution live encoder sends a single bitrate stream to the live event and Media Services creates multiple bitrate + // streams. The output cannot exceed 1080p in resolution. + LiveEventEncodingTypePremium1080P LiveEventEncodingType = "Premium1080p" + // LiveEventEncodingTypeStandard - A contribution live encoder sends a single bitrate stream to the live event and Media Services creates multiple bitrate + // streams. The output cannot exceed 720p in resolution. + LiveEventEncodingTypeStandard LiveEventEncodingType = "Standard" +) + +// PossibleLiveEventEncodingTypeValues returns the possible values for the LiveEventEncodingType const type. +func PossibleLiveEventEncodingTypeValues() []LiveEventEncodingType { + return []LiveEventEncodingType{ + LiveEventEncodingTypeNone, + LiveEventEncodingTypePassthroughBasic, + LiveEventEncodingTypePassthroughStandard, + LiveEventEncodingTypePremium1080P, + LiveEventEncodingTypeStandard, + } +} + +// ToPtr returns a *LiveEventEncodingType pointing to the current value. +func (c LiveEventEncodingType) ToPtr() *LiveEventEncodingType { + return &c +} + +// LiveEventInputProtocol - The input protocol for the live event. This is specified at creation time and cannot be updated. +type LiveEventInputProtocol string + +const ( + // LiveEventInputProtocolFragmentedMP4 - Smooth Streaming input will be sent by the contribution encoder to the live event. + LiveEventInputProtocolFragmentedMP4 LiveEventInputProtocol = "FragmentedMP4" + // LiveEventInputProtocolRTMP - RTMP input will be sent by the contribution encoder to the live event. + LiveEventInputProtocolRTMP LiveEventInputProtocol = "RTMP" +) + +// PossibleLiveEventInputProtocolValues returns the possible values for the LiveEventInputProtocol const type. +func PossibleLiveEventInputProtocolValues() []LiveEventInputProtocol { + return []LiveEventInputProtocol{ + LiveEventInputProtocolFragmentedMP4, + LiveEventInputProtocolRTMP, + } +} + +// ToPtr returns a *LiveEventInputProtocol pointing to the current value. +func (c LiveEventInputProtocol) ToPtr() *LiveEventInputProtocol { + return &c +} + +// LiveEventResourceState - The resource state of the live event. See https://go.microsoft.com/fwlink/?linkid=2139012 for more information. +type LiveEventResourceState string + +const ( + // LiveEventResourceStateAllocating - Allocate action was called on the live event and resources are being provisioned for this live event. Once allocation + // completes successfully, the live event will transition to StandBy state. + LiveEventResourceStateAllocating LiveEventResourceState = "Allocating" + // LiveEventResourceStateDeleting - The live event is being deleted. No billing occurs in this transient state. Updates or streaming are not allowed during + // this state. + LiveEventResourceStateDeleting LiveEventResourceState = "Deleting" + // LiveEventResourceStateRunning - The live event resources have been allocated, ingest and preview URLs have been generated, and it is capable of receiving + // live streams. At this point, billing is active. You must explicitly call Stop on the live event resource to halt further billing. + LiveEventResourceStateRunning LiveEventResourceState = "Running" + // LiveEventResourceStateStandBy - Live event resources have been provisioned and is ready to start. Billing occurs in this state. Most properties can still + // be updated, however ingest or streaming is not allowed during this state. + LiveEventResourceStateStandBy LiveEventResourceState = "StandBy" + // LiveEventResourceStateStarting - The live event is being started and resources are being allocated. No billing occurs in this state. Updates or streaming + // are not allowed during this state. If an error occurs, the live event returns to the Stopped state. + LiveEventResourceStateStarting LiveEventResourceState = "Starting" + // LiveEventResourceStateStopped - This is the initial state of the live event after creation (unless autostart was set to true.) No billing occurs in this + // state. In this state, the live event properties can be updated but streaming is not allowed. + LiveEventResourceStateStopped LiveEventResourceState = "Stopped" + // LiveEventResourceStateStopping - The live event is being stopped and resources are being de-provisioned. No billing occurs in this transient state. Updates + // or streaming are not allowed during this state. + LiveEventResourceStateStopping LiveEventResourceState = "Stopping" +) + +// PossibleLiveEventResourceStateValues returns the possible values for the LiveEventResourceState const type. +func PossibleLiveEventResourceStateValues() []LiveEventResourceState { + return []LiveEventResourceState{ + LiveEventResourceStateAllocating, + LiveEventResourceStateDeleting, + LiveEventResourceStateRunning, + LiveEventResourceStateStandBy, + LiveEventResourceStateStarting, + LiveEventResourceStateStopped, + LiveEventResourceStateStopping, + } +} + +// ToPtr returns a *LiveEventResourceState pointing to the current value. +func (c LiveEventResourceState) ToPtr() *LiveEventResourceState { + return &c +} + +// LiveOutputResourceState - The resource state of the live output. +type LiveOutputResourceState string + +const ( + // LiveOutputResourceStateCreating - Live output is being created. No content is archived in the asset until the live output is in running state. + LiveOutputResourceStateCreating LiveOutputResourceState = "Creating" + // LiveOutputResourceStateDeleting - Live output is being deleted. The live asset is being converted from live to on-demand asset. Any streaming URLs created + // on the live output asset continue to work. + LiveOutputResourceStateDeleting LiveOutputResourceState = "Deleting" + // LiveOutputResourceStateRunning - Live output is running and archiving live streaming content to the asset if there is valid input from a contribution + // encoder. + LiveOutputResourceStateRunning LiveOutputResourceState = "Running" +) + +// PossibleLiveOutputResourceStateValues returns the possible values for the LiveOutputResourceState const type. +func PossibleLiveOutputResourceStateValues() []LiveOutputResourceState { + return []LiveOutputResourceState{ + LiveOutputResourceStateCreating, + LiveOutputResourceStateDeleting, + LiveOutputResourceStateRunning, + } +} + +// ToPtr returns a *LiveOutputResourceState pointing to the current value. +func (c LiveOutputResourceState) ToPtr() *LiveOutputResourceState { + return &c +} + +// MetricAggregationType - The metric aggregation type +type MetricAggregationType string + +const ( + // MetricAggregationTypeAverage - The average. + MetricAggregationTypeAverage MetricAggregationType = "Average" + // MetricAggregationTypeCount - The count of a number of items, usually requests. + MetricAggregationTypeCount MetricAggregationType = "Count" + // MetricAggregationTypeTotal - The sum. + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{ + MetricAggregationTypeAverage, + MetricAggregationTypeCount, + MetricAggregationTypeTotal, + } +} + +// ToPtr returns a *MetricAggregationType pointing to the current value. +func (c MetricAggregationType) ToPtr() *MetricAggregationType { + return &c +} + +// MetricUnit - The metric unit +type MetricUnit string + +const ( + // MetricUnitBytes - The number of bytes. + MetricUnitBytes MetricUnit = "Bytes" + // MetricUnitCount - The count. + MetricUnitCount MetricUnit = "Count" + // MetricUnitMilliseconds - The number of milliseconds. + MetricUnitMilliseconds MetricUnit = "Milliseconds" +) + +// PossibleMetricUnitValues returns the possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{ + MetricUnitBytes, + MetricUnitCount, + MetricUnitMilliseconds, + } +} + +// ToPtr returns a *MetricUnit pointing to the current value. +func (c MetricUnit) ToPtr() *MetricUnit { + return &c +} + +// OnErrorType - A Transform can define more than one outputs. This property defines what the service should do when one output fails - either continue +// to produce other outputs, or, stop the other outputs. The overall +// Job state will not reflect failures of outputs that are specified with 'ContinueJob'. The default is 'StopProcessingJob'. +type OnErrorType string + +const ( + // OnErrorTypeContinueJob - Tells the service that if this TransformOutput fails, then allow any other TransformOutput to continue. + OnErrorTypeContinueJob OnErrorType = "ContinueJob" + // OnErrorTypeStopProcessingJob - Tells the service that if this TransformOutput fails, then any other incomplete TransformOutputs can be stopped. + OnErrorTypeStopProcessingJob OnErrorType = "StopProcessingJob" +) + +// PossibleOnErrorTypeValues returns the possible values for the OnErrorType const type. +func PossibleOnErrorTypeValues() []OnErrorType { + return []OnErrorType{ + OnErrorTypeContinueJob, + OnErrorTypeStopProcessingJob, + } +} + +// ToPtr returns a *OnErrorType pointing to the current value. +func (c OnErrorType) ToPtr() *OnErrorType { + return &c +} + +// Priority - Sets the relative priority of the TransformOutputs within a Transform. This sets the priority that the service uses for processing TransformOutputs. +// The default priority is Normal. +type Priority string + +const ( + // PriorityHigh - Used for TransformOutputs that should take precedence over others. + PriorityHigh Priority = "High" + // PriorityLow - Used for TransformOutputs that can be generated after Normal and High priority TransformOutputs. + PriorityLow Priority = "Low" + // PriorityNormal - Used for TransformOutputs that can be generated at Normal priority. + PriorityNormal Priority = "Normal" +) + +// PossiblePriorityValues returns the possible values for the Priority const type. +func PossiblePriorityValues() []Priority { + return []Priority{ + PriorityHigh, + PriorityLow, + PriorityNormal, + } +} + +// ToPtr returns a *Priority pointing to the current value. +func (c Priority) ToPtr() *Priority { + return &c +} + +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// ToPtr returns a *PrivateEndpointConnectionProvisioningState pointing to the current value. +func (c PrivateEndpointConnectionProvisioningState) ToPtr() *PrivateEndpointConnectionProvisioningState { + return &c +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + +// ToPtr returns a *PrivateEndpointServiceConnectionStatus pointing to the current value. +func (c PrivateEndpointServiceConnectionStatus) ToPtr() *PrivateEndpointServiceConnectionStatus { + return &c +} + +// PublicNetworkAccess - Whether or not public network access is allowed for resources under the Media Services account. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled - Public network access is disabled. + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled - Public network access is enabled. + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + +// ToPtr returns a *PublicNetworkAccess pointing to the current value. +func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { + return &c +} + +// Rotation - The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto +type Rotation string + +const ( + // RotationAuto - Automatically detect and rotate as needed. + RotationAuto Rotation = "Auto" + // RotationNone - Do not rotate the video. If the output format supports it, any metadata about rotation is kept intact. + RotationNone Rotation = "None" + // RotationRotate0 - Do not rotate the video but remove any metadata about the rotation. + RotationRotate0 Rotation = "Rotate0" + // RotationRotate180 - Rotate 180 degrees clockwise. + RotationRotate180 Rotation = "Rotate180" + // RotationRotate270 - Rotate 270 degrees clockwise. + RotationRotate270 Rotation = "Rotate270" + // RotationRotate90 - Rotate 90 degrees clockwise. + RotationRotate90 Rotation = "Rotate90" +) + +// PossibleRotationValues returns the possible values for the Rotation const type. +func PossibleRotationValues() []Rotation { + return []Rotation{ + RotationAuto, + RotationNone, + RotationRotate0, + RotationRotate180, + RotationRotate270, + RotationRotate90, + } +} + +// ToPtr returns a *Rotation pointing to the current value. +func (c Rotation) ToPtr() *Rotation { + return &c +} + +// StorageAccountType - The type of the storage account. +type StorageAccountType string + +const ( + // StorageAccountTypePrimary - The primary storage account for the Media Services account. + StorageAccountTypePrimary StorageAccountType = "Primary" + // StorageAccountTypeSecondary - A secondary storage account for the Media Services account. + StorageAccountTypeSecondary StorageAccountType = "Secondary" +) + +// PossibleStorageAccountTypeValues returns the possible values for the StorageAccountType const type. +func PossibleStorageAccountTypeValues() []StorageAccountType { + return []StorageAccountType{ + StorageAccountTypePrimary, + StorageAccountTypeSecondary, + } +} + +// ToPtr returns a *StorageAccountType pointing to the current value. +func (c StorageAccountType) ToPtr() *StorageAccountType { + return &c +} + +type StorageAuthentication string + +const ( + // StorageAuthenticationManagedIdentity - Managed Identity authentication. + StorageAuthenticationManagedIdentity StorageAuthentication = "ManagedIdentity" + // StorageAuthenticationSystem - System authentication. + StorageAuthenticationSystem StorageAuthentication = "System" +) + +// PossibleStorageAuthenticationValues returns the possible values for the StorageAuthentication const type. +func PossibleStorageAuthenticationValues() []StorageAuthentication { + return []StorageAuthentication{ + StorageAuthenticationManagedIdentity, + StorageAuthenticationSystem, + } +} + +// ToPtr returns a *StorageAuthentication pointing to the current value. +func (c StorageAuthentication) ToPtr() *StorageAuthentication { + return &c +} + +type StreamOptionsFlag string + +const ( + // StreamOptionsFlagDefault - Live streaming with no special latency optimizations. + StreamOptionsFlagDefault StreamOptionsFlag = "Default" + // StreamOptionsFlagLowLatency - The live event provides lower end to end latency by reducing its internal buffers. This could result in more client buffering + // during playback if network bandwidth is low. + StreamOptionsFlagLowLatency StreamOptionsFlag = "LowLatency" +) + +// PossibleStreamOptionsFlagValues returns the possible values for the StreamOptionsFlag const type. +func PossibleStreamOptionsFlagValues() []StreamOptionsFlag { + return []StreamOptionsFlag{ + StreamOptionsFlagDefault, + StreamOptionsFlagLowLatency, + } +} + +// ToPtr returns a *StreamOptionsFlag pointing to the current value. +func (c StreamOptionsFlag) ToPtr() *StreamOptionsFlag { + return &c +} + +// StreamingEndpointResourceState - The resource state of the streaming endpoint. +type StreamingEndpointResourceState string + +const ( + // StreamingEndpointResourceStateDeleting - The streaming endpoint is being deleted. + StreamingEndpointResourceStateDeleting StreamingEndpointResourceState = "Deleting" + // StreamingEndpointResourceStateRunning - The streaming endpoint is running. It is able to stream content to clients + StreamingEndpointResourceStateRunning StreamingEndpointResourceState = "Running" + // StreamingEndpointResourceStateScaling - The streaming endpoint is increasing or decreasing scale units. + StreamingEndpointResourceStateScaling StreamingEndpointResourceState = "Scaling" + // StreamingEndpointResourceStateStarting - The streaming endpoint is transitioning to the running state. + StreamingEndpointResourceStateStarting StreamingEndpointResourceState = "Starting" + // StreamingEndpointResourceStateStopped - The initial state of a streaming endpoint after creation. Content is not ready to be streamed from this endpoint. + StreamingEndpointResourceStateStopped StreamingEndpointResourceState = "Stopped" + // StreamingEndpointResourceStateStopping - The streaming endpoint is transitioning to the stopped state. + StreamingEndpointResourceStateStopping StreamingEndpointResourceState = "Stopping" +) + +// PossibleStreamingEndpointResourceStateValues returns the possible values for the StreamingEndpointResourceState const type. +func PossibleStreamingEndpointResourceStateValues() []StreamingEndpointResourceState { + return []StreamingEndpointResourceState{ + StreamingEndpointResourceStateDeleting, + StreamingEndpointResourceStateRunning, + StreamingEndpointResourceStateScaling, + StreamingEndpointResourceStateStarting, + StreamingEndpointResourceStateStopped, + StreamingEndpointResourceStateStopping, + } +} + +// ToPtr returns a *StreamingEndpointResourceState pointing to the current value. +func (c StreamingEndpointResourceState) ToPtr() *StreamingEndpointResourceState { + return &c +} + +// StreamingLocatorContentKeyType - Encryption type of Content Key +type StreamingLocatorContentKeyType string + +const ( + // StreamingLocatorContentKeyTypeCommonEncryptionCbcs - Common Encryption using CBCS + StreamingLocatorContentKeyTypeCommonEncryptionCbcs StreamingLocatorContentKeyType = "CommonEncryptionCbcs" + // StreamingLocatorContentKeyTypeCommonEncryptionCenc - Common Encryption using CENC + StreamingLocatorContentKeyTypeCommonEncryptionCenc StreamingLocatorContentKeyType = "CommonEncryptionCenc" + // StreamingLocatorContentKeyTypeEnvelopeEncryption - Envelope Encryption + StreamingLocatorContentKeyTypeEnvelopeEncryption StreamingLocatorContentKeyType = "EnvelopeEncryption" +) + +// PossibleStreamingLocatorContentKeyTypeValues returns the possible values for the StreamingLocatorContentKeyType const type. +func PossibleStreamingLocatorContentKeyTypeValues() []StreamingLocatorContentKeyType { + return []StreamingLocatorContentKeyType{ + StreamingLocatorContentKeyTypeCommonEncryptionCbcs, + StreamingLocatorContentKeyTypeCommonEncryptionCenc, + StreamingLocatorContentKeyTypeEnvelopeEncryption, + } +} + +// ToPtr returns a *StreamingLocatorContentKeyType pointing to the current value. +func (c StreamingLocatorContentKeyType) ToPtr() *StreamingLocatorContentKeyType { + return &c +} + +// StreamingPolicyStreamingProtocol - Streaming protocol +type StreamingPolicyStreamingProtocol string + +const ( + // StreamingPolicyStreamingProtocolDash - DASH protocol + StreamingPolicyStreamingProtocolDash StreamingPolicyStreamingProtocol = "Dash" + // StreamingPolicyStreamingProtocolDownload - Download protocol + StreamingPolicyStreamingProtocolDownload StreamingPolicyStreamingProtocol = "Download" + // StreamingPolicyStreamingProtocolHls - HLS protocol + StreamingPolicyStreamingProtocolHls StreamingPolicyStreamingProtocol = "Hls" + // StreamingPolicyStreamingProtocolSmoothStreaming - SmoothStreaming protocol + StreamingPolicyStreamingProtocolSmoothStreaming StreamingPolicyStreamingProtocol = "SmoothStreaming" +) + +// PossibleStreamingPolicyStreamingProtocolValues returns the possible values for the StreamingPolicyStreamingProtocol const type. +func PossibleStreamingPolicyStreamingProtocolValues() []StreamingPolicyStreamingProtocol { + return []StreamingPolicyStreamingProtocol{ + StreamingPolicyStreamingProtocolDash, + StreamingPolicyStreamingProtocolDownload, + StreamingPolicyStreamingProtocolHls, + StreamingPolicyStreamingProtocolSmoothStreaming, + } +} + +// ToPtr returns a *StreamingPolicyStreamingProtocol pointing to the current value. +func (c StreamingPolicyStreamingProtocol) ToPtr() *StreamingPolicyStreamingProtocol { + return &c +} + +// StretchMode - The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize +type StretchMode string + +const ( + // StretchModeAutoFit - Pad the output (with either letterbox or pillar box) to honor the output resolution, while ensuring that the active video region + // in the output has the same aspect ratio as the input. For example, if the input is 1920x1080 and the encoding preset asks for 1280x1280, then the output + // will be at 1280x1280, which contains an inner rectangle of 1280x720 at aspect ratio of 16:9, and pillar box regions 280 pixels wide at the left and right. + StretchModeAutoFit StretchMode = "AutoFit" + // StretchModeAutoSize - Override the output resolution, and change it to match the display aspect ratio of the input, without padding. For example, if + // the input is 1920x1080 and the encoding preset asks for 1280x1280, then the value in the preset is overridden, and the output will be at 1280x720, which + // maintains the input aspect ratio of 16:9. + StretchModeAutoSize StretchMode = "AutoSize" + // StretchModeNone - Strictly respect the output resolution without considering the pixel aspect ratio or display aspect ratio of the input video. + StretchModeNone StretchMode = "None" +) + +// PossibleStretchModeValues returns the possible values for the StretchMode const type. +func PossibleStretchModeValues() []StretchMode { + return []StretchMode{ + StretchModeAutoFit, + StretchModeAutoSize, + StretchModeNone, + } +} + +// ToPtr returns a *StretchMode pointing to the current value. +func (c StretchMode) ToPtr() *StretchMode { + return &c +} + +// TrackAttribute - The TrackAttribute to filter the tracks by. +type TrackAttribute string + +const ( + // TrackAttributeBitrate - The bitrate of the track. + TrackAttributeBitrate TrackAttribute = "Bitrate" + // TrackAttributeLanguage - The language of the track. + TrackAttributeLanguage TrackAttribute = "Language" +) + +// PossibleTrackAttributeValues returns the possible values for the TrackAttribute const type. +func PossibleTrackAttributeValues() []TrackAttribute { + return []TrackAttribute{ + TrackAttributeBitrate, + TrackAttributeLanguage, + } +} + +// ToPtr returns a *TrackAttribute pointing to the current value. +func (c TrackAttribute) ToPtr() *TrackAttribute { + return &c +} + +// TrackPropertyCompareOperation - Track property condition operation +type TrackPropertyCompareOperation string + +const ( + // TrackPropertyCompareOperationEqual - Equal operation + TrackPropertyCompareOperationEqual TrackPropertyCompareOperation = "Equal" + // TrackPropertyCompareOperationUnknown - Unknown track property compare operation + TrackPropertyCompareOperationUnknown TrackPropertyCompareOperation = "Unknown" +) + +// PossibleTrackPropertyCompareOperationValues returns the possible values for the TrackPropertyCompareOperation const type. +func PossibleTrackPropertyCompareOperationValues() []TrackPropertyCompareOperation { + return []TrackPropertyCompareOperation{ + TrackPropertyCompareOperationEqual, + TrackPropertyCompareOperationUnknown, + } +} + +// ToPtr returns a *TrackPropertyCompareOperation pointing to the current value. +func (c TrackPropertyCompareOperation) ToPtr() *TrackPropertyCompareOperation { + return &c +} + +// TrackPropertyType - Track property type +type TrackPropertyType string + +const ( + // TrackPropertyTypeFourCC - Track FourCC + TrackPropertyTypeFourCC TrackPropertyType = "FourCC" + // TrackPropertyTypeUnknown - Unknown track property + TrackPropertyTypeUnknown TrackPropertyType = "Unknown" +) + +// PossibleTrackPropertyTypeValues returns the possible values for the TrackPropertyType const type. +func PossibleTrackPropertyTypeValues() []TrackPropertyType { + return []TrackPropertyType{ + TrackPropertyTypeFourCC, + TrackPropertyTypeUnknown, + } +} + +// ToPtr returns a *TrackPropertyType pointing to the current value. +func (c TrackPropertyType) ToPtr() *TrackPropertyType { + return &c +} + +// VideoSyncMode - The Video Sync Mode +type VideoSyncMode string + +const ( + // VideoSyncModeAuto - This is the default method. Chooses between Cfr and Vfr depending on muxer capabilities. For output format MP4, the default mode + // is Cfr. + VideoSyncModeAuto VideoSyncMode = "Auto" + // VideoSyncModeCfr - Input frames will be repeated and/or dropped as needed to achieve exactly the requested constant frame rate. Recommended when the + // output frame rate is explicitly set at a specified value + VideoSyncModeCfr VideoSyncMode = "Cfr" + // VideoSyncModePassthrough - The presentation timestamps on frames are passed through from the input file to the output file writer. Recommended when the + // input source has variable frame rate, and are attempting to produce multiple layers for adaptive streaming in the output which have aligned GOP boundaries. + // Note: if two or more frames in the input have duplicate timestamps, then the output will also have the same behavior + VideoSyncModePassthrough VideoSyncMode = "Passthrough" + // VideoSyncModeVfr - Similar to the Passthrough mode, but if the input has frames that have duplicate timestamps, then only one frame is passed through + // to the output, and others are dropped. Recommended when the number of output frames is expected to be equal to the number of input frames. For example, + // the output is used to calculate a quality metric like PSNR against the input + VideoSyncModeVfr VideoSyncMode = "Vfr" +) + +// PossibleVideoSyncModeValues returns the possible values for the VideoSyncMode const type. +func PossibleVideoSyncModeValues() []VideoSyncMode { + return []VideoSyncMode{ + VideoSyncModeAuto, + VideoSyncModeCfr, + VideoSyncModePassthrough, + VideoSyncModeVfr, + } +} + +// ToPtr returns a *VideoSyncMode pointing to the current value. +func (c VideoSyncMode) ToPtr() *VideoSyncMode { + return &c +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go new file mode 100644 index 000000000000..7f5f56cf06fc --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go @@ -0,0 +1,443 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// ContentKeyPoliciesClient contains the methods for the ContentKeyPolicies group. +// Don't use this type directly, use NewContentKeyPoliciesClient() instead. +type ContentKeyPoliciesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewContentKeyPoliciesClient creates a new instance of ContentKeyPoliciesClient with the specified values. +func NewContentKeyPoliciesClient(con *arm.Connection, subscriptionID string) *ContentKeyPoliciesClient { + return &ContentKeyPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Create or update a Content Key Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *ContentKeyPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, parameters ContentKeyPolicy, options *ContentKeyPoliciesCreateOrUpdateOptions) (ContentKeyPoliciesCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, contentKeyPolicyName, parameters, options) + if err != nil { + return ContentKeyPoliciesCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContentKeyPoliciesCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ContentKeyPoliciesCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ContentKeyPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, parameters ContentKeyPolicy, options *ContentKeyPoliciesCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if contentKeyPolicyName == "" { + return nil, errors.New("parameter contentKeyPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{contentKeyPolicyName}", url.PathEscape(contentKeyPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ContentKeyPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ContentKeyPoliciesCreateOrUpdateResponse, error) { + result := ContentKeyPoliciesCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { + return ContentKeyPoliciesCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *ContentKeyPoliciesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a Content Key Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *ContentKeyPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, options *ContentKeyPoliciesDeleteOptions) (ContentKeyPoliciesDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, contentKeyPolicyName, options) + if err != nil { + return ContentKeyPoliciesDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContentKeyPoliciesDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ContentKeyPoliciesDeleteResponse{}, client.deleteHandleError(resp) + } + return ContentKeyPoliciesDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContentKeyPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, options *ContentKeyPoliciesDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if contentKeyPolicyName == "" { + return nil, errors.New("parameter contentKeyPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{contentKeyPolicyName}", url.PathEscape(contentKeyPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *ContentKeyPoliciesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of a Content Key Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *ContentKeyPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, options *ContentKeyPoliciesGetOptions) (ContentKeyPoliciesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, contentKeyPolicyName, options) + if err != nil { + return ContentKeyPoliciesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContentKeyPoliciesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContentKeyPoliciesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ContentKeyPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, options *ContentKeyPoliciesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if contentKeyPolicyName == "" { + return nil, errors.New("parameter contentKeyPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{contentKeyPolicyName}", url.PathEscape(contentKeyPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ContentKeyPoliciesClient) getHandleResponse(resp *http.Response) (ContentKeyPoliciesGetResponse, error) { + result := ContentKeyPoliciesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { + return ContentKeyPoliciesGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *ContentKeyPoliciesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// GetPolicyPropertiesWithSecrets - Get a Content Key Policy including secret values +// If the operation fails it returns the *ErrorResponse error type. +func (client *ContentKeyPoliciesClient) GetPolicyPropertiesWithSecrets(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, options *ContentKeyPoliciesGetPolicyPropertiesWithSecretsOptions) (ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse, error) { + req, err := client.getPolicyPropertiesWithSecretsCreateRequest(ctx, resourceGroupName, accountName, contentKeyPolicyName, options) + if err != nil { + return ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{}, client.getPolicyPropertiesWithSecretsHandleError(resp) + } + return client.getPolicyPropertiesWithSecretsHandleResponse(resp) +} + +// getPolicyPropertiesWithSecretsCreateRequest creates the GetPolicyPropertiesWithSecrets request. +func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, options *ContentKeyPoliciesGetPolicyPropertiesWithSecretsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}/getPolicyPropertiesWithSecrets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if contentKeyPolicyName == "" { + return nil, errors.New("parameter contentKeyPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{contentKeyPolicyName}", url.PathEscape(contentKeyPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getPolicyPropertiesWithSecretsHandleResponse handles the GetPolicyPropertiesWithSecrets response. +func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsHandleResponse(resp *http.Response) (ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse, error) { + result := ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicyProperties); err != nil { + return ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{}, err + } + return result, nil +} + +// getPolicyPropertiesWithSecretsHandleError handles the GetPolicyPropertiesWithSecrets error response. +func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the Content Key Policies in the account +// If the operation fails it returns the *ErrorResponse error type. +func (client *ContentKeyPoliciesClient) List(resourceGroupName string, accountName string, options *ContentKeyPoliciesListOptions) *ContentKeyPoliciesListPager { + return &ContentKeyPoliciesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp ContentKeyPoliciesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ContentKeyPolicyCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *ContentKeyPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *ContentKeyPoliciesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ContentKeyPoliciesClient) listHandleResponse(resp *http.Response) (ContentKeyPoliciesListResponse, error) { + result := ContentKeyPoliciesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicyCollection); err != nil { + return ContentKeyPoliciesListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *ContentKeyPoliciesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates an existing Content Key Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *ContentKeyPoliciesClient) Update(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, parameters ContentKeyPolicy, options *ContentKeyPoliciesUpdateOptions) (ContentKeyPoliciesUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, contentKeyPolicyName, parameters, options) + if err != nil { + return ContentKeyPoliciesUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ContentKeyPoliciesUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ContentKeyPoliciesUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ContentKeyPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, contentKeyPolicyName string, parameters ContentKeyPolicy, options *ContentKeyPoliciesUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if contentKeyPolicyName == "" { + return nil, errors.New("parameter contentKeyPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{contentKeyPolicyName}", url.PathEscape(contentKeyPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *ContentKeyPoliciesClient) updateHandleResponse(resp *http.Response) (ContentKeyPoliciesUpdateResponse, error) { + result := ContentKeyPoliciesUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { + return ContentKeyPoliciesUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *ContentKeyPoliciesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go new file mode 100644 index 000000000000..5fece488786b --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go @@ -0,0 +1,455 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// JobsClient contains the methods for the Jobs group. +// Don't use this type directly, use NewJobsClient() instead. +type JobsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewJobsClient creates a new instance of JobsClient with the specified values. +func NewJobsClient(con *arm.Connection, subscriptionID string) *JobsClient { + return &JobsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CancelJob - Cancel a Job. +// If the operation fails it returns the *ErrorResponse error type. +func (client *JobsClient) CancelJob(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, options *JobsCancelJobOptions) (JobsCancelJobResponse, error) { + req, err := client.cancelJobCreateRequest(ctx, resourceGroupName, accountName, transformName, jobName, options) + if err != nil { + return JobsCancelJobResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsCancelJobResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsCancelJobResponse{}, client.cancelJobHandleError(resp) + } + return JobsCancelJobResponse{RawResponse: resp}, nil +} + +// cancelJobCreateRequest creates the CancelJob request. +func (client *JobsClient) cancelJobCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, options *JobsCancelJobOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}/cancelJob" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// cancelJobHandleError handles the CancelJob error response. +func (client *JobsClient) cancelJobHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Create - Creates a Job. +// If the operation fails it returns the *ErrorResponse error type. +func (client *JobsClient) Create(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, parameters Job, options *JobsCreateOptions) (JobsCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, transformName, jobName, parameters, options) + if err != nil { + return JobsCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return JobsCreateResponse{}, client.createHandleError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *JobsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, parameters Job, options *JobsCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleResponse handles the Create response. +func (client *JobsClient) createHandleResponse(resp *http.Response) (JobsCreateResponse, error) { + result := JobsCreateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return JobsCreateResponse{}, err + } + return result, nil +} + +// createHandleError handles the Create error response. +func (client *JobsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a Job. +// If the operation fails it returns the *ErrorResponse error type. +func (client *JobsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, options *JobsDeleteOptions) (JobsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, transformName, jobName, options) + if err != nil { + return JobsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return JobsDeleteResponse{}, client.deleteHandleError(resp) + } + return JobsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *JobsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, options *JobsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *JobsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a Job. +// If the operation fails it returns the *ErrorResponse error type. +func (client *JobsClient) Get(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, options *JobsGetOptions) (JobsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, transformName, jobName, options) + if err != nil { + return JobsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, options *JobsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsGetResponse, error) { + result := JobsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return JobsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *JobsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all of the Jobs for the Transform. +// If the operation fails it returns the *ErrorResponse error type. +func (client *JobsClient) List(resourceGroupName string, accountName string, transformName string, options *JobsListOptions) *JobsListPager { + return &JobsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, transformName, options) + }, + advancer: func(ctx context.Context, resp JobsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.JobCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, options *JobsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *JobsClient) listHandleResponse(resp *http.Response) (JobsListResponse, error) { + result := JobsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.JobCollection); err != nil { + return JobsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *JobsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Update is only supported for description and priority. Updating Priority will take effect when the Job state is Queued or Scheduled and depending +// on the timing the priority update may be ignored. +// If the operation fails it returns the *ErrorResponse error type. +func (client *JobsClient) Update(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, parameters Job, options *JobsUpdateOptions) (JobsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, transformName, jobName, parameters, options) + if err != nil { + return JobsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return JobsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return JobsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *JobsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, jobName string, parameters Job, options *JobsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}/jobs/{jobName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + if jobName == "" { + return nil, errors.New("parameter jobName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *JobsClient) updateHandleResponse(resp *http.Response) (JobsUpdateResponse, error) { + result := JobsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { + return JobsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *JobsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go new file mode 100644 index 000000000000..31a0ae015960 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go @@ -0,0 +1,735 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// LiveEventsClient contains the methods for the LiveEvents group. +// Don't use this type directly, use NewLiveEventsClient() instead. +type LiveEventsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewLiveEventsClient creates a new instance of LiveEventsClient with the specified values. +func NewLiveEventsClient(con *arm.Connection, subscriptionID string) *LiveEventsClient { + return &LiveEventsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// BeginAllocate - A live event is in StandBy state after allocation completes, and is ready to start. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginAllocate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginAllocateOptions) (LiveEventsAllocatePollerResponse, error) { + resp, err := client.allocate(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return LiveEventsAllocatePollerResponse{}, err + } + result := LiveEventsAllocatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Allocate", "", resp, client.pl, client.allocateHandleError) + if err != nil { + return LiveEventsAllocatePollerResponse{}, err + } + result.Poller = &LiveEventsAllocatePoller{ + pt: pt, + } + return result, nil +} + +// Allocate - A live event is in StandBy state after allocation completes, and is ready to start. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) allocate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginAllocateOptions) (*http.Response, error) { + req, err := client.allocateCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.allocateHandleError(resp) + } + return resp, nil +} + +// allocateCreateRequest creates the Allocate request. +func (client *LiveEventsClient) allocateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginAllocateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/allocate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// allocateHandleError handles the Allocate error response. +func (client *LiveEventsClient) allocateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginCreate - Creates a new live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsBeginCreateOptions) (LiveEventsCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return LiveEventsCreatePollerResponse{}, err + } + result := LiveEventsCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Create", "", resp, client.pl, client.createHandleError) + if err != nil { + return LiveEventsCreatePollerResponse{}, err + } + result.Poller = &LiveEventsCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Creates a new live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) create(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *LiveEventsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.AutoStart != nil { + reqQP.Set("autoStart", strconv.FormatBool(*options.AutoStart)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleError handles the Create error response. +func (client *LiveEventsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginDeleteOptions) (LiveEventsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return LiveEventsDeletePollerResponse{}, err + } + result := LiveEventsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return LiveEventsDeletePollerResponse{}, err + } + result.Poller = &LiveEventsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LiveEventsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *LiveEventsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets properties of a live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) Get(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsGetOptions) (LiveEventsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return LiveEventsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LiveEventsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LiveEventsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LiveEventsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LiveEventsClient) getHandleResponse(resp *http.Response) (LiveEventsGetResponse, error) { + result := LiveEventsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.LiveEvent); err != nil { + return LiveEventsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *LiveEventsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all the live events in the account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) List(resourceGroupName string, accountName string, options *LiveEventsListOptions) *LiveEventsListPager { + return &LiveEventsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp LiveEventsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.LiveEventListResult.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *LiveEventsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *LiveEventsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LiveEventsClient) listHandleResponse(resp *http.Response) (LiveEventsListResponse, error) { + result := LiveEventsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.LiveEventListResult); err != nil { + return LiveEventsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *LiveEventsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginReset - Resets an existing live event. All live outputs for the live event are deleted and the live event is stopped and will be started again. +// All assets used by the live outputs and streaming locators +// created on these assets are unaffected. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginReset(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginResetOptions) (LiveEventsResetPollerResponse, error) { + resp, err := client.reset(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return LiveEventsResetPollerResponse{}, err + } + result := LiveEventsResetPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Reset", "", resp, client.pl, client.resetHandleError) + if err != nil { + return LiveEventsResetPollerResponse{}, err + } + result.Poller = &LiveEventsResetPoller{ + pt: pt, + } + return result, nil +} + +// Reset - Resets an existing live event. All live outputs for the live event are deleted and the live event is stopped and will be started again. All assets +// used by the live outputs and streaming locators +// created on these assets are unaffected. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) reset(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginResetOptions) (*http.Response, error) { + req, err := client.resetCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.resetHandleError(resp) + } + return resp, nil +} + +// resetCreateRequest creates the Reset request. +func (client *LiveEventsClient) resetCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginResetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/reset" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// resetHandleError handles the Reset error response. +func (client *LiveEventsClient) resetHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStart - A live event in Stopped or StandBy state will be in Running state after the start operation completes. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginStartOptions) (LiveEventsStartPollerResponse, error) { + resp, err := client.start(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return LiveEventsStartPollerResponse{}, err + } + result := LiveEventsStartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Start", "", resp, client.pl, client.startHandleError) + if err != nil { + return LiveEventsStartPollerResponse{}, err + } + result.Poller = &LiveEventsStartPoller{ + pt: pt, + } + return result, nil +} + +// Start - A live event in Stopped or StandBy state will be in Running state after the start operation completes. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) start(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.startHandleError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *LiveEventsClient) startCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveEventsBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// startHandleError handles the Start error response. +func (client *LiveEventsClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStop - Stops a running live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEventActionInput, options *LiveEventsBeginStopOptions) (LiveEventsStopPollerResponse, error) { + resp, err := client.stop(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return LiveEventsStopPollerResponse{}, err + } + result := LiveEventsStopPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Stop", "", resp, client.pl, client.stopHandleError) + if err != nil { + return LiveEventsStopPollerResponse{}, err + } + result.Poller = &LiveEventsStopPoller{ + pt: pt, + } + return result, nil +} + +// Stop - Stops a running live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) stop(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEventActionInput, options *LiveEventsBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.stopHandleError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *LiveEventsClient) stopCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEventActionInput, options *LiveEventsBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// stopHandleError handles the Stop error response. +func (client *LiveEventsClient) stopHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Updates settings on an existing live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsBeginUpdateOptions) (LiveEventsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return LiveEventsUpdatePollerResponse{}, err + } + result := LiveEventsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveEventsClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return LiveEventsUpdatePollerResponse{}, err + } + result.Poller = &LiveEventsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Updates settings on an existing live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveEventsClient) update(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, liveEventName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *LiveEventsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, parameters LiveEvent, options *LiveEventsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleError handles the Update error response. +func (client *LiveEventsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go new file mode 100644 index 000000000000..cc45d148de56 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go @@ -0,0 +1,343 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// LiveOutputsClient contains the methods for the LiveOutputs group. +// Don't use this type directly, use NewLiveOutputsClient() instead. +type LiveOutputsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewLiveOutputsClient creates a new instance of LiveOutputsClient with the specified values. +func NewLiveOutputsClient(con *arm.Connection, subscriptionID string) *LiveOutputsClient { + return &LiveOutputsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// BeginCreate - Creates a new live output. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveOutputsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, parameters LiveOutput, options *LiveOutputsBeginCreateOptions) (LiveOutputsCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, parameters, options) + if err != nil { + return LiveOutputsCreatePollerResponse{}, err + } + result := LiveOutputsCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveOutputsClient.Create", "", resp, client.pl, client.createHandleError) + if err != nil { + return LiveOutputsCreatePollerResponse{}, err + } + result.Poller = &LiveOutputsCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Creates a new live output. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveOutputsClient) create(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, parameters LiveOutput, options *LiveOutputsBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *LiveOutputsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, parameters LiveOutput, options *LiveOutputsBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + if liveOutputName == "" { + return nil, errors.New("parameter liveOutputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveOutputName}", url.PathEscape(liveOutputName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleError handles the Create error response. +func (client *LiveOutputsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a live output. Deleting a live output does not delete the asset the live output is writing to. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveOutputsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsBeginDeleteOptions) (LiveOutputsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, options) + if err != nil { + return LiveOutputsDeletePollerResponse{}, err + } + result := LiveOutputsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LiveOutputsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return LiveOutputsDeletePollerResponse{}, err + } + result.Poller = &LiveOutputsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a live output. Deleting a live output does not delete the asset the live output is writing to. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveOutputsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LiveOutputsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + if liveOutputName == "" { + return nil, errors.New("parameter liveOutputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveOutputName}", url.PathEscape(liveOutputName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *LiveOutputsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a live output. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveOutputsClient) Get(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsGetOptions) (LiveOutputsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, liveEventName, liveOutputName, options) + if err != nil { + return LiveOutputsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LiveOutputsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LiveOutputsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LiveOutputsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, liveOutputName string, options *LiveOutputsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs/{liveOutputName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + if liveOutputName == "" { + return nil, errors.New("parameter liveOutputName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveOutputName}", url.PathEscape(liveOutputName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LiveOutputsClient) getHandleResponse(resp *http.Response) (LiveOutputsGetResponse, error) { + result := LiveOutputsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.LiveOutput); err != nil { + return LiveOutputsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *LiveOutputsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the live outputs of a live event. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LiveOutputsClient) List(resourceGroupName string, accountName string, liveEventName string, options *LiveOutputsListOptions) *LiveOutputsListPager { + return &LiveOutputsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, liveEventName, options) + }, + advancer: func(ctx context.Context, resp LiveOutputsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.LiveOutputListResult.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *LiveOutputsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, liveEventName string, options *LiveOutputsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/liveEvents/{liveEventName}/liveOutputs" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if liveEventName == "" { + return nil, errors.New("parameter liveEventName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{liveEventName}", url.PathEscape(liveEventName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *LiveOutputsClient) listHandleResponse(resp *http.Response) (LiveOutputsListResponse, error) { + result := LiveOutputsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.LiveOutputListResult); err != nil { + return LiveOutputsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *LiveOutputsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go new file mode 100644 index 000000000000..fa702a4739f2 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go @@ -0,0 +1,96 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// LocationsClient contains the methods for the Locations group. +// Don't use this type directly, use NewLocationsClient() instead. +type LocationsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewLocationsClient creates a new instance of LocationsClient with the specified values. +func NewLocationsClient(con *arm.Connection, subscriptionID string) *LocationsClient { + return &LocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CheckNameAvailability - Checks whether the Media Service resource name is available. +// If the operation fails it returns the *ErrorResponse error type. +func (client *LocationsClient) CheckNameAvailability(ctx context.Context, locationName string, parameters CheckNameAvailabilityInput, options *LocationsCheckNameAvailabilityOptions) (LocationsCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, locationName, parameters, options) + if err != nil { + return LocationsCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LocationsCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocationsCheckNameAvailabilityResponse{}, client.checkNameAvailabilityHandleError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, locationName string, parameters CheckNameAvailabilityInput, options *LocationsCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Media/locations/{locationName}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationName == "" { + return nil, errors.New("parameter locationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsCheckNameAvailabilityResponse, error) { + result := LocationsCheckNameAvailabilityResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.EntityNameAvailabilityCheckOutput); err != nil { + return LocationsCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// checkNameAvailabilityHandleError handles the CheckNameAvailability error response. +func (client *LocationsClient) checkNameAvailabilityHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go new file mode 100644 index 000000000000..f0eb62f58d18 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go @@ -0,0 +1,519 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// MediaservicesClient contains the methods for the Mediaservices group. +// Don't use this type directly, use NewMediaservicesClient() instead. +type MediaservicesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewMediaservicesClient creates a new instance of MediaservicesClient with the specified values. +func NewMediaservicesClient(con *arm.Connection, subscriptionID string) *MediaservicesClient { + return &MediaservicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates a Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, parameters MediaService, options *MediaservicesCreateOrUpdateOptions) (MediaservicesCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return MediaservicesCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MediaservicesCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return MediaservicesCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *MediaservicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters MediaService, options *MediaservicesCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *MediaservicesClient) createOrUpdateHandleResponse(resp *http.Response) (MediaservicesCreateOrUpdateResponse, error) { + result := MediaservicesCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { + return MediaservicesCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *MediaservicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, options *MediaservicesDeleteOptions) (MediaservicesDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return MediaservicesDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MediaservicesDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return MediaservicesDeleteResponse{}, client.deleteHandleError(resp) + } + return MediaservicesDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MediaservicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *MediaservicesDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *MediaservicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of a Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) Get(ctx context.Context, resourceGroupName string, accountName string, options *MediaservicesGetOptions) (MediaservicesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return MediaservicesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MediaservicesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MediaservicesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MediaservicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *MediaservicesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MediaservicesClient) getHandleResponse(resp *http.Response) (MediaservicesGetResponse, error) { + result := MediaservicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { + return MediaservicesGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *MediaservicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - List Media Services accounts in the resource group +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) List(resourceGroupName string, options *MediaservicesListOptions) *MediaservicesListPager { + return &MediaservicesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp MediaservicesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.MediaServiceCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *MediaservicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *MediaservicesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MediaservicesClient) listHandleResponse(resp *http.Response) (MediaservicesListResponse, error) { + result := MediaservicesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MediaServiceCollection); err != nil { + return MediaservicesListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *MediaservicesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - List Media Services accounts in the subscription. +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) ListBySubscription(options *MediaservicesListBySubscriptionOptions) *MediaservicesListBySubscriptionPager { + return &MediaservicesListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp MediaservicesListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.MediaServiceCollection.ODataNextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *MediaservicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *MediaservicesListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Media/mediaservices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *MediaservicesClient) listBySubscriptionHandleResponse(resp *http.Response) (MediaservicesListBySubscriptionResponse, error) { + result := MediaservicesListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MediaServiceCollection); err != nil { + return MediaservicesListBySubscriptionResponse{}, err + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *MediaservicesClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListEdgePolicies - List the media edge policies associated with the Media Services account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) ListEdgePolicies(ctx context.Context, resourceGroupName string, accountName string, parameters ListEdgePoliciesInput, options *MediaservicesListEdgePoliciesOptions) (MediaservicesListEdgePoliciesResponse, error) { + req, err := client.listEdgePoliciesCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return MediaservicesListEdgePoliciesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MediaservicesListEdgePoliciesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MediaservicesListEdgePoliciesResponse{}, client.listEdgePoliciesHandleError(resp) + } + return client.listEdgePoliciesHandleResponse(resp) +} + +// listEdgePoliciesCreateRequest creates the ListEdgePolicies request. +func (client *MediaservicesClient) listEdgePoliciesCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters ListEdgePoliciesInput, options *MediaservicesListEdgePoliciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/listEdgePolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listEdgePoliciesHandleResponse handles the ListEdgePolicies response. +func (client *MediaservicesClient) listEdgePoliciesHandleResponse(resp *http.Response) (MediaservicesListEdgePoliciesResponse, error) { + result := MediaservicesListEdgePoliciesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.EdgePolicies); err != nil { + return MediaservicesListEdgePoliciesResponse{}, err + } + return result, nil +} + +// listEdgePoliciesHandleError handles the ListEdgePolicies error response. +func (client *MediaservicesClient) listEdgePoliciesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// SyncStorageKeys - Synchronizes storage account keys for a storage account associated with the Media Service account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) SyncStorageKeys(ctx context.Context, resourceGroupName string, accountName string, parameters SyncStorageKeysInput, options *MediaservicesSyncStorageKeysOptions) (MediaservicesSyncStorageKeysResponse, error) { + req, err := client.syncStorageKeysCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return MediaservicesSyncStorageKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MediaservicesSyncStorageKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MediaservicesSyncStorageKeysResponse{}, client.syncStorageKeysHandleError(resp) + } + return MediaservicesSyncStorageKeysResponse{RawResponse: resp}, nil +} + +// syncStorageKeysCreateRequest creates the SyncStorageKeys request. +func (client *MediaservicesClient) syncStorageKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters SyncStorageKeysInput, options *MediaservicesSyncStorageKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/syncStorageKeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// syncStorageKeysHandleError handles the SyncStorageKeys error response. +func (client *MediaservicesClient) syncStorageKeysHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates an existing Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *MediaservicesClient) Update(ctx context.Context, resourceGroupName string, accountName string, parameters MediaServiceUpdate, options *MediaservicesUpdateOptions) (MediaservicesUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, parameters, options) + if err != nil { + return MediaservicesUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MediaservicesUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MediaservicesUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *MediaservicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, parameters MediaServiceUpdate, options *MediaservicesUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *MediaservicesClient) updateHandleResponse(resp *http.Response) (MediaservicesUpdateResponse, error) { + result := MediaservicesUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { + return MediaservicesUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *MediaservicesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go new file mode 100644 index 000000000000..ac8501a2c873 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go @@ -0,0 +1,7147 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "encoding/json" + "reflect" + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// AacAudio - Describes Advanced Audio Codec (AAC) audio encoding settings. +type AacAudio struct { + Audio + // The encoding profile to be used when encoding audio with AAC. + Profile *AacAudioProfile `json:"profile,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AacAudio. +func (a AacAudio) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.Audio.marshalInternal(objectMap, "#Microsoft.Media.AacAudio") + populate(objectMap, "profile", a.Profile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AacAudio. +func (a *AacAudio) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "profile": + err = unpopulate(val, &a.Profile) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.Audio.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AbsoluteClipTime - Specifies the clip time as an absolute time position in the media file. The absolute time can point to a different position depending +// on whether the media file starts from a timestamp of zero or not. +type AbsoluteClipTime struct { + ClipTime + // REQUIRED; The time position on the timeline of the input media. It is usually specified as an ISO8601 period. e.g PT30S for 30 seconds. + Time *string `json:"time,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AbsoluteClipTime. +func (a AbsoluteClipTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ClipTime.marshalInternal(objectMap, "#Microsoft.Media.AbsoluteClipTime") + populate(objectMap, "time", a.Time) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AbsoluteClipTime. +func (a *AbsoluteClipTime) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "time": + err = unpopulate(val, &a.Time) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.ClipTime.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +type AccessControl struct { + // The behavior for IP access control in Key Delivery. + DefaultAction *DefaultAction `json:"defaultAction,omitempty"` + + // The IP allow list for access control in Key Delivery. If the default action is set to 'Allow', the IP allow list must be empty. + IPAllowList []*string `json:"ipAllowList,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AccessControl. +func (a AccessControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultAction", a.DefaultAction) + populate(objectMap, "ipAllowList", a.IPAllowList) + return json.Marshal(objectMap) +} + +type AccountEncryption struct { + // REQUIRED; The type of key used to encrypt the Account Key. + Type *AccountEncryptionKeyType `json:"type,omitempty"` + + // The Key Vault identity. + Identity *ResourceIdentity `json:"identity,omitempty"` + + // The properties of the key used to encrypt the account. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` + + // READ-ONLY; The current status of the Key Vault mapping. + Status *string `json:"status,omitempty" azure:"ro"` +} + +// AccountFilter - An Account Filter. +type AccountFilter struct { + ProxyResource + // The Media Filter properties. + Properties *MediaFilterProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AccountFilter. +func (a AccountFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + return json.Marshal(objectMap) +} + +// AccountFilterCollection - A collection of AccountFilter items. +type AccountFilterCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of AccountFilter items. + Value []*AccountFilter `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AccountFilterCollection. +func (a AccountFilterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", a.ODataNextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// AccountFiltersCreateOrUpdateOptions contains the optional parameters for the AccountFilters.CreateOrUpdate method. +type AccountFiltersCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AccountFiltersDeleteOptions contains the optional parameters for the AccountFilters.Delete method. +type AccountFiltersDeleteOptions struct { + // placeholder for future optional parameters +} + +// AccountFiltersGetOptions contains the optional parameters for the AccountFilters.Get method. +type AccountFiltersGetOptions struct { + // placeholder for future optional parameters +} + +// AccountFiltersListOptions contains the optional parameters for the AccountFilters.List method. +type AccountFiltersListOptions struct { + // placeholder for future optional parameters +} + +// AccountFiltersUpdateOptions contains the optional parameters for the AccountFilters.Update method. +type AccountFiltersUpdateOptions struct { + // placeholder for future optional parameters +} + +// AkamaiAccessControl - Akamai access control +type AkamaiAccessControl struct { + // authentication key list + AkamaiSignatureHeaderAuthenticationKeyList []*AkamaiSignatureHeaderAuthenticationKey `json:"akamaiSignatureHeaderAuthenticationKeyList,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AkamaiAccessControl. +func (a AkamaiAccessControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "akamaiSignatureHeaderAuthenticationKeyList", a.AkamaiSignatureHeaderAuthenticationKeyList) + return json.Marshal(objectMap) +} + +// AkamaiSignatureHeaderAuthenticationKey - Akamai Signature Header authentication key. +type AkamaiSignatureHeaderAuthenticationKey struct { + // authentication key + Base64Key *string `json:"base64Key,omitempty"` + + // The expiration time of the authentication key. + Expiration *time.Time `json:"expiration,omitempty"` + + // identifier of the key + Identifier *string `json:"identifier,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AkamaiSignatureHeaderAuthenticationKey. +func (a AkamaiSignatureHeaderAuthenticationKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "base64Key", a.Base64Key) + populate(objectMap, "expiration", (*timeRFC3339)(a.Expiration)) + populate(objectMap, "identifier", a.Identifier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AkamaiSignatureHeaderAuthenticationKey. +func (a *AkamaiSignatureHeaderAuthenticationKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "base64Key": + err = unpopulate(val, &a.Base64Key) + delete(rawMsg, key) + case "expiration": + var aux timeRFC3339 + err = unpopulate(val, &aux) + a.Expiration = (*time.Time)(&aux) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, &a.Identifier) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// Asset - An Asset. +type Asset struct { + ProxyResource + // The resource properties. + Properties *AssetProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Asset. +func (a Asset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + return json.Marshal(objectMap) +} + +// AssetCollection - A collection of Asset items. +type AssetCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of Asset items. + Value []*Asset `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssetCollection. +func (a AssetCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", a.ODataNextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// AssetContainerSas - The Asset Storage container SAS URLs. +type AssetContainerSas struct { + // The list of Asset container SAS URLs. + AssetContainerSasUrls []*string `json:"assetContainerSasUrls,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssetContainerSas. +func (a AssetContainerSas) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetContainerSasUrls", a.AssetContainerSasUrls) + return json.Marshal(objectMap) +} + +// AssetFileEncryptionMetadata - The Asset File Storage encryption metadata. +type AssetFileEncryptionMetadata struct { + // REQUIRED; The Asset File Id. + AssetFileID *string `json:"assetFileId,omitempty"` + + // The Asset File name. + AssetFileName *string `json:"assetFileName,omitempty"` + + // The Asset File initialization vector. + InitializationVector *string `json:"initializationVector,omitempty"` +} + +// AssetFilter - An Asset Filter. +type AssetFilter struct { + ProxyResource + // The Media Filter properties. + Properties *MediaFilterProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssetFilter. +func (a AssetFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + return json.Marshal(objectMap) +} + +// AssetFilterCollection - A collection of AssetFilter items. +type AssetFilterCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of AssetFilter items. + Value []*AssetFilter `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssetFilterCollection. +func (a AssetFilterCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", a.ODataNextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// AssetFiltersCreateOrUpdateOptions contains the optional parameters for the AssetFilters.CreateOrUpdate method. +type AssetFiltersCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AssetFiltersDeleteOptions contains the optional parameters for the AssetFilters.Delete method. +type AssetFiltersDeleteOptions struct { + // placeholder for future optional parameters +} + +// AssetFiltersGetOptions contains the optional parameters for the AssetFilters.Get method. +type AssetFiltersGetOptions struct { + // placeholder for future optional parameters +} + +// AssetFiltersListOptions contains the optional parameters for the AssetFilters.List method. +type AssetFiltersListOptions struct { + // placeholder for future optional parameters +} + +// AssetFiltersUpdateOptions contains the optional parameters for the AssetFilters.Update method. +type AssetFiltersUpdateOptions struct { + // placeholder for future optional parameters +} + +// AssetProperties - The Asset properties. +type AssetProperties struct { + // The alternate ID of the Asset. + AlternateID *string `json:"alternateId,omitempty"` + + // The name of the asset blob container. + Container *string `json:"container,omitempty"` + + // The Asset description. + Description *string `json:"description,omitempty"` + + // The name of the storage account. + StorageAccountName *string `json:"storageAccountName,omitempty"` + + // READ-ONLY; The Asset ID. + AssetID *string `json:"assetId,omitempty" azure:"ro"` + + // READ-ONLY; The creation date of the Asset. + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The last modified date of the Asset. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + + // READ-ONLY; The Asset encryption format. One of None or MediaStorageEncryption. + StorageEncryptionFormat *AssetStorageEncryptionFormat `json:"storageEncryptionFormat,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssetProperties. +func (a AssetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alternateId", a.AlternateID) + populate(objectMap, "assetId", a.AssetID) + populate(objectMap, "container", a.Container) + populate(objectMap, "created", (*timeRFC3339)(a.Created)) + populate(objectMap, "description", a.Description) + populate(objectMap, "lastModified", (*timeRFC3339)(a.LastModified)) + populate(objectMap, "storageAccountName", a.StorageAccountName) + populate(objectMap, "storageEncryptionFormat", a.StorageEncryptionFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetProperties. +func (a *AssetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "alternateId": + err = unpopulate(val, &a.AlternateID) + delete(rawMsg, key) + case "assetId": + err = unpopulate(val, &a.AssetID) + delete(rawMsg, key) + case "container": + err = unpopulate(val, &a.Container) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + a.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &a.Description) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + a.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "storageAccountName": + err = unpopulate(val, &a.StorageAccountName) + delete(rawMsg, key) + case "storageEncryptionFormat": + err = unpopulate(val, &a.StorageEncryptionFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// AssetStreamingLocator - Properties of the Streaming Locator. +type AssetStreamingLocator struct { + // READ-ONLY; Asset Name. + AssetName *string `json:"assetName,omitempty" azure:"ro"` + + // READ-ONLY; The creation time of the Streaming Locator. + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; Name of the default ContentKeyPolicy used by this Streaming Locator. + DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty" azure:"ro"` + + // READ-ONLY; The end time of the Streaming Locator. + EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + + // READ-ONLY; Streaming Locator name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The start time of the Streaming Locator. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; StreamingLocatorId of the Streaming Locator. + StreamingLocatorID *string `json:"streamingLocatorId,omitempty" azure:"ro"` + + // READ-ONLY; Name of the Streaming Policy used by this Streaming Locator. + StreamingPolicyName *string `json:"streamingPolicyName,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AssetStreamingLocator. +func (a AssetStreamingLocator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetName", a.AssetName) + populate(objectMap, "created", (*timeRFC3339)(a.Created)) + populate(objectMap, "defaultContentKeyPolicyName", a.DefaultContentKeyPolicyName) + populate(objectMap, "endTime", (*timeRFC3339)(a.EndTime)) + populate(objectMap, "name", a.Name) + populate(objectMap, "startTime", (*timeRFC3339)(a.StartTime)) + populate(objectMap, "streamingLocatorId", a.StreamingLocatorID) + populate(objectMap, "streamingPolicyName", a.StreamingPolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetStreamingLocator. +func (a *AssetStreamingLocator) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "assetName": + err = unpopulate(val, &a.AssetName) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + a.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "defaultContentKeyPolicyName": + err = unpopulate(val, &a.DefaultContentKeyPolicyName) + delete(rawMsg, key) + case "endTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + a.EndTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &a.Name) + delete(rawMsg, key) + case "startTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + a.StartTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "streamingLocatorId": + err = unpopulate(val, &a.StreamingLocatorID) + delete(rawMsg, key) + case "streamingPolicyName": + err = unpopulate(val, &a.StreamingPolicyName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// AssetsCreateOrUpdateOptions contains the optional parameters for the Assets.CreateOrUpdate method. +type AssetsCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AssetsDeleteOptions contains the optional parameters for the Assets.Delete method. +type AssetsDeleteOptions struct { + // placeholder for future optional parameters +} + +// AssetsGetEncryptionKeyOptions contains the optional parameters for the Assets.GetEncryptionKey method. +type AssetsGetEncryptionKeyOptions struct { + // placeholder for future optional parameters +} + +// AssetsGetOptions contains the optional parameters for the Assets.Get method. +type AssetsGetOptions struct { + // placeholder for future optional parameters +} + +// AssetsListContainerSasOptions contains the optional parameters for the Assets.ListContainerSas method. +type AssetsListContainerSasOptions struct { + // placeholder for future optional parameters +} + +// AssetsListOptions contains the optional parameters for the Assets.List method. +type AssetsListOptions struct { + // Restricts the set of items returned. + Filter *string + // Specifies the key by which the result collection should be ordered. + Orderby *string + // 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. + Top *int32 +} + +// AssetsListStreamingLocatorsOptions contains the optional parameters for the Assets.ListStreamingLocators method. +type AssetsListStreamingLocatorsOptions struct { + // placeholder for future optional parameters +} + +// AssetsUpdateOptions contains the optional parameters for the Assets.Update method. +type AssetsUpdateOptions struct { + // placeholder for future optional parameters +} + +// AudioClassification provides polymorphic access to related types. +// Call the interface's GetAudio() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AacAudio, *Audio +type AudioClassification interface { + CodecClassification + // GetAudio returns the Audio content of the underlying type. + GetAudio() *Audio +} + +// Audio - Defines the common properties for all audio codecs. +type Audio struct { + Codec + // The bitrate, in bits per second, of the output encoded audio. + Bitrate *int32 `json:"bitrate,omitempty"` + + // The number of channels in the audio. + Channels *int32 `json:"channels,omitempty"` + + // The sampling rate to use for encoding in hertz. + SamplingRate *int32 `json:"samplingRate,omitempty"` +} + +// GetAudio implements the AudioClassification interface for type Audio. +func (a *Audio) GetAudio() *Audio { return a } + +// MarshalJSON implements the json.Marshaller interface for type Audio. +func (a Audio) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.marshalInternal(objectMap, "#Microsoft.Media.Audio") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Audio. +func (a *Audio) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return a.unmarshalInternal(rawMsg) +} + +func (a Audio) marshalInternal(objectMap map[string]interface{}, discValue string) { + a.Codec.marshalInternal(objectMap, discValue) + populate(objectMap, "bitrate", a.Bitrate) + populate(objectMap, "channels", a.Channels) + populate(objectMap, "samplingRate", a.SamplingRate) +} + +func (a *Audio) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "bitrate": + err = unpopulate(val, &a.Bitrate) + delete(rawMsg, key) + case "channels": + err = unpopulate(val, &a.Channels) + delete(rawMsg, key) + case "samplingRate": + err = unpopulate(val, &a.SamplingRate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.Codec.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AudioAnalyzerPresetClassification provides polymorphic access to related types. +// Call the interface's GetAudioAnalyzerPreset() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AudioAnalyzerPreset, *VideoAnalyzerPreset +type AudioAnalyzerPresetClassification interface { + PresetClassification + // GetAudioAnalyzerPreset returns the AudioAnalyzerPreset content of the underlying type. + GetAudioAnalyzerPreset() *AudioAnalyzerPreset +} + +// AudioAnalyzerPreset - The Audio Analyzer preset applies a pre-defined set of AI-based analysis operations, including speech transcription. Currently, +// the preset supports processing of content with a single audio track. +type AudioAnalyzerPreset struct { + Preset + // The language for the audio payload in the input using the BCP-47 format of 'language tag-region' (e.g: 'en-US'). If you know the language of your content, + // it is recommended that you specify it. The + // language must be specified explicitly for AudioAnalysisMode::Basic, since automatic language detection is not included in basic mode. If the language + // isn't specified or set to null, automatic language + // detection will choose the first language detected and process with the selected language for the duration of the file. It does not currently support + // dynamically switching between languages after the + // first language is detected. The automatic detection works best with audio recordings with clearly discernable speech. If automatic detection fails to + // find the language, transcription would fallback to + // 'en-US'." The list of supported languages is available here: https://go.microsoft.com/fwlink/?linkid=2109463 + AudioLanguage *string `json:"audioLanguage,omitempty"` + + // Dictionary containing key value pairs for parameters not exposed in the preset itself + ExperimentalOptions map[string]*string `json:"experimentalOptions,omitempty"` + + // Determines the set of audio analysis operations to be performed. If unspecified, the Standard AudioAnalysisMode would be chosen. + Mode *AudioAnalysisMode `json:"mode,omitempty"` +} + +// GetAudioAnalyzerPreset implements the AudioAnalyzerPresetClassification interface for type AudioAnalyzerPreset. +func (a *AudioAnalyzerPreset) GetAudioAnalyzerPreset() *AudioAnalyzerPreset { return a } + +// MarshalJSON implements the json.Marshaller interface for type AudioAnalyzerPreset. +func (a AudioAnalyzerPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.marshalInternal(objectMap, "#Microsoft.Media.AudioAnalyzerPreset") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioAnalyzerPreset. +func (a *AudioAnalyzerPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return a.unmarshalInternal(rawMsg) +} + +func (a AudioAnalyzerPreset) marshalInternal(objectMap map[string]interface{}, discValue string) { + a.Preset.marshalInternal(objectMap, discValue) + populate(objectMap, "audioLanguage", a.AudioLanguage) + populate(objectMap, "experimentalOptions", a.ExperimentalOptions) + populate(objectMap, "mode", a.Mode) +} + +func (a *AudioAnalyzerPreset) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "audioLanguage": + err = unpopulate(val, &a.AudioLanguage) + delete(rawMsg, key) + case "experimentalOptions": + err = unpopulate(val, &a.ExperimentalOptions) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, &a.Mode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.Preset.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AudioOverlay - Describes the properties of an audio overlay. +type AudioOverlay struct { + Overlay +} + +// MarshalJSON implements the json.Marshaller interface for type AudioOverlay. +func (a AudioOverlay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.Overlay.marshalInternal(objectMap, "#Microsoft.Media.AudioOverlay") + return json.Marshal(objectMap) +} + +// AudioTrackDescriptorClassification provides polymorphic access to related types. +// Call the interface's GetAudioTrackDescriptor() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AudioTrackDescriptor, *SelectAudioTrackByAttribute, *SelectAudioTrackById +type AudioTrackDescriptorClassification interface { + TrackDescriptorClassification + // GetAudioTrackDescriptor returns the AudioTrackDescriptor content of the underlying type. + GetAudioTrackDescriptor() *AudioTrackDescriptor +} + +// AudioTrackDescriptor - A TrackSelection to select audio tracks. +type AudioTrackDescriptor struct { + TrackDescriptor + // Optional designation for single channel audio tracks. Can be used to combine the tracks into stereo or multi-channel audio tracks. + ChannelMapping *ChannelMapping `json:"channelMapping,omitempty"` +} + +// GetAudioTrackDescriptor implements the AudioTrackDescriptorClassification interface for type AudioTrackDescriptor. +func (a *AudioTrackDescriptor) GetAudioTrackDescriptor() *AudioTrackDescriptor { return a } + +// MarshalJSON implements the json.Marshaller interface for type AudioTrackDescriptor. +func (a AudioTrackDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.marshalInternal(objectMap, "#Microsoft.Media.AudioTrackDescriptor") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AudioTrackDescriptor. +func (a *AudioTrackDescriptor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return a.unmarshalInternal(rawMsg) +} + +func (a AudioTrackDescriptor) marshalInternal(objectMap map[string]interface{}, discValue string) { + a.TrackDescriptor.marshalInternal(objectMap, discValue) + populate(objectMap, "channelMapping", a.ChannelMapping) +} + +func (a *AudioTrackDescriptor) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "channelMapping": + err = unpopulate(val, &a.ChannelMapping) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.TrackDescriptor.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// BuiltInStandardEncoderPreset - Describes a built-in preset for encoding the input video with the Standard Encoder. +type BuiltInStandardEncoderPreset struct { + Preset + // REQUIRED; The built-in preset to be used for encoding videos. + PresetName *EncoderNamedPreset `json:"presetName,omitempty"` + + // PresetConfigurations are only supported for the ContentAwareEncoding and H265ContentAwareEncoding built-in presets. These settings will not affect other + // built-in or custom defined presets. + Configurations *PresetConfigurations `json:"configurations,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BuiltInStandardEncoderPreset. +func (b BuiltInStandardEncoderPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + b.Preset.marshalInternal(objectMap, "#Microsoft.Media.BuiltInStandardEncoderPreset") + populate(objectMap, "configurations", b.Configurations) + populate(objectMap, "presetName", b.PresetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BuiltInStandardEncoderPreset. +func (b *BuiltInStandardEncoderPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "configurations": + err = unpopulate(val, &b.Configurations) + delete(rawMsg, key) + case "presetName": + err = unpopulate(val, &b.PresetName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := b.Preset.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CbcsDrmConfiguration - Class to specify DRM configurations of CommonEncryptionCbcs scheme in Streaming Policy +type CbcsDrmConfiguration struct { + // FairPlay configurations + FairPlay *StreamingPolicyFairPlayConfiguration `json:"fairPlay,omitempty"` + + // PlayReady configurations + PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"` + + // Widevine configurations + Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"` +} + +// CencDrmConfiguration - Class to specify DRM configurations of CommonEncryptionCenc scheme in Streaming Policy +type CencDrmConfiguration struct { + // PlayReady configurations + PlayReady *StreamingPolicyPlayReadyConfiguration `json:"playReady,omitempty"` + + // Widevine configurations + Widevine *StreamingPolicyWidevineConfiguration `json:"widevine,omitempty"` +} + +// CheckNameAvailabilityInput - The input to the check name availability request. +type CheckNameAvailabilityInput struct { + // The account name. + Name *string `json:"name,omitempty"` + + // The account type. For a Media Services account, this should be 'MediaServices'. + Type *string `json:"type,omitempty"` +} + +// ClipTimeClassification provides polymorphic access to related types. +// Call the interface's GetClipTime() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AbsoluteClipTime, *ClipTime, *UtcClipTime +type ClipTimeClassification interface { + // GetClipTime returns the ClipTime content of the underlying type. + GetClipTime() *ClipTime +} + +// ClipTime - Base class for specifying a clip time. Use sub classes of this class to specify the time position in the media. +type ClipTime struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetClipTime implements the ClipTimeClassification interface for type ClipTime. +func (c *ClipTime) GetClipTime() *ClipTime { return c } + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClipTime. +func (c *ClipTime) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c ClipTime) marshalInternal(objectMap map[string]interface{}, discValue string) { + c.ODataType = &discValue + objectMap["@odata.type"] = c.ODataType +} + +func (c *ClipTime) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// CodecClassification provides polymorphic access to related types. +// Call the interface's GetCodec() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AacAudio, *Audio, *Codec, *CopyAudio, *CopyVideo, *H264Video, *H265Video, *Image, *JpgImage, *PngImage, *Video +type CodecClassification interface { + // GetCodec returns the Codec content of the underlying type. + GetCodec() *Codec +} + +// Codec - Describes the basic properties of all codecs. +type Codec struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` + + // An optional label for the codec. The label can be used to control muxing behavior. + Label *string `json:"label,omitempty"` +} + +// GetCodec implements the CodecClassification interface for type Codec. +func (c *Codec) GetCodec() *Codec { return c } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Codec. +func (c *Codec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c Codec) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "label", c.Label) + c.ODataType = &discValue + objectMap["@odata.type"] = c.ODataType +} + +func (c *Codec) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "label": + err = unpopulate(val, &c.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// CommonEncryptionCbcs - Class for CommonEncryptionCbcs encryption scheme +type CommonEncryptionCbcs struct { + // Representing which tracks should not be encrypted + ClearTracks []*TrackSelection `json:"clearTracks,omitempty"` + + // Representing default content key for each encryption scheme and separate content keys for specific tracks + ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` + + // Configuration of DRMs for current encryption scheme + Drm *CbcsDrmConfiguration `json:"drm,omitempty"` + + // Representing supported protocols + EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CommonEncryptionCbcs. +func (c CommonEncryptionCbcs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clearTracks", c.ClearTracks) + populate(objectMap, "contentKeys", c.ContentKeys) + populate(objectMap, "drm", c.Drm) + populate(objectMap, "enabledProtocols", c.EnabledProtocols) + return json.Marshal(objectMap) +} + +// CommonEncryptionCenc - Class for envelope encryption scheme +type CommonEncryptionCenc struct { + // Representing which tracks should not be encrypted + ClearTracks []*TrackSelection `json:"clearTracks,omitempty"` + + // Representing default content key for each encryption scheme and separate content keys for specific tracks + ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` + + // Configuration of DRMs for CommonEncryptionCenc encryption scheme + Drm *CencDrmConfiguration `json:"drm,omitempty"` + + // Representing supported protocols + EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CommonEncryptionCenc. +func (c CommonEncryptionCenc) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clearTracks", c.ClearTracks) + populate(objectMap, "contentKeys", c.ContentKeys) + populate(objectMap, "drm", c.Drm) + populate(objectMap, "enabledProtocols", c.EnabledProtocols) + return json.Marshal(objectMap) +} + +// ContentKeyPoliciesCreateOrUpdateOptions contains the optional parameters for the ContentKeyPolicies.CreateOrUpdate method. +type ContentKeyPoliciesCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ContentKeyPoliciesDeleteOptions contains the optional parameters for the ContentKeyPolicies.Delete method. +type ContentKeyPoliciesDeleteOptions struct { + // placeholder for future optional parameters +} + +// ContentKeyPoliciesGetOptions contains the optional parameters for the ContentKeyPolicies.Get method. +type ContentKeyPoliciesGetOptions struct { + // placeholder for future optional parameters +} + +// ContentKeyPoliciesGetPolicyPropertiesWithSecretsOptions contains the optional parameters for the ContentKeyPolicies.GetPolicyPropertiesWithSecrets method. +type ContentKeyPoliciesGetPolicyPropertiesWithSecretsOptions struct { + // placeholder for future optional parameters +} + +// ContentKeyPoliciesListOptions contains the optional parameters for the ContentKeyPolicies.List method. +type ContentKeyPoliciesListOptions struct { + // Restricts the set of items returned. + Filter *string + // Specifies the key by which the result collection should be ordered. + Orderby *string + // 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. + Top *int32 +} + +// ContentKeyPoliciesUpdateOptions contains the optional parameters for the ContentKeyPolicies.Update method. +type ContentKeyPoliciesUpdateOptions struct { + // placeholder for future optional parameters +} + +// ContentKeyPolicy - A Content Key Policy resource. +type ContentKeyPolicy struct { + ProxyResource + // The properties of the Content Key Policy. + Properties *ContentKeyPolicyProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicy. +func (c ContentKeyPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + return json.Marshal(objectMap) +} + +// ContentKeyPolicyClearKeyConfiguration - Represents a configuration for non-DRM keys. +type ContentKeyPolicyClearKeyConfiguration struct { + ContentKeyPolicyConfiguration +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyClearKeyConfiguration. +func (c ContentKeyPolicyClearKeyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyConfiguration.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration") + return json.Marshal(objectMap) +} + +// ContentKeyPolicyCollection - A collection of ContentKeyPolicy items. +type ContentKeyPolicyCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of ContentKeyPolicy items. + Value []*ContentKeyPolicy `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyCollection. +func (c ContentKeyPolicyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", c.ODataNextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// ContentKeyPolicyConfigurationClassification provides polymorphic access to related types. +// Call the interface's GetContentKeyPolicyConfiguration() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ContentKeyPolicyClearKeyConfiguration, *ContentKeyPolicyConfiguration, *ContentKeyPolicyFairPlayConfiguration, *ContentKeyPolicyPlayReadyConfiguration, +// - *ContentKeyPolicyUnknownConfiguration, *ContentKeyPolicyWidevineConfiguration +type ContentKeyPolicyConfigurationClassification interface { + // GetContentKeyPolicyConfiguration returns the ContentKeyPolicyConfiguration content of the underlying type. + GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration +} + +// ContentKeyPolicyConfiguration - Base class for Content Key Policy configuration. A derived class must be used to create a configuration. +type ContentKeyPolicyConfiguration struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetContentKeyPolicyConfiguration implements the ContentKeyPolicyConfigurationClassification interface for type ContentKeyPolicyConfiguration. +func (c *ContentKeyPolicyConfiguration) GetContentKeyPolicyConfiguration() *ContentKeyPolicyConfiguration { + return c +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyConfiguration. +func (c *ContentKeyPolicyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c ContentKeyPolicyConfiguration) marshalInternal(objectMap map[string]interface{}, discValue string) { + c.ODataType = &discValue + objectMap["@odata.type"] = c.ODataType +} + +func (c *ContentKeyPolicyConfiguration) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyFairPlayConfiguration - Specifies a configuration for FairPlay licenses. +type ContentKeyPolicyFairPlayConfiguration struct { + ContentKeyPolicyConfiguration + // REQUIRED; The key that must be used as FairPlay Application Secret key. + Ask []byte `json:"ask,omitempty"` + + // REQUIRED; The Base64 representation of FairPlay certificate in PKCS 12 (pfx) format (including private key). + FairPlayPfx *string `json:"fairPlayPfx,omitempty"` + + // REQUIRED; The password encrypting FairPlay certificate in PKCS 12 (pfx) format. + FairPlayPfxPassword *string `json:"fairPlayPfxPassword,omitempty"` + + // REQUIRED; The rental and lease key type. + RentalAndLeaseKeyType *ContentKeyPolicyFairPlayRentalAndLeaseKeyType `json:"rentalAndLeaseKeyType,omitempty"` + + // REQUIRED; The rental duration. Must be greater than or equal to 0. + RentalDuration *int64 `json:"rentalDuration,omitempty"` + + // Offline rental policy + OfflineRentalConfiguration *ContentKeyPolicyFairPlayOfflineRentalConfiguration `json:"offlineRentalConfiguration,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyFairPlayConfiguration. +func (c ContentKeyPolicyFairPlayConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyConfiguration.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration") + populateByteArray(objectMap, "ask", c.Ask, runtime.Base64StdFormat) + populate(objectMap, "fairPlayPfx", c.FairPlayPfx) + populate(objectMap, "fairPlayPfxPassword", c.FairPlayPfxPassword) + populate(objectMap, "offlineRentalConfiguration", c.OfflineRentalConfiguration) + populate(objectMap, "rentalAndLeaseKeyType", c.RentalAndLeaseKeyType) + populate(objectMap, "rentalDuration", c.RentalDuration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyFairPlayConfiguration. +func (c *ContentKeyPolicyFairPlayConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "ask": + err = runtime.DecodeByteArray(string(val), &c.Ask, runtime.Base64StdFormat) + delete(rawMsg, key) + case "fairPlayPfx": + err = unpopulate(val, &c.FairPlayPfx) + delete(rawMsg, key) + case "fairPlayPfxPassword": + err = unpopulate(val, &c.FairPlayPfxPassword) + delete(rawMsg, key) + case "offlineRentalConfiguration": + err = unpopulate(val, &c.OfflineRentalConfiguration) + delete(rawMsg, key) + case "rentalAndLeaseKeyType": + err = unpopulate(val, &c.RentalAndLeaseKeyType) + delete(rawMsg, key) + case "rentalDuration": + err = unpopulate(val, &c.RentalDuration) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyConfiguration.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +type ContentKeyPolicyFairPlayOfflineRentalConfiguration struct { + // REQUIRED; Playback duration + PlaybackDurationSeconds *int64 `json:"playbackDurationSeconds,omitempty"` + + // REQUIRED; Storage duration + StorageDurationSeconds *int64 `json:"storageDurationSeconds,omitempty"` +} + +// ContentKeyPolicyOpenRestriction - Represents an open restriction. License or key will be delivered on every request. +type ContentKeyPolicyOpenRestriction struct { + ContentKeyPolicyRestriction +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyOpenRestriction. +func (c ContentKeyPolicyOpenRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyRestriction.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyOpenRestriction") + return json.Marshal(objectMap) +} + +// ContentKeyPolicyOption - Represents a policy option. +type ContentKeyPolicyOption struct { + // REQUIRED; The key delivery configuration. + Configuration ContentKeyPolicyConfigurationClassification `json:"configuration,omitempty"` + + // REQUIRED; The requirements that must be met to deliver keys with this configuration + Restriction ContentKeyPolicyRestrictionClassification `json:"restriction,omitempty"` + + // The Policy Option description. + Name *string `json:"name,omitempty"` + + // READ-ONLY; The legacy Policy Option ID. + PolicyOptionID *string `json:"policyOptionId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyOption. +func (c ContentKeyPolicyOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", c.Configuration) + populate(objectMap, "name", c.Name) + populate(objectMap, "policyOptionId", c.PolicyOptionID) + populate(objectMap, "restriction", c.Restriction) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyOption. +func (c *ContentKeyPolicyOption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "configuration": + c.Configuration, err = unmarshalContentKeyPolicyConfigurationClassification(val) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &c.Name) + delete(rawMsg, key) + case "policyOptionId": + err = unpopulate(val, &c.PolicyOptionID) + delete(rawMsg, key) + case "restriction": + c.Restriction, err = unmarshalContentKeyPolicyRestrictionClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyPlayReadyConfiguration - Specifies a configuration for PlayReady licenses. +type ContentKeyPolicyPlayReadyConfiguration struct { + ContentKeyPolicyConfiguration + // REQUIRED; The PlayReady licenses. + Licenses []*ContentKeyPolicyPlayReadyLicense `json:"licenses,omitempty"` + + // The custom response data. + ResponseCustomData *string `json:"responseCustomData,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyConfiguration. +func (c ContentKeyPolicyPlayReadyConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyConfiguration.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration") + populate(objectMap, "licenses", c.Licenses) + populate(objectMap, "responseCustomData", c.ResponseCustomData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyConfiguration. +func (c *ContentKeyPolicyPlayReadyConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "licenses": + err = unpopulate(val, &c.Licenses) + delete(rawMsg, key) + case "responseCustomData": + err = unpopulate(val, &c.ResponseCustomData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyConfiguration.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader - Specifies that the content key ID is in the PlayReady header. +type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader struct { + ContentKeyPolicyPlayReadyContentKeyLocation +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader. +func (c ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyPlayReadyContentKeyLocation.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader") + return json.Marshal(objectMap) +} + +// ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier - Specifies that the content key ID is specified in the PlayReady configuration. +type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier struct { + ContentKeyPolicyPlayReadyContentKeyLocation + // REQUIRED; The content key ID. + KeyID *string `json:"keyId,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. +func (c ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyPlayReadyContentKeyLocation.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier") + populate(objectMap, "keyId", c.KeyID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier. +func (c *ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "keyId": + err = unpopulate(val, &c.KeyID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyPlayReadyContentKeyLocation.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContentKeyPolicyPlayReadyContentKeyLocationClassification provides polymorphic access to related types. +// Call the interface's GetContentKeyPolicyPlayReadyContentKeyLocation() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader, *ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier, +// - *ContentKeyPolicyPlayReadyContentKeyLocation +type ContentKeyPolicyPlayReadyContentKeyLocationClassification interface { + // GetContentKeyPolicyPlayReadyContentKeyLocation returns the ContentKeyPolicyPlayReadyContentKeyLocation content of the underlying type. + GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation +} + +// ContentKeyPolicyPlayReadyContentKeyLocation - Base class for content key ID location. A derived class must be used to represent the location. +type ContentKeyPolicyPlayReadyContentKeyLocation struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetContentKeyPolicyPlayReadyContentKeyLocation implements the ContentKeyPolicyPlayReadyContentKeyLocationClassification interface for type ContentKeyPolicyPlayReadyContentKeyLocation. +func (c *ContentKeyPolicyPlayReadyContentKeyLocation) GetContentKeyPolicyPlayReadyContentKeyLocation() *ContentKeyPolicyPlayReadyContentKeyLocation { + return c +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyContentKeyLocation. +func (c *ContentKeyPolicyPlayReadyContentKeyLocation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c ContentKeyPolicyPlayReadyContentKeyLocation) marshalInternal(objectMap map[string]interface{}, discValue string) { + c.ODataType = &discValue + objectMap["@odata.type"] = c.ODataType +} + +func (c *ContentKeyPolicyPlayReadyContentKeyLocation) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction - Configures the Explicit Analog Television Output Restriction control bits. For further +// details see the PlayReady Compliance Rules. +type ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction struct { + // REQUIRED; Indicates whether this restriction is enforced on a Best Effort basis. + BestEffort *bool `json:"bestEffort,omitempty"` + + // REQUIRED; Configures the restriction control bits. Must be between 0 and 3 inclusive. + ConfigurationData *int32 `json:"configurationData,omitempty"` +} + +// ContentKeyPolicyPlayReadyLicense - The PlayReady license +type ContentKeyPolicyPlayReadyLicense struct { + // REQUIRED; A flag indicating whether test devices can use the license. + AllowTestDevices *bool `json:"allowTestDevices,omitempty"` + + // REQUIRED; The content key location. + ContentKeyLocation ContentKeyPolicyPlayReadyContentKeyLocationClassification `json:"contentKeyLocation,omitempty"` + + // REQUIRED; The PlayReady content type. + ContentType *ContentKeyPolicyPlayReadyContentType `json:"contentType,omitempty"` + + // REQUIRED; The license type. + LicenseType *ContentKeyPolicyPlayReadyLicenseType `json:"licenseType,omitempty"` + + // The begin date of license + BeginDate *time.Time `json:"beginDate,omitempty"` + + // The expiration date of license. + ExpirationDate *time.Time `json:"expirationDate,omitempty"` + + // The grace period of license. + GracePeriod *string `json:"gracePeriod,omitempty"` + + // The license PlayRight + PlayRight *ContentKeyPolicyPlayReadyPlayRight `json:"playRight,omitempty"` + + // The relative begin date of license. + RelativeBeginDate *string `json:"relativeBeginDate,omitempty"` + + // The relative expiration date of license. + RelativeExpirationDate *string `json:"relativeExpirationDate,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyPlayReadyLicense. +func (c ContentKeyPolicyPlayReadyLicense) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowTestDevices", c.AllowTestDevices) + populate(objectMap, "beginDate", (*timeRFC3339)(c.BeginDate)) + populate(objectMap, "contentKeyLocation", c.ContentKeyLocation) + populate(objectMap, "contentType", c.ContentType) + populate(objectMap, "expirationDate", (*timeRFC3339)(c.ExpirationDate)) + populate(objectMap, "gracePeriod", c.GracePeriod) + populate(objectMap, "licenseType", c.LicenseType) + populate(objectMap, "playRight", c.PlayRight) + populate(objectMap, "relativeBeginDate", c.RelativeBeginDate) + populate(objectMap, "relativeExpirationDate", c.RelativeExpirationDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyPlayReadyLicense. +func (c *ContentKeyPolicyPlayReadyLicense) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "allowTestDevices": + err = unpopulate(val, &c.AllowTestDevices) + delete(rawMsg, key) + case "beginDate": + var aux timeRFC3339 + err = unpopulate(val, &aux) + c.BeginDate = (*time.Time)(&aux) + delete(rawMsg, key) + case "contentKeyLocation": + c.ContentKeyLocation, err = unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(val) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, &c.ContentType) + delete(rawMsg, key) + case "expirationDate": + var aux timeRFC3339 + err = unpopulate(val, &aux) + c.ExpirationDate = (*time.Time)(&aux) + delete(rawMsg, key) + case "gracePeriod": + err = unpopulate(val, &c.GracePeriod) + delete(rawMsg, key) + case "licenseType": + err = unpopulate(val, &c.LicenseType) + delete(rawMsg, key) + case "playRight": + err = unpopulate(val, &c.PlayRight) + delete(rawMsg, key) + case "relativeBeginDate": + err = unpopulate(val, &c.RelativeBeginDate) + delete(rawMsg, key) + case "relativeExpirationDate": + err = unpopulate(val, &c.RelativeExpirationDate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyPlayReadyPlayRight - Configures the Play Right in the PlayReady license. +type ContentKeyPolicyPlayReadyPlayRight struct { + // REQUIRED; Configures Unknown output handling settings of the license. + AllowPassingVideoContentToUnknownOutput *ContentKeyPolicyPlayReadyUnknownOutputPassingOption `json:"allowPassingVideoContentToUnknownOutput,omitempty"` + + // REQUIRED; Enables the Image Constraint For Analog Component Video Restriction in the license. + DigitalVideoOnlyContentRestriction *bool `json:"digitalVideoOnlyContentRestriction,omitempty"` + + // REQUIRED; Enables the Image Constraint For Analog Component Video Restriction in the license. + ImageConstraintForAnalogComponentVideoRestriction *bool `json:"imageConstraintForAnalogComponentVideoRestriction,omitempty"` + + // REQUIRED; Enables the Image Constraint For Analog Component Video Restriction in the license. + ImageConstraintForAnalogComputerMonitorRestriction *bool `json:"imageConstraintForAnalogComputerMonitorRestriction,omitempty"` + + // Configures Automatic Gain Control (AGC) and Color Stripe in the license. Must be between 0 and 3 inclusive. + AgcAndColorStripeRestriction *int32 `json:"agcAndColorStripeRestriction,omitempty"` + + // Specifies the output protection level for compressed digital audio. + AnalogVideoOpl *int32 `json:"analogVideoOpl,omitempty"` + + // Specifies the output protection level for compressed digital audio. + CompressedDigitalAudioOpl *int32 `json:"compressedDigitalAudioOpl,omitempty"` + + // Specifies the output protection level for compressed digital video. + CompressedDigitalVideoOpl *int32 `json:"compressedDigitalVideoOpl,omitempty"` + + // Configures the Explicit Analog Television Output Restriction in the license. Configuration data must be between 0 and 3 inclusive. + ExplicitAnalogTelevisionOutputRestriction *ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction `json:"explicitAnalogTelevisionOutputRestriction,omitempty"` + + // The amount of time that the license is valid after the license is first used to play content. + FirstPlayExpiration *string `json:"firstPlayExpiration,omitempty"` + + // Configures the Serial Copy Management System (SCMS) in the license. Must be between 0 and 3 inclusive. + ScmsRestriction *int32 `json:"scmsRestriction,omitempty"` + + // Specifies the output protection level for uncompressed digital audio. + UncompressedDigitalAudioOpl *int32 `json:"uncompressedDigitalAudioOpl,omitempty"` + + // Specifies the output protection level for uncompressed digital video. + UncompressedDigitalVideoOpl *int32 `json:"uncompressedDigitalVideoOpl,omitempty"` +} + +// ContentKeyPolicyProperties - The properties of the Content Key Policy. +type ContentKeyPolicyProperties struct { + // REQUIRED; The Key Policy options. + Options []*ContentKeyPolicyOption `json:"options,omitempty"` + + // A description for the Policy. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The creation date of the Policy + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The last modified date of the Policy + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + + // READ-ONLY; The legacy Policy ID. + PolicyID *string `json:"policyId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyProperties. +func (c ContentKeyPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "created", (*timeRFC3339)(c.Created)) + populate(objectMap, "description", c.Description) + populate(objectMap, "lastModified", (*timeRFC3339)(c.LastModified)) + populate(objectMap, "options", c.Options) + populate(objectMap, "policyId", c.PolicyID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyProperties. +func (c *ContentKeyPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + c.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &c.Description) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + c.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "options": + err = unpopulate(val, &c.Options) + delete(rawMsg, key) + case "policyId": + err = unpopulate(val, &c.PolicyID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyRestrictionClassification provides polymorphic access to related types. +// Call the interface's GetContentKeyPolicyRestriction() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ContentKeyPolicyOpenRestriction, *ContentKeyPolicyRestriction, *ContentKeyPolicyTokenRestriction, *ContentKeyPolicyUnknownRestriction +type ContentKeyPolicyRestrictionClassification interface { + // GetContentKeyPolicyRestriction returns the ContentKeyPolicyRestriction content of the underlying type. + GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction +} + +// ContentKeyPolicyRestriction - Base class for Content Key Policy restrictions. A derived class must be used to create a restriction. +type ContentKeyPolicyRestriction struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetContentKeyPolicyRestriction implements the ContentKeyPolicyRestrictionClassification interface for type ContentKeyPolicyRestriction. +func (c *ContentKeyPolicyRestriction) GetContentKeyPolicyRestriction() *ContentKeyPolicyRestriction { + return c +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyRestriction. +func (c *ContentKeyPolicyRestriction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c ContentKeyPolicyRestriction) marshalInternal(objectMap map[string]interface{}, discValue string) { + c.ODataType = &discValue + objectMap["@odata.type"] = c.ODataType +} + +func (c *ContentKeyPolicyRestriction) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyRestrictionTokenKeyClassification provides polymorphic access to related types. +// Call the interface's GetContentKeyPolicyRestrictionTokenKey() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ContentKeyPolicyRestrictionTokenKey, *ContentKeyPolicyRsaTokenKey, *ContentKeyPolicySymmetricTokenKey, *ContentKeyPolicyX509CertificateTokenKey +type ContentKeyPolicyRestrictionTokenKeyClassification interface { + // GetContentKeyPolicyRestrictionTokenKey returns the ContentKeyPolicyRestrictionTokenKey content of the underlying type. + GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey +} + +// ContentKeyPolicyRestrictionTokenKey - Base class for Content Key Policy key for token validation. A derived class must be used to create a token key. +type ContentKeyPolicyRestrictionTokenKey struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetContentKeyPolicyRestrictionTokenKey implements the ContentKeyPolicyRestrictionTokenKeyClassification interface for type ContentKeyPolicyRestrictionTokenKey. +func (c *ContentKeyPolicyRestrictionTokenKey) GetContentKeyPolicyRestrictionTokenKey() *ContentKeyPolicyRestrictionTokenKey { + return c +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyRestrictionTokenKey. +func (c *ContentKeyPolicyRestrictionTokenKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c ContentKeyPolicyRestrictionTokenKey) marshalInternal(objectMap map[string]interface{}, discValue string) { + c.ODataType = &discValue + objectMap["@odata.type"] = c.ODataType +} + +func (c *ContentKeyPolicyRestrictionTokenKey) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &c.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ContentKeyPolicyRsaTokenKey - Specifies a RSA key for token validation +type ContentKeyPolicyRsaTokenKey struct { + ContentKeyPolicyRestrictionTokenKey + // REQUIRED; The RSA Parameter exponent + Exponent []byte `json:"exponent,omitempty"` + + // REQUIRED; The RSA Parameter modulus + Modulus []byte `json:"modulus,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyRsaTokenKey. +func (c ContentKeyPolicyRsaTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyRestrictionTokenKey.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyRsaTokenKey") + populateByteArray(objectMap, "exponent", c.Exponent, runtime.Base64StdFormat) + populateByteArray(objectMap, "modulus", c.Modulus, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyRsaTokenKey. +func (c *ContentKeyPolicyRsaTokenKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "exponent": + err = runtime.DecodeByteArray(string(val), &c.Exponent, runtime.Base64StdFormat) + delete(rawMsg, key) + case "modulus": + err = runtime.DecodeByteArray(string(val), &c.Modulus, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyRestrictionTokenKey.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContentKeyPolicySymmetricTokenKey - Specifies a symmetric key for token validation. +type ContentKeyPolicySymmetricTokenKey struct { + ContentKeyPolicyRestrictionTokenKey + // REQUIRED; The key value of the key + KeyValue []byte `json:"keyValue,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicySymmetricTokenKey. +func (c ContentKeyPolicySymmetricTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyRestrictionTokenKey.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey") + populateByteArray(objectMap, "keyValue", c.KeyValue, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicySymmetricTokenKey. +func (c *ContentKeyPolicySymmetricTokenKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "keyValue": + err = runtime.DecodeByteArray(string(val), &c.KeyValue, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyRestrictionTokenKey.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContentKeyPolicyTokenClaim - Represents a token claim. +type ContentKeyPolicyTokenClaim struct { + // Token claim type. + ClaimType *string `json:"claimType,omitempty"` + + // Token claim value. + ClaimValue *string `json:"claimValue,omitempty"` +} + +// ContentKeyPolicyTokenRestriction - Represents a token restriction. Provided token must match these requirements for successful license or key delivery. +type ContentKeyPolicyTokenRestriction struct { + ContentKeyPolicyRestriction + // REQUIRED; The audience for the token. + Audience *string `json:"audience,omitempty"` + + // REQUIRED; The token issuer. + Issuer *string `json:"issuer,omitempty"` + + // REQUIRED; The primary verification key. + PrimaryVerificationKey ContentKeyPolicyRestrictionTokenKeyClassification `json:"primaryVerificationKey,omitempty"` + + // REQUIRED; The type of token. + RestrictionTokenType *ContentKeyPolicyRestrictionTokenType `json:"restrictionTokenType,omitempty"` + + // A list of alternative verification keys. + AlternateVerificationKeys []ContentKeyPolicyRestrictionTokenKeyClassification `json:"alternateVerificationKeys,omitempty"` + + // The OpenID connect discovery document. + OpenIDConnectDiscoveryDocument *string `json:"openIdConnectDiscoveryDocument,omitempty"` + + // A list of required token claims. + RequiredClaims []*ContentKeyPolicyTokenClaim `json:"requiredClaims,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyTokenRestriction. +func (c ContentKeyPolicyTokenRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyRestriction.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyTokenRestriction") + populate(objectMap, "alternateVerificationKeys", c.AlternateVerificationKeys) + populate(objectMap, "audience", c.Audience) + populate(objectMap, "issuer", c.Issuer) + populate(objectMap, "openIdConnectDiscoveryDocument", c.OpenIDConnectDiscoveryDocument) + populate(objectMap, "primaryVerificationKey", c.PrimaryVerificationKey) + populate(objectMap, "requiredClaims", c.RequiredClaims) + populate(objectMap, "restrictionTokenType", c.RestrictionTokenType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyTokenRestriction. +func (c *ContentKeyPolicyTokenRestriction) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "alternateVerificationKeys": + c.AlternateVerificationKeys, err = unmarshalContentKeyPolicyRestrictionTokenKeyClassificationArray(val) + delete(rawMsg, key) + case "audience": + err = unpopulate(val, &c.Audience) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, &c.Issuer) + delete(rawMsg, key) + case "openIdConnectDiscoveryDocument": + err = unpopulate(val, &c.OpenIDConnectDiscoveryDocument) + delete(rawMsg, key) + case "primaryVerificationKey": + c.PrimaryVerificationKey, err = unmarshalContentKeyPolicyRestrictionTokenKeyClassification(val) + delete(rawMsg, key) + case "requiredClaims": + err = unpopulate(val, &c.RequiredClaims) + delete(rawMsg, key) + case "restrictionTokenType": + err = unpopulate(val, &c.RestrictionTokenType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyRestriction.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContentKeyPolicyUnknownConfiguration - Represents a ContentKeyPolicyConfiguration that is unavailable in the current API version. +type ContentKeyPolicyUnknownConfiguration struct { + ContentKeyPolicyConfiguration +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyUnknownConfiguration. +func (c ContentKeyPolicyUnknownConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyConfiguration.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration") + return json.Marshal(objectMap) +} + +// ContentKeyPolicyUnknownRestriction - Represents a ContentKeyPolicyRestriction that is unavailable in the current API version. +type ContentKeyPolicyUnknownRestriction struct { + ContentKeyPolicyRestriction +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyUnknownRestriction. +func (c ContentKeyPolicyUnknownRestriction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyRestriction.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyUnknownRestriction") + return json.Marshal(objectMap) +} + +// ContentKeyPolicyWidevineConfiguration - Specifies a configuration for Widevine licenses. +type ContentKeyPolicyWidevineConfiguration struct { + ContentKeyPolicyConfiguration + // REQUIRED; The Widevine template. + WidevineTemplate *string `json:"widevineTemplate,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyWidevineConfiguration. +func (c ContentKeyPolicyWidevineConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyConfiguration.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration") + populate(objectMap, "widevineTemplate", c.WidevineTemplate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyWidevineConfiguration. +func (c *ContentKeyPolicyWidevineConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "widevineTemplate": + err = unpopulate(val, &c.WidevineTemplate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyConfiguration.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ContentKeyPolicyX509CertificateTokenKey - Specifies a certificate for token validation. +type ContentKeyPolicyX509CertificateTokenKey struct { + ContentKeyPolicyRestrictionTokenKey + // REQUIRED; The raw data field of a certificate in PKCS 12 format (X509Certificate2 in .NET) + RawBody []byte `json:"rawBody,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyX509CertificateTokenKey. +func (c ContentKeyPolicyX509CertificateTokenKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.ContentKeyPolicyRestrictionTokenKey.marshalInternal(objectMap, "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey") + populateByteArray(objectMap, "rawBody", c.RawBody, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentKeyPolicyX509CertificateTokenKey. +func (c *ContentKeyPolicyX509CertificateTokenKey) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "rawBody": + err = runtime.DecodeByteArray(string(val), &c.RawBody, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ContentKeyPolicyRestrictionTokenKey.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CopyAudio - A codec flag, which tells the encoder to copy the input audio bitstream. +type CopyAudio struct { + Codec +} + +// MarshalJSON implements the json.Marshaller interface for type CopyAudio. +func (c CopyAudio) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Codec.marshalInternal(objectMap, "#Microsoft.Media.CopyAudio") + return json.Marshal(objectMap) +} + +// CopyVideo - A codec flag, which tells the encoder to copy the input video bitstream without re-encoding. +type CopyVideo struct { + Codec +} + +// MarshalJSON implements the json.Marshaller interface for type CopyVideo. +func (c CopyVideo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Codec.marshalInternal(objectMap, "#Microsoft.Media.CopyVideo") + return json.Marshal(objectMap) +} + +// CrossSiteAccessPolicies - The client access policy. +type CrossSiteAccessPolicies struct { + // The content of clientaccesspolicy.xml used by Silverlight. + ClientAccessPolicy *string `json:"clientAccessPolicy,omitempty"` + + // The content of crossdomain.xml used by Silverlight. + CrossDomainPolicy *string `json:"crossDomainPolicy,omitempty"` +} + +// DefaultKey - Class to specify properties of default content key for each encryption scheme +type DefaultKey struct { + // Label can be used to specify Content Key when creating a Streaming Locator + Label *string `json:"label,omitempty"` + + // Policy used by Default Key + PolicyName *string `json:"policyName,omitempty"` +} + +// Deinterlace - Describes the de-interlacing settings. +type Deinterlace struct { + // The deinterlacing mode. Defaults to AutoPixelAdaptive. + Mode *DeinterlaceMode `json:"mode,omitempty"` + + // The field parity for de-interlacing, defaults to Auto. + Parity *DeinterlaceParity `json:"parity,omitempty"` +} + +type EdgePolicies struct { + UsageDataCollectionPolicy *EdgeUsageDataCollectionPolicy `json:"usageDataCollectionPolicy,omitempty"` +} + +type EdgeUsageDataCollectionPolicy struct { + // Usage data collection frequency in ISO 8601 duration format e.g. PT10M , PT5H. + DataCollectionFrequency *string `json:"dataCollectionFrequency,omitempty"` + + // Usage data reporting frequency in ISO 8601 duration format e.g. PT10M , PT5H. + DataReportingFrequency *string `json:"dataReportingFrequency,omitempty"` + + // Details of Event Hub where the usage will be reported. + EventHubDetails *EdgeUsageDataEventHub `json:"eventHubDetails,omitempty"` + + // Maximum time for which the functionality of the device will not be hampered for not reporting the usage data. + MaxAllowedUnreportedUsageDuration *string `json:"maxAllowedUnreportedUsageDuration,omitempty"` +} + +type EdgeUsageDataEventHub struct { + // Name of the Event Hub where usage will be reported. + Name *string `json:"name,omitempty"` + + // Namespace of the Event Hub where usage will be reported. + Namespace *string `json:"namespace,omitempty"` + + // SAS token needed to interact with Event Hub. + Token *string `json:"token,omitempty"` +} + +// EnabledProtocols - Class to specify which protocols are enabled +type EnabledProtocols struct { + // REQUIRED; Enable DASH protocol or not + Dash *bool `json:"dash,omitempty"` + + // REQUIRED; Enable Download protocol or not + Download *bool `json:"download,omitempty"` + + // REQUIRED; Enable HLS protocol or not + Hls *bool `json:"hls,omitempty"` + + // REQUIRED; Enable SmoothStreaming protocol or not + SmoothStreaming *bool `json:"smoothStreaming,omitempty"` +} + +// EntityNameAvailabilityCheckOutput - The response from the check name availability request. +type EntityNameAvailabilityCheckOutput struct { + // REQUIRED; Specifies if the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // Specifies the detailed reason if the name is not available. + Message *string `json:"message,omitempty"` + + // Specifies the reason if the name is not available. + Reason *string `json:"reason,omitempty"` +} + +// EnvelopeEncryption - Class for EnvelopeEncryption encryption scheme +type EnvelopeEncryption struct { + // Representing which tracks should not be encrypted + ClearTracks []*TrackSelection `json:"clearTracks,omitempty"` + + // Representing default content key for each encryption scheme and separate content keys for specific tracks + ContentKeys *StreamingPolicyContentKeys `json:"contentKeys,omitempty"` + + // Template for the URL of the custom service delivering keys to end user players. Not required when using Azure Media Services for issuing keys. The template + // supports replaceable tokens that the service + // will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced with + // the value of StreamingLocatorId.AlternativeMediaId, + // and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. + CustomKeyAcquisitionURLTemplate *string `json:"customKeyAcquisitionUrlTemplate,omitempty"` + + // Representing supported protocols + EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type EnvelopeEncryption. +func (e EnvelopeEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "clearTracks", e.ClearTracks) + populate(objectMap, "contentKeys", e.ContentKeys) + populate(objectMap, "customKeyAcquisitionUrlTemplate", e.CustomKeyAcquisitionURLTemplate) + populate(objectMap, "enabledProtocols", e.EnabledProtocols) + return json.Marshal(objectMap) +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData +// error response format.). +// Implements the error and azcore.HTTPResponse interfaces. +type ErrorResponse struct { + raw string + // The error object. + InnerError *ErrorDetail `json:"error,omitempty"` +} + +// Error implements the error interface for type ErrorResponse. +// The contents of the error text are not contractual and subject to change. +func (e ErrorResponse) Error() string { + return e.raw +} + +// FaceDetectorPreset - Describes all the settings to be used when analyzing a video in order to detect (and optionally redact) all the faces present. +type FaceDetectorPreset struct { + Preset + // Blur type + BlurType *BlurType `json:"blurType,omitempty"` + + // Dictionary containing key value pairs for parameters not exposed in the preset itself + ExperimentalOptions map[string]*string `json:"experimentalOptions,omitempty"` + + // This mode provides the ability to choose between the following settings: 1) Analyze - For detection only.This mode generates a metadata JSON file marking + // appearances of faces throughout the + // video.Where possible, appearances of the same person are assigned the same ID. 2) Combined - Additionally redacts(blurs) detected faces. 3) Redact - + // This enables a 2-pass process, allowing for + // selective redaction of a subset of detected faces.It takes in the metadata file from a prior analyze pass, along with the source video, and a user-selected + // subset of IDs that require redaction. + Mode *FaceRedactorMode `json:"mode,omitempty"` + + // Specifies the maximum resolution at which your video is analyzed. The default behavior is "SourceResolution," which will keep the input video at its + // original resolution when analyzed. Using + // "StandardDefinition" will resize input videos to standard definition while preserving the appropriate aspect ratio. It will only resize if the video + // is of higher resolution. For example, a 1920x1080 + // input would be scaled to 640x360 before processing. Switching to "StandardDefinition" will reduce the time it takes to process high resolution video. + // It may also reduce the cost of using this + // component (see https://azure.microsoft.com/en-us/pricing/details/media-services/#analytics for details). However, faces that end up being too small in + // the resized video may not be detected. + Resolution *AnalysisResolution `json:"resolution,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FaceDetectorPreset. +func (f FaceDetectorPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + f.Preset.marshalInternal(objectMap, "#Microsoft.Media.FaceDetectorPreset") + populate(objectMap, "blurType", f.BlurType) + populate(objectMap, "experimentalOptions", f.ExperimentalOptions) + populate(objectMap, "mode", f.Mode) + populate(objectMap, "resolution", f.Resolution) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FaceDetectorPreset. +func (f *FaceDetectorPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "blurType": + err = unpopulate(val, &f.BlurType) + delete(rawMsg, key) + case "experimentalOptions": + err = unpopulate(val, &f.ExperimentalOptions) + delete(rawMsg, key) + case "mode": + err = unpopulate(val, &f.Mode) + delete(rawMsg, key) + case "resolution": + err = unpopulate(val, &f.Resolution) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := f.Preset.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// FilterTrackPropertyCondition - The class to specify one track property condition. +type FilterTrackPropertyCondition struct { + // REQUIRED; The track property condition operation. + Operation *FilterTrackPropertyCompareOperation `json:"operation,omitempty"` + + // REQUIRED; The track property type. + Property *FilterTrackPropertyType `json:"property,omitempty"` + + // REQUIRED; The track property value. + Value *string `json:"value,omitempty"` +} + +// FilterTrackSelection - Representing a list of FilterTrackPropertyConditions to select a track. The filters are combined using a logical AND operation. +type FilterTrackSelection struct { + // REQUIRED; The track selections. + TrackSelections []*FilterTrackPropertyCondition `json:"trackSelections,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FilterTrackSelection. +func (f FilterTrackSelection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "trackSelections", f.TrackSelections) + return json.Marshal(objectMap) +} + +// Filters - Describes all the filtering operations, such as de-interlacing, rotation etc. that are to be applied to the input media before encoding. +type Filters struct { + // The parameters for the rectangular window with which to crop the input video. + Crop *Rectangle `json:"crop,omitempty"` + + // The de-interlacing settings. + Deinterlace *Deinterlace `json:"deinterlace,omitempty"` + + // The properties of overlays to be applied to the input video. These could be audio, image or video overlays. + Overlays []OverlayClassification `json:"overlays,omitempty"` + + // The rotation, if any, to be applied to the input video, before it is encoded. Default is Auto + Rotation *Rotation `json:"rotation,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type Filters. +func (f Filters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "crop", f.Crop) + populate(objectMap, "deinterlace", f.Deinterlace) + populate(objectMap, "overlays", f.Overlays) + populate(objectMap, "rotation", f.Rotation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Filters. +func (f *Filters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "crop": + err = unpopulate(val, &f.Crop) + delete(rawMsg, key) + case "deinterlace": + err = unpopulate(val, &f.Deinterlace) + delete(rawMsg, key) + case "overlays": + f.Overlays, err = unmarshalOverlayClassificationArray(val) + delete(rawMsg, key) + case "rotation": + err = unpopulate(val, &f.Rotation) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// FirstQuality - Filter First Quality +type FirstQuality struct { + // REQUIRED; The first quality bitrate. + Bitrate *int32 `json:"bitrate,omitempty"` +} + +// FormatClassification provides polymorphic access to related types. +// Call the interface's GetFormat() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *Format, *ImageFormat, *JpgFormat, *Mp4Format, *MultiBitrateFormat, *PngFormat, *TransportStreamFormat +type FormatClassification interface { + // GetFormat returns the Format content of the underlying type. + GetFormat() *Format +} + +// Format - Base class for output. +type Format struct { + // REQUIRED; The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - An expansion + // macro that will use the name of the input video file. If + // the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. + // If the length of base name of the input video + // file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. + // {Label} - The label assigned to the + // codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. + // {Codec} - The type of the audio/video codec. + // {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed from the filename. + FilenamePattern *string `json:"filenamePattern,omitempty"` + + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetFormat implements the FormatClassification interface for type Format. +func (f *Format) GetFormat() *Format { return f } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Format. +func (f *Format) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return f.unmarshalInternal(rawMsg) +} + +func (f Format) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "filenamePattern", f.FilenamePattern) + f.ODataType = &discValue + objectMap["@odata.type"] = f.ODataType +} + +func (f *Format) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "filenamePattern": + err = unpopulate(val, &f.FilenamePattern) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &f.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// FromAllInputFile - An InputDefinition that looks across all of the files provided to select tracks specified by the IncludedTracks property. Generally +// used with the AudioTrackByAttribute and VideoTrackByAttribute to +// allow selection of a single track across a set of input files. +type FromAllInputFile struct { + InputDefinition +} + +// MarshalJSON implements the json.Marshaller interface for type FromAllInputFile. +func (f FromAllInputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + f.InputDefinition.marshalInternal(objectMap, "#Microsoft.Media.FromAllInputFile") + return json.Marshal(objectMap) +} + +// FromEachInputFile - An InputDefinition that looks at each input file provided to select tracks specified by the IncludedTracks property. Generally used +// with the AudioTrackByAttribute and VideoTrackByAttribute to select +// tracks from each file given. +type FromEachInputFile struct { + InputDefinition +} + +// MarshalJSON implements the json.Marshaller interface for type FromEachInputFile. +func (f FromEachInputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + f.InputDefinition.marshalInternal(objectMap, "#Microsoft.Media.FromEachInputFile") + return json.Marshal(objectMap) +} + +// H264Layer - Describes the settings to be used when encoding the input video into a desired output bitrate layer with the H.264 video codec. +type H264Layer struct { + VideoLayer + // The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for + // example, PT5S). + BufferWindow *string `json:"bufferWindow,omitempty"` + + // The entropy mode to be used for this layer. If not specified, the encoder chooses the mode that is appropriate for the profile and level. + EntropyMode *EntropyMode `json:"entropyMode,omitempty"` + + // We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.264 profile. If not specified, the default is Auto, which + // lets the encoder choose the Level that is + // appropriate for this layer. + Level *string `json:"level,omitempty"` + + // We currently support Baseline, Main, High, High422, High444. Default is Auto. + Profile *H264VideoProfile `json:"profile,omitempty"` + + // The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder + // complexity setting. + ReferenceFrames *int32 `json:"referenceFrames,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type H264Layer. +func (h H264Layer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + h.VideoLayer.marshalInternal(objectMap, "#Microsoft.Media.H264Layer") + populate(objectMap, "bufferWindow", h.BufferWindow) + populate(objectMap, "entropyMode", h.EntropyMode) + populate(objectMap, "level", h.Level) + populate(objectMap, "profile", h.Profile) + populate(objectMap, "referenceFrames", h.ReferenceFrames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H264Layer. +func (h *H264Layer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bufferWindow": + err = unpopulate(val, &h.BufferWindow) + delete(rawMsg, key) + case "entropyMode": + err = unpopulate(val, &h.EntropyMode) + delete(rawMsg, key) + case "level": + err = unpopulate(val, &h.Level) + delete(rawMsg, key) + case "profile": + err = unpopulate(val, &h.Profile) + delete(rawMsg, key) + case "referenceFrames": + err = unpopulate(val, &h.ReferenceFrames) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := h.VideoLayer.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// H264Video - Describes all the properties for encoding a video with the H.264 codec. +type H264Video struct { + Video + // Tells the encoder how to choose its encoding settings. The default value is Balanced. + Complexity *H264Complexity `json:"complexity,omitempty"` + + // The collection of output H.264 layers to be produced by the encoder. + Layers []*H264Layer `json:"layers,omitempty"` + + // Whether or not the encoder should insert key frames at scene changes. If not specified, the default is false. This flag should be set to true only when + // the encoder is being configured to produce a + // single output video. + SceneChangeDetection *bool `json:"sceneChangeDetection,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type H264Video. +func (h H264Video) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + h.Video.marshalInternal(objectMap, "#Microsoft.Media.H264Video") + populate(objectMap, "complexity", h.Complexity) + populate(objectMap, "layers", h.Layers) + populate(objectMap, "sceneChangeDetection", h.SceneChangeDetection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H264Video. +func (h *H264Video) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "complexity": + err = unpopulate(val, &h.Complexity) + delete(rawMsg, key) + case "layers": + err = unpopulate(val, &h.Layers) + delete(rawMsg, key) + case "sceneChangeDetection": + err = unpopulate(val, &h.SceneChangeDetection) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := h.Video.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// H265Layer - Describes the settings to be used when encoding the input video into a desired output bitrate layer with the H.265 video codec. +type H265Layer struct { + H265VideoLayer + // The VBV buffer window length. The value should be in ISO 8601 format. The value should be in the range [0.1-100] seconds. The default is 5 seconds (for + // example, PT5S). + BufferWindow *string `json:"bufferWindow,omitempty"` + + // We currently support Level up to 6.2. The value can be Auto, or a number that matches the H.265 profile. If not specified, the default is Auto, which + // lets the encoder choose the Level that is + // appropriate for this layer. + Level *string `json:"level,omitempty"` + + // We currently support Main. Default is Auto. + Profile *H265VideoProfile `json:"profile,omitempty"` + + // The number of reference frames to be used when encoding this layer. If not specified, the encoder determines an appropriate number based on the encoder + // complexity setting. + ReferenceFrames *int32 `json:"referenceFrames,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type H265Layer. +func (h H265Layer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + h.H265VideoLayer.marshalInternal(objectMap, "#Microsoft.Media.H265Layer") + populate(objectMap, "bufferWindow", h.BufferWindow) + populate(objectMap, "level", h.Level) + populate(objectMap, "profile", h.Profile) + populate(objectMap, "referenceFrames", h.ReferenceFrames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H265Layer. +func (h *H265Layer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "bufferWindow": + err = unpopulate(val, &h.BufferWindow) + delete(rawMsg, key) + case "level": + err = unpopulate(val, &h.Level) + delete(rawMsg, key) + case "profile": + err = unpopulate(val, &h.Profile) + delete(rawMsg, key) + case "referenceFrames": + err = unpopulate(val, &h.ReferenceFrames) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := h.H265VideoLayer.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// H265Video - Describes all the properties for encoding a video with the H.265 codec. +type H265Video struct { + Video + // Tells the encoder how to choose its encoding settings. Quality will provide for a higher compression ratio but at a higher cost and longer compute time. + // Speed will produce a relatively larger file but + // is faster and more economical. The default value is Balanced. + Complexity *H265Complexity `json:"complexity,omitempty"` + + // The collection of output H.265 layers to be produced by the encoder. + Layers []*H265Layer `json:"layers,omitempty"` + + // Specifies whether or not the encoder should insert key frames at scene changes. If not specified, the default is false. This flag should be set to true + // only when the encoder is being configured to + // produce a single output video. + SceneChangeDetection *bool `json:"sceneChangeDetection,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type H265Video. +func (h H265Video) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + h.Video.marshalInternal(objectMap, "#Microsoft.Media.H265Video") + populate(objectMap, "complexity", h.Complexity) + populate(objectMap, "layers", h.Layers) + populate(objectMap, "sceneChangeDetection", h.SceneChangeDetection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H265Video. +func (h *H265Video) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "complexity": + err = unpopulate(val, &h.Complexity) + delete(rawMsg, key) + case "layers": + err = unpopulate(val, &h.Layers) + delete(rawMsg, key) + case "sceneChangeDetection": + err = unpopulate(val, &h.SceneChangeDetection) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := h.Video.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// H265VideoLayerClassification provides polymorphic access to related types. +// Call the interface's GetH265VideoLayer() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *H265Layer, *H265VideoLayer +type H265VideoLayerClassification interface { + LayerClassification + // GetH265VideoLayer returns the H265VideoLayer content of the underlying type. + GetH265VideoLayer() *H265VideoLayer +} + +// H265VideoLayer - Describes the settings to be used when encoding the input video into a desired output bitrate layer. +type H265VideoLayer struct { + Layer + // REQUIRED; The average bitrate in bits per second at which to encode the input video when generating this layer. For example: a target bitrate of 3000Kbps + // or 3Mbps means this value should be 3000000 This is a + // required field. + Bitrate *int32 `json:"bitrate,omitempty"` + + // Specifies whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video + // profile permits its use. + AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` + + // The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and + // level. + BFrames *int32 `json:"bFrames,omitempty"` + + // The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), + // or in the form of a number (For example, + // 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the + // same frame rate as the input video. + FrameRate *string `json:"frameRate,omitempty"` + + // The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. + MaxBitrate *int32 `json:"maxBitrate,omitempty"` + + // The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each + // frame. + Slices *int32 `json:"slices,omitempty"` +} + +// GetH265VideoLayer implements the H265VideoLayerClassification interface for type H265VideoLayer. +func (h *H265VideoLayer) GetH265VideoLayer() *H265VideoLayer { return h } + +// MarshalJSON implements the json.Marshaller interface for type H265VideoLayer. +func (h H265VideoLayer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + h.marshalInternal(objectMap, "#Microsoft.Media.H265VideoLayer") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type H265VideoLayer. +func (h *H265VideoLayer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return h.unmarshalInternal(rawMsg) +} + +func (h H265VideoLayer) marshalInternal(objectMap map[string]interface{}, discValue string) { + h.Layer.marshalInternal(objectMap, discValue) + populate(objectMap, "adaptiveBFrame", h.AdaptiveBFrame) + populate(objectMap, "bFrames", h.BFrames) + populate(objectMap, "bitrate", h.Bitrate) + populate(objectMap, "frameRate", h.FrameRate) + populate(objectMap, "maxBitrate", h.MaxBitrate) + populate(objectMap, "slices", h.Slices) +} + +func (h *H265VideoLayer) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "adaptiveBFrame": + err = unpopulate(val, &h.AdaptiveBFrame) + delete(rawMsg, key) + case "bFrames": + err = unpopulate(val, &h.BFrames) + delete(rawMsg, key) + case "bitrate": + err = unpopulate(val, &h.Bitrate) + delete(rawMsg, key) + case "frameRate": + err = unpopulate(val, &h.FrameRate) + delete(rawMsg, key) + case "maxBitrate": + err = unpopulate(val, &h.MaxBitrate) + delete(rawMsg, key) + case "slices": + err = unpopulate(val, &h.Slices) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := h.Layer.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// Hls - HTTP Live Streaming (HLS) packing setting for the live output. +type Hls struct { + // The number of fragments in an HTTP Live Streaming (HLS) TS segment in the output of the live event. This value does not affect the packing ratio for + // HLS CMAF output. + FragmentsPerTsSegment *int32 `json:"fragmentsPerTsSegment,omitempty"` +} + +// IPAccessControl - The IP access control. +type IPAccessControl struct { + // The IP allow list. + Allow []*IPRange `json:"allow,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IPAccessControl. +func (i IPAccessControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allow", i.Allow) + return json.Marshal(objectMap) +} + +// IPRange - The IP address range in the CIDR scheme. +type IPRange struct { + // The IP address. + Address *string `json:"address,omitempty"` + + // The friendly name for the IP address range. + Name *string `json:"name,omitempty"` + + // The subnet mask prefix length (see CIDR notation). + SubnetPrefixLength *int32 `json:"subnetPrefixLength,omitempty"` +} + +// ImageClassification provides polymorphic access to related types. +// Call the interface's GetImage() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *Image, *JpgImage, *PngImage +type ImageClassification interface { + VideoClassification + // GetImage returns the Image content of the underlying type. + GetImage() *Image +} + +// Image - Describes the basic properties for generating thumbnails from the input video +type Image struct { + Video + // REQUIRED; The position in the input video from where to start generating thumbnails. The value can be in ISO 8601 format (For example, PT05S to start + // at 5 seconds), or a frame count (For example, 10 to start at + // the 10th frame), or a relative value to stream duration (For example, 10% to start at 10% of stream duration). Also supports a macro {Best}, which tells + // the encoder to select the best thumbnail from + // the first few seconds of the video and will only produce one thumbnail, no matter what other settings are for Step and Range. The default value is macro + // {Best}. + Start *string `json:"start,omitempty"` + + // The position relative to transform preset start time in the input video at which to stop generating thumbnails. The value can be in ISO 8601 format (For + // example, PT5M30S to stop at 5 minutes and 30 + // seconds from start time), or a frame count (For example, 300 to stop at the 300th frame from the frame at start time. If this value is 1, it means only + // producing one thumbnail at start time), or a + // relative value to the stream duration (For example, 50% to stop at half of stream duration from start time). The default value is 100%, which means to + // stop at the end of the stream. + Range *string `json:"range,omitempty"` + + // The intervals at which thumbnails are generated. The value can be in ISO 8601 format (For example, PT05S for one image every 5 seconds), or a frame count + // (For example, 30 for one image every 30 + // frames), or a relative value to stream duration (For example, 10% for one image every 10% of stream duration). Note: Step value will affect the first + // generated thumbnail, which may not be exactly the + // one specified at transform preset start time. This is due to the encoder, which tries to select the best thumbnail between start time and Step position + // from start time as the first output. As the + // default value is 10%, it means if stream has long duration, the first generated thumbnail might be far away from the one specified at start time. Try + // to select reasonable value for Step if the first + // thumbnail is expected close to start time, or set Range value at 1 if only one thumbnail is needed at start time. + Step *string `json:"step,omitempty"` +} + +// GetImage implements the ImageClassification interface for type Image. +func (i *Image) GetImage() *Image { return i } + +// MarshalJSON implements the json.Marshaller interface for type Image. +func (i Image) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.marshalInternal(objectMap, "#Microsoft.Media.Image") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Image. +func (i *Image) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return i.unmarshalInternal(rawMsg) +} + +func (i Image) marshalInternal(objectMap map[string]interface{}, discValue string) { + i.Video.marshalInternal(objectMap, discValue) + populate(objectMap, "range", i.Range) + populate(objectMap, "start", i.Start) + populate(objectMap, "step", i.Step) +} + +func (i *Image) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "range": + err = unpopulate(val, &i.Range) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &i.Start) + delete(rawMsg, key) + case "step": + err = unpopulate(val, &i.Step) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := i.Video.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ImageFormatClassification provides polymorphic access to related types. +// Call the interface's GetImageFormat() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ImageFormat, *JpgFormat, *PngFormat +type ImageFormatClassification interface { + FormatClassification + // GetImageFormat returns the ImageFormat content of the underlying type. + GetImageFormat() *ImageFormat +} + +// ImageFormat - Describes the properties for an output image file. +type ImageFormat struct { + Format +} + +// GetImageFormat implements the ImageFormatClassification interface for type ImageFormat. +func (i *ImageFormat) GetImageFormat() *ImageFormat { return i } + +// MarshalJSON implements the json.Marshaller interface for type ImageFormat. +func (i ImageFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.marshalInternal(objectMap, "#Microsoft.Media.ImageFormat") + return json.Marshal(objectMap) +} + +func (i ImageFormat) marshalInternal(objectMap map[string]interface{}, discValue string) { + i.Format.marshalInternal(objectMap, discValue) +} + +func (i *ImageFormat) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + if err := i.Format.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// InputDefinitionClassification provides polymorphic access to related types. +// Call the interface's GetInputDefinition() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FromAllInputFile, *FromEachInputFile, *InputDefinition, *InputFile +type InputDefinitionClassification interface { + // GetInputDefinition returns the InputDefinition content of the underlying type. + GetInputDefinition() *InputDefinition +} + +// InputDefinition - Base class for defining an input. Use sub classes of this class to specify tracks selections and related metadata. +type InputDefinition struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` + + // The list of TrackDescriptors which define the metadata and selection of tracks in the input. + IncludedTracks []TrackDescriptorClassification `json:"includedTracks,omitempty"` +} + +// GetInputDefinition implements the InputDefinitionClassification interface for type InputDefinition. +func (i *InputDefinition) GetInputDefinition() *InputDefinition { return i } + +// UnmarshalJSON implements the json.Unmarshaller interface for type InputDefinition. +func (i *InputDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return i.unmarshalInternal(rawMsg) +} + +func (i InputDefinition) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "includedTracks", i.IncludedTracks) + i.ODataType = &discValue + objectMap["@odata.type"] = i.ODataType +} + +func (i *InputDefinition) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "includedTracks": + i.IncludedTracks, err = unmarshalTrackDescriptorClassificationArray(val) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &i.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// InputFile - An InputDefinition for a single file. TrackSelections are scoped to the file specified. +type InputFile struct { + InputDefinition + // Name of the file that this input definition applies to. + Filename *string `json:"filename,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type InputFile. +func (i InputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + i.InputDefinition.marshalInternal(objectMap, "#Microsoft.Media.InputFile") + populate(objectMap, "filename", i.Filename) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InputFile. +func (i *InputFile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "filename": + err = unpopulate(val, &i.Filename) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := i.InputDefinition.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// Job - A Job resource type. The progress and state can be obtained by polling a Job or subscribing to events using EventGrid. +type Job struct { + ProxyResource + // The resource properties. + Properties *JobProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + return json.Marshal(objectMap) +} + +// JobCollection - A collection of Job items. +type JobCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of Job items. + Value []*Job `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobCollection. +func (j JobCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", j.ODataNextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// JobError - Details of JobOutput errors. +type JobError struct { + // READ-ONLY; Helps with categorization of errors. + Category *JobErrorCategory `json:"category,omitempty" azure:"ro"` + + // READ-ONLY; Error code describing the error. + Code *JobErrorCode `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; An array of details about specific errors that led to this reported error. + Details []*JobErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; A human-readable language-dependent representation of the error. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via Azure Portal. + Retry *JobRetry `json:"retry,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobError. +func (j JobError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "category", j.Category) + populate(objectMap, "code", j.Code) + populate(objectMap, "details", j.Details) + populate(objectMap, "message", j.Message) + populate(objectMap, "retry", j.Retry) + return json.Marshal(objectMap) +} + +// JobErrorDetail - Details of JobOutput errors. +type JobErrorDetail struct { + // READ-ONLY; Code describing the error detail. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; A human-readable representation of the error. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// JobInputClassification provides polymorphic access to related types. +// Call the interface's GetJobInput() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *JobInput, *JobInputAsset, *JobInputClip, *JobInputHttp, *JobInputSequence, *JobInputs +type JobInputClassification interface { + // GetJobInput returns the JobInput content of the underlying type. + GetJobInput() *JobInput +} + +// JobInput - Base class for inputs to a Job. +type JobInput struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetJobInput implements the JobInputClassification interface for type JobInput. +func (j *JobInput) GetJobInput() *JobInput { return j } + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInput. +func (j *JobInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return j.unmarshalInternal(rawMsg) +} + +func (j JobInput) marshalInternal(objectMap map[string]interface{}, discValue string) { + j.ODataType = &discValue + objectMap["@odata.type"] = j.ODataType +} + +func (j *JobInput) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// JobInputAsset - Represents an Asset for input into a Job. +type JobInputAsset struct { + JobInputClip + // REQUIRED; The name of the input Asset. + AssetName *string `json:"assetName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputAsset. +func (j JobInputAsset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.JobInputClip.marshalInternal(objectMap, "#Microsoft.Media.JobInputAsset") + populate(objectMap, "assetName", j.AssetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputAsset. +func (j *JobInputAsset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "assetName": + err = unpopulate(val, &j.AssetName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.JobInputClip.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobInputClipClassification provides polymorphic access to related types. +// Call the interface's GetJobInputClip() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *JobInputAsset, *JobInputClip, *JobInputHttp +type JobInputClipClassification interface { + JobInputClassification + // GetJobInputClip returns the JobInputClip content of the underlying type. + GetJobInputClip() *JobInputClip +} + +// JobInputClip - Represents input files for a Job. +type JobInputClip struct { + JobInput + // Defines a point on the timeline of the input media at which processing will end. Defaults to the end of the input media. + End ClipTimeClassification `json:"end,omitempty"` + + // List of files. Required for JobInputHttp. Maximum of 4000 characters each. Query strings will not be returned in service responses to prevent sensitive + // data exposure. + Files []*string `json:"files,omitempty"` + + // Defines a list of InputDefinitions. For each InputDefinition, it defines a list of track selections and related metadata. + InputDefinitions []InputDefinitionClassification `json:"inputDefinitions,omitempty"` + + // A label that is assigned to a JobInputClip, that is used to satisfy a reference used in the Transform. For example, a Transform can be authored so as + // to take an image file with the label 'xyz' and + // apply it as an overlay onto the input video before it is encoded. When submitting a Job, exactly one of the JobInputs should be the image file, and it + // should have the label 'xyz'. + Label *string `json:"label,omitempty"` + + // Defines a point on the timeline of the input media at which processing will start. Defaults to the beginning of the input media. + Start ClipTimeClassification `json:"start,omitempty"` +} + +// GetJobInputClip implements the JobInputClipClassification interface for type JobInputClip. +func (j *JobInputClip) GetJobInputClip() *JobInputClip { return j } + +// MarshalJSON implements the json.Marshaller interface for type JobInputClip. +func (j JobInputClip) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.marshalInternal(objectMap, "#Microsoft.Media.JobInputClip") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputClip. +func (j *JobInputClip) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return j.unmarshalInternal(rawMsg) +} + +func (j JobInputClip) marshalInternal(objectMap map[string]interface{}, discValue string) { + j.JobInput.marshalInternal(objectMap, discValue) + populate(objectMap, "end", j.End) + populate(objectMap, "files", j.Files) + populate(objectMap, "inputDefinitions", j.InputDefinitions) + populate(objectMap, "label", j.Label) + populate(objectMap, "start", j.Start) +} + +func (j *JobInputClip) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "end": + j.End, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + case "files": + err = unpopulate(val, &j.Files) + delete(rawMsg, key) + case "inputDefinitions": + j.InputDefinitions, err = unmarshalInputDefinitionClassificationArray(val) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "start": + j.Start, err = unmarshalClipTimeClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.JobInput.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobInputHTTP - Represents HTTPS job input. +type JobInputHTTP struct { + JobInputClip + // Base URI for HTTPS job input. It will be concatenated with provided file names. If no base uri is given, then the provided file list is assumed to be + // fully qualified uris. Maximum length of 4000 + // characters. The query strings will not be returned in service responses to prevent sensitive data exposure. + BaseURI *string `json:"baseUri,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputHTTP. +func (j JobInputHTTP) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.JobInputClip.marshalInternal(objectMap, "#Microsoft.Media.JobInputHttp") + populate(objectMap, "baseUri", j.BaseURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputHTTP. +func (j *JobInputHTTP) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "baseUri": + err = unpopulate(val, &j.BaseURI) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.JobInputClip.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobInputSequence - A Sequence contains an ordered list of Clips where each clip is a JobInput. The Sequence will be treated as a single input. +type JobInputSequence struct { + JobInput + // JobInputs that make up the timeline. + Inputs []JobInputClipClassification `json:"inputs,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputSequence. +func (j JobInputSequence) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.JobInput.marshalInternal(objectMap, "#Microsoft.Media.JobInputSequence") + populate(objectMap, "inputs", j.Inputs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputSequence. +func (j *JobInputSequence) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + j.Inputs, err = unmarshalJobInputClipClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.JobInput.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobInputs - Describes a list of inputs to a Job. +type JobInputs struct { + JobInput + // List of inputs to a Job. + Inputs []JobInputClassification `json:"inputs,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobInputs. +func (j JobInputs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.JobInput.marshalInternal(objectMap, "#Microsoft.Media.JobInputs") + populate(objectMap, "inputs", j.Inputs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobInputs. +func (j *JobInputs) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "inputs": + j.Inputs, err = unmarshalJobInputClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.JobInput.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobOutputClassification provides polymorphic access to related types. +// Call the interface's GetJobOutput() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *JobOutput, *JobOutputAsset +type JobOutputClassification interface { + // GetJobOutput returns the JobOutput content of the underlying type. + GetJobOutput() *JobOutput +} + +// JobOutput - Describes all the properties of a JobOutput. +type JobOutput struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` + + // A label that is assigned to a JobOutput in order to help uniquely identify it. This is useful when your Transform has more than one TransformOutput, + // whereby your Job has more than one JobOutput. In + // such cases, when you submit the Job, you will add two or more JobOutputs, in the same order as TransformOutputs in the Transform. Subsequently, when + // you retrieve the Job, either through events or on a + // GET request, you can use the label to easily identify the JobOutput. If a label is not provided, a default value of '{presetName}_{outputIndex}' will + // be used, where the preset name is the name of the + // preset in the corresponding TransformOutput and the output index is the relative index of the this JobOutput within the Job. Note that this index is + // the same as the relative index of the corresponding + // TransformOutput within its Transform. + Label *string `json:"label,omitempty"` + + // A preset used to override the preset in the corresponding transform output. + PresetOverride PresetClassification `json:"presetOverride,omitempty"` + + // READ-ONLY; The UTC date and time at which this Job Output finished processing. + EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + + // READ-ONLY; If the JobOutput is in the Error state, it contains the details of the error. + Error *JobError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; If the JobOutput is in a Processing state, this contains the Job completion percentage. The value is an estimate and not intended to be used + // to predict Job completion times. To determine if the + // JobOutput is complete, use the State property. + Progress *int32 `json:"progress,omitempty" azure:"ro"` + + // READ-ONLY; The UTC date and time at which this Job Output began processing. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; Describes the state of the JobOutput. + State *JobState `json:"state,omitempty" azure:"ro"` +} + +// GetJobOutput implements the JobOutputClassification interface for type JobOutput. +func (j *JobOutput) GetJobOutput() *JobOutput { return j } + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobOutput. +func (j *JobOutput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return j.unmarshalInternal(rawMsg) +} + +func (j JobOutput) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populate(objectMap, "error", j.Error) + populate(objectMap, "label", j.Label) + j.ODataType = &discValue + objectMap["@odata.type"] = j.ODataType + populate(objectMap, "presetOverride", j.PresetOverride) + populate(objectMap, "progress", j.Progress) + populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populate(objectMap, "state", j.State) +} + +func (j *JobOutput) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + j.EndTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "error": + err = unpopulate(val, &j.Error) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &j.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &j.ODataType) + delete(rawMsg, key) + case "presetOverride": + j.PresetOverride, err = unmarshalPresetClassification(val) + delete(rawMsg, key) + case "progress": + err = unpopulate(val, &j.Progress) + delete(rawMsg, key) + case "startTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + j.StartTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &j.State) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// JobOutputAsset - Represents an Asset used as a JobOutput. +type JobOutputAsset struct { + JobOutput + // REQUIRED; The name of the output Asset. + AssetName *string `json:"assetName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobOutputAsset. +func (j JobOutputAsset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.JobOutput.marshalInternal(objectMap, "#Microsoft.Media.JobOutputAsset") + populate(objectMap, "assetName", j.AssetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobOutputAsset. +func (j *JobOutputAsset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "assetName": + err = unpopulate(val, &j.AssetName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.JobOutput.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JobProperties - Properties of the Job. +type JobProperties struct { + // REQUIRED; The inputs for the Job. + Input JobInputClassification `json:"input,omitempty"` + + // REQUIRED; The outputs for the Job. + Outputs []JobOutputClassification `json:"outputs,omitempty"` + + // Customer provided key, value pairs that will be returned in Job and JobOutput state events. + CorrelationData map[string]*string `json:"correlationData,omitempty"` + + // Optional customer supplied description of the Job. + Description *string `json:"description,omitempty"` + + // Priority with which the job should be processed. Higher priority jobs are processed before lower priority jobs. If not set, the default is normal. + Priority *Priority `json:"priority,omitempty"` + + // READ-ONLY; The UTC date and time when the customer has created the Job, in 'YYYY-MM-DDThh:mm:ssZ' format. + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The UTC date and time at which this Job finished processing. + EndTime *time.Time `json:"endTime,omitempty" azure:"ro"` + + // READ-ONLY; The UTC date and time when the customer has last updated the Job, in 'YYYY-MM-DDThh:mm:ssZ' format. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + + // READ-ONLY; The UTC date and time at which this Job began processing. + StartTime *time.Time `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; The current state of the job. + State *JobState `json:"state,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type JobProperties. +func (j JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "correlationData", j.CorrelationData) + populate(objectMap, "created", (*timeRFC3339)(j.Created)) + populate(objectMap, "description", j.Description) + populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populate(objectMap, "input", j.Input) + populate(objectMap, "lastModified", (*timeRFC3339)(j.LastModified)) + populate(objectMap, "outputs", j.Outputs) + populate(objectMap, "priority", j.Priority) + populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populate(objectMap, "state", j.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobProperties. +func (j *JobProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationData": + err = unpopulate(val, &j.CorrelationData) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + j.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &j.Description) + delete(rawMsg, key) + case "endTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + j.EndTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "input": + j.Input, err = unmarshalJobInputClassification(val) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + j.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "outputs": + j.Outputs, err = unmarshalJobOutputClassificationArray(val) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, &j.Priority) + delete(rawMsg, key) + case "startTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + j.StartTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "state": + err = unpopulate(val, &j.State) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// JobsCancelJobOptions contains the optional parameters for the Jobs.CancelJob method. +type JobsCancelJobOptions struct { + // placeholder for future optional parameters +} + +// JobsCreateOptions contains the optional parameters for the Jobs.Create method. +type JobsCreateOptions struct { + // placeholder for future optional parameters +} + +// JobsDeleteOptions contains the optional parameters for the Jobs.Delete method. +type JobsDeleteOptions struct { + // placeholder for future optional parameters +} + +// JobsGetOptions contains the optional parameters for the Jobs.Get method. +type JobsGetOptions struct { + // placeholder for future optional parameters +} + +// JobsListOptions contains the optional parameters for the Jobs.List method. +type JobsListOptions struct { + // Restricts the set of items returned. + Filter *string + // Specifies the key by which the result collection should be ordered. + Orderby *string +} + +// JobsUpdateOptions contains the optional parameters for the Jobs.Update method. +type JobsUpdateOptions struct { + // placeholder for future optional parameters +} + +// JpgFormat - Describes the settings for producing JPEG thumbnails. +type JpgFormat struct { + ImageFormat +} + +// MarshalJSON implements the json.Marshaller interface for type JpgFormat. +func (j JpgFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.ImageFormat.marshalInternal(objectMap, "#Microsoft.Media.JpgFormat") + return json.Marshal(objectMap) +} + +// JpgImage - Describes the properties for producing a series of JPEG images from the input video. +type JpgImage struct { + Image + // A collection of output JPEG image layers to be produced by the encoder. + Layers []*JpgLayer `json:"layers,omitempty"` + + // Sets the number of columns used in thumbnail sprite image. The number of rows are automatically calculated and a VTT file is generated with the coordinate + // mappings for each thumbnail in the sprite. + // Note: this value should be a positive integer and a proper value is recommended so that the output image resolution will not go beyond JPEG maximum pixel + // resolution limit 65535x65535. + SpriteColumn *int32 `json:"spriteColumn,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JpgImage. +func (j JpgImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.Image.marshalInternal(objectMap, "#Microsoft.Media.JpgImage") + populate(objectMap, "layers", j.Layers) + populate(objectMap, "spriteColumn", j.SpriteColumn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JpgImage. +func (j *JpgImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "layers": + err = unpopulate(val, &j.Layers) + delete(rawMsg, key) + case "spriteColumn": + err = unpopulate(val, &j.SpriteColumn) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.Image.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// JpgLayer - Describes the settings to produce a JPEG image from the input video. +type JpgLayer struct { + Layer + // The compression quality of the JPEG output. Range is from 0-100 and the default is 70. + Quality *int32 `json:"quality,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type JpgLayer. +func (j JpgLayer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + j.Layer.marshalInternal(objectMap, "#Microsoft.Media.JpgLayer") + populate(objectMap, "quality", j.Quality) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JpgLayer. +func (j *JpgLayer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "quality": + err = unpopulate(val, &j.Quality) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := j.Layer.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +type KeyDelivery struct { + // The access control properties for Key Delivery. + AccessControl *AccessControl `json:"accessControl,omitempty"` +} + +type KeyVaultProperties struct { + // The URL of the Key Vault key used to encrypt the account. The key may either be versioned (for example https://vault/keys/mykey/version1) or reference + // a key without a version (for example + // https://vault/keys/mykey). + KeyIdentifier *string `json:"keyIdentifier,omitempty"` + + // READ-ONLY; The current key used to encrypt the Media Services account, including the key version. + CurrentKeyIdentifier *string `json:"currentKeyIdentifier,omitempty" azure:"ro"` +} + +// LayerClassification provides polymorphic access to related types. +// Call the interface's GetLayer() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *H264Layer, *H265Layer, *H265VideoLayer, *JpgLayer, *Layer, *PngLayer, *VideoLayer +type LayerClassification interface { + // GetLayer returns the Layer content of the underlying type. + GetLayer() *Layer +} + +// Layer - The encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by specifying a layer for each desired resolution. +// A layer represents the properties for the video +// or image at a resolution. +type Layer struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` + + // The height of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video + // has half as many pixels in height as the input. + Height *string `json:"height,omitempty"` + + // The alphanumeric label for this layer, which can be used in multiplexing different video and audio layers, or in naming the output file. + Label *string `json:"label,omitempty"` + + // The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video + // has half as many pixels in width as the input. + Width *string `json:"width,omitempty"` +} + +// GetLayer implements the LayerClassification interface for type Layer. +func (l *Layer) GetLayer() *Layer { return l } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Layer. +func (l *Layer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return l.unmarshalInternal(rawMsg) +} + +func (l Layer) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "height", l.Height) + populate(objectMap, "label", l.Label) + l.ODataType = &discValue + objectMap["@odata.type"] = l.ODataType + populate(objectMap, "width", l.Width) +} + +func (l *Layer) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "height": + err = unpopulate(val, &l.Height) + delete(rawMsg, key) + case "label": + err = unpopulate(val, &l.Label) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &l.ODataType) + delete(rawMsg, key) + case "width": + err = unpopulate(val, &l.Width) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ListContainerSasInput - The parameters to the list SAS request. +type ListContainerSasInput struct { + // The SAS URL expiration time. This must be less than 24 hours from the current time. + ExpiryTime *time.Time `json:"expiryTime,omitempty"` + + // The permissions to set on the SAS URL. + Permissions *AssetContainerPermission `json:"permissions,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListContainerSasInput. +func (l ListContainerSasInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expiryTime", (*timeRFC3339)(l.ExpiryTime)) + populate(objectMap, "permissions", l.Permissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListContainerSasInput. +func (l *ListContainerSasInput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "expiryTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + l.ExpiryTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "permissions": + err = unpopulate(val, &l.Permissions) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ListContentKeysResponse - Class of response for listContentKeys action +type ListContentKeysResponse struct { + // ContentKeys used by current Streaming Locator + ContentKeys []*StreamingLocatorContentKey `json:"contentKeys,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListContentKeysResponse. +func (l ListContentKeysResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "contentKeys", l.ContentKeys) + return json.Marshal(objectMap) +} + +type ListEdgePoliciesInput struct { + // Unique identifier of the edge device. + DeviceID *string `json:"deviceId,omitempty"` +} + +// ListPathsResponse - Class of response for listPaths action +type ListPathsResponse struct { + // Download Paths supported by current Streaming Locator + DownloadPaths []*string `json:"downloadPaths,omitempty"` + + // Streaming Paths supported by current Streaming Locator + StreamingPaths []*StreamingPath `json:"streamingPaths,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListPathsResponse. +func (l ListPathsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "downloadPaths", l.DownloadPaths) + populate(objectMap, "streamingPaths", l.StreamingPaths) + return json.Marshal(objectMap) +} + +// ListStreamingLocatorsResponse - The Streaming Locators associated with this Asset. +type ListStreamingLocatorsResponse struct { + // READ-ONLY; The list of Streaming Locators. + StreamingLocators []*AssetStreamingLocator `json:"streamingLocators,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListStreamingLocatorsResponse. +func (l ListStreamingLocatorsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "streamingLocators", l.StreamingLocators) + return json.Marshal(objectMap) +} + +// LiveEvent - The live event. +type LiveEvent struct { + TrackedResource + // The live event properties. + Properties *LiveEventProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEvent. +func (l LiveEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + l.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + return json.Marshal(objectMap) +} + +// LiveEventActionInput - The LiveEvent action input parameter definition. +type LiveEventActionInput struct { + // The flag indicates whether live outputs are automatically deleted when live event is being stopped. Deleting live outputs do not delete the underlying + // assets. + RemoveOutputsOnStop *bool `json:"removeOutputsOnStop,omitempty"` +} + +// LiveEventEncoding - Specifies the live event type and optional encoding settings for encoding live events. +type LiveEventEncoding struct { + // Live event type. When encodingType is set to PassthroughBasic or PassthroughStandard, the service simply passes through the incoming video and audio + // layer(s) to the output. When encodingType is set to + // Standard or Premium1080p, a live encoder transcodes the incoming stream into multiple bitrates or layers. See https://go.microsoft.com/fwlink/?linkid=2095101 + // for more information. This property cannot + // be modified after the live event is created. + EncodingType *LiveEventEncodingType `json:"encodingType,omitempty"` + + // Use an ISO 8601 time value between 0.5 to 20 seconds to specify the output fragment length for the video and audio tracks of an encoding live event. + // For example, use PT2S to indicate 2 seconds. For + // the video track it also defines the key frame interval, or the length of a GoP (group of pictures). If this value is not set for an encoding live event, + // the fragment duration defaults to 2 seconds. + // The value cannot be set for pass-through live events. + KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` + + // The optional encoding preset name, used when encodingType is not None. This value is specified at creation time and cannot be updated. If the encodingType + // is set to Standard, then the default preset + // name is ‘Default720p’. Else if the encodingType is set to Premium1080p, the default preset is ‘Default1080p’. + PresetName *string `json:"presetName,omitempty"` + + // Specifies how the input video will be resized to fit the desired output resolution(s). Default is None + StretchMode *StretchMode `json:"stretchMode,omitempty"` +} + +// LiveEventEndpoint - The live event endpoint. +type LiveEventEndpoint struct { + // The endpoint protocol. + Protocol *string `json:"protocol,omitempty"` + + // The endpoint URL. + URL *string `json:"url,omitempty"` +} + +// LiveEventInput - The live event input. +type LiveEventInput struct { + // REQUIRED; The input protocol for the live event. This is specified at creation time and cannot be updated. + StreamingProtocol *LiveEventInputProtocol `json:"streamingProtocol,omitempty"` + + // Access control for live event input. + AccessControl *LiveEventInputAccessControl `json:"accessControl,omitempty"` + + // A UUID in string form to uniquely identify the stream. This can be specified at creation time but cannot be updated. If omitted, the service will generate + // a unique value. + AccessToken *string `json:"accessToken,omitempty"` + + // The input endpoints for the live event. + Endpoints []*LiveEventEndpoint `json:"endpoints,omitempty"` + + // ISO 8601 time duration of the key frame interval duration of the input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, + // use PT2S to indicate 2 seconds. Leave the + // value empty for encoding live events. + KeyFrameIntervalDuration *string `json:"keyFrameIntervalDuration,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventInput. +func (l LiveEventInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControl", l.AccessControl) + populate(objectMap, "accessToken", l.AccessToken) + populate(objectMap, "endpoints", l.Endpoints) + populate(objectMap, "keyFrameIntervalDuration", l.KeyFrameIntervalDuration) + populate(objectMap, "streamingProtocol", l.StreamingProtocol) + return json.Marshal(objectMap) +} + +// LiveEventInputAccessControl - The IP access control for live event input. +type LiveEventInputAccessControl struct { + // The IP access control properties. + IP *IPAccessControl `json:"ip,omitempty"` +} + +// LiveEventInputTrackSelection - A track selection condition. This property is reserved for future use, any value set on this property will be ignored. +type LiveEventInputTrackSelection struct { + // Comparing operation. This property is reserved for future use, any value set on this property will be ignored. + Operation *string `json:"operation,omitempty"` + + // Property name to select. This property is reserved for future use, any value set on this property will be ignored. + Property *string `json:"property,omitempty"` + + // Property value to select. This property is reserved for future use, any value set on this property will be ignored. + Value *string `json:"value,omitempty"` +} + +// LiveEventListResult - The LiveEvent list result. +type LiveEventListResult struct { + // The number of result. + ODataCount *int32 `json:"@odata.count,omitempty"` + + // The link to the next set of results. Not empty if value contains incomplete list of live outputs. + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // The result of the List Live Event operation. + Value []*LiveEvent `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventListResult. +func (l LiveEventListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.count", l.ODataCount) + populate(objectMap, "@odata.nextLink", l.ODataNextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// LiveEventOutputTranscriptionTrack - Describes a transcription track in the output of a live event, generated using speech-to-text transcription. This +// property is reserved for future use, any value set on this property will be ignored. +type LiveEventOutputTranscriptionTrack struct { + // REQUIRED; The output track name. This property is reserved for future use, any value set on this property will be ignored. + TrackName *string `json:"trackName,omitempty"` +} + +// LiveEventPreview - Live event preview settings. +type LiveEventPreview struct { + // The access control for live event preview. + AccessControl *LiveEventPreviewAccessControl `json:"accessControl,omitempty"` + + // An alternative media identifier associated with the streaming locator created for the preview. This value is specified at creation time and cannot be + // updated. The identifier can be used in the + // CustomLicenseAcquisitionUrlTemplate or the CustomKeyAcquisitionUrlTemplate of the StreamingPolicy specified in the StreamingPolicyName field. + AlternativeMediaID *string `json:"alternativeMediaId,omitempty"` + + // The endpoints for preview. Do not share the preview URL with the live event audience. + Endpoints []*LiveEventEndpoint `json:"endpoints,omitempty"` + + // The identifier of the preview locator in Guid format. Specifying this at creation time allows the caller to know the preview locator url before the event + // is created. If omitted, the service will + // generate a random identifier. This value cannot be updated once the live event is created. + PreviewLocator *string `json:"previewLocator,omitempty"` + + // The name of streaming policy used for the live event preview. This value is specified at creation time and cannot be updated. + StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventPreview. +func (l LiveEventPreview) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControl", l.AccessControl) + populate(objectMap, "alternativeMediaId", l.AlternativeMediaID) + populate(objectMap, "endpoints", l.Endpoints) + populate(objectMap, "previewLocator", l.PreviewLocator) + populate(objectMap, "streamingPolicyName", l.StreamingPolicyName) + return json.Marshal(objectMap) +} + +// LiveEventPreviewAccessControl - The IP access control for the live event preview endpoint. +type LiveEventPreviewAccessControl struct { + // The IP access control properties. + IP *IPAccessControl `json:"ip,omitempty"` +} + +// LiveEventProperties - The live event properties. +type LiveEventProperties struct { + // REQUIRED; Live event input settings. It defines how the live event receives input from a contribution encoder. + Input *LiveEventInput `json:"input,omitempty"` + + // Live event cross site access policies. + CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` + + // A description for the live event. + Description *string `json:"description,omitempty"` + + // Encoding settings for the live event. It configures whether a live encoder is used for the live event and settings for the live encoder if it is used. + Encoding *LiveEventEncoding `json:"encoding,omitempty"` + + // When useStaticHostname is set to true, the hostnamePrefix specifies the first part of the hostname assigned to the live event preview and ingest endpoints. + // The final hostname would be a combination of + // this prefix, the media service account name and a short code for the Azure Media Services data center. + HostnamePrefix *string `json:"hostnamePrefix,omitempty"` + + // Live event preview settings. Preview allows live event producers to preview the live streaming content without creating any live output. + Preview *LiveEventPreview `json:"preview,omitempty"` + + // The options to use for the LiveEvent. This value is specified at creation time and cannot be updated. The valid values for the array entry values are + // 'Default' and 'LowLatency'. + StreamOptions []*StreamOptionsFlag `json:"streamOptions,omitempty"` + + // Live transcription settings for the live event. See https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription + // feature. + Transcriptions []*LiveEventTranscription `json:"transcriptions,omitempty"` + + // Specifies whether a static hostname would be assigned to the live event preview and ingest endpoints. This value can only be updated if the live event + // is in Standby state + UseStaticHostname *bool `json:"useStaticHostname,omitempty"` + + // READ-ONLY; The creation time for the live event + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The last modified time of the live event. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the live event. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource state of the live event. See https://go.microsoft.com/fwlink/?linkid=2139012 for more information. + ResourceState *LiveEventResourceState `json:"resourceState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventProperties. +func (l LiveEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "created", (*timeRFC3339)(l.Created)) + populate(objectMap, "crossSiteAccessPolicies", l.CrossSiteAccessPolicies) + populate(objectMap, "description", l.Description) + populate(objectMap, "encoding", l.Encoding) + populate(objectMap, "hostnamePrefix", l.HostnamePrefix) + populate(objectMap, "input", l.Input) + populate(objectMap, "lastModified", (*timeRFC3339)(l.LastModified)) + populate(objectMap, "preview", l.Preview) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceState", l.ResourceState) + populate(objectMap, "streamOptions", l.StreamOptions) + populate(objectMap, "transcriptions", l.Transcriptions) + populate(objectMap, "useStaticHostname", l.UseStaticHostname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiveEventProperties. +func (l *LiveEventProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + l.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "crossSiteAccessPolicies": + err = unpopulate(val, &l.CrossSiteAccessPolicies) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &l.Description) + delete(rawMsg, key) + case "encoding": + err = unpopulate(val, &l.Encoding) + delete(rawMsg, key) + case "hostnamePrefix": + err = unpopulate(val, &l.HostnamePrefix) + delete(rawMsg, key) + case "input": + err = unpopulate(val, &l.Input) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + l.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "preview": + err = unpopulate(val, &l.Preview) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &l.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &l.ResourceState) + delete(rawMsg, key) + case "streamOptions": + err = unpopulate(val, &l.StreamOptions) + delete(rawMsg, key) + case "transcriptions": + err = unpopulate(val, &l.Transcriptions) + delete(rawMsg, key) + case "useStaticHostname": + err = unpopulate(val, &l.UseStaticHostname) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// LiveEventTranscription - Describes the transcription tracks in the output of a live event, generated using speech-to-text transcription. This property +// is reserved for future use, any value set on this property will be +// ignored. +type LiveEventTranscription struct { + // Provides a mechanism to select the audio track in the input live feed, to which speech-to-text transcription is applied. This property is reserved for + // future use, any value set on this property will + // be ignored. + InputTrackSelection []*LiveEventInputTrackSelection `json:"inputTrackSelection,omitempty"` + + // Specifies the language (locale) to be used for speech-to-text transcription – it should match the spoken language in the audio track. The value should + // be in BCP-47 format (e.g: 'en-US'). See + // https://go.microsoft.com/fwlink/?linkid=2133742 for more information about the live transcription feature and the list of supported languages. + Language *string `json:"language,omitempty"` + + // Describes a transcription track in the output of a live event, generated using speech-to-text transcription. This property is reserved for future use, + // any value set on this property will be ignored. + OutputTranscriptionTrack *LiveEventOutputTranscriptionTrack `json:"outputTranscriptionTrack,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveEventTranscription. +func (l LiveEventTranscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inputTrackSelection", l.InputTrackSelection) + populate(objectMap, "language", l.Language) + populate(objectMap, "outputTranscriptionTrack", l.OutputTranscriptionTrack) + return json.Marshal(objectMap) +} + +// LiveEventsBeginAllocateOptions contains the optional parameters for the LiveEvents.BeginAllocate method. +type LiveEventsBeginAllocateOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsBeginCreateOptions contains the optional parameters for the LiveEvents.BeginCreate method. +type LiveEventsBeginCreateOptions struct { + // The flag indicates if the resource should be automatically started on creation. + AutoStart *bool +} + +// LiveEventsBeginDeleteOptions contains the optional parameters for the LiveEvents.BeginDelete method. +type LiveEventsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsBeginResetOptions contains the optional parameters for the LiveEvents.BeginReset method. +type LiveEventsBeginResetOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsBeginStartOptions contains the optional parameters for the LiveEvents.BeginStart method. +type LiveEventsBeginStartOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsBeginStopOptions contains the optional parameters for the LiveEvents.BeginStop method. +type LiveEventsBeginStopOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsBeginUpdateOptions contains the optional parameters for the LiveEvents.BeginUpdate method. +type LiveEventsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsGetOptions contains the optional parameters for the LiveEvents.Get method. +type LiveEventsGetOptions struct { + // placeholder for future optional parameters +} + +// LiveEventsListOptions contains the optional parameters for the LiveEvents.List method. +type LiveEventsListOptions struct { + // placeholder for future optional parameters +} + +// LiveOutput - The Live Output. +type LiveOutput struct { + ProxyResource + // Live output properties. + Properties *LiveOutputProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveOutput. +func (l LiveOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + l.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + return json.Marshal(objectMap) +} + +// LiveOutputListResult - The LiveOutput list result. +type LiveOutputListResult struct { + // The number of result. + ODataCount *int32 `json:"@odata.count,omitempty"` + + // The link to the next set of results. Not empty if value contains incomplete list of live outputs. + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // The result of the List LiveOutput operation. + Value []*LiveOutput `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveOutputListResult. +func (l LiveOutputListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.count", l.ODataCount) + populate(objectMap, "@odata.nextLink", l.ODataNextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// LiveOutputProperties - The JSON object that contains the properties required to create a live output. +type LiveOutputProperties struct { + // REQUIRED; ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the asset for this live output. This + // also sets the maximum content length for the rewind + // window. For example, use PT1H30M to indicate 1 hour and 30 minutes of archive window. + ArchiveWindowLength *string `json:"archiveWindowLength,omitempty"` + + // REQUIRED; The asset that the live output will write to. + AssetName *string `json:"assetName,omitempty"` + + // The description of the live output. + Description *string `json:"description,omitempty"` + + // HTTP Live Streaming (HLS) packing setting for the live output. + Hls *Hls `json:"hls,omitempty"` + + // The manifest file name. If not provided, the service will generate one automatically. + ManifestName *string `json:"manifestName,omitempty"` + + // The initial timestamp that the live output will start at, any content before this value will not be archived. + OutputSnapTime *int64 `json:"outputSnapTime,omitempty"` + + // READ-ONLY; The creation time the live output. + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The time the live output was last modified. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the live output. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource state of the live output. + ResourceState *LiveOutputResourceState `json:"resourceState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type LiveOutputProperties. +func (l LiveOutputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "archiveWindowLength", l.ArchiveWindowLength) + populate(objectMap, "assetName", l.AssetName) + populate(objectMap, "created", (*timeRFC3339)(l.Created)) + populate(objectMap, "description", l.Description) + populate(objectMap, "hls", l.Hls) + populate(objectMap, "lastModified", (*timeRFC3339)(l.LastModified)) + populate(objectMap, "manifestName", l.ManifestName) + populate(objectMap, "outputSnapTime", l.OutputSnapTime) + populate(objectMap, "provisioningState", l.ProvisioningState) + populate(objectMap, "resourceState", l.ResourceState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiveOutputProperties. +func (l *LiveOutputProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "archiveWindowLength": + err = unpopulate(val, &l.ArchiveWindowLength) + delete(rawMsg, key) + case "assetName": + err = unpopulate(val, &l.AssetName) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + l.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &l.Description) + delete(rawMsg, key) + case "hls": + err = unpopulate(val, &l.Hls) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + l.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "manifestName": + err = unpopulate(val, &l.ManifestName) + delete(rawMsg, key) + case "outputSnapTime": + err = unpopulate(val, &l.OutputSnapTime) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &l.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &l.ResourceState) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// LiveOutputsBeginCreateOptions contains the optional parameters for the LiveOutputs.BeginCreate method. +type LiveOutputsBeginCreateOptions struct { + // placeholder for future optional parameters +} + +// LiveOutputsBeginDeleteOptions contains the optional parameters for the LiveOutputs.BeginDelete method. +type LiveOutputsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// LiveOutputsGetOptions contains the optional parameters for the LiveOutputs.Get method. +type LiveOutputsGetOptions struct { + // placeholder for future optional parameters +} + +// LiveOutputsListOptions contains the optional parameters for the LiveOutputs.List method. +type LiveOutputsListOptions struct { + // placeholder for future optional parameters +} + +// LocationsCheckNameAvailabilityOptions contains the optional parameters for the Locations.CheckNameAvailability method. +type LocationsCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// LogSpecification - A diagnostic log emitted by service. +type LogSpecification struct { + // READ-ONLY; The time range for requests in each blob. + BlobDuration *string `json:"blobDuration,omitempty" azure:"ro"` + + // READ-ONLY; The diagnostic log category display name. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; The diagnostic log category name. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// MediaFilterProperties - The Media Filter properties. +type MediaFilterProperties struct { + // The first quality. + FirstQuality *FirstQuality `json:"firstQuality,omitempty"` + + // The presentation time range. + PresentationTimeRange *PresentationTimeRange `json:"presentationTimeRange,omitempty"` + + // The tracks selection conditions. + Tracks []*FilterTrackSelection `json:"tracks,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MediaFilterProperties. +func (m MediaFilterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "firstQuality", m.FirstQuality) + populate(objectMap, "presentationTimeRange", m.PresentationTimeRange) + populate(objectMap, "tracks", m.Tracks) + return json.Marshal(objectMap) +} + +// MediaService - A Media Services account. +type MediaService struct { + TrackedResource + // The Managed Identity for the Media Services account. + Identity *MediaServiceIdentity `json:"identity,omitempty"` + + // The resource properties. + Properties *MediaServiceProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MediaService. +func (m MediaService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + m.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + return json.Marshal(objectMap) +} + +// MediaServiceCollection - A collection of MediaService items. +type MediaServiceCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of MediaService items. + Value []*MediaService `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceCollection. +func (m MediaServiceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", m.ODataNextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +type MediaServiceIdentity struct { + // REQUIRED; The identity type. + Type *string `json:"type,omitempty"` + + // The user assigned managed identities. + UserAssignedIdentities map[string]*UserAssignedManagedIdentity `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The Principal ID of the identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The Tenant ID of the identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceIdentity. +func (m MediaServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// MediaServiceProperties - Properties of the Media Services account. +type MediaServiceProperties struct { + // The account encryption properties. + Encryption *AccountEncryption `json:"encryption,omitempty"` + + // The Key Delivery properties for Media Services account. + KeyDelivery *KeyDelivery `json:"keyDelivery,omitempty"` + + // Whether or not public network access is allowed for resources under the Media Services account. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // The storage accounts for this resource. + StorageAccounts []*StorageAccount `json:"storageAccounts,omitempty"` + StorageAuthentication *StorageAuthentication `json:"storageAuthentication,omitempty"` + + // READ-ONLY; The Media Services account ID. + MediaServiceID *string `json:"mediaServiceId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceProperties. +func (m MediaServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryption", m.Encryption) + populate(objectMap, "keyDelivery", m.KeyDelivery) + populate(objectMap, "mediaServiceId", m.MediaServiceID) + populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) + populate(objectMap, "storageAccounts", m.StorageAccounts) + populate(objectMap, "storageAuthentication", m.StorageAuthentication) + return json.Marshal(objectMap) +} + +// MediaServiceUpdate - A Media Services account update. +type MediaServiceUpdate struct { + // The Managed Identity for the Media Services account. + Identity *MediaServiceIdentity `json:"identity,omitempty"` + + // The resource properties. + Properties *MediaServiceProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MediaServiceUpdate. +func (m MediaServiceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "tags", m.Tags) + return json.Marshal(objectMap) +} + +// MediaservicesCreateOrUpdateOptions contains the optional parameters for the Mediaservices.CreateOrUpdate method. +type MediaservicesCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesDeleteOptions contains the optional parameters for the Mediaservices.Delete method. +type MediaservicesDeleteOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesGetOptions contains the optional parameters for the Mediaservices.Get method. +type MediaservicesGetOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesListBySubscriptionOptions contains the optional parameters for the Mediaservices.ListBySubscription method. +type MediaservicesListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesListEdgePoliciesOptions contains the optional parameters for the Mediaservices.ListEdgePolicies method. +type MediaservicesListEdgePoliciesOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesListOptions contains the optional parameters for the Mediaservices.List method. +type MediaservicesListOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesSyncStorageKeysOptions contains the optional parameters for the Mediaservices.SyncStorageKeys method. +type MediaservicesSyncStorageKeysOptions struct { + // placeholder for future optional parameters +} + +// MediaservicesUpdateOptions contains the optional parameters for the Mediaservices.Update method. +type MediaservicesUpdateOptions struct { + // placeholder for future optional parameters +} + +// MetricDimension - A metric dimension. +type MetricDimension struct { + // READ-ONLY; The display name for the dimension. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; The metric dimension name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Whether to export metric to shoebox. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty" azure:"ro"` +} + +// MetricSpecification - A metric emitted by service. +type MetricSpecification struct { + // Supported aggregation types. + SupportedAggregationTypes []*string `json:"supportedAggregationTypes,omitempty"` + + // READ-ONLY; The metric aggregation type + AggregationType *MetricAggregationType `json:"aggregationType,omitempty" azure:"ro"` + + // READ-ONLY; The metric dimensions. + Dimensions []*MetricDimension `json:"dimensions,omitempty" azure:"ro"` + + // READ-ONLY; The metric display description. + DisplayDescription *string `json:"displayDescription,omitempty" azure:"ro"` + + // READ-ONLY; The metric display name. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; Indicates whether regional MDM account is enabled. + EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty" azure:"ro"` + + // READ-ONLY; The metric lock aggregation type + LockAggregationType *MetricAggregationType `json:"lockAggregationType,omitempty" azure:"ro"` + + // READ-ONLY; The metric name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The source MDM account. + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty" azure:"ro"` + + // READ-ONLY; The source MDM namespace. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty" azure:"ro"` + + // READ-ONLY; The supported time grain types. + SupportedTimeGrainTypes []*string `json:"supportedTimeGrainTypes,omitempty" azure:"ro"` + + // READ-ONLY; The metric unit + Unit *MetricUnit `json:"unit,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "enableRegionalMdmAccount", m.EnableRegionalMdmAccount) + populate(objectMap, "lockAggregationType", m.LockAggregationType) + populate(objectMap, "name", m.Name) + populate(objectMap, "sourceMdmAccount", m.SourceMdmAccount) + populate(objectMap, "sourceMdmNamespace", m.SourceMdmNamespace) + populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + +// Mp4Format - Describes the properties for an output ISO MP4 file. +type Mp4Format struct { + MultiBitrateFormat +} + +// MarshalJSON implements the json.Marshaller interface for type Mp4Format. +func (m Mp4Format) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + m.MultiBitrateFormat.marshalInternal(objectMap, "#Microsoft.Media.Mp4Format") + return json.Marshal(objectMap) +} + +// MultiBitrateFormatClassification provides polymorphic access to related types. +// Call the interface's GetMultiBitrateFormat() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *Mp4Format, *MultiBitrateFormat, *TransportStreamFormat +type MultiBitrateFormatClassification interface { + FormatClassification + // GetMultiBitrateFormat returns the MultiBitrateFormat content of the underlying type. + GetMultiBitrateFormat() *MultiBitrateFormat +} + +// MultiBitrateFormat - Describes the properties for producing a collection of GOP aligned multi-bitrate files. The default behavior is to produce one output +// file for each video layer which is muxed together with all the +// audios. The exact output files produced can be controlled by specifying the outputFiles collection. +type MultiBitrateFormat struct { + Format + // The list of output files to produce. Each entry in the list is a set of audio and video layer labels to be muxed together . + OutputFiles []*OutputFile `json:"outputFiles,omitempty"` +} + +// GetMultiBitrateFormat implements the MultiBitrateFormatClassification interface for type MultiBitrateFormat. +func (m *MultiBitrateFormat) GetMultiBitrateFormat() *MultiBitrateFormat { return m } + +// MarshalJSON implements the json.Marshaller interface for type MultiBitrateFormat. +func (m MultiBitrateFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + m.marshalInternal(objectMap, "#Microsoft.Media.MultiBitrateFormat") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MultiBitrateFormat. +func (m *MultiBitrateFormat) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return m.unmarshalInternal(rawMsg) +} + +func (m MultiBitrateFormat) marshalInternal(objectMap map[string]interface{}, discValue string) { + m.Format.marshalInternal(objectMap, discValue) + populate(objectMap, "outputFiles", m.OutputFiles) +} + +func (m *MultiBitrateFormat) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "outputFiles": + err = unpopulate(val, &m.OutputFiles) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := m.Format.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// NoEncryption - Class for NoEncryption scheme +type NoEncryption struct { + // Representing supported protocols + EnabledProtocols *EnabledProtocols `json:"enabledProtocols,omitempty"` +} + +// Operation - An operation. +type Operation struct { + // REQUIRED; The operation name. + Name *string `json:"name,omitempty"` + + // Indicates the action type. + ActionType *ActionType `json:"actionType,omitempty"` + + // The operation display name. + Display *OperationDisplay `json:"display,omitempty"` + + // Whether the operation applies to data-plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Origin of the operation. + Origin *string `json:"origin,omitempty"` + + // Operation properties format. + Properties *Properties `json:"properties,omitempty"` +} + +// OperationCollection - A collection of Operation items. +type OperationCollection struct { + // A collection of Operation items. + Value []*Operation `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationCollection. +func (o OperationCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationDisplay - Operation details. +type OperationDisplay struct { + // The operation description. + Description *string `json:"description,omitempty"` + + // The operation type. + Operation *string `json:"operation,omitempty"` + + // The service provider. + Provider *string `json:"provider,omitempty"` + + // Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationsListOptions contains the optional parameters for the Operations.List method. +type OperationsListOptions struct { + // placeholder for future optional parameters +} + +// OutputFile - Represents an output file produced. +type OutputFile struct { + // REQUIRED; The list of labels that describe how the encoder should multiplex video and audio into an output file. For example, if the encoder is producing + // two video layers with labels v1 and v2, and one audio + // layer with label a1, then an array like '[v1, a1]' tells the encoder to produce an output file with the video track represented by v1 and the audio track + // represented by a1. + Labels []*string `json:"labels,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OutputFile. +func (o OutputFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "labels", o.Labels) + return json.Marshal(objectMap) +} + +// OverlayClassification provides polymorphic access to related types. +// Call the interface's GetOverlay() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AudioOverlay, *Overlay, *VideoOverlay +type OverlayClassification interface { + // GetOverlay returns the Overlay content of the underlying type. + GetOverlay() *Overlay +} + +// Overlay - Base type for all overlays - image, audio or video. +type Overlay struct { + // REQUIRED; The label of the job input which is to be used as an overlay. The Input must specify exactly one file. You can specify an image file in JPG, + // PNG, GIF or BMP format, or an audio file (such as a WAV, + // MP3, WMA or M4A file), or a video file. See https://aka.ms/mesformats for the complete list of supported audio and video file formats. + InputLabel *string `json:"inputLabel,omitempty"` + + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` + + // The gain level of audio in the overlay. The value should be in the range [0, 1.0]. The default is 1.0. + AudioGainLevel *float64 `json:"audioGainLevel,omitempty"` + + // The end position, with reference to the input video, at which the overlay ends. The value should be in ISO 8601 format. For example, PT30S to end the + // overlay at 30 seconds into the input video. If not + // specified or the value is greater than the input video duration, the overlay will be applied until the end of the input video if the overlay media duration + // is greater than the input video duration, + // else the overlay will last as long as the overlay media duration. + End *string `json:"end,omitempty"` + + // The duration over which the overlay fades in onto the input video. The value should be in ISO 8601 duration format. If not specified the default behavior + // is to have no fade in (same as PT0S). + FadeInDuration *string `json:"fadeInDuration,omitempty"` + + // The duration over which the overlay fades out of the input video. The value should be in ISO 8601 duration format. If not specified the default behavior + // is to have no fade out (same as PT0S). + FadeOutDuration *string `json:"fadeOutDuration,omitempty"` + + // The start position, with reference to the input video, at which the overlay starts. The value should be in ISO 8601 format. For example, PT05S to start + // the overlay at 5 seconds into the input video. + // If not specified the overlay starts from the beginning of the input video. + Start *string `json:"start,omitempty"` +} + +// GetOverlay implements the OverlayClassification interface for type Overlay. +func (o *Overlay) GetOverlay() *Overlay { return o } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Overlay. +func (o *Overlay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return o.unmarshalInternal(rawMsg) +} + +func (o Overlay) marshalInternal(objectMap map[string]interface{}, discValue string) { + populate(objectMap, "audioGainLevel", o.AudioGainLevel) + populate(objectMap, "end", o.End) + populate(objectMap, "fadeInDuration", o.FadeInDuration) + populate(objectMap, "fadeOutDuration", o.FadeOutDuration) + populate(objectMap, "inputLabel", o.InputLabel) + o.ODataType = &discValue + objectMap["@odata.type"] = o.ODataType + populate(objectMap, "start", o.Start) +} + +func (o *Overlay) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "audioGainLevel": + err = unpopulate(val, &o.AudioGainLevel) + delete(rawMsg, key) + case "end": + err = unpopulate(val, &o.End) + delete(rawMsg, key) + case "fadeInDuration": + err = unpopulate(val, &o.FadeInDuration) + delete(rawMsg, key) + case "fadeOutDuration": + err = unpopulate(val, &o.FadeOutDuration) + delete(rawMsg, key) + case "inputLabel": + err = unpopulate(val, &o.InputLabel) + delete(rawMsg, key) + case "@odata.type": + err = unpopulate(val, &o.ODataType) + delete(rawMsg, key) + case "start": + err = unpopulate(val, &o.Start) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// PNGFormat - Describes the settings for producing PNG thumbnails. +type PNGFormat struct { + ImageFormat +} + +// MarshalJSON implements the json.Marshaller interface for type PNGFormat. +func (p PNGFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ImageFormat.marshalInternal(objectMap, "#Microsoft.Media.PngFormat") + return json.Marshal(objectMap) +} + +// PNGImage - Describes the properties for producing a series of PNG images from the input video. +type PNGImage struct { + Image + // A collection of output PNG image layers to be produced by the encoder. + Layers []*PNGLayer `json:"layers,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PNGImage. +func (p PNGImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.Image.marshalInternal(objectMap, "#Microsoft.Media.PngImage") + populate(objectMap, "layers", p.Layers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PNGImage. +func (p *PNGImage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "layers": + err = unpopulate(val, &p.Layers) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := p.Image.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// PNGLayer - Describes the settings to produce a PNG image from the input video. +type PNGLayer struct { + Layer +} + +// MarshalJSON implements the json.Marshaller interface for type PNGLayer. +func (p PNGLayer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.Layer.marshalInternal(objectMap, "#Microsoft.Media.PngLayer") + return json.Marshal(objectMap) +} + +// PresentationTimeRange - The presentation time range, this is asset related and not recommended for Account Filter. +type PresentationTimeRange struct { + // The absolute end time boundary. + EndTimestamp *int64 `json:"endTimestamp,omitempty"` + + // The indicator of forcing existing of end time stamp. + ForceEndTimestamp *bool `json:"forceEndTimestamp,omitempty"` + + // The relative to end right edge. + LiveBackoffDuration *int64 `json:"liveBackoffDuration,omitempty"` + + // The relative to end sliding window. + PresentationWindowDuration *int64 `json:"presentationWindowDuration,omitempty"` + + // The absolute start time boundary. + StartTimestamp *int64 `json:"startTimestamp,omitempty"` + + // The time scale of time stamps. + Timescale *int64 `json:"timescale,omitempty"` +} + +// PresetClassification provides polymorphic access to related types. +// Call the interface's GetPreset() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AudioAnalyzerPreset, *BuiltInStandardEncoderPreset, *FaceDetectorPreset, *Preset, *StandardEncoderPreset, *VideoAnalyzerPreset +type PresetClassification interface { + // GetPreset returns the Preset content of the underlying type. + GetPreset() *Preset +} + +// Preset - Base type for all Presets, which define the recipe or instructions on how the input media files should be processed. +type Preset struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetPreset implements the PresetClassification interface for type Preset. +func (p *Preset) GetPreset() *Preset { return p } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Preset. +func (p *Preset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return p.unmarshalInternal(rawMsg) +} + +func (p Preset) marshalInternal(objectMap map[string]interface{}, discValue string) { + p.ODataType = &discValue + objectMap["@odata.type"] = p.ODataType +} + +func (p *Preset) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &p.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// PresetConfigurations - An object of optional configuration settings for encoder. +type PresetConfigurations struct { + // Allows you to configure the encoder settings to control the balance between speed and quality. Example: set Complexity as Speed for faster encoding but + // less compression efficiency. + Complexity *Complexity `json:"complexity,omitempty"` + + // Sets the interleave mode of the output to control how audio and video are stored in the container format. Example: set InterleavedOutput as NonInterleavedOutput + // to produce audio-only and video-only + // outputs in separate MP4 files. + InterleaveOutput *InterleaveOutput `json:"interleaveOutput,omitempty"` + + // The key frame interval in seconds. Example: set KeyFrameIntervalInSeconds as 2 to reduce the playback buffering for some players. + KeyFrameIntervalInSeconds *float32 `json:"keyFrameIntervalInSeconds,omitempty"` + + // The maximum bitrate in bits per second (threshold for the top video layer). Example: set MaxBitrateBps as 6000000 to avoid producing very high bitrate + // outputs for contents with high complexity. + MaxBitrateBps *int32 `json:"maxBitrateBps,omitempty"` + + // The maximum height of output video layers. Example: set MaxHeight as 720 to produce output layers up to 720P even if the input is 4K. + MaxHeight *int32 `json:"maxHeight,omitempty"` + + // The maximum number of output video layers. Example: set MaxLayers as 4 to make sure at most 4 output layers are produced to control the overall cost + // of the encoding job. + MaxLayers *int32 `json:"maxLayers,omitempty"` + + // The minimum bitrate in bits per second (threshold for the bottom video layer). Example: set MinBitrateBps as 200000 to have a bottom layer that covers + // users with low network bandwidth. + MinBitrateBps *int32 `json:"minBitrateBps,omitempty"` + + // The minimum height of output video layers. Example: set MinHeight as 360 to avoid output layers of smaller resolutions like 180P. + MinHeight *int32 `json:"minHeight,omitempty"` +} + +// PrivateEndpoint - The Private Endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The ARM identifier for Private Endpoint + ID *string `json:"id,omitempty" azure:"ro"` +} + +// PrivateEndpointConnection - The Private Endpoint Connection resource. +type PrivateEndpointConnection struct { + Resource + // Resource properties. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account +type PrivateEndpointConnectionListResult struct { + // Array of private endpoint connections + Value []*PrivateEndpointConnection `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionsCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnections.CreateOrUpdate method. +type PrivateEndpointConnectionsCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsDeleteOptions contains the optional parameters for the PrivateEndpointConnections.Delete method. +type PrivateEndpointConnectionsDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsGetOptions contains the optional parameters for the PrivateEndpointConnections.Get method. +type PrivateEndpointConnectionsGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsListOptions contains the optional parameters for the PrivateEndpointConnections.List method. +type PrivateEndpointConnectionsListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + Resource + // Resource properties. + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceListResult - A list of private link resources +type PrivateLinkResourceListResult struct { + // Array of private link resources + Value []*PrivateLinkResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource Private link DNS zone name. + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` + + // READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty" azure:"ro"` + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesGetOptions contains the optional parameters for the PrivateLinkResources.Get method. +type PrivateLinkResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesListOptions contains the optional parameters for the PrivateLinkResources.List method. +type PrivateLinkResourcesListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} + +// Properties - The service specification property. +type Properties struct { + // READ-ONLY; The service specifications. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty" azure:"ro"` +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location +type ProxyResource struct { + Resource +} + +func (p ProxyResource) marshalInternal(objectMap map[string]interface{}) { + p.Resource.marshalInternal(objectMap) +} + +// Rectangle - Describes the properties of a rectangular window applied to the input media before processing it. +type Rectangle struct { + // The height of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). + Height *string `json:"height,omitempty"` + + // The number of pixels from the left-margin. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). + Left *string `json:"left,omitempty"` + + // The number of pixels from the top-margin. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). + Top *string `json:"top,omitempty"` + + // The width of the rectangular region in pixels. This can be absolute pixel value (e.g 100), or relative to the size of the video (For example, 50%). + Width *string `json:"width,omitempty"` +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (r Resource) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) +} + +type ResourceIdentity struct { + // REQUIRED; Indicates whether to use System Assigned Managed Identity. Mutual exclusive with User Assigned Managed Identity. + UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` + + // The user assigned managed identity's ARM ID to use when accessing a resource. + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} + +// SelectAudioTrackByAttribute - Select audio tracks from the input by specifying an attribute and an attribute filter. +type SelectAudioTrackByAttribute struct { + AudioTrackDescriptor + // REQUIRED; The TrackAttribute to filter the tracks by. + Attribute *TrackAttribute `json:"attribute,omitempty"` + + // REQUIRED; The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. + Filter *AttributeFilter `json:"filter,omitempty"` + + // The value to filter the tracks by. Only used when AttributeFilter.ValueEquals is specified for the Filter property. + FilterValue *string `json:"filterValue,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SelectAudioTrackByAttribute. +func (s SelectAudioTrackByAttribute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.AudioTrackDescriptor.marshalInternal(objectMap, "#Microsoft.Media.SelectAudioTrackByAttribute") + populate(objectMap, "attribute", s.Attribute) + populate(objectMap, "filter", s.Filter) + populate(objectMap, "filterValue", s.FilterValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectAudioTrackByAttribute. +func (s *SelectAudioTrackByAttribute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "attribute": + err = unpopulate(val, &s.Attribute) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, &s.Filter) + delete(rawMsg, key) + case "filterValue": + err = unpopulate(val, &s.FilterValue) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.AudioTrackDescriptor.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SelectAudioTrackByID - Select audio tracks from the input by specifying a track identifier. +type SelectAudioTrackByID struct { + AudioTrackDescriptor + // REQUIRED; Track identifier to select + TrackID *int64 `json:"trackId,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SelectAudioTrackByID. +func (s SelectAudioTrackByID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.AudioTrackDescriptor.marshalInternal(objectMap, "#Microsoft.Media.SelectAudioTrackById") + populate(objectMap, "trackId", s.TrackID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectAudioTrackByID. +func (s *SelectAudioTrackByID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "trackId": + err = unpopulate(val, &s.TrackID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.AudioTrackDescriptor.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SelectVideoTrackByAttribute - Select video tracks from the input by specifying an attribute and an attribute filter. +type SelectVideoTrackByAttribute struct { + VideoTrackDescriptor + // REQUIRED; The TrackAttribute to filter the tracks by. + Attribute *TrackAttribute `json:"attribute,omitempty"` + + // REQUIRED; The type of AttributeFilter to apply to the TrackAttribute in order to select the tracks. + Filter *AttributeFilter `json:"filter,omitempty"` + + // The value to filter the tracks by. Only used when AttributeFilter.ValueEquals is specified for the Filter property. For TrackAttribute.Bitrate, this + // should be an integer value in bits per second (e.g: + // '1500000'). The TrackAttribute.Language is not supported for video tracks. + FilterValue *string `json:"filterValue,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SelectVideoTrackByAttribute. +func (s SelectVideoTrackByAttribute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.VideoTrackDescriptor.marshalInternal(objectMap, "#Microsoft.Media.SelectVideoTrackByAttribute") + populate(objectMap, "attribute", s.Attribute) + populate(objectMap, "filter", s.Filter) + populate(objectMap, "filterValue", s.FilterValue) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectVideoTrackByAttribute. +func (s *SelectVideoTrackByAttribute) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "attribute": + err = unpopulate(val, &s.Attribute) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, &s.Filter) + delete(rawMsg, key) + case "filterValue": + err = unpopulate(val, &s.FilterValue) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.VideoTrackDescriptor.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SelectVideoTrackByID - Select video tracks from the input by specifying a track identifier. +type SelectVideoTrackByID struct { + VideoTrackDescriptor + // REQUIRED; Track identifier to select + TrackID *int64 `json:"trackId,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SelectVideoTrackByID. +func (s SelectVideoTrackByID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.VideoTrackDescriptor.marshalInternal(objectMap, "#Microsoft.Media.SelectVideoTrackById") + populate(objectMap, "trackId", s.TrackID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SelectVideoTrackByID. +func (s *SelectVideoTrackByID) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "trackId": + err = unpopulate(val, &s.TrackID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.VideoTrackDescriptor.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ServiceSpecification - The service metric specifications. +type ServiceSpecification struct { + // READ-ONLY; List of log specifications. + LogSpecifications []*LogSpecification `json:"logSpecifications,omitempty" azure:"ro"` + + // READ-ONLY; List of metric specifications. + MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "logSpecifications", s.LogSpecifications) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + +// StandardEncoderPreset - Describes all the settings to be used when encoding the input video with the Standard Encoder. +type StandardEncoderPreset struct { + Preset + // REQUIRED; The list of codecs to be used when encoding the input video. + Codecs []CodecClassification `json:"codecs,omitempty"` + + // REQUIRED; The list of outputs to be produced by the encoder. + Formats []FormatClassification `json:"formats,omitempty"` + + // One or more filtering operations that are applied to the input media before encoding. + Filters *Filters `json:"filters,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StandardEncoderPreset. +func (s StandardEncoderPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.Preset.marshalInternal(objectMap, "#Microsoft.Media.StandardEncoderPreset") + populate(objectMap, "codecs", s.Codecs) + populate(objectMap, "filters", s.Filters) + populate(objectMap, "formats", s.Formats) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardEncoderPreset. +func (s *StandardEncoderPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "codecs": + s.Codecs, err = unmarshalCodecClassificationArray(val) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, &s.Filters) + delete(rawMsg, key) + case "formats": + s.Formats, err = unmarshalFormatClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.Preset.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// StorageAccount - The storage account details. +type StorageAccount struct { + // REQUIRED; The type of the storage account. + Type *StorageAccountType `json:"type,omitempty"` + + // The ID of the storage account resource. Media Services relies on tables and queues as well as blobs, so the primary storage account must be a Standard + // Storage account (either Microsoft.ClassicStorage + // or Microsoft.Storage). Blob only storage accounts can be added as secondary storage accounts. + ID *string `json:"id,omitempty"` + + // The storage account identity. + Identity *ResourceIdentity `json:"identity,omitempty"` + + // READ-ONLY; The current status of the storage account mapping. + Status *string `json:"status,omitempty" azure:"ro"` +} + +// StorageEncryptedAssetDecryptionData - Data needed to decrypt asset files encrypted with legacy storage encryption. +type StorageEncryptedAssetDecryptionData struct { + // Asset File encryption metadata. + AssetFileEncryptionMetadata []*AssetFileEncryptionMetadata `json:"assetFileEncryptionMetadata,omitempty"` + + // The Asset File storage encryption key. + Key []byte `json:"key,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageEncryptedAssetDecryptionData. +func (s StorageEncryptedAssetDecryptionData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assetFileEncryptionMetadata", s.AssetFileEncryptionMetadata) + populateByteArray(objectMap, "key", s.Key, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageEncryptedAssetDecryptionData. +func (s *StorageEncryptedAssetDecryptionData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "assetFileEncryptionMetadata": + err = unpopulate(val, &s.AssetFileEncryptionMetadata) + delete(rawMsg, key) + case "key": + err = runtime.DecodeByteArray(string(val), &s.Key, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StreamingEndpoint - The streaming endpoint. +type StreamingEndpoint struct { + TrackedResource + // The streaming endpoint properties. + Properties *StreamingEndpointProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpoint. +func (s StreamingEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// StreamingEndpointAccessControl - Streaming endpoint access control definition. +type StreamingEndpointAccessControl struct { + // The access control of Akamai + Akamai *AkamaiAccessControl `json:"akamai,omitempty"` + + // The IP access control of the streaming endpoint. + IP *IPAccessControl `json:"ip,omitempty"` +} + +// StreamingEndpointListResult - The streaming endpoint list result. +type StreamingEndpointListResult struct { + // The number of result. + ODataCount *int32 `json:"@odata.count,omitempty"` + + // The link to the next set of results. Not empty if value contains incomplete list of streaming endpoints. + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // The result of the List StreamingEndpoint operation. + Value []*StreamingEndpoint `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointListResult. +func (s StreamingEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.count", s.ODataCount) + populate(objectMap, "@odata.nextLink", s.ODataNextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StreamingEndpointProperties - The streaming endpoint properties. +type StreamingEndpointProperties struct { + // REQUIRED; The number of scale units. Use the Scale operation to adjust this value. + ScaleUnits *int32 `json:"scaleUnits,omitempty"` + + // The access control definition of the streaming endpoint. + AccessControl *StreamingEndpointAccessControl `json:"accessControl,omitempty"` + + // This feature is deprecated, do not set a value for this property. + AvailabilitySetName *string `json:"availabilitySetName,omitempty"` + + // The CDN enabled flag. + CdnEnabled *bool `json:"cdnEnabled,omitempty"` + + // The CDN profile name. + CdnProfile *string `json:"cdnProfile,omitempty"` + + // The CDN provider name. + CdnProvider *string `json:"cdnProvider,omitempty"` + + // The streaming endpoint access policies. + CrossSiteAccessPolicies *CrossSiteAccessPolicies `json:"crossSiteAccessPolicies,omitempty"` + + // The custom host names of the streaming endpoint + CustomHostNames []*string `json:"customHostNames,omitempty"` + + // The streaming endpoint description. + Description *string `json:"description,omitempty"` + + // Max cache age + MaxCacheAge *int64 `json:"maxCacheAge,omitempty"` + + // READ-ONLY; The exact time the streaming endpoint was created. + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The free trial expiration time. + FreeTrialEndTime *time.Time `json:"freeTrialEndTime,omitempty" azure:"ro"` + + // READ-ONLY; The streaming endpoint host name. + HostName *string `json:"hostName,omitempty" azure:"ro"` + + // READ-ONLY; The exact time the streaming endpoint was last modified. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the streaming endpoint. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The resource state of the streaming endpoint. + ResourceState *StreamingEndpointResourceState `json:"resourceState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingEndpointProperties. +func (s StreamingEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessControl", s.AccessControl) + populate(objectMap, "availabilitySetName", s.AvailabilitySetName) + populate(objectMap, "cdnEnabled", s.CdnEnabled) + populate(objectMap, "cdnProfile", s.CdnProfile) + populate(objectMap, "cdnProvider", s.CdnProvider) + populate(objectMap, "created", (*timeRFC3339)(s.Created)) + populate(objectMap, "crossSiteAccessPolicies", s.CrossSiteAccessPolicies) + populate(objectMap, "customHostNames", s.CustomHostNames) + populate(objectMap, "description", s.Description) + populate(objectMap, "freeTrialEndTime", (*timeRFC3339)(s.FreeTrialEndTime)) + populate(objectMap, "hostName", s.HostName) + populate(objectMap, "lastModified", (*timeRFC3339)(s.LastModified)) + populate(objectMap, "maxCacheAge", s.MaxCacheAge) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "resourceState", s.ResourceState) + populate(objectMap, "scaleUnits", s.ScaleUnits) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingEndpointProperties. +func (s *StreamingEndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "accessControl": + err = unpopulate(val, &s.AccessControl) + delete(rawMsg, key) + case "availabilitySetName": + err = unpopulate(val, &s.AvailabilitySetName) + delete(rawMsg, key) + case "cdnEnabled": + err = unpopulate(val, &s.CdnEnabled) + delete(rawMsg, key) + case "cdnProfile": + err = unpopulate(val, &s.CdnProfile) + delete(rawMsg, key) + case "cdnProvider": + err = unpopulate(val, &s.CdnProvider) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "crossSiteAccessPolicies": + err = unpopulate(val, &s.CrossSiteAccessPolicies) + delete(rawMsg, key) + case "customHostNames": + err = unpopulate(val, &s.CustomHostNames) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &s.Description) + delete(rawMsg, key) + case "freeTrialEndTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.FreeTrialEndTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, &s.HostName) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "maxCacheAge": + err = unpopulate(val, &s.MaxCacheAge) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &s.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &s.ResourceState) + delete(rawMsg, key) + case "scaleUnits": + err = unpopulate(val, &s.ScaleUnits) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StreamingEndpointsBeginCreateOptions contains the optional parameters for the StreamingEndpoints.BeginCreate method. +type StreamingEndpointsBeginCreateOptions struct { + // The flag indicates if the resource should be automatically started on creation. + AutoStart *bool +} + +// StreamingEndpointsBeginDeleteOptions contains the optional parameters for the StreamingEndpoints.BeginDelete method. +type StreamingEndpointsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// StreamingEndpointsBeginScaleOptions contains the optional parameters for the StreamingEndpoints.BeginScale method. +type StreamingEndpointsBeginScaleOptions struct { + // placeholder for future optional parameters +} + +// StreamingEndpointsBeginStartOptions contains the optional parameters for the StreamingEndpoints.BeginStart method. +type StreamingEndpointsBeginStartOptions struct { + // placeholder for future optional parameters +} + +// StreamingEndpointsBeginStopOptions contains the optional parameters for the StreamingEndpoints.BeginStop method. +type StreamingEndpointsBeginStopOptions struct { + // placeholder for future optional parameters +} + +// StreamingEndpointsBeginUpdateOptions contains the optional parameters for the StreamingEndpoints.BeginUpdate method. +type StreamingEndpointsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// StreamingEndpointsGetOptions contains the optional parameters for the StreamingEndpoints.Get method. +type StreamingEndpointsGetOptions struct { + // placeholder for future optional parameters +} + +// StreamingEndpointsListOptions contains the optional parameters for the StreamingEndpoints.List method. +type StreamingEndpointsListOptions struct { + // placeholder for future optional parameters +} + +// StreamingEntityScaleUnit - scale units definition +type StreamingEntityScaleUnit struct { + // The scale unit number of the streaming endpoint. + ScaleUnit *int32 `json:"scaleUnit,omitempty"` +} + +// StreamingLocator - A Streaming Locator resource +type StreamingLocator struct { + ProxyResource + // Properties of the Streaming Locator. + Properties *StreamingLocatorProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocator. +func (s StreamingLocator) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// StreamingLocatorCollection - A collection of StreamingLocator items. +type StreamingLocatorCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of StreamingLocator items. + Value []*StreamingLocator `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorCollection. +func (s StreamingLocatorCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", s.ODataNextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StreamingLocatorContentKey - Class for content key in Streaming Locator +type StreamingLocatorContentKey struct { + // REQUIRED; ID of Content Key + ID *string `json:"id,omitempty"` + + // Label of Content Key as specified in the Streaming Policy + LabelReferenceInStreamingPolicy *string `json:"labelReferenceInStreamingPolicy,omitempty"` + + // Value of Content Key + Value *string `json:"value,omitempty"` + + // READ-ONLY; ContentKeyPolicy used by Content Key + PolicyName *string `json:"policyName,omitempty" azure:"ro"` + + // READ-ONLY; Tracks which use this Content Key + Tracks []*TrackSelection `json:"tracks,omitempty" azure:"ro"` + + // READ-ONLY; Encryption type of Content Key + Type *StreamingLocatorContentKeyType `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorContentKey. +func (s StreamingLocatorContentKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "labelReferenceInStreamingPolicy", s.LabelReferenceInStreamingPolicy) + populate(objectMap, "policyName", s.PolicyName) + populate(objectMap, "tracks", s.Tracks) + populate(objectMap, "type", s.Type) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StreamingLocatorProperties - Properties of the Streaming Locator. +type StreamingLocatorProperties struct { + // REQUIRED; Asset Name + AssetName *string `json:"assetName,omitempty"` + + // REQUIRED; Name of the Streaming Policy used by this Streaming Locator. Either specify the name of Streaming Policy you created or use one of the predefined + // Streaming Policies. The predefined Streaming Policies + // available are: 'PredefinedDownloadOnly', 'PredefinedClearStreamingOnly', 'PredefinedDownloadAndClearStreaming', 'PredefinedClearKey', 'PredefinedMultiDrmCencStreaming' + // and 'Predefined + // MultiDrmStreaming' + StreamingPolicyName *string `json:"streamingPolicyName,omitempty"` + + // Alternative Media ID of this Streaming Locator + AlternativeMediaID *string `json:"alternativeMediaId,omitempty"` + + // The ContentKeys used by this Streaming Locator. + ContentKeys []*StreamingLocatorContentKey `json:"contentKeys,omitempty"` + + // Name of the default ContentKeyPolicy used by this Streaming Locator. + DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` + + // The end time of the Streaming Locator. + EndTime *time.Time `json:"endTime,omitempty"` + + // A list of asset or account filters which apply to this streaming locator + Filters []*string `json:"filters,omitempty"` + + // The start time of the Streaming Locator. + StartTime *time.Time `json:"startTime,omitempty"` + + // The StreamingLocatorId of the Streaming Locator. + StreamingLocatorID *string `json:"streamingLocatorId,omitempty"` + + // READ-ONLY; The creation time of the Streaming Locator. + Created *time.Time `json:"created,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingLocatorProperties. +func (s StreamingLocatorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alternativeMediaId", s.AlternativeMediaID) + populate(objectMap, "assetName", s.AssetName) + populate(objectMap, "contentKeys", s.ContentKeys) + populate(objectMap, "created", (*timeRFC3339)(s.Created)) + populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) + populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populate(objectMap, "filters", s.Filters) + populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populate(objectMap, "streamingLocatorId", s.StreamingLocatorID) + populate(objectMap, "streamingPolicyName", s.StreamingPolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingLocatorProperties. +func (s *StreamingLocatorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "alternativeMediaId": + err = unpopulate(val, &s.AlternativeMediaID) + delete(rawMsg, key) + case "assetName": + err = unpopulate(val, &s.AssetName) + delete(rawMsg, key) + case "contentKeys": + err = unpopulate(val, &s.ContentKeys) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "defaultContentKeyPolicyName": + err = unpopulate(val, &s.DefaultContentKeyPolicyName) + delete(rawMsg, key) + case "endTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.EndTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "filters": + err = unpopulate(val, &s.Filters) + delete(rawMsg, key) + case "startTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.StartTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "streamingLocatorId": + err = unpopulate(val, &s.StreamingLocatorID) + delete(rawMsg, key) + case "streamingPolicyName": + err = unpopulate(val, &s.StreamingPolicyName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StreamingLocatorsCreateOptions contains the optional parameters for the StreamingLocators.Create method. +type StreamingLocatorsCreateOptions struct { + // placeholder for future optional parameters +} + +// StreamingLocatorsDeleteOptions contains the optional parameters for the StreamingLocators.Delete method. +type StreamingLocatorsDeleteOptions struct { + // placeholder for future optional parameters +} + +// StreamingLocatorsGetOptions contains the optional parameters for the StreamingLocators.Get method. +type StreamingLocatorsGetOptions struct { + // placeholder for future optional parameters +} + +// StreamingLocatorsListContentKeysOptions contains the optional parameters for the StreamingLocators.ListContentKeys method. +type StreamingLocatorsListContentKeysOptions struct { + // placeholder for future optional parameters +} + +// StreamingLocatorsListOptions contains the optional parameters for the StreamingLocators.List method. +type StreamingLocatorsListOptions struct { + // Restricts the set of items returned. + Filter *string + // Specifies the key by which the result collection should be ordered. + Orderby *string + // 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. + Top *int32 +} + +// StreamingLocatorsListPathsOptions contains the optional parameters for the StreamingLocators.ListPaths method. +type StreamingLocatorsListPathsOptions struct { + // placeholder for future optional parameters +} + +// StreamingPath - Class of paths for streaming +type StreamingPath struct { + // REQUIRED; Encryption scheme + EncryptionScheme *EncryptionScheme `json:"encryptionScheme,omitempty"` + + // REQUIRED; Streaming protocol + StreamingProtocol *StreamingPolicyStreamingProtocol `json:"streamingProtocol,omitempty"` + + // Streaming paths for each protocol and encryptionScheme pair + Paths []*string `json:"paths,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPath. +func (s StreamingPath) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptionScheme", s.EncryptionScheme) + populate(objectMap, "paths", s.Paths) + populate(objectMap, "streamingProtocol", s.StreamingProtocol) + return json.Marshal(objectMap) +} + +// StreamingPoliciesCreateOptions contains the optional parameters for the StreamingPolicies.Create method. +type StreamingPoliciesCreateOptions struct { + // placeholder for future optional parameters +} + +// StreamingPoliciesDeleteOptions contains the optional parameters for the StreamingPolicies.Delete method. +type StreamingPoliciesDeleteOptions struct { + // placeholder for future optional parameters +} + +// StreamingPoliciesGetOptions contains the optional parameters for the StreamingPolicies.Get method. +type StreamingPoliciesGetOptions struct { + // placeholder for future optional parameters +} + +// StreamingPoliciesListOptions contains the optional parameters for the StreamingPolicies.List method. +type StreamingPoliciesListOptions struct { + // Restricts the set of items returned. + Filter *string + // Specifies the key by which the result collection should be ordered. + Orderby *string + // 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. + Top *int32 +} + +// StreamingPolicy - A Streaming Policy resource +type StreamingPolicy struct { + ProxyResource + // Class to specify properties of Streaming Policy + Properties *StreamingPolicyProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicy. +func (s StreamingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// StreamingPolicyCollection - A collection of StreamingPolicy items. +type StreamingPolicyCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of StreamingPolicy items. + Value []*StreamingPolicy `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyCollection. +func (s StreamingPolicyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", s.ODataNextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StreamingPolicyContentKey - Class to specify properties of content key +type StreamingPolicyContentKey struct { + // Label can be used to specify Content Key when creating a Streaming Locator + Label *string `json:"label,omitempty"` + + // Policy used by Content Key + PolicyName *string `json:"policyName,omitempty"` + + // Tracks which use this content key + Tracks []*TrackSelection `json:"tracks,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyContentKey. +func (s StreamingPolicyContentKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "label", s.Label) + populate(objectMap, "policyName", s.PolicyName) + populate(objectMap, "tracks", s.Tracks) + return json.Marshal(objectMap) +} + +// StreamingPolicyContentKeys - Class to specify properties of all content keys in Streaming Policy +type StreamingPolicyContentKeys struct { + // Default content key for an encryption scheme + DefaultKey *DefaultKey `json:"defaultKey,omitempty"` + + // Representing tracks needs separate content key + KeyToTrackMappings []*StreamingPolicyContentKey `json:"keyToTrackMappings,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyContentKeys. +func (s StreamingPolicyContentKeys) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultKey", s.DefaultKey) + populate(objectMap, "keyToTrackMappings", s.KeyToTrackMappings) + return json.Marshal(objectMap) +} + +// StreamingPolicyFairPlayConfiguration - Class to specify configurations of FairPlay in Streaming Policy +type StreamingPolicyFairPlayConfiguration struct { + // REQUIRED; All license to be persistent or not + AllowPersistentLicense *bool `json:"allowPersistentLicense,omitempty"` + + // Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. + // The template supports replaceable tokens that the + // service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced + // with the value of + // StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. + CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` +} + +// StreamingPolicyPlayReadyConfiguration - Class to specify configurations of PlayReady in Streaming Policy +type StreamingPolicyPlayReadyConfiguration struct { + // Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. + // The template supports replaceable tokens that the + // service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced + // with the value of + // StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. + CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` + + // Custom attributes for PlayReady + PlayReadyCustomAttributes *string `json:"playReadyCustomAttributes,omitempty"` +} + +// StreamingPolicyProperties - Class to specify properties of Streaming Policy +type StreamingPolicyProperties struct { + // Configuration of CommonEncryptionCbcs + CommonEncryptionCbcs *CommonEncryptionCbcs `json:"commonEncryptionCbcs,omitempty"` + + // Configuration of CommonEncryptionCenc + CommonEncryptionCenc *CommonEncryptionCenc `json:"commonEncryptionCenc,omitempty"` + + // Default ContentKey used by current Streaming Policy + DefaultContentKeyPolicyName *string `json:"defaultContentKeyPolicyName,omitempty"` + + // Configuration of EnvelopeEncryption + EnvelopeEncryption *EnvelopeEncryption `json:"envelopeEncryption,omitempty"` + + // Configurations of NoEncryption + NoEncryption *NoEncryption `json:"noEncryption,omitempty"` + + // READ-ONLY; Creation time of Streaming Policy + Created *time.Time `json:"created,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StreamingPolicyProperties. +func (s StreamingPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "commonEncryptionCbcs", s.CommonEncryptionCbcs) + populate(objectMap, "commonEncryptionCenc", s.CommonEncryptionCenc) + populate(objectMap, "created", (*timeRFC3339)(s.Created)) + populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) + populate(objectMap, "envelopeEncryption", s.EnvelopeEncryption) + populate(objectMap, "noEncryption", s.NoEncryption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StreamingPolicyProperties. +func (s *StreamingPolicyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "commonEncryptionCbcs": + err = unpopulate(val, &s.CommonEncryptionCbcs) + delete(rawMsg, key) + case "commonEncryptionCenc": + err = unpopulate(val, &s.CommonEncryptionCenc) + delete(rawMsg, key) + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "defaultContentKeyPolicyName": + err = unpopulate(val, &s.DefaultContentKeyPolicyName) + delete(rawMsg, key) + case "envelopeEncryption": + err = unpopulate(val, &s.EnvelopeEncryption) + delete(rawMsg, key) + case "noEncryption": + err = unpopulate(val, &s.NoEncryption) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StreamingPolicyWidevineConfiguration - Class to specify configurations of Widevine in Streaming Policy +type StreamingPolicyWidevineConfiguration struct { + // Template for the URL of the custom service delivering licenses to end user players. Not required when using Azure Media Services for issuing licenses. + // The template supports replaceable tokens that the + // service will update at runtime with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is replaced + // with the value of + // StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the key being requested. + CustomLicenseAcquisitionURLTemplate *string `json:"customLicenseAcquisitionUrlTemplate,omitempty"` +} + +// SyncStorageKeysInput - The input to the sync storage keys request. +type SyncStorageKeysInput struct { + // The ID of the storage account resource. + ID *string `json:"id,omitempty"` +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.CreatedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + var aux timeRFC3339 + err = unpopulate(val, &aux) + s.LastModifiedAt = (*time.Time)(&aux) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TrackDescriptorClassification provides polymorphic access to related types. +// Call the interface's GetTrackDescriptor() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AudioTrackDescriptor, *SelectAudioTrackByAttribute, *SelectAudioTrackById, *SelectVideoTrackByAttribute, *SelectVideoTrackById, +// - *TrackDescriptor, *VideoTrackDescriptor +type TrackDescriptorClassification interface { + // GetTrackDescriptor returns the TrackDescriptor content of the underlying type. + GetTrackDescriptor() *TrackDescriptor +} + +// TrackDescriptor - Base type for all TrackDescriptor types, which define the metadata and selection for tracks that should be processed by a Job +type TrackDescriptor struct { + // REQUIRED; The discriminator for derived types. + ODataType *string `json:"@odata.type,omitempty"` +} + +// GetTrackDescriptor implements the TrackDescriptorClassification interface for type TrackDescriptor. +func (t *TrackDescriptor) GetTrackDescriptor() *TrackDescriptor { return t } + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackDescriptor. +func (t *TrackDescriptor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return t.unmarshalInternal(rawMsg) +} + +func (t TrackDescriptor) marshalInternal(objectMap map[string]interface{}, discValue string) { + t.ODataType = &discValue + objectMap["@odata.type"] = t.ODataType +} + +func (t *TrackDescriptor) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "@odata.type": + err = unpopulate(val, &t.ODataType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TrackPropertyCondition - Class to specify one track property condition +type TrackPropertyCondition struct { + // REQUIRED; Track property condition operation + Operation *TrackPropertyCompareOperation `json:"operation,omitempty"` + + // REQUIRED; Track property type + Property *TrackPropertyType `json:"property,omitempty"` + + // Track property value + Value *string `json:"value,omitempty"` +} + +// TrackSelection - Class to select a track +type TrackSelection struct { + // TrackSelections is a track property condition list which can specify track(s) + TrackSelections []*TrackPropertyCondition `json:"trackSelections,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TrackSelection. +func (t TrackSelection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "trackSelections", t.TrackSelections) + return json.Marshal(objectMap) +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' +type TrackedResource struct { + Resource + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.marshalInternal(objectMap) + return json.Marshal(objectMap) +} + +func (t TrackedResource) marshalInternal(objectMap map[string]interface{}) { + t.Resource.marshalInternal(objectMap) + populate(objectMap, "location", t.Location) + populate(objectMap, "tags", t.Tags) +} + +// Transform - A Transform encapsulates the rules or instructions for generating desired outputs from input media, such as by transcoding or by extracting +// insights. After the Transform is created, it can be applied +// to input media by creating Jobs. +type Transform struct { + ProxyResource + // The resource properties. + Properties *TransformProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type Transform. +func (t Transform) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + return json.Marshal(objectMap) +} + +// TransformCollection - A collection of Transform items. +type TransformCollection struct { + // A link to the next page of the collection (when the collection contains too many results to return in one response). + ODataNextLink *string `json:"@odata.nextLink,omitempty"` + + // A collection of Transform items. + Value []*Transform `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TransformCollection. +func (t TransformCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "@odata.nextLink", t.ODataNextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// TransformOutput - Describes the properties of a TransformOutput, which are the rules to be applied while generating the desired output. +type TransformOutput struct { + // REQUIRED; Preset that describes the operations that will be used to modify, transcode, or extract insights from the source file to generate the output. + Preset PresetClassification `json:"preset,omitempty"` + + // A Transform can define more than one outputs. This property defines what the service should do when one output fails - either continue to produce other + // outputs, or, stop the other outputs. The overall + // Job state will not reflect failures of outputs that are specified with 'ContinueJob'. The default is 'StopProcessingJob'. + OnError *OnErrorType `json:"onError,omitempty"` + + // Sets the relative priority of the TransformOutputs within a Transform. This sets the priority that the service uses for processing TransformOutputs. + // The default priority is Normal. + RelativePriority *Priority `json:"relativePriority,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type TransformOutput. +func (t TransformOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "onError", t.OnError) + populate(objectMap, "preset", t.Preset) + populate(objectMap, "relativePriority", t.RelativePriority) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransformOutput. +func (t *TransformOutput) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "onError": + err = unpopulate(val, &t.OnError) + delete(rawMsg, key) + case "preset": + t.Preset, err = unmarshalPresetClassification(val) + delete(rawMsg, key) + case "relativePriority": + err = unpopulate(val, &t.RelativePriority) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TransformProperties - A Transform. +type TransformProperties struct { + // REQUIRED; An array of one or more TransformOutputs that the Transform should generate. + Outputs []*TransformOutput `json:"outputs,omitempty"` + + // An optional verbose description of the Transform. + Description *string `json:"description,omitempty"` + + // READ-ONLY; The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' format. + Created *time.Time `json:"created,omitempty" azure:"ro"` + + // READ-ONLY; The UTC date and time when the Transform was last updated, in 'YYYY-MM-DDThh:mm:ssZ' format. + LastModified *time.Time `json:"lastModified,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type TransformProperties. +func (t TransformProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "created", (*timeRFC3339)(t.Created)) + populate(objectMap, "description", t.Description) + populate(objectMap, "lastModified", (*timeRFC3339)(t.LastModified)) + populate(objectMap, "outputs", t.Outputs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransformProperties. +func (t *TransformProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "created": + var aux timeRFC3339 + err = unpopulate(val, &aux) + t.Created = (*time.Time)(&aux) + delete(rawMsg, key) + case "description": + err = unpopulate(val, &t.Description) + delete(rawMsg, key) + case "lastModified": + var aux timeRFC3339 + err = unpopulate(val, &aux) + t.LastModified = (*time.Time)(&aux) + delete(rawMsg, key) + case "outputs": + err = unpopulate(val, &t.Outputs) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// TransformsCreateOrUpdateOptions contains the optional parameters for the Transforms.CreateOrUpdate method. +type TransformsCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TransformsDeleteOptions contains the optional parameters for the Transforms.Delete method. +type TransformsDeleteOptions struct { + // placeholder for future optional parameters +} + +// TransformsGetOptions contains the optional parameters for the Transforms.Get method. +type TransformsGetOptions struct { + // placeholder for future optional parameters +} + +// TransformsListOptions contains the optional parameters for the Transforms.List method. +type TransformsListOptions struct { + // Restricts the set of items returned. + Filter *string + // Specifies the key by which the result collection should be ordered. + Orderby *string +} + +// TransformsUpdateOptions contains the optional parameters for the Transforms.Update method. +type TransformsUpdateOptions struct { + // placeholder for future optional parameters +} + +// TransportStreamFormat - Describes the properties for generating an MPEG-2 Transport Stream (ISO/IEC 13818-1) output video file(s). +type TransportStreamFormat struct { + MultiBitrateFormat +} + +// MarshalJSON implements the json.Marshaller interface for type TransportStreamFormat. +func (t TransportStreamFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + t.MultiBitrateFormat.marshalInternal(objectMap, "#Microsoft.Media.TransportStreamFormat") + return json.Marshal(objectMap) +} + +// UTCClipTime - Specifies the clip time as a Utc time position in the media file. The Utc time can point to a different position depending on whether the +// media file starts from a timestamp of zero or not. +type UTCClipTime struct { + ClipTime + // REQUIRED; The time position on the timeline of the input media based on Utc time. + Time *time.Time `json:"time,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type UTCClipTime. +func (u UTCClipTime) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + u.ClipTime.marshalInternal(objectMap, "#Microsoft.Media.UtcClipTime") + populate(objectMap, "time", (*timeRFC3339)(u.Time)) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UTCClipTime. +func (u *UTCClipTime) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "time": + var aux timeRFC3339 + err = unpopulate(val, &aux) + u.Time = (*time.Time)(&aux) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := u.ClipTime.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +type UserAssignedManagedIdentity struct { + // READ-ONLY; The client ID. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal ID. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} + +// VideoClassification provides polymorphic access to related types. +// Call the interface's GetVideo() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *H264Video, *H265Video, *Image, *JpgImage, *PngImage, *Video +type VideoClassification interface { + CodecClassification + // GetVideo returns the Video content of the underlying type. + GetVideo() *Video +} + +// Video - Describes the basic properties for encoding the input video. +type Video struct { + Codec + // The distance between two key frames. The value should be non-zero in the range [0.5, 20] seconds, specified in ISO 8601 format. The default is 2 seconds(PT2S). + // Note that this setting is ignored if + // VideoSyncMode.Passthrough is set, where the KeyFrameInterval value will follow the input source setting. + KeyFrameInterval *string `json:"keyFrameInterval,omitempty"` + + // The resizing mode - how the input video will be resized to fit the desired output resolution(s). Default is AutoSize + StretchMode *StretchMode `json:"stretchMode,omitempty"` + + // The Video Sync Mode + SyncMode *VideoSyncMode `json:"syncMode,omitempty"` +} + +// GetVideo implements the VideoClassification interface for type Video. +func (v *Video) GetVideo() *Video { return v } + +// UnmarshalJSON implements the json.Unmarshaller interface for type Video. +func (v *Video) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return v.unmarshalInternal(rawMsg) +} + +func (v Video) marshalInternal(objectMap map[string]interface{}, discValue string) { + v.Codec.marshalInternal(objectMap, discValue) + populate(objectMap, "keyFrameInterval", v.KeyFrameInterval) + populate(objectMap, "stretchMode", v.StretchMode) + populate(objectMap, "syncMode", v.SyncMode) +} + +func (v *Video) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "keyFrameInterval": + err = unpopulate(val, &v.KeyFrameInterval) + delete(rawMsg, key) + case "stretchMode": + err = unpopulate(val, &v.StretchMode) + delete(rawMsg, key) + case "syncMode": + err = unpopulate(val, &v.SyncMode) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.Codec.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VideoAnalyzerPreset - A video analyzer preset that extracts insights (rich metadata) from both audio and video, and outputs a JSON format file. +type VideoAnalyzerPreset struct { + AudioAnalyzerPreset + // Defines the type of insights that you want the service to generate. The allowed values are 'AudioInsightsOnly', 'VideoInsightsOnly', and 'AllInsights'. + // The default is AllInsights. If you set this to + // AllInsights and the input is audio only, then only audio insights are generated. Similarly if the input is video only, then only video insights are generated. + // It is recommended that you not use + // AudioInsightsOnly if you expect some of your inputs to be video only; or use VideoInsightsOnly if you expect some of your inputs to be audio only. Your + // Jobs in such conditions would error out. + InsightsToExtract *InsightsType `json:"insightsToExtract,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VideoAnalyzerPreset. +func (v VideoAnalyzerPreset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.AudioAnalyzerPreset.marshalInternal(objectMap, "#Microsoft.Media.VideoAnalyzerPreset") + populate(objectMap, "insightsToExtract", v.InsightsToExtract) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoAnalyzerPreset. +func (v *VideoAnalyzerPreset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "insightsToExtract": + err = unpopulate(val, &v.InsightsToExtract) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.AudioAnalyzerPreset.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VideoLayerClassification provides polymorphic access to related types. +// Call the interface's GetVideoLayer() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *H264Layer, *VideoLayer +type VideoLayerClassification interface { + LayerClassification + // GetVideoLayer returns the VideoLayer content of the underlying type. + GetVideoLayer() *VideoLayer +} + +// VideoLayer - Describes the settings to be used when encoding the input video into a desired output bitrate layer. +type VideoLayer struct { + Layer + // REQUIRED; The average bitrate in bits per second at which to encode the input video when generating this layer. This is a required field. + Bitrate *int32 `json:"bitrate,omitempty"` + + // Whether or not adaptive B-frames are to be used when encoding this layer. If not specified, the encoder will turn it on whenever the video profile permits + // its use. + AdaptiveBFrame *bool `json:"adaptiveBFrame,omitempty"` + + // The number of B-frames to be used when encoding this layer. If not specified, the encoder chooses an appropriate number based on the video profile and + // level. + BFrames *int32 `json:"bFrames,omitempty"` + + // The frame rate (in frames per second) at which to encode this layer. The value can be in the form of M/N where M and N are integers (For example, 30000/1001), + // or in the form of a number (For example, + // 30, or 29.97). The encoder enforces constraints on allowed frame rates based on the profile and level. If it is not specified, the encoder will use the + // same frame rate as the input video. + FrameRate *string `json:"frameRate,omitempty"` + + // The maximum bitrate (in bits per second), at which the VBV buffer should be assumed to refill. If not specified, defaults to the same value as bitrate. + MaxBitrate *int32 `json:"maxBitrate,omitempty"` + + // The number of slices to be used when encoding this layer. If not specified, default is zero, which means that encoder will use a single slice for each + // frame. + Slices *int32 `json:"slices,omitempty"` +} + +// GetVideoLayer implements the VideoLayerClassification interface for type VideoLayer. +func (v *VideoLayer) GetVideoLayer() *VideoLayer { return v } + +// MarshalJSON implements the json.Marshaller interface for type VideoLayer. +func (v VideoLayer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.marshalInternal(objectMap, "#Microsoft.Media.VideoLayer") + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoLayer. +func (v *VideoLayer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return v.unmarshalInternal(rawMsg) +} + +func (v VideoLayer) marshalInternal(objectMap map[string]interface{}, discValue string) { + v.Layer.marshalInternal(objectMap, discValue) + populate(objectMap, "adaptiveBFrame", v.AdaptiveBFrame) + populate(objectMap, "bFrames", v.BFrames) + populate(objectMap, "bitrate", v.Bitrate) + populate(objectMap, "frameRate", v.FrameRate) + populate(objectMap, "maxBitrate", v.MaxBitrate) + populate(objectMap, "slices", v.Slices) +} + +func (v *VideoLayer) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "adaptiveBFrame": + err = unpopulate(val, &v.AdaptiveBFrame) + delete(rawMsg, key) + case "bFrames": + err = unpopulate(val, &v.BFrames) + delete(rawMsg, key) + case "bitrate": + err = unpopulate(val, &v.Bitrate) + delete(rawMsg, key) + case "frameRate": + err = unpopulate(val, &v.FrameRate) + delete(rawMsg, key) + case "maxBitrate": + err = unpopulate(val, &v.MaxBitrate) + delete(rawMsg, key) + case "slices": + err = unpopulate(val, &v.Slices) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.Layer.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VideoOverlay - Describes the properties of a video overlay. +type VideoOverlay struct { + Overlay + // An optional rectangular window used to crop the overlay image or video. + CropRectangle *Rectangle `json:"cropRectangle,omitempty"` + + // The opacity of the overlay. This is a value in the range [0 - 1.0]. Default is 1.0 which mean the overlay is opaque. + Opacity *float64 `json:"opacity,omitempty"` + + // The location in the input video where the overlay is applied. + Position *Rectangle `json:"position,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VideoOverlay. +func (v VideoOverlay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.Overlay.marshalInternal(objectMap, "#Microsoft.Media.VideoOverlay") + populate(objectMap, "cropRectangle", v.CropRectangle) + populate(objectMap, "opacity", v.Opacity) + populate(objectMap, "position", v.Position) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VideoOverlay. +func (v *VideoOverlay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "cropRectangle": + err = unpopulate(val, &v.CropRectangle) + delete(rawMsg, key) + case "opacity": + err = unpopulate(val, &v.Opacity) + delete(rawMsg, key) + case "position": + err = unpopulate(val, &v.Position) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.Overlay.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VideoTrackDescriptorClassification provides polymorphic access to related types. +// Call the interface's GetVideoTrackDescriptor() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *SelectVideoTrackByAttribute, *SelectVideoTrackById, *VideoTrackDescriptor +type VideoTrackDescriptorClassification interface { + TrackDescriptorClassification + // GetVideoTrackDescriptor returns the VideoTrackDescriptor content of the underlying type. + GetVideoTrackDescriptor() *VideoTrackDescriptor +} + +// VideoTrackDescriptor - A TrackSelection to select video tracks. +type VideoTrackDescriptor struct { + TrackDescriptor +} + +// GetVideoTrackDescriptor implements the VideoTrackDescriptorClassification interface for type VideoTrackDescriptor. +func (v *VideoTrackDescriptor) GetVideoTrackDescriptor() *VideoTrackDescriptor { return v } + +// MarshalJSON implements the json.Marshaller interface for type VideoTrackDescriptor. +func (v VideoTrackDescriptor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.marshalInternal(objectMap, "#Microsoft.Media.VideoTrackDescriptor") + return json.Marshal(objectMap) +} + +func (v VideoTrackDescriptor) marshalInternal(objectMap map[string]interface{}, discValue string) { + v.TrackDescriptor.marshalInternal(objectMap, discValue) +} + +func (v *VideoTrackDescriptor) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + if err := v.TrackDescriptor.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray(m map[string]interface{}, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go new file mode 100644 index 000000000000..d957efa06c27 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go @@ -0,0 +1,84 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +func NewOperationsClient(con *arm.Connection) *OperationsClient { + return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +} + +// List - Lists all the Media Services operations. +// If the operation fails it returns the *ErrorResponse error type. +func (client *OperationsClient) List(ctx context.Context, options *OperationsListOptions) (OperationsListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Media/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationCollection); err != nil { + return OperationsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go new file mode 100644 index 000000000000..dff63fd5d4e0 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go @@ -0,0 +1,720 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "net/http" + "reflect" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// AccountFiltersListPager provides operations for iterating over paged responses. +type AccountFiltersListPager struct { + client *AccountFiltersClient + current AccountFiltersListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AccountFiltersListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AccountFiltersListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AccountFiltersListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AccountFilterCollection.ODataNextLink == nil || len(*p.current.AccountFilterCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AccountFiltersListResponse page. +func (p *AccountFiltersListPager) PageResponse() AccountFiltersListResponse { + return p.current +} + +// AssetFiltersListPager provides operations for iterating over paged responses. +type AssetFiltersListPager struct { + client *AssetFiltersClient + current AssetFiltersListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AssetFiltersListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AssetFiltersListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AssetFiltersListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AssetFilterCollection.ODataNextLink == nil || len(*p.current.AssetFilterCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AssetFiltersListResponse page. +func (p *AssetFiltersListPager) PageResponse() AssetFiltersListResponse { + return p.current +} + +// AssetsListPager provides operations for iterating over paged responses. +type AssetsListPager struct { + client *AssetsClient + current AssetsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AssetsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *AssetsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AssetsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.AssetCollection.ODataNextLink == nil || len(*p.current.AssetCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current AssetsListResponse page. +func (p *AssetsListPager) PageResponse() AssetsListResponse { + return p.current +} + +// ContentKeyPoliciesListPager provides operations for iterating over paged responses. +type ContentKeyPoliciesListPager struct { + client *ContentKeyPoliciesClient + current ContentKeyPoliciesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ContentKeyPoliciesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ContentKeyPoliciesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ContentKeyPoliciesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ContentKeyPolicyCollection.ODataNextLink == nil || len(*p.current.ContentKeyPolicyCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ContentKeyPoliciesListResponse page. +func (p *ContentKeyPoliciesListPager) PageResponse() ContentKeyPoliciesListResponse { + return p.current +} + +// JobsListPager provides operations for iterating over paged responses. +type JobsListPager struct { + client *JobsClient + current JobsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, JobsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *JobsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *JobsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.JobCollection.ODataNextLink == nil || len(*p.current.JobCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current JobsListResponse page. +func (p *JobsListPager) PageResponse() JobsListResponse { + return p.current +} + +// LiveEventsListPager provides operations for iterating over paged responses. +type LiveEventsListPager struct { + client *LiveEventsClient + current LiveEventsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, LiveEventsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *LiveEventsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *LiveEventsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.LiveEventListResult.ODataNextLink == nil || len(*p.current.LiveEventListResult.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current LiveEventsListResponse page. +func (p *LiveEventsListPager) PageResponse() LiveEventsListResponse { + return p.current +} + +// LiveOutputsListPager provides operations for iterating over paged responses. +type LiveOutputsListPager struct { + client *LiveOutputsClient + current LiveOutputsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, LiveOutputsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *LiveOutputsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *LiveOutputsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.LiveOutputListResult.ODataNextLink == nil || len(*p.current.LiveOutputListResult.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current LiveOutputsListResponse page. +func (p *LiveOutputsListPager) PageResponse() LiveOutputsListResponse { + return p.current +} + +// MediaservicesListBySubscriptionPager provides operations for iterating over paged responses. +type MediaservicesListBySubscriptionPager struct { + client *MediaservicesClient + current MediaservicesListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, MediaservicesListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *MediaservicesListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *MediaservicesListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.MediaServiceCollection.ODataNextLink == nil || len(*p.current.MediaServiceCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current MediaservicesListBySubscriptionResponse page. +func (p *MediaservicesListBySubscriptionPager) PageResponse() MediaservicesListBySubscriptionResponse { + return p.current +} + +// MediaservicesListPager provides operations for iterating over paged responses. +type MediaservicesListPager struct { + client *MediaservicesClient + current MediaservicesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, MediaservicesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *MediaservicesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *MediaservicesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.MediaServiceCollection.ODataNextLink == nil || len(*p.current.MediaServiceCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current MediaservicesListResponse page. +func (p *MediaservicesListPager) PageResponse() MediaservicesListResponse { + return p.current +} + +// StreamingEndpointsListPager provides operations for iterating over paged responses. +type StreamingEndpointsListPager struct { + client *StreamingEndpointsClient + current StreamingEndpointsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StreamingEndpointsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StreamingEndpointsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StreamingEndpointsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StreamingEndpointListResult.ODataNextLink == nil || len(*p.current.StreamingEndpointListResult.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StreamingEndpointsListResponse page. +func (p *StreamingEndpointsListPager) PageResponse() StreamingEndpointsListResponse { + return p.current +} + +// StreamingLocatorsListPager provides operations for iterating over paged responses. +type StreamingLocatorsListPager struct { + client *StreamingLocatorsClient + current StreamingLocatorsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StreamingLocatorsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StreamingLocatorsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StreamingLocatorsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StreamingLocatorCollection.ODataNextLink == nil || len(*p.current.StreamingLocatorCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StreamingLocatorsListResponse page. +func (p *StreamingLocatorsListPager) PageResponse() StreamingLocatorsListResponse { + return p.current +} + +// StreamingPoliciesListPager provides operations for iterating over paged responses. +type StreamingPoliciesListPager struct { + client *StreamingPoliciesClient + current StreamingPoliciesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StreamingPoliciesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StreamingPoliciesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StreamingPoliciesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StreamingPolicyCollection.ODataNextLink == nil || len(*p.current.StreamingPolicyCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StreamingPoliciesListResponse page. +func (p *StreamingPoliciesListPager) PageResponse() StreamingPoliciesListResponse { + return p.current +} + +// TransformsListPager provides operations for iterating over paged responses. +type TransformsListPager struct { + client *TransformsClient + current TransformsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, TransformsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *TransformsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *TransformsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.TransformCollection.ODataNextLink == nil || len(*p.current.TransformCollection.ODataNextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current TransformsListResponse page. +func (p *TransformsListPager) PageResponse() TransformsListResponse { + return p.current +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go new file mode 100644 index 000000000000..f08a66e34141 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go @@ -0,0 +1,661 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) + +// LiveEventsAllocatePoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsAllocatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsAllocatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsAllocatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsAllocateResponse will be returned. +func (p *LiveEventsAllocatePoller) FinalResponse(ctx context.Context) (LiveEventsAllocateResponse, error) { + respType := LiveEventsAllocateResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return LiveEventsAllocateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsAllocatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveEventsCreatePoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsCreatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsCreatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsCreateResponse will be returned. +func (p *LiveEventsCreatePoller) FinalResponse(ctx context.Context) (LiveEventsCreateResponse, error) { + respType := LiveEventsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.LiveEvent) + if err != nil { + return LiveEventsCreateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveEventsDeletePoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsDeleteResponse will be returned. +func (p *LiveEventsDeletePoller) FinalResponse(ctx context.Context) (LiveEventsDeleteResponse, error) { + respType := LiveEventsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return LiveEventsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveEventsResetPoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsResetPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsResetPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsResetPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsResetResponse will be returned. +func (p *LiveEventsResetPoller) FinalResponse(ctx context.Context) (LiveEventsResetResponse, error) { + respType := LiveEventsResetResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return LiveEventsResetResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsResetPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveEventsStartPoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsStartResponse will be returned. +func (p *LiveEventsStartPoller) FinalResponse(ctx context.Context) (LiveEventsStartResponse, error) { + respType := LiveEventsStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return LiveEventsStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveEventsStopPoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsStopPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsStopPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsStopPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsStopResponse will be returned. +func (p *LiveEventsStopPoller) FinalResponse(ctx context.Context) (LiveEventsStopResponse, error) { + respType := LiveEventsStopResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return LiveEventsStopResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsStopPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveEventsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type LiveEventsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveEventsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveEventsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveEventsUpdateResponse will be returned. +func (p *LiveEventsUpdatePoller) FinalResponse(ctx context.Context) (LiveEventsUpdateResponse, error) { + respType := LiveEventsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.LiveEvent) + if err != nil { + return LiveEventsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveEventsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveOutputsCreatePoller provides polling facilities until the operation reaches a terminal state. +type LiveOutputsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveOutputsCreatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveOutputsCreatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveOutputsCreateResponse will be returned. +func (p *LiveOutputsCreatePoller) FinalResponse(ctx context.Context) (LiveOutputsCreateResponse, error) { + respType := LiveOutputsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.LiveOutput) + if err != nil { + return LiveOutputsCreateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveOutputsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// LiveOutputsDeletePoller provides polling facilities until the operation reaches a terminal state. +type LiveOutputsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LiveOutputsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LiveOutputsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LiveOutputsDeleteResponse will be returned. +func (p *LiveOutputsDeletePoller) FinalResponse(ctx context.Context) (LiveOutputsDeleteResponse, error) { + respType := LiveOutputsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return LiveOutputsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LiveOutputsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingEndpointsCreatePoller provides polling facilities until the operation reaches a terminal state. +type StreamingEndpointsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingEndpointsCreatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingEndpointsCreatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingEndpointsCreateResponse will be returned. +func (p *StreamingEndpointsCreatePoller) FinalResponse(ctx context.Context) (StreamingEndpointsCreateResponse, error) { + respType := StreamingEndpointsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.StreamingEndpoint) + if err != nil { + return StreamingEndpointsCreateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingEndpointsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingEndpointsDeletePoller provides polling facilities until the operation reaches a terminal state. +type StreamingEndpointsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingEndpointsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingEndpointsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingEndpointsDeleteResponse will be returned. +func (p *StreamingEndpointsDeletePoller) FinalResponse(ctx context.Context) (StreamingEndpointsDeleteResponse, error) { + respType := StreamingEndpointsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingEndpointsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingEndpointsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingEndpointsScalePoller provides polling facilities until the operation reaches a terminal state. +type StreamingEndpointsScalePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingEndpointsScalePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingEndpointsScalePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingEndpointsScaleResponse will be returned. +func (p *StreamingEndpointsScalePoller) FinalResponse(ctx context.Context) (StreamingEndpointsScaleResponse, error) { + respType := StreamingEndpointsScaleResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingEndpointsScaleResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingEndpointsScalePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingEndpointsStartPoller provides polling facilities until the operation reaches a terminal state. +type StreamingEndpointsStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingEndpointsStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingEndpointsStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingEndpointsStartResponse will be returned. +func (p *StreamingEndpointsStartPoller) FinalResponse(ctx context.Context) (StreamingEndpointsStartResponse, error) { + respType := StreamingEndpointsStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingEndpointsStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingEndpointsStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingEndpointsStopPoller provides polling facilities until the operation reaches a terminal state. +type StreamingEndpointsStopPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingEndpointsStopPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingEndpointsStopPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingEndpointsStopResponse will be returned. +func (p *StreamingEndpointsStopPoller) FinalResponse(ctx context.Context) (StreamingEndpointsStopResponse, error) { + respType := StreamingEndpointsStopResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StreamingEndpointsStopResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingEndpointsStopPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StreamingEndpointsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type StreamingEndpointsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StreamingEndpointsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StreamingEndpointsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StreamingEndpointsUpdateResponse will be returned. +func (p *StreamingEndpointsUpdatePoller) FinalResponse(ctx context.Context) (StreamingEndpointsUpdateResponse, error) { + respType := StreamingEndpointsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.StreamingEndpoint) + if err != nil { + return StreamingEndpointsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StreamingEndpointsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..379fdff6a6f2 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go @@ -0,0 +1,1046 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import "encoding/json" + +func unmarshalAudioAnalyzerPresetClassification(rawMsg json.RawMessage) (AudioAnalyzerPresetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AudioAnalyzerPresetClassification + switch m["@odata.type"] { + case "#Microsoft.Media.VideoAnalyzerPreset": + b = &VideoAnalyzerPreset{} + default: + b = &AudioAnalyzerPreset{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAudioAnalyzerPresetClassificationArray(rawMsg json.RawMessage) ([]AudioAnalyzerPresetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]AudioAnalyzerPresetClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalAudioAnalyzerPresetClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalAudioClassification(rawMsg json.RawMessage) (AudioClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AudioClassification + switch m["@odata.type"] { + case "#Microsoft.Media.AacAudio": + b = &AacAudio{} + default: + b = &Audio{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAudioClassificationArray(rawMsg json.RawMessage) ([]AudioClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]AudioClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalAudioClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalAudioTrackDescriptorClassification(rawMsg json.RawMessage) (AudioTrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AudioTrackDescriptorClassification + switch m["@odata.type"] { + case "#Microsoft.Media.SelectAudioTrackByAttribute": + b = &SelectAudioTrackByAttribute{} + case "#Microsoft.Media.SelectAudioTrackById": + b = &SelectAudioTrackByID{} + default: + b = &AudioTrackDescriptor{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalAudioTrackDescriptorClassificationArray(rawMsg json.RawMessage) ([]AudioTrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]AudioTrackDescriptorClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalAudioTrackDescriptorClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalClipTimeClassification(rawMsg json.RawMessage) (ClipTimeClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ClipTimeClassification + switch m["@odata.type"] { + case "#Microsoft.Media.AbsoluteClipTime": + b = &AbsoluteClipTime{} + case "#Microsoft.Media.UtcClipTime": + b = &UTCClipTime{} + default: + b = &ClipTime{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalClipTimeClassificationArray(rawMsg json.RawMessage) ([]ClipTimeClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ClipTimeClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalClipTimeClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalCodecClassification(rawMsg json.RawMessage) (CodecClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b CodecClassification + switch m["@odata.type"] { + case "#Microsoft.Media.AacAudio": + b = &AacAudio{} + case "#Microsoft.Media.Audio": + b = &Audio{} + case "#Microsoft.Media.CopyAudio": + b = &CopyAudio{} + case "#Microsoft.Media.CopyVideo": + b = &CopyVideo{} + case "#Microsoft.Media.H264Video": + b = &H264Video{} + case "#Microsoft.Media.H265Video": + b = &H265Video{} + case "#Microsoft.Media.Image": + b = &Image{} + case "#Microsoft.Media.JpgImage": + b = &JpgImage{} + case "#Microsoft.Media.PngImage": + b = &PNGImage{} + case "#Microsoft.Media.Video": + b = &Video{} + default: + b = &Codec{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalCodecClassificationArray(rawMsg json.RawMessage) ([]CodecClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]CodecClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalCodecClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalContentKeyPolicyConfigurationClassification(rawMsg json.RawMessage) (ContentKeyPolicyConfigurationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ContentKeyPolicyConfigurationClassification + switch m["@odata.type"] { + case "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration": + b = &ContentKeyPolicyClearKeyConfiguration{} + case "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration": + b = &ContentKeyPolicyFairPlayConfiguration{} + case "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration": + b = &ContentKeyPolicyPlayReadyConfiguration{} + case "#Microsoft.Media.ContentKeyPolicyUnknownConfiguration": + b = &ContentKeyPolicyUnknownConfiguration{} + case "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration": + b = &ContentKeyPolicyWidevineConfiguration{} + default: + b = &ContentKeyPolicyConfiguration{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalContentKeyPolicyConfigurationClassificationArray(rawMsg json.RawMessage) ([]ContentKeyPolicyConfigurationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ContentKeyPolicyConfigurationClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyConfigurationClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(rawMsg json.RawMessage) (ContentKeyPolicyPlayReadyContentKeyLocationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ContentKeyPolicyPlayReadyContentKeyLocationClassification + switch m["@odata.type"] { + case "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader": + b = &ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{} + case "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier": + b = &ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier{} + default: + b = &ContentKeyPolicyPlayReadyContentKeyLocation{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassificationArray(rawMsg json.RawMessage) ([]ContentKeyPolicyPlayReadyContentKeyLocationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ContentKeyPolicyPlayReadyContentKeyLocationClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalContentKeyPolicyRestrictionClassification(rawMsg json.RawMessage) (ContentKeyPolicyRestrictionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ContentKeyPolicyRestrictionClassification + switch m["@odata.type"] { + case "#Microsoft.Media.ContentKeyPolicyOpenRestriction": + b = &ContentKeyPolicyOpenRestriction{} + case "#Microsoft.Media.ContentKeyPolicyTokenRestriction": + b = &ContentKeyPolicyTokenRestriction{} + case "#Microsoft.Media.ContentKeyPolicyUnknownRestriction": + b = &ContentKeyPolicyUnknownRestriction{} + default: + b = &ContentKeyPolicyRestriction{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalContentKeyPolicyRestrictionClassificationArray(rawMsg json.RawMessage) ([]ContentKeyPolicyRestrictionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ContentKeyPolicyRestrictionClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyRestrictionClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalContentKeyPolicyRestrictionTokenKeyClassification(rawMsg json.RawMessage) (ContentKeyPolicyRestrictionTokenKeyClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ContentKeyPolicyRestrictionTokenKeyClassification + switch m["@odata.type"] { + case "#Microsoft.Media.ContentKeyPolicyRsaTokenKey": + b = &ContentKeyPolicyRsaTokenKey{} + case "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey": + b = &ContentKeyPolicySymmetricTokenKey{} + case "#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey": + b = &ContentKeyPolicyX509CertificateTokenKey{} + default: + b = &ContentKeyPolicyRestrictionTokenKey{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalContentKeyPolicyRestrictionTokenKeyClassificationArray(rawMsg json.RawMessage) ([]ContentKeyPolicyRestrictionTokenKeyClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ContentKeyPolicyRestrictionTokenKeyClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyRestrictionTokenKeyClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalFormatClassification(rawMsg json.RawMessage) (FormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b FormatClassification + switch m["@odata.type"] { + case "#Microsoft.Media.ImageFormat": + b = &ImageFormat{} + case "#Microsoft.Media.JpgFormat": + b = &JpgFormat{} + case "#Microsoft.Media.Mp4Format": + b = &Mp4Format{} + case "#Microsoft.Media.MultiBitrateFormat": + b = &MultiBitrateFormat{} + case "#Microsoft.Media.PngFormat": + b = &PNGFormat{} + case "#Microsoft.Media.TransportStreamFormat": + b = &TransportStreamFormat{} + default: + b = &Format{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalFormatClassificationArray(rawMsg json.RawMessage) ([]FormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]FormatClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalH265VideoLayerClassification(rawMsg json.RawMessage) (H265VideoLayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b H265VideoLayerClassification + switch m["@odata.type"] { + case "#Microsoft.Media.H265Layer": + b = &H265Layer{} + default: + b = &H265VideoLayer{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalH265VideoLayerClassificationArray(rawMsg json.RawMessage) ([]H265VideoLayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]H265VideoLayerClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalH265VideoLayerClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalImageClassification(rawMsg json.RawMessage) (ImageClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ImageClassification + switch m["@odata.type"] { + case "#Microsoft.Media.JpgImage": + b = &JpgImage{} + case "#Microsoft.Media.PngImage": + b = &PNGImage{} + default: + b = &Image{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalImageClassificationArray(rawMsg json.RawMessage) ([]ImageClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ImageClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalImageClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalImageFormatClassification(rawMsg json.RawMessage) (ImageFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ImageFormatClassification + switch m["@odata.type"] { + case "#Microsoft.Media.JpgFormat": + b = &JpgFormat{} + case "#Microsoft.Media.PngFormat": + b = &PNGFormat{} + default: + b = &ImageFormat{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalImageFormatClassificationArray(rawMsg json.RawMessage) ([]ImageFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ImageFormatClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalImageFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalInputDefinitionClassification(rawMsg json.RawMessage) (InputDefinitionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b InputDefinitionClassification + switch m["@odata.type"] { + case "#Microsoft.Media.FromAllInputFile": + b = &FromAllInputFile{} + case "#Microsoft.Media.FromEachInputFile": + b = &FromEachInputFile{} + case "#Microsoft.Media.InputFile": + b = &InputFile{} + default: + b = &InputDefinition{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalInputDefinitionClassificationArray(rawMsg json.RawMessage) ([]InputDefinitionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]InputDefinitionClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalInputDefinitionClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalJobInputClassification(rawMsg json.RawMessage) (JobInputClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JobInputClassification + switch m["@odata.type"] { + case "#Microsoft.Media.JobInputAsset": + b = &JobInputAsset{} + case "#Microsoft.Media.JobInputClip": + b = &JobInputClip{} + case "#Microsoft.Media.JobInputHttp": + b = &JobInputHTTP{} + case "#Microsoft.Media.JobInputSequence": + b = &JobInputSequence{} + case "#Microsoft.Media.JobInputs": + b = &JobInputs{} + default: + b = &JobInput{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalJobInputClassificationArray(rawMsg json.RawMessage) ([]JobInputClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]JobInputClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalJobInputClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalJobInputClipClassification(rawMsg json.RawMessage) (JobInputClipClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JobInputClipClassification + switch m["@odata.type"] { + case "#Microsoft.Media.JobInputAsset": + b = &JobInputAsset{} + case "#Microsoft.Media.JobInputHttp": + b = &JobInputHTTP{} + default: + b = &JobInputClip{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalJobInputClipClassificationArray(rawMsg json.RawMessage) ([]JobInputClipClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]JobInputClipClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalJobInputClipClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalJobOutputClassification(rawMsg json.RawMessage) (JobOutputClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JobOutputClassification + switch m["@odata.type"] { + case "#Microsoft.Media.JobOutputAsset": + b = &JobOutputAsset{} + default: + b = &JobOutput{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalJobOutputClassificationArray(rawMsg json.RawMessage) ([]JobOutputClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]JobOutputClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalJobOutputClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalLayerClassification(rawMsg json.RawMessage) (LayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b LayerClassification + switch m["@odata.type"] { + case "#Microsoft.Media.H264Layer": + b = &H264Layer{} + case "#Microsoft.Media.H265Layer": + b = &H265Layer{} + case "#Microsoft.Media.H265VideoLayer": + b = &H265VideoLayer{} + case "#Microsoft.Media.JpgLayer": + b = &JpgLayer{} + case "#Microsoft.Media.PngLayer": + b = &PNGLayer{} + case "#Microsoft.Media.VideoLayer": + b = &VideoLayer{} + default: + b = &Layer{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalLayerClassificationArray(rawMsg json.RawMessage) ([]LayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]LayerClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalLayerClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalMultiBitrateFormatClassification(rawMsg json.RawMessage) (MultiBitrateFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b MultiBitrateFormatClassification + switch m["@odata.type"] { + case "#Microsoft.Media.Mp4Format": + b = &Mp4Format{} + case "#Microsoft.Media.TransportStreamFormat": + b = &TransportStreamFormat{} + default: + b = &MultiBitrateFormat{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalMultiBitrateFormatClassificationArray(rawMsg json.RawMessage) ([]MultiBitrateFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]MultiBitrateFormatClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalMultiBitrateFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalOverlayClassification(rawMsg json.RawMessage) (OverlayClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b OverlayClassification + switch m["@odata.type"] { + case "#Microsoft.Media.AudioOverlay": + b = &AudioOverlay{} + case "#Microsoft.Media.VideoOverlay": + b = &VideoOverlay{} + default: + b = &Overlay{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalOverlayClassificationArray(rawMsg json.RawMessage) ([]OverlayClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]OverlayClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalOverlayClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalPresetClassification(rawMsg json.RawMessage) (PresetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b PresetClassification + switch m["@odata.type"] { + case "#Microsoft.Media.AudioAnalyzerPreset": + b = &AudioAnalyzerPreset{} + case "#Microsoft.Media.BuiltInStandardEncoderPreset": + b = &BuiltInStandardEncoderPreset{} + case "#Microsoft.Media.FaceDetectorPreset": + b = &FaceDetectorPreset{} + case "#Microsoft.Media.StandardEncoderPreset": + b = &StandardEncoderPreset{} + case "#Microsoft.Media.VideoAnalyzerPreset": + b = &VideoAnalyzerPreset{} + default: + b = &Preset{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalPresetClassificationArray(rawMsg json.RawMessage) ([]PresetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]PresetClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalPresetClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalTrackDescriptorClassification(rawMsg json.RawMessage) (TrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b TrackDescriptorClassification + switch m["@odata.type"] { + case "#Microsoft.Media.AudioTrackDescriptor": + b = &AudioTrackDescriptor{} + case "#Microsoft.Media.SelectAudioTrackByAttribute": + b = &SelectAudioTrackByAttribute{} + case "#Microsoft.Media.SelectAudioTrackById": + b = &SelectAudioTrackByID{} + case "#Microsoft.Media.SelectVideoTrackByAttribute": + b = &SelectVideoTrackByAttribute{} + case "#Microsoft.Media.SelectVideoTrackById": + b = &SelectVideoTrackByID{} + case "#Microsoft.Media.VideoTrackDescriptor": + b = &VideoTrackDescriptor{} + default: + b = &TrackDescriptor{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalTrackDescriptorClassificationArray(rawMsg json.RawMessage) ([]TrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]TrackDescriptorClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalTrackDescriptorClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalVideoClassification(rawMsg json.RawMessage) (VideoClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b VideoClassification + switch m["@odata.type"] { + case "#Microsoft.Media.H264Video": + b = &H264Video{} + case "#Microsoft.Media.H265Video": + b = &H265Video{} + case "#Microsoft.Media.Image": + b = &Image{} + case "#Microsoft.Media.JpgImage": + b = &JpgImage{} + case "#Microsoft.Media.PngImage": + b = &PNGImage{} + default: + b = &Video{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalVideoClassificationArray(rawMsg json.RawMessage) ([]VideoClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]VideoClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalVideoClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalVideoLayerClassification(rawMsg json.RawMessage) (VideoLayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b VideoLayerClassification + switch m["@odata.type"] { + case "#Microsoft.Media.H264Layer": + b = &H264Layer{} + default: + b = &VideoLayer{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalVideoLayerClassificationArray(rawMsg json.RawMessage) ([]VideoLayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]VideoLayerClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalVideoLayerClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalVideoTrackDescriptorClassification(rawMsg json.RawMessage) (VideoTrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b VideoTrackDescriptorClassification + switch m["@odata.type"] { + case "#Microsoft.Media.SelectVideoTrackByAttribute": + b = &SelectVideoTrackByAttribute{} + case "#Microsoft.Media.SelectVideoTrackById": + b = &SelectVideoTrackByID{} + default: + b = &VideoTrackDescriptor{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalVideoTrackDescriptorClassificationArray(rawMsg json.RawMessage) ([]VideoTrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]VideoTrackDescriptorClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalVideoTrackDescriptorClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go new file mode 100644 index 000000000000..a8c00e4d3fff --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go @@ -0,0 +1,298 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Update private endpoint connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, name string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsCreateOrUpdateOptions) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, name, parameters, options) + if err != nil { + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, name string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { + result := PrivateEndpointConnectionsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Delete private endpoint connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, name string, options *PrivateEndpointConnectionsDeleteOptions) (PrivateEndpointConnectionsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, name, options) + if err != nil { + return PrivateEndpointConnectionsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return PrivateEndpointConnectionsDeleteResponse{}, client.deleteHandleError(resp) + } + return PrivateEndpointConnectionsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, name string, options *PrivateEndpointConnectionsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *PrivateEndpointConnectionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get private endpoint connection. +// If the operation fails it returns the *ErrorResponse error type. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, accountName string, name string, options *PrivateEndpointConnectionsGetOptions) (PrivateEndpointConnectionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, name, options) + if err != nil { + return PrivateEndpointConnectionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, name string, options *PrivateEndpointConnectionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { + result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateEndpointConnectionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Get all private endpoint connections. +// If the operation fails it returns the *ErrorResponse error type. +func (client *PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsListOptions) (PrivateEndpointConnectionsListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateEndpointConnectionsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateEndpointConnectionsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { + result := PrivateEndpointConnectionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateEndpointConnectionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go new file mode 100644 index 000000000000..3f2956544409 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go @@ -0,0 +1,169 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { + return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// Get - Get group ID. +// If the operation fails it returns the *ErrorResponse error type. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, accountName string, name string, options *PrivateLinkResourcesGetOptions) (PrivateLinkResourcesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, name, options) + if err != nil { + return PrivateLinkResourcesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, name string, options *PrivateLinkResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources/{name}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { + result := PrivateLinkResourcesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *PrivateLinkResourcesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Get list of group IDs. +// If the operation fails it returns the *ErrorResponse error type. +func (client *PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesListOptions) (PrivateLinkResourcesListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) + if err != nil { + return PrivateLinkResourcesListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *PrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { + result := PrivateLinkResourcesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *PrivateLinkResourcesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go new file mode 100644 index 000000000000..3544909512a5 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go @@ -0,0 +1,1439 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "net/http" + "time" + + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" +) + +// AccountFiltersCreateOrUpdateResponse contains the response from method AccountFilters.CreateOrUpdate. +type AccountFiltersCreateOrUpdateResponse struct { + AccountFiltersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountFiltersCreateOrUpdateResult contains the result from method AccountFilters.CreateOrUpdate. +type AccountFiltersCreateOrUpdateResult struct { + AccountFilter +} + +// AccountFiltersDeleteResponse contains the response from method AccountFilters.Delete. +type AccountFiltersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountFiltersGetResponse contains the response from method AccountFilters.Get. +type AccountFiltersGetResponse struct { + AccountFiltersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountFiltersGetResult contains the result from method AccountFilters.Get. +type AccountFiltersGetResult struct { + AccountFilter +} + +// AccountFiltersListResponse contains the response from method AccountFilters.List. +type AccountFiltersListResponse struct { + AccountFiltersListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountFiltersListResult contains the result from method AccountFilters.List. +type AccountFiltersListResult struct { + AccountFilterCollection +} + +// AccountFiltersUpdateResponse contains the response from method AccountFilters.Update. +type AccountFiltersUpdateResponse struct { + AccountFiltersUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AccountFiltersUpdateResult contains the result from method AccountFilters.Update. +type AccountFiltersUpdateResult struct { + AccountFilter +} + +// AssetFiltersCreateOrUpdateResponse contains the response from method AssetFilters.CreateOrUpdate. +type AssetFiltersCreateOrUpdateResponse struct { + AssetFiltersCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetFiltersCreateOrUpdateResult contains the result from method AssetFilters.CreateOrUpdate. +type AssetFiltersCreateOrUpdateResult struct { + AssetFilter +} + +// AssetFiltersDeleteResponse contains the response from method AssetFilters.Delete. +type AssetFiltersDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetFiltersGetResponse contains the response from method AssetFilters.Get. +type AssetFiltersGetResponse struct { + AssetFiltersGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetFiltersGetResult contains the result from method AssetFilters.Get. +type AssetFiltersGetResult struct { + AssetFilter +} + +// AssetFiltersListResponse contains the response from method AssetFilters.List. +type AssetFiltersListResponse struct { + AssetFiltersListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetFiltersListResult contains the result from method AssetFilters.List. +type AssetFiltersListResult struct { + AssetFilterCollection +} + +// AssetFiltersUpdateResponse contains the response from method AssetFilters.Update. +type AssetFiltersUpdateResponse struct { + AssetFiltersUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetFiltersUpdateResult contains the result from method AssetFilters.Update. +type AssetFiltersUpdateResult struct { + AssetFilter +} + +// AssetsCreateOrUpdateResponse contains the response from method Assets.CreateOrUpdate. +type AssetsCreateOrUpdateResponse struct { + AssetsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsCreateOrUpdateResult contains the result from method Assets.CreateOrUpdate. +type AssetsCreateOrUpdateResult struct { + Asset +} + +// AssetsDeleteResponse contains the response from method Assets.Delete. +type AssetsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsGetEncryptionKeyResponse contains the response from method Assets.GetEncryptionKey. +type AssetsGetEncryptionKeyResponse struct { + AssetsGetEncryptionKeyResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsGetEncryptionKeyResult contains the result from method Assets.GetEncryptionKey. +type AssetsGetEncryptionKeyResult struct { + StorageEncryptedAssetDecryptionData +} + +// AssetsGetResponse contains the response from method Assets.Get. +type AssetsGetResponse struct { + AssetsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsGetResult contains the result from method Assets.Get. +type AssetsGetResult struct { + Asset +} + +// AssetsListContainerSasResponse contains the response from method Assets.ListContainerSas. +type AssetsListContainerSasResponse struct { + AssetsListContainerSasResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsListContainerSasResult contains the result from method Assets.ListContainerSas. +type AssetsListContainerSasResult struct { + AssetContainerSas +} + +// AssetsListResponse contains the response from method Assets.List. +type AssetsListResponse struct { + AssetsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsListResult contains the result from method Assets.List. +type AssetsListResult struct { + AssetCollection +} + +// AssetsListStreamingLocatorsResponse contains the response from method Assets.ListStreamingLocators. +type AssetsListStreamingLocatorsResponse struct { + AssetsListStreamingLocatorsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsListStreamingLocatorsResult contains the result from method Assets.ListStreamingLocators. +type AssetsListStreamingLocatorsResult struct { + ListStreamingLocatorsResponse +} + +// AssetsUpdateResponse contains the response from method Assets.Update. +type AssetsUpdateResponse struct { + AssetsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// AssetsUpdateResult contains the result from method Assets.Update. +type AssetsUpdateResult struct { + Asset +} + +// ContentKeyPoliciesCreateOrUpdateResponse contains the response from method ContentKeyPolicies.CreateOrUpdate. +type ContentKeyPoliciesCreateOrUpdateResponse struct { + ContentKeyPoliciesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContentKeyPoliciesCreateOrUpdateResult contains the result from method ContentKeyPolicies.CreateOrUpdate. +type ContentKeyPoliciesCreateOrUpdateResult struct { + ContentKeyPolicy +} + +// ContentKeyPoliciesDeleteResponse contains the response from method ContentKeyPolicies.Delete. +type ContentKeyPoliciesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse contains the response from method ContentKeyPolicies.GetPolicyPropertiesWithSecrets. +type ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse struct { + ContentKeyPoliciesGetPolicyPropertiesWithSecretsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContentKeyPoliciesGetPolicyPropertiesWithSecretsResult contains the result from method ContentKeyPolicies.GetPolicyPropertiesWithSecrets. +type ContentKeyPoliciesGetPolicyPropertiesWithSecretsResult struct { + ContentKeyPolicyProperties +} + +// ContentKeyPoliciesGetResponse contains the response from method ContentKeyPolicies.Get. +type ContentKeyPoliciesGetResponse struct { + ContentKeyPoliciesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContentKeyPoliciesGetResult contains the result from method ContentKeyPolicies.Get. +type ContentKeyPoliciesGetResult struct { + ContentKeyPolicy +} + +// ContentKeyPoliciesListResponse contains the response from method ContentKeyPolicies.List. +type ContentKeyPoliciesListResponse struct { + ContentKeyPoliciesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContentKeyPoliciesListResult contains the result from method ContentKeyPolicies.List. +type ContentKeyPoliciesListResult struct { + ContentKeyPolicyCollection +} + +// ContentKeyPoliciesUpdateResponse contains the response from method ContentKeyPolicies.Update. +type ContentKeyPoliciesUpdateResponse struct { + ContentKeyPoliciesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ContentKeyPoliciesUpdateResult contains the result from method ContentKeyPolicies.Update. +type ContentKeyPoliciesUpdateResult struct { + ContentKeyPolicy +} + +// JobsCancelJobResponse contains the response from method Jobs.CancelJob. +type JobsCancelJobResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsCreateResponse contains the response from method Jobs.Create. +type JobsCreateResponse struct { + JobsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsCreateResult contains the result from method Jobs.Create. +type JobsCreateResult struct { + Job +} + +// JobsDeleteResponse contains the response from method Jobs.Delete. +type JobsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsGetResponse contains the response from method Jobs.Get. +type JobsGetResponse struct { + JobsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsGetResult contains the result from method Jobs.Get. +type JobsGetResult struct { + Job +} + +// JobsListResponse contains the response from method Jobs.List. +type JobsListResponse struct { + JobsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsListResult contains the result from method Jobs.List. +type JobsListResult struct { + JobCollection +} + +// JobsUpdateResponse contains the response from method Jobs.Update. +type JobsUpdateResponse struct { + JobsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// JobsUpdateResult contains the result from method Jobs.Update. +type JobsUpdateResult struct { + Job +} + +// LiveEventsAllocatePollerResponse contains the response from method LiveEvents.Allocate. +type LiveEventsAllocatePollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsAllocatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsAllocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsAllocateResponse, error) { + respType := LiveEventsAllocateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsAllocatePollerResponse from the provided client and resume token. +func (l *LiveEventsAllocatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Allocate", token, client.pl, client.allocateHandleError) + if err != nil { + return err + } + poller := &LiveEventsAllocatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsAllocateResponse contains the response from method LiveEvents.Allocate. +type LiveEventsAllocateResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsCreatePollerResponse contains the response from method LiveEvents.Create. +type LiveEventsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsCreatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsCreateResponse, error) { + respType := LiveEventsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveEvent) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsCreatePollerResponse from the provided client and resume token. +func (l *LiveEventsCreatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &LiveEventsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsCreateResponse contains the response from method LiveEvents.Create. +type LiveEventsCreateResponse struct { + LiveEventsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsCreateResult contains the result from method LiveEvents.Create. +type LiveEventsCreateResult struct { + LiveEvent +} + +// LiveEventsDeletePollerResponse contains the response from method LiveEvents.Delete. +type LiveEventsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsDeleteResponse, error) { + respType := LiveEventsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsDeletePollerResponse from the provided client and resume token. +func (l *LiveEventsDeletePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &LiveEventsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsDeleteResponse contains the response from method LiveEvents.Delete. +type LiveEventsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsGetResponse contains the response from method LiveEvents.Get. +type LiveEventsGetResponse struct { + LiveEventsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsGetResult contains the result from method LiveEvents.Get. +type LiveEventsGetResult struct { + LiveEvent +} + +// LiveEventsListResponse contains the response from method LiveEvents.List. +type LiveEventsListResponse struct { + LiveEventsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsListResult contains the result from method LiveEvents.List. +type LiveEventsListResult struct { + LiveEventListResult +} + +// LiveEventsResetPollerResponse contains the response from method LiveEvents.Reset. +type LiveEventsResetPollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsResetPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsResetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsResetResponse, error) { + respType := LiveEventsResetResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsResetPollerResponse from the provided client and resume token. +func (l *LiveEventsResetPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Reset", token, client.pl, client.resetHandleError) + if err != nil { + return err + } + poller := &LiveEventsResetPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsResetResponse contains the response from method LiveEvents.Reset. +type LiveEventsResetResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsStartPollerResponse contains the response from method LiveEvents.Start. +type LiveEventsStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsStartResponse, error) { + respType := LiveEventsStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsStartPollerResponse from the provided client and resume token. +func (l *LiveEventsStartPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &LiveEventsStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsStartResponse contains the response from method LiveEvents.Start. +type LiveEventsStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsStopPollerResponse contains the response from method LiveEvents.Stop. +type LiveEventsStopPollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsStopPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsStopResponse, error) { + respType := LiveEventsStopResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsStopPollerResponse from the provided client and resume token. +func (l *LiveEventsStopPollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Stop", token, client.pl, client.stopHandleError) + if err != nil { + return err + } + poller := &LiveEventsStopPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsStopResponse contains the response from method LiveEvents.Stop. +type LiveEventsStopResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsUpdatePollerResponse contains the response from method LiveEvents.Update. +type LiveEventsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveEventsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveEventsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsUpdateResponse, error) { + respType := LiveEventsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveEvent) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveEventsUpdatePollerResponse from the provided client and resume token. +func (l *LiveEventsUpdatePollerResponse) Resume(ctx context.Context, client *LiveEventsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveEventsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &LiveEventsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveEventsUpdateResponse contains the response from method LiveEvents.Update. +type LiveEventsUpdateResponse struct { + LiveEventsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveEventsUpdateResult contains the result from method LiveEvents.Update. +type LiveEventsUpdateResult struct { + LiveEvent +} + +// LiveOutputsCreatePollerResponse contains the response from method LiveOutputs.Create. +type LiveOutputsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveOutputsCreatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveOutputsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveOutputsCreateResponse, error) { + respType := LiveOutputsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveOutput) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveOutputsCreatePollerResponse from the provided client and resume token. +func (l *LiveOutputsCreatePollerResponse) Resume(ctx context.Context, client *LiveOutputsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveOutputsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &LiveOutputsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveOutputsCreateResponse contains the response from method LiveOutputs.Create. +type LiveOutputsCreateResponse struct { + LiveOutputsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveOutputsCreateResult contains the result from method LiveOutputs.Create. +type LiveOutputsCreateResult struct { + LiveOutput +} + +// LiveOutputsDeletePollerResponse contains the response from method LiveOutputs.Delete. +type LiveOutputsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *LiveOutputsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LiveOutputsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveOutputsDeleteResponse, error) { + respType := LiveOutputsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LiveOutputsDeletePollerResponse from the provided client and resume token. +func (l *LiveOutputsDeletePollerResponse) Resume(ctx context.Context, client *LiveOutputsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LiveOutputsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &LiveOutputsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LiveOutputsDeleteResponse contains the response from method LiveOutputs.Delete. +type LiveOutputsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveOutputsGetResponse contains the response from method LiveOutputs.Get. +type LiveOutputsGetResponse struct { + LiveOutputsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveOutputsGetResult contains the result from method LiveOutputs.Get. +type LiveOutputsGetResult struct { + LiveOutput +} + +// LiveOutputsListResponse contains the response from method LiveOutputs.List. +type LiveOutputsListResponse struct { + LiveOutputsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LiveOutputsListResult contains the result from method LiveOutputs.List. +type LiveOutputsListResult struct { + LiveOutputListResult +} + +// LocationsCheckNameAvailabilityResponse contains the response from method Locations.CheckNameAvailability. +type LocationsCheckNameAvailabilityResponse struct { + LocationsCheckNameAvailabilityResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LocationsCheckNameAvailabilityResult contains the result from method Locations.CheckNameAvailability. +type LocationsCheckNameAvailabilityResult struct { + EntityNameAvailabilityCheckOutput +} + +// MediaservicesCreateOrUpdateResponse contains the response from method Mediaservices.CreateOrUpdate. +type MediaservicesCreateOrUpdateResponse struct { + MediaservicesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesCreateOrUpdateResult contains the result from method Mediaservices.CreateOrUpdate. +type MediaservicesCreateOrUpdateResult struct { + MediaService +} + +// MediaservicesDeleteResponse contains the response from method Mediaservices.Delete. +type MediaservicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesGetResponse contains the response from method Mediaservices.Get. +type MediaservicesGetResponse struct { + MediaservicesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesGetResult contains the result from method Mediaservices.Get. +type MediaservicesGetResult struct { + MediaService +} + +// MediaservicesListBySubscriptionResponse contains the response from method Mediaservices.ListBySubscription. +type MediaservicesListBySubscriptionResponse struct { + MediaservicesListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesListBySubscriptionResult contains the result from method Mediaservices.ListBySubscription. +type MediaservicesListBySubscriptionResult struct { + MediaServiceCollection +} + +// MediaservicesListEdgePoliciesResponse contains the response from method Mediaservices.ListEdgePolicies. +type MediaservicesListEdgePoliciesResponse struct { + MediaservicesListEdgePoliciesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesListEdgePoliciesResult contains the result from method Mediaservices.ListEdgePolicies. +type MediaservicesListEdgePoliciesResult struct { + EdgePolicies +} + +// MediaservicesListResponse contains the response from method Mediaservices.List. +type MediaservicesListResponse struct { + MediaservicesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesListResult contains the result from method Mediaservices.List. +type MediaservicesListResult struct { + MediaServiceCollection +} + +// MediaservicesSyncStorageKeysResponse contains the response from method Mediaservices.SyncStorageKeys. +type MediaservicesSyncStorageKeysResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesUpdateResponse contains the response from method Mediaservices.Update. +type MediaservicesUpdateResponse struct { + MediaservicesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MediaservicesUpdateResult contains the result from method Mediaservices.Update. +type MediaservicesUpdateResult struct { + MediaService +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + OperationCollection +} + +// PrivateEndpointConnectionsCreateOrUpdateResponse contains the response from method PrivateEndpointConnections.CreateOrUpdate. +type PrivateEndpointConnectionsCreateOrUpdateResponse struct { + PrivateEndpointConnectionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsCreateOrUpdateResult contains the result from method PrivateEndpointConnections.CreateOrUpdate. +type PrivateEndpointConnectionsCreateOrUpdateResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsDeleteResponse contains the response from method PrivateEndpointConnections.Delete. +type PrivateEndpointConnectionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsGetResponse contains the response from method PrivateEndpointConnections.Get. +type PrivateEndpointConnectionsGetResponse struct { + PrivateEndpointConnectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsGetResult contains the result from method PrivateEndpointConnections.Get. +type PrivateEndpointConnectionsGetResult struct { + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsListResponse contains the response from method PrivateEndpointConnections.List. +type PrivateEndpointConnectionsListResponse struct { + PrivateEndpointConnectionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateEndpointConnectionsListResult contains the result from method PrivateEndpointConnections.List. +type PrivateEndpointConnectionsListResult struct { + PrivateEndpointConnectionListResult +} + +// PrivateLinkResourcesGetResponse contains the response from method PrivateLinkResources.Get. +type PrivateLinkResourcesGetResponse struct { + PrivateLinkResourcesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesGetResult contains the result from method PrivateLinkResources.Get. +type PrivateLinkResourcesGetResult struct { + PrivateLinkResource +} + +// PrivateLinkResourcesListResponse contains the response from method PrivateLinkResources.List. +type PrivateLinkResourcesListResponse struct { + PrivateLinkResourcesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrivateLinkResourcesListResult contains the result from method PrivateLinkResources.List. +type PrivateLinkResourcesListResult struct { + PrivateLinkResourceListResult +} + +// StreamingEndpointsCreatePollerResponse contains the response from method StreamingEndpoints.Create. +type StreamingEndpointsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingEndpointsCreatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingEndpointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsCreateResponse, error) { + respType := StreamingEndpointsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingEndpoint) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingEndpointsCreatePollerResponse from the provided client and resume token. +func (l *StreamingEndpointsCreatePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &StreamingEndpointsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingEndpointsCreateResponse contains the response from method StreamingEndpoints.Create. +type StreamingEndpointsCreateResponse struct { + StreamingEndpointsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsCreateResult contains the result from method StreamingEndpoints.Create. +type StreamingEndpointsCreateResult struct { + StreamingEndpoint +} + +// StreamingEndpointsDeletePollerResponse contains the response from method StreamingEndpoints.Delete. +type StreamingEndpointsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingEndpointsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingEndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsDeleteResponse, error) { + respType := StreamingEndpointsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingEndpointsDeletePollerResponse from the provided client and resume token. +func (l *StreamingEndpointsDeletePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &StreamingEndpointsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingEndpointsDeleteResponse contains the response from method StreamingEndpoints.Delete. +type StreamingEndpointsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsGetResponse contains the response from method StreamingEndpoints.Get. +type StreamingEndpointsGetResponse struct { + StreamingEndpointsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsGetResult contains the result from method StreamingEndpoints.Get. +type StreamingEndpointsGetResult struct { + StreamingEndpoint +} + +// StreamingEndpointsListResponse contains the response from method StreamingEndpoints.List. +type StreamingEndpointsListResponse struct { + StreamingEndpointsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsListResult contains the result from method StreamingEndpoints.List. +type StreamingEndpointsListResult struct { + StreamingEndpointListResult +} + +// StreamingEndpointsScalePollerResponse contains the response from method StreamingEndpoints.Scale. +type StreamingEndpointsScalePollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingEndpointsScalePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingEndpointsScalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsScaleResponse, error) { + respType := StreamingEndpointsScaleResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingEndpointsScalePollerResponse from the provided client and resume token. +func (l *StreamingEndpointsScalePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Scale", token, client.pl, client.scaleHandleError) + if err != nil { + return err + } + poller := &StreamingEndpointsScalePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingEndpointsScaleResponse contains the response from method StreamingEndpoints.Scale. +type StreamingEndpointsScaleResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsStartPollerResponse contains the response from method StreamingEndpoints.Start. +type StreamingEndpointsStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingEndpointsStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingEndpointsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsStartResponse, error) { + respType := StreamingEndpointsStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingEndpointsStartPollerResponse from the provided client and resume token. +func (l *StreamingEndpointsStartPollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &StreamingEndpointsStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingEndpointsStartResponse contains the response from method StreamingEndpoints.Start. +type StreamingEndpointsStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsStopPollerResponse contains the response from method StreamingEndpoints.Stop. +type StreamingEndpointsStopPollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingEndpointsStopPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingEndpointsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsStopResponse, error) { + respType := StreamingEndpointsStopResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingEndpointsStopPollerResponse from the provided client and resume token. +func (l *StreamingEndpointsStopPollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Stop", token, client.pl, client.stopHandleError) + if err != nil { + return err + } + poller := &StreamingEndpointsStopPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingEndpointsStopResponse contains the response from method StreamingEndpoints.Stop. +type StreamingEndpointsStopResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsUpdatePollerResponse contains the response from method StreamingEndpoints.Update. +type StreamingEndpointsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *StreamingEndpointsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l StreamingEndpointsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsUpdateResponse, error) { + respType := StreamingEndpointsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingEndpoint) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StreamingEndpointsUpdatePollerResponse from the provided client and resume token. +func (l *StreamingEndpointsUpdatePollerResponse) Resume(ctx context.Context, client *StreamingEndpointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StreamingEndpointsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &StreamingEndpointsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StreamingEndpointsUpdateResponse contains the response from method StreamingEndpoints.Update. +type StreamingEndpointsUpdateResponse struct { + StreamingEndpointsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingEndpointsUpdateResult contains the result from method StreamingEndpoints.Update. +type StreamingEndpointsUpdateResult struct { + StreamingEndpoint +} + +// StreamingLocatorsCreateResponse contains the response from method StreamingLocators.Create. +type StreamingLocatorsCreateResponse struct { + StreamingLocatorsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingLocatorsCreateResult contains the result from method StreamingLocators.Create. +type StreamingLocatorsCreateResult struct { + StreamingLocator +} + +// StreamingLocatorsDeleteResponse contains the response from method StreamingLocators.Delete. +type StreamingLocatorsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingLocatorsGetResponse contains the response from method StreamingLocators.Get. +type StreamingLocatorsGetResponse struct { + StreamingLocatorsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingLocatorsGetResult contains the result from method StreamingLocators.Get. +type StreamingLocatorsGetResult struct { + StreamingLocator +} + +// StreamingLocatorsListContentKeysResponse contains the response from method StreamingLocators.ListContentKeys. +type StreamingLocatorsListContentKeysResponse struct { + StreamingLocatorsListContentKeysResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingLocatorsListContentKeysResult contains the result from method StreamingLocators.ListContentKeys. +type StreamingLocatorsListContentKeysResult struct { + ListContentKeysResponse +} + +// StreamingLocatorsListPathsResponse contains the response from method StreamingLocators.ListPaths. +type StreamingLocatorsListPathsResponse struct { + StreamingLocatorsListPathsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingLocatorsListPathsResult contains the result from method StreamingLocators.ListPaths. +type StreamingLocatorsListPathsResult struct { + ListPathsResponse +} + +// StreamingLocatorsListResponse contains the response from method StreamingLocators.List. +type StreamingLocatorsListResponse struct { + StreamingLocatorsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingLocatorsListResult contains the result from method StreamingLocators.List. +type StreamingLocatorsListResult struct { + StreamingLocatorCollection +} + +// StreamingPoliciesCreateResponse contains the response from method StreamingPolicies.Create. +type StreamingPoliciesCreateResponse struct { + StreamingPoliciesCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingPoliciesCreateResult contains the result from method StreamingPolicies.Create. +type StreamingPoliciesCreateResult struct { + StreamingPolicy +} + +// StreamingPoliciesDeleteResponse contains the response from method StreamingPolicies.Delete. +type StreamingPoliciesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingPoliciesGetResponse contains the response from method StreamingPolicies.Get. +type StreamingPoliciesGetResponse struct { + StreamingPoliciesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingPoliciesGetResult contains the result from method StreamingPolicies.Get. +type StreamingPoliciesGetResult struct { + StreamingPolicy +} + +// StreamingPoliciesListResponse contains the response from method StreamingPolicies.List. +type StreamingPoliciesListResponse struct { + StreamingPoliciesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StreamingPoliciesListResult contains the result from method StreamingPolicies.List. +type StreamingPoliciesListResult struct { + StreamingPolicyCollection +} + +// TransformsCreateOrUpdateResponse contains the response from method Transforms.CreateOrUpdate. +type TransformsCreateOrUpdateResponse struct { + TransformsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformsCreateOrUpdateResult contains the result from method Transforms.CreateOrUpdate. +type TransformsCreateOrUpdateResult struct { + Transform +} + +// TransformsDeleteResponse contains the response from method Transforms.Delete. +type TransformsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformsGetResponse contains the response from method Transforms.Get. +type TransformsGetResponse struct { + TransformsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformsGetResult contains the result from method Transforms.Get. +type TransformsGetResult struct { + Transform +} + +// TransformsListResponse contains the response from method Transforms.List. +type TransformsListResponse struct { + TransformsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformsListResult contains the result from method Transforms.List. +type TransformsListResult struct { + TransformCollection +} + +// TransformsUpdateResponse contains the response from method Transforms.Update. +type TransformsUpdateResponse struct { + TransformsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// TransformsUpdateResult contains the result from method Transforms.Update. +type TransformsUpdateResult struct { + Transform +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go new file mode 100644 index 000000000000..9af6acc7c078 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go @@ -0,0 +1,651 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// StreamingEndpointsClient contains the methods for the StreamingEndpoints group. +// Don't use this type directly, use NewStreamingEndpointsClient() instead. +type StreamingEndpointsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewStreamingEndpointsClient creates a new instance of StreamingEndpointsClient with the specified values. +func NewStreamingEndpointsClient(con *arm.Connection, subscriptionID string) *StreamingEndpointsClient { + return &StreamingEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// BeginCreate - Creates a streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsBeginCreateOptions) (StreamingEndpointsCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return StreamingEndpointsCreatePollerResponse{}, err + } + result := StreamingEndpointsCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingEndpointsClient.Create", "", resp, client.pl, client.createHandleError) + if err != nil { + return StreamingEndpointsCreatePollerResponse{}, err + } + result.Poller = &StreamingEndpointsCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Creates a streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) create(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *StreamingEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.AutoStart != nil { + reqQP.Set("autoStart", strconv.FormatBool(*options.AutoStart)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleError handles the Create error response. +func (client *StreamingEndpointsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginDeleteOptions) (StreamingEndpointsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return StreamingEndpointsDeletePollerResponse{}, err + } + result := StreamingEndpointsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingEndpointsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return StreamingEndpointsDeletePollerResponse{}, err + } + result.Poller = &StreamingEndpointsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StreamingEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *StreamingEndpointsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) Get(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsGetOptions) (StreamingEndpointsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return StreamingEndpointsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingEndpointsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingEndpointsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StreamingEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StreamingEndpointsClient) getHandleResponse(resp *http.Response) (StreamingEndpointsGetResponse, error) { + result := StreamingEndpointsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpoint); err != nil { + return StreamingEndpointsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *StreamingEndpointsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the streaming endpoints in the account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) List(resourceGroupName string, accountName string, options *StreamingEndpointsListOptions) *StreamingEndpointsListPager { + return &StreamingEndpointsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp StreamingEndpointsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingEndpointListResult.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *StreamingEndpointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *StreamingEndpointsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StreamingEndpointsClient) listHandleResponse(resp *http.Response) (StreamingEndpointsListResponse, error) { + result := StreamingEndpointsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpointListResult); err != nil { + return StreamingEndpointsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *StreamingEndpointsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginScale - Scales an existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) BeginScale(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEntityScaleUnit, options *StreamingEndpointsBeginScaleOptions) (StreamingEndpointsScalePollerResponse, error) { + resp, err := client.scale(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return StreamingEndpointsScalePollerResponse{}, err + } + result := StreamingEndpointsScalePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingEndpointsClient.Scale", "", resp, client.pl, client.scaleHandleError) + if err != nil { + return StreamingEndpointsScalePollerResponse{}, err + } + result.Poller = &StreamingEndpointsScalePoller{ + pt: pt, + } + return result, nil +} + +// Scale - Scales an existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) scale(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEntityScaleUnit, options *StreamingEndpointsBeginScaleOptions) (*http.Response, error) { + req, err := client.scaleCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.scaleHandleError(resp) + } + return resp, nil +} + +// scaleCreateRequest creates the Scale request. +func (client *StreamingEndpointsClient) scaleCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEntityScaleUnit, options *StreamingEndpointsBeginScaleOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/scale" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// scaleHandleError handles the Scale error response. +func (client *StreamingEndpointsClient) scaleHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStart - Starts an existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) BeginStart(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginStartOptions) (StreamingEndpointsStartPollerResponse, error) { + resp, err := client.start(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return StreamingEndpointsStartPollerResponse{}, err + } + result := StreamingEndpointsStartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingEndpointsClient.Start", "", resp, client.pl, client.startHandleError) + if err != nil { + return StreamingEndpointsStartPollerResponse{}, err + } + result.Poller = &StreamingEndpointsStartPoller{ + pt: pt, + } + return result, nil +} + +// Start - Starts an existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) start(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.startHandleError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *StreamingEndpointsClient) startCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// startHandleError handles the Start error response. +func (client *StreamingEndpointsClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginStop - Stops an existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) BeginStop(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginStopOptions) (StreamingEndpointsStopPollerResponse, error) { + resp, err := client.stop(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return StreamingEndpointsStopPollerResponse{}, err + } + result := StreamingEndpointsStopPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingEndpointsClient.Stop", "", resp, client.pl, client.stopHandleError) + if err != nil { + return StreamingEndpointsStopPollerResponse{}, err + } + result.Poller = &StreamingEndpointsStopPoller{ + pt: pt, + } + return result, nil +} + +// Stop - Stops an existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) stop(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.stopHandleError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *StreamingEndpointsClient) stopCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, options *StreamingEndpointsBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// stopHandleError handles the Stop error response. +func (client *StreamingEndpointsClient) stopHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - Updates a existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsBeginUpdateOptions) (StreamingEndpointsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return StreamingEndpointsUpdatePollerResponse{}, err + } + result := StreamingEndpointsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("StreamingEndpointsClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return StreamingEndpointsUpdatePollerResponse{}, err + } + result.Poller = &StreamingEndpointsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - Updates a existing streaming endpoint. +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingEndpointsClient) update(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, streamingEndpointName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *StreamingEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingEndpointName string, parameters StreamingEndpoint, options *StreamingEndpointsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{accountName}/streamingEndpoints/{streamingEndpointName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingEndpointName == "" { + return nil, errors.New("parameter streamingEndpointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingEndpointName}", url.PathEscape(streamingEndpointName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleError handles the Update error response. +func (client *StreamingEndpointsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go new file mode 100644 index 000000000000..bcecdc9f0691 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go @@ -0,0 +1,443 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// StreamingLocatorsClient contains the methods for the StreamingLocators group. +// Don't use this type directly, use NewStreamingLocatorsClient() instead. +type StreamingLocatorsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewStreamingLocatorsClient creates a new instance of StreamingLocatorsClient with the specified values. +func NewStreamingLocatorsClient(con *arm.Connection, subscriptionID string) *StreamingLocatorsClient { + return &StreamingLocatorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// Create - Create a Streaming Locator in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingLocatorsClient) Create(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, parameters StreamingLocator, options *StreamingLocatorsCreateOptions) (StreamingLocatorsCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, streamingLocatorName, parameters, options) + if err != nil { + return StreamingLocatorsCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingLocatorsCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return StreamingLocatorsCreateResponse{}, client.createHandleError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *StreamingLocatorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, parameters StreamingLocator, options *StreamingLocatorsCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingLocatorName == "" { + return nil, errors.New("parameter streamingLocatorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingLocatorName}", url.PathEscape(streamingLocatorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleResponse handles the Create response. +func (client *StreamingLocatorsClient) createHandleResponse(resp *http.Response) (StreamingLocatorsCreateResponse, error) { + result := StreamingLocatorsCreateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocator); err != nil { + return StreamingLocatorsCreateResponse{}, err + } + return result, nil +} + +// createHandleError handles the Create error response. +func (client *StreamingLocatorsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a Streaming Locator in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingLocatorsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsDeleteOptions) (StreamingLocatorsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, streamingLocatorName, options) + if err != nil { + return StreamingLocatorsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingLocatorsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return StreamingLocatorsDeleteResponse{}, client.deleteHandleError(resp) + } + return StreamingLocatorsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StreamingLocatorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingLocatorName == "" { + return nil, errors.New("parameter streamingLocatorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingLocatorName}", url.PathEscape(streamingLocatorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *StreamingLocatorsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of a Streaming Locator in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingLocatorsClient) Get(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsGetOptions) (StreamingLocatorsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, streamingLocatorName, options) + if err != nil { + return StreamingLocatorsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingLocatorsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingLocatorsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StreamingLocatorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingLocatorName == "" { + return nil, errors.New("parameter streamingLocatorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingLocatorName}", url.PathEscape(streamingLocatorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StreamingLocatorsClient) getHandleResponse(resp *http.Response) (StreamingLocatorsGetResponse, error) { + result := StreamingLocatorsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocator); err != nil { + return StreamingLocatorsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *StreamingLocatorsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the Streaming Locators in the account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingLocatorsClient) List(resourceGroupName string, accountName string, options *StreamingLocatorsListOptions) *StreamingLocatorsListPager { + return &StreamingLocatorsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp StreamingLocatorsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingLocatorCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *StreamingLocatorsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *StreamingLocatorsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StreamingLocatorsClient) listHandleResponse(resp *http.Response) (StreamingLocatorsListResponse, error) { + result := StreamingLocatorsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocatorCollection); err != nil { + return StreamingLocatorsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *StreamingLocatorsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListContentKeys - List Content Keys used by this Streaming Locator +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingLocatorsClient) ListContentKeys(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsListContentKeysOptions) (StreamingLocatorsListContentKeysResponse, error) { + req, err := client.listContentKeysCreateRequest(ctx, resourceGroupName, accountName, streamingLocatorName, options) + if err != nil { + return StreamingLocatorsListContentKeysResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingLocatorsListContentKeysResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingLocatorsListContentKeysResponse{}, client.listContentKeysHandleError(resp) + } + return client.listContentKeysHandleResponse(resp) +} + +// listContentKeysCreateRequest creates the ListContentKeys request. +func (client *StreamingLocatorsClient) listContentKeysCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsListContentKeysOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listContentKeys" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingLocatorName == "" { + return nil, errors.New("parameter streamingLocatorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingLocatorName}", url.PathEscape(streamingLocatorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listContentKeysHandleResponse handles the ListContentKeys response. +func (client *StreamingLocatorsClient) listContentKeysHandleResponse(resp *http.Response) (StreamingLocatorsListContentKeysResponse, error) { + result := StreamingLocatorsListContentKeysResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListContentKeysResponse); err != nil { + return StreamingLocatorsListContentKeysResponse{}, err + } + return result, nil +} + +// listContentKeysHandleError handles the ListContentKeys error response. +func (client *StreamingLocatorsClient) listContentKeysHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListPaths - List Paths supported by this Streaming Locator +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingLocatorsClient) ListPaths(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsListPathsOptions) (StreamingLocatorsListPathsResponse, error) { + req, err := client.listPathsCreateRequest(ctx, resourceGroupName, accountName, streamingLocatorName, options) + if err != nil { + return StreamingLocatorsListPathsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingLocatorsListPathsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingLocatorsListPathsResponse{}, client.listPathsHandleError(resp) + } + return client.listPathsHandleResponse(resp) +} + +// listPathsCreateRequest creates the ListPaths request. +func (client *StreamingLocatorsClient) listPathsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingLocatorName string, options *StreamingLocatorsListPathsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}/listPaths" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingLocatorName == "" { + return nil, errors.New("parameter streamingLocatorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingLocatorName}", url.PathEscape(streamingLocatorName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listPathsHandleResponse handles the ListPaths response. +func (client *StreamingLocatorsClient) listPathsHandleResponse(resp *http.Response) (StreamingLocatorsListPathsResponse, error) { + result := StreamingLocatorsListPathsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListPathsResponse); err != nil { + return StreamingLocatorsListPathsResponse{}, err + } + return result, nil +} + +// listPathsHandleError handles the ListPaths error response. +func (client *StreamingLocatorsClient) listPathsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go new file mode 100644 index 000000000000..7625d1c9e153 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go @@ -0,0 +1,305 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strconv" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// StreamingPoliciesClient contains the methods for the StreamingPolicies group. +// Don't use this type directly, use NewStreamingPoliciesClient() instead. +type StreamingPoliciesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewStreamingPoliciesClient creates a new instance of StreamingPoliciesClient with the specified values. +func NewStreamingPoliciesClient(con *arm.Connection, subscriptionID string) *StreamingPoliciesClient { + return &StreamingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// Create - Create a Streaming Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingPoliciesClient) Create(ctx context.Context, resourceGroupName string, accountName string, streamingPolicyName string, parameters StreamingPolicy, options *StreamingPoliciesCreateOptions) (StreamingPoliciesCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, streamingPolicyName, parameters, options) + if err != nil { + return StreamingPoliciesCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingPoliciesCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return StreamingPoliciesCreateResponse{}, client.createHandleError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *StreamingPoliciesClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingPolicyName string, parameters StreamingPolicy, options *StreamingPoliciesCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingPolicyName == "" { + return nil, errors.New("parameter streamingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingPolicyName}", url.PathEscape(streamingPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createHandleResponse handles the Create response. +func (client *StreamingPoliciesClient) createHandleResponse(resp *http.Response) (StreamingPoliciesCreateResponse, error) { + result := StreamingPoliciesCreateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicy); err != nil { + return StreamingPoliciesCreateResponse{}, err + } + return result, nil +} + +// createHandleError handles the Create error response. +func (client *StreamingPoliciesClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a Streaming Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, streamingPolicyName string, options *StreamingPoliciesDeleteOptions) (StreamingPoliciesDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, streamingPolicyName, options) + if err != nil { + return StreamingPoliciesDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingPoliciesDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return StreamingPoliciesDeleteResponse{}, client.deleteHandleError(resp) + } + return StreamingPoliciesDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StreamingPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingPolicyName string, options *StreamingPoliciesDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingPolicyName == "" { + return nil, errors.New("parameter streamingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingPolicyName}", url.PathEscape(streamingPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *StreamingPoliciesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Get the details of a Streaming Policy in the Media Services account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, streamingPolicyName string, options *StreamingPoliciesGetOptions) (StreamingPoliciesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, streamingPolicyName, options) + if err != nil { + return StreamingPoliciesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return StreamingPoliciesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return StreamingPoliciesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *StreamingPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, streamingPolicyName string, options *StreamingPoliciesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies/{streamingPolicyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if streamingPolicyName == "" { + return nil, errors.New("parameter streamingPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{streamingPolicyName}", url.PathEscape(streamingPolicyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StreamingPoliciesClient) getHandleResponse(resp *http.Response) (StreamingPoliciesGetResponse, error) { + result := StreamingPoliciesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicy); err != nil { + return StreamingPoliciesGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *StreamingPoliciesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the Streaming Policies in the account +// If the operation fails it returns the *ErrorResponse error type. +func (client *StreamingPoliciesClient) List(resourceGroupName string, accountName string, options *StreamingPoliciesListOptions) *StreamingPoliciesListPager { + return &StreamingPoliciesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp StreamingPoliciesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StreamingPolicyCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *StreamingPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *StreamingPoliciesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StreamingPoliciesClient) listHandleResponse(resp *http.Response) (StreamingPoliciesListResponse, error) { + result := StreamingPoliciesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicyCollection); err != nil { + return StreamingPoliciesListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *StreamingPoliciesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..44240b77addf --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go @@ -0,0 +1,58 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go new file mode 100644 index 000000000000..55547feef6b7 --- /dev/null +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go @@ -0,0 +1,370 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmediaservices + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// TransformsClient contains the methods for the Transforms group. +// Don't use this type directly, use NewTransformsClient() instead. +type TransformsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewTransformsClient creates a new instance of TransformsClient with the specified values. +func NewTransformsClient(con *arm.Connection, subscriptionID string) *TransformsClient { + return &TransformsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - Creates or updates a new Transform. +// If the operation fails it returns the *ErrorResponse error type. +func (client *TransformsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, accountName string, transformName string, parameters Transform, options *TransformsCreateOrUpdateOptions) (TransformsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, accountName, transformName, parameters, options) + if err != nil { + return TransformsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return TransformsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TransformsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, parameters Transform, options *TransformsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TransformsClient) createOrUpdateHandleResponse(resp *http.Response) (TransformsCreateOrUpdateResponse, error) { + result := TransformsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { + return TransformsCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *TransformsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a Transform. +// If the operation fails it returns the *ErrorResponse error type. +func (client *TransformsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, transformName string, options *TransformsDeleteOptions) (TransformsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, transformName, options) + if err != nil { + return TransformsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return TransformsDeleteResponse{}, client.deleteHandleError(resp) + } + return TransformsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TransformsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, options *TransformsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *TransformsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Gets a Transform. +// If the operation fails it returns the *ErrorResponse error type. +func (client *TransformsClient) Get(ctx context.Context, resourceGroupName string, accountName string, transformName string, options *TransformsGetOptions) (TransformsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, transformName, options) + if err != nil { + return TransformsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TransformsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *TransformsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, options *TransformsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TransformsClient) getHandleResponse(resp *http.Response) (TransformsGetResponse, error) { + result := TransformsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { + return TransformsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *TransformsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists the Transforms in the account. +// If the operation fails it returns the *ErrorResponse error type. +func (client *TransformsClient) List(resourceGroupName string, accountName string, options *TransformsListOptions) *TransformsListPager { + return &TransformsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, accountName, options) + }, + advancer: func(ctx context.Context, resp TransformsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.TransformCollection.ODataNextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *TransformsClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *TransformsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *TransformsClient) listHandleResponse(resp *http.Response) (TransformsListResponse, error) { + result := TransformsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.TransformCollection); err != nil { + return TransformsListResponse{}, err + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *TransformsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates a Transform. +// If the operation fails it returns the *ErrorResponse error type. +func (client *TransformsClient) Update(ctx context.Context, resourceGroupName string, accountName string, transformName string, parameters Transform, options *TransformsUpdateOptions) (TransformsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, accountName, transformName, parameters, options) + if err != nil { + return TransformsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return TransformsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return TransformsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *TransformsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, transformName string, parameters Transform, options *TransformsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/transforms/{transformName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if transformName == "" { + return nil, errors.New("parameter transformName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{transformName}", url.PathEscape(transformName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *TransformsClient) updateHandleResponse(resp *http.Response) (TransformsUpdateResponse, error) { + result := TransformsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { + return TransformsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *TransformsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +}