From a4e7f3cc07a079dccb28eb1dc5d67be34244d9e8 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 20 Oct 2021 01:39:21 +0000 Subject: [PATCH] CodeGen from PR 16439 in Azure/azure-rest-api-specs First time adding VideoIndexer to public repo (#16439) * First time adding VideoIndexer to public repo * Fix spelling * Fix more spelling * remove preview only api for now --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + sdk/vi/azure-resourcemanager-vi/CHANGELOG.md | 5 + sdk/vi/azure-resourcemanager-vi/README.md | 102 ++ sdk/vi/azure-resourcemanager-vi/SAMPLE.md | 944 +++++++++++ sdk/vi/azure-resourcemanager-vi/pom.xml | 86 + .../azure/resourcemanager/vi/ViManager.java | 251 +++ .../vi/fluent/AccountsClient.java | 204 +++ .../vi/fluent/GeneratesClient.java | 44 + .../vi/fluent/OperationsClient.java | 36 + .../vi/fluent/ViManagementClient.java | 67 + .../vi/fluent/models/AccessTokenInner.java | 39 + .../vi/fluent/models/AccountInner.java | 180 +++ .../AccountPropertiesForPatchRequest.java | 100 ++ .../AccountPropertiesForPutRequest.java | 126 ++ .../CheckNameAvailabilityResultInner.java | 75 + .../vi/fluent/models/OperationInner.java | 103 ++ .../vi/fluent/models/package-info.java | 6 + .../vi/fluent/package-info.java | 6 + .../vi/implementation/AccessTokenImpl.java | 31 + .../vi/implementation/AccountImpl.java | 231 +++ .../vi/implementation/AccountsClientImpl.java | 1440 +++++++++++++++++ .../vi/implementation/AccountsImpl.java | 198 +++ .../CheckNameAvailabilityResultImpl.java | 41 + .../implementation/GeneratesClientImpl.java | 262 +++ .../vi/implementation/GeneratesImpl.java | 61 + .../vi/implementation/OperationImpl.java | 48 + .../implementation/OperationsClientImpl.java | 269 +++ .../vi/implementation/OperationsImpl.java | 45 + .../vi/implementation/Utils.java | 204 +++ .../ViManagementClientBuilder.java | 146 ++ .../ViManagementClientImpl.java | 321 ++++ .../vi/implementation/package-info.java | 6 + .../vi/models/AccessToken.java | 24 + .../resourcemanager/vi/models/Account.java | 298 ++++ ...ccountCheckNameAvailabilityParameters.java | 88 + .../vi/models/AccountList.java | 70 + .../vi/models/AccountPatch.java | 133 ++ .../resourcemanager/vi/models/Accounts.java | 182 +++ .../models/CheckNameAvailabilityResult.java | 40 + .../models/GenerateAccessTokenParameters.java | 140 ++ .../resourcemanager/vi/models/Generates.java | 38 + .../vi/models/ManagedServiceIdentity.java | 142 ++ .../vi/models/ManagedServiceIdentityType.java | 41 + .../models/MediaServicesForPatchRequest.java | 50 + .../vi/models/MediaServicesForPutRequest.java | 76 + .../resourcemanager/vi/models/Operation.java | 52 + .../vi/models/OperationDisplay.java | 84 + .../vi/models/OperationListResult.java | 59 + .../resourcemanager/vi/models/Operations.java | 31 + .../vi/models/PermissionType.java | 34 + .../vi/models/ProvisioningState.java | 46 + .../resourcemanager/vi/models/Reason.java | 31 + .../resourcemanager/vi/models/Scope.java | 37 + .../azure/resourcemanager/vi/models/Tags.java | 53 + .../azure/resourcemanager/vi/models/Type.java | 31 + .../vi/models/UserAssignedIdentity.java | 55 + .../vi/models/package-info.java | 6 + .../resourcemanager/vi/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../AccountsCheckNameAvailabilitySamples.java | 48 + .../AccountsCreateOrUpdateSamples.java | 308 ++++ .../vi/generated/AccountsDeleteSamples.java | 22 + .../AccountsGetByResourceGroupSamples.java | 22 + .../AccountsListByResourceGroupSamples.java | 22 + .../vi/generated/AccountsListSamples.java | 22 + .../vi/generated/AccountsUpdateSamples.java | 248 +++ .../generated/GenerateAccessTokenSamples.java | 219 +++ .../vi/generated/OperationsListSamples.java | 22 + sdk/vi/ci.yml | 39 + sdk/vi/pom.xml | 53 + 71 files changed, 8570 insertions(+) create mode 100644 sdk/vi/azure-resourcemanager-vi/CHANGELOG.md create mode 100644 sdk/vi/azure-resourcemanager-vi/README.md create mode 100644 sdk/vi/azure-resourcemanager-vi/SAMPLE.md create mode 100644 sdk/vi/azure-resourcemanager-vi/pom.xml create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/ViManager.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/AccountsClient.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/GeneratesClient.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/OperationsClient.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/ViManagementClient.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccessTokenInner.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountInner.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPatchRequest.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPutRequest.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/CheckNameAvailabilityResultInner.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/OperationInner.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/package-info.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/package-info.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccessTokenImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsClientImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/CheckNameAvailabilityResultImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesClientImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsClientImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/Utils.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientBuilder.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientImpl.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/package-info.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccessToken.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Account.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountCheckNameAvailabilityParameters.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountList.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountPatch.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Accounts.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/CheckNameAvailabilityResult.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/GenerateAccessTokenParameters.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Generates.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentity.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentityType.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPatchRequest.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPutRequest.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operation.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationDisplay.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationListResult.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operations.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/PermissionType.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ProvisioningState.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Reason.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Scope.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Tags.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Type.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/UserAssignedIdentity.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/package-info.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/package-info.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/main/java/module-info.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCheckNameAvailabilitySamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCreateOrUpdateSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsDeleteSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsGetByResourceGroupSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListByResourceGroupSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsUpdateSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/GenerateAccessTokenSamples.java create mode 100644 sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/OperationsListSamples.java create mode 100644 sdk/vi/ci.yml create mode 100644 sdk/vi/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3c22cd94e7bb..ab6abe1036f3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -320,6 +320,7 @@ com.azure.resourcemanager:azure-resourcemanager-quota;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-extendedlocation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-logz;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-vi;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index c48350b9b837..cbf5fe61d0e1 100644 --- a/pom.xml +++ b/pom.xml @@ -836,6 +836,7 @@ sdk/textanalytics sdk/timeseriesinsights sdk/translation + sdk/vi sdk/videoanalyzer sdk/vmwarecloudsimple sdk/webpubsub diff --git a/sdk/vi/azure-resourcemanager-vi/CHANGELOG.md b/sdk/vi/azure-resourcemanager-vi/CHANGELOG.md new file mode 100644 index 000000000000..43d3d47ca84c --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-10-20) + +- Azure Resource Manager Vi client library for Java. This package contains Microsoft Azure SDK for Vi Management SDK. Microsoft Azure Video Analyzer for Media. Package tag package-2021-10-18-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/vi/azure-resourcemanager-vi/README.md b/sdk/vi/azure-resourcemanager-vi/README.md new file mode 100644 index 000000000000..0897287aa098 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Vi client library for Java + +Azure Resource Manager Vi client library for Java. + +This package contains Microsoft Azure SDK for Vi Management SDK. Microsoft Azure Video Analyzer for Media. Package tag package-2021-10-18-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-vi;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-vi + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ViManager manager = ViManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/vi/azure-resourcemanager-vi/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/vi/azure-resourcemanager-vi/SAMPLE.md b/sdk/vi/azure-resourcemanager-vi/SAMPLE.md new file mode 100644 index 000000000000..dad4c43bbe43 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/SAMPLE.md @@ -0,0 +1,944 @@ +# Code snippets and samples + + +## Accounts + +- [CheckNameAvailability](#accounts_checknameavailability) +- [CreateOrUpdate](#accounts_createorupdate) +- [Delete](#accounts_delete) +- [GetByResourceGroup](#accounts_getbyresourcegroup) +- [List](#accounts_list) +- [ListByResourceGroup](#accounts_listbyresourcegroup) +- [Update](#accounts_update) + +## Generate + +- [AccessToken](#generate_accesstoken) + +## Operations + +- [List](#operations_list) +### Accounts_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.vi.models.Type; + +/** Samples for Accounts CheckNameAvailability. */ +public final class AccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountCheckNameAvailabilityFree.json + */ + /** + * Sample code: Check free account name availability. + * + * @param manager Entry point to ViManager. + */ + public static void checkFreeAccountNameAvailability(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .checkNameAvailabilityWithResponse( + new AccountCheckNameAvailabilityParameters() + .withName("vi1") + .withType(Type.MICROSOFT_VIDEO_INDEXER_ACCOUNTS), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountCheckNameAvailabilityTaken.json + */ + /** + * Sample code: Check taken account name availability. + * + * @param manager Entry point to ViManager. + */ + public static void checkTakenAccountNameAvailability(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .checkNameAvailabilityWithResponse( + new AccountCheckNameAvailabilityParameters() + .withName("vi1") + .withType(Type.MICROSOFT_VIDEO_INDEXER_ACCOUNTS), + Context.NONE); + } +} +``` + +### Accounts_CreateOrUpdate + +```java +import com.azure.resourcemanager.vi.models.ManagedServiceIdentity; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.vi.models.MediaServicesForPutRequest; +import com.azure.resourcemanager.vi.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts CreateOrUpdate. */ +public final class AccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut10.json + */ + /** + * Sample code: Put example #10. + * + * @param manager Entry point to ViManager. + */ + public static void putExample10(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut8.json + */ + /** + * Sample code: Put example #8. + * + * @param manager Entry point to ViManager. + */ + public static void putExample8(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "subscriptions/24237b72-8546-4da5-b204-8c3cb76dd930/resourceGroups/uratzmon-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/talshoham", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/24237b72-8546-4da5-b204-8c3cb76dd930/resourceGroups/uratzmon-rg/providers/Microsoft.Media/mediaservices/talshoham")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut9.json + */ + /** + * Sample code: Put example #9. + * + * @param manager Entry point to ViManager. + */ + public static void putExample9(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion((String) null) + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut4.json + */ + /** + * Sample code: Put example #4. + * + * @param manager Entry point to ViManager. + */ + public static void putExample4(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut5.json + */ + /** + * Sample code: Put example #5. + * + * @param manager Entry point to ViManager. + */ + public static void putExample5(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut6.json + */ + /** + * Sample code: Put example #6. + * + * @param manager Entry point to ViManager. + */ + public static void putExample6(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut7.json + */ + /** + * Sample code: Put example #7. + * + * @param manager Entry point to ViManager. + */ + public static void putExample7(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut1.json + */ + /** + * Sample code: Put example #1. + * + * @param manager Entry point to ViManager. + */ + public static void putExample1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut2.json + */ + /** + * Sample code: Put example #2. + * + * @param manager Entry point to ViManager. + */ + public static void putExample2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut3.json + */ + /** + * Sample code: Put example #3. + * + * @param manager Entry point to ViManager. + */ + public static void putExample3(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Accounts_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Accounts Delete. */ +public final class AccountsDeleteSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountDelete.json + */ + /** + * Sample code: Delete account. + * + * @param manager Entry point to ViManager. + */ + public static void deleteAccount(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().deleteWithResponse("contoso-rg", "contosto-videoanalyzer", Context.NONE); + } +} +``` + +### Accounts_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Accounts GetByResourceGroup. */ +public final class AccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountGet.json + */ + /** + * Sample code: Get account. + * + * @param manager Entry point to ViManager. + */ + public static void getAccount(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().getByResourceGroupWithResponse("contoso-rg", "contosto-videoanalyzer", Context.NONE); + } +} +``` + +### Accounts_List + +```java +import com.azure.core.util.Context; + +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountsList.json + */ + /** + * Sample code: List accounts. + * + * @param manager Entry point to ViManager. + */ + public static void listAccounts(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().list(Context.NONE); + } +} +``` + +### Accounts_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Accounts ListByResourceGroup. */ +public final class AccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountsListByResourceGroup.json + */ + /** + * Sample code: List accounts by resource group. + * + * @param manager Entry point to ViManager. + */ + public static void listAccountsByResourceGroup(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().listByResourceGroup("contoso-videoanalyzer-rg", Context.NONE); + } +} +``` + +### Accounts_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.models.Account; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentity; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.vi.models.MediaServicesForPatchRequest; +import com.azure.resourcemanager.vi.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts Update. */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch3.json + */ + /** + * Sample code: Patch example #3. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample3(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch4.json + */ + /** + * Sample code: Patch example #4. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample4(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch1.json + */ + /** + * Sample code: Patch example #1. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample1(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch2.json + */ + /** + * Sample code: Patch example #2. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample2(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch7.json + */ + /** + * Sample code: Patch example #7. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample7(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch8.json + */ + /** + * Sample code: Patch example #8. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample8(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch5.json + */ + /** + * Sample code: Patch example #5. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample5(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch6.json + */ + /** + * Sample code: Patch example #6. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample6(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource.update().apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Generate_AccessToken + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.models.GenerateAccessTokenParameters; +import com.azure.resourcemanager.vi.models.PermissionType; +import com.azure.resourcemanager.vi.models.Scope; + +/** Samples for Generate AccessToken. */ +public final class GenerateAccessTokenSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoContributerAccessToken1.json + */ + /** + * Sample code: Generate accessToken for video contributor #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoContributor1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectReaderAccessToken1.json + */ + /** + * Sample code: Generate accessToken for project reader #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectReader1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoContributerAccessToken2.json + */ + /** + * Sample code: Generate accessToken for video contributor #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoContributor2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateAccountContributerAccessToken.json + */ + /** + * Sample code: Generate accessToken for account contributor. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForAccountContributor(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.ACCOUNT), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectContributerAccessToken2.json + */ + /** + * Sample code: Generate accessToken for project contributor #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectContributor2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateAccountReaderAccessToken.json + */ + /** + * Sample code: Generate accessToken for account reader. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForAccountReader(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters().withPermissionType(PermissionType.READER).withScope(Scope.ACCOUNT), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoReaderAccessToken1.json + */ + /** + * Sample code: Generate accessToken for video reader #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoReader1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectContributerAccessToken1.json + */ + /** + * Sample code: Generate accessToken for project contributor #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectContributor1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoReaderAccessToken2.json + */ + /** + * Sample code: Generate accessToken for video reader #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoReader2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectReaderAccessToken2.json + */ + /** + * Sample code: Generate accessToken for project reader #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectReader2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViOperationsList.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to ViManager. + */ + public static void listOperations(com.azure.resourcemanager.vi.ViManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + diff --git a/sdk/vi/azure-resourcemanager-vi/pom.xml b/sdk/vi/azure-resourcemanager-vi/pom.xml new file mode 100644 index 000000000000..caf1d3b887bc --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-vi + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Vi Management + This package contains Microsoft Azure SDK for Vi Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Azure Video Analyzer for Media. Package tag package-2021-10-18-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.21.0 + + + com.azure + azure-core-management + 1.4.2 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/ViManager.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/ViManager.java new file mode 100644 index 000000000000..61f2c258aeca --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/ViManager.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.ViManagementClient; +import com.azure.resourcemanager.vi.implementation.AccountsImpl; +import com.azure.resourcemanager.vi.implementation.GeneratesImpl; +import com.azure.resourcemanager.vi.implementation.OperationsImpl; +import com.azure.resourcemanager.vi.implementation.ViManagementClientBuilder; +import com.azure.resourcemanager.vi.models.Accounts; +import com.azure.resourcemanager.vi.models.Generates; +import com.azure.resourcemanager.vi.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to ViManager. Microsoft Azure Video Analyzer for Media. */ +public final class ViManager { + private Operations operations; + + private Accounts accounts; + + private Generates generates; + + private final ViManagementClient clientObject; + + private ViManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ViManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Vi service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Vi service API instance. + */ + public static ViManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ViManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ViManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Vi service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Vi service API instance. + */ + public ViManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.vi") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ViManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Accounts. */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** @return Resource collection API of Generates. */ + public Generates generates() { + if (this.generates == null) { + this.generates = new GeneratesImpl(clientObject.getGenerates(), this); + } + return generates; + } + + /** + * @return Wrapped service client ViManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ViManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/AccountsClient.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/AccountsClient.java new file mode 100644 index 000000000000..e062590b9ca0 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/AccountsClient.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.fluent.models.AccountInner; +import com.azure.resourcemanager.vi.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.vi.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.vi.models.AccountPatch; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public interface AccountsClient { + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters); + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters, Context context); + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner update(String resourceGroupName, String accountName); + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the current Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String accountName, AccountPatch parameters, Context context); + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountInner createOrUpdate(String resourceGroupName, String accountName); + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String accountName, AccountInner parameters, Context context); + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName); + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/GeneratesClient.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/GeneratesClient.java new file mode 100644 index 000000000000..e98b12cc4be2 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/GeneratesClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.fluent.models.AccessTokenInner; +import com.azure.resourcemanager.vi.models.GenerateAccessTokenParameters; + +/** An instance of this class provides access to all the operations defined in GeneratesClient. */ +public interface GeneratesClient { + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessTokenInner accessToken(String resourceGroupName, String accountName); + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters for generating access token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response accessTokenWithResponse( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters, Context context); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/OperationsClient.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/OperationsClient.java new file mode 100644 index 000000000000..091baa5eb4b8 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/ViManagementClient.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/ViManagementClient.java new file mode 100644 index 000000000000..abf53b62d9b7 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/ViManagementClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ViManagementClient class. */ +public interface ViManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the GeneratesClient object to access its operations. + * + * @return the GeneratesClient object. + */ + GeneratesClient getGenerates(); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccessTokenInner.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccessTokenInner.java new file mode 100644 index 000000000000..fc2cdd7a075c --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccessTokenInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Video Analyzer for Media access token. */ +@Immutable +public final class AccessTokenInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccessTokenInner.class); + + /* + * The access token. + */ + @JsonProperty(value = "accessToken", access = JsonProperty.Access.WRITE_ONLY) + private String accessToken; + + /** + * Get the accessToken property: The access token. + * + * @return the accessToken value. + */ + public String accessToken() { + return this.accessToken; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountInner.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountInner.java new file mode 100644 index 000000000000..f42d027de279 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountInner.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentity; +import com.azure.resourcemanager.vi.models.MediaServicesForPutRequest; +import com.azure.resourcemanager.vi.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Video Analyzer for Media account. */ +@Fluent +public final class AccountInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountInner.class); + + /* + * List of account properties + */ + @JsonProperty(value = "properties") + private AccountPropertiesForPutRequest innerProperties; + + /* + * Managed service identity (system assigned and/or user assigned + * identities) + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * The system meta data relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the innerProperties property: List of account properties. + * + * @return the innerProperties value. + */ + private AccountPropertiesForPutRequest innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the AccountInner object itself. + */ + public AccountInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public AccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the tenantId property: The account's tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + public String accountId() { + return this.innerProperties() == null ? null : this.innerProperties().accountId(); + } + + /** + * Set the accountId property: The account's data-plane ID. + * + * @param accountId the accountId value to set. + * @return the AccountInner object itself. + */ + public AccountInner withAccountId(String accountId) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountPropertiesForPutRequest(); + } + this.innerProperties().withAccountId(accountId); + return this; + } + + /** + * Get the accountName property: The account's name. + * + * @return the accountName value. + */ + public String accountName() { + return this.innerProperties() == null ? null : this.innerProperties().accountName(); + } + + /** + * Get the mediaServices property: The media services details. + * + * @return the mediaServices value. + */ + public MediaServicesForPutRequest mediaServices() { + return this.innerProperties() == null ? null : this.innerProperties().mediaServices(); + } + + /** + * Set the mediaServices property: The media services details. + * + * @param mediaServices the mediaServices value to set. + * @return the AccountInner object itself. + */ + public AccountInner withMediaServices(MediaServicesForPutRequest mediaServices) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountPropertiesForPutRequest(); + } + this.innerProperties().withMediaServices(mediaServices); + return this; + } + + /** + * Get the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPatchRequest.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPatchRequest.java new file mode 100644 index 000000000000..a024201dc4cc --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPatchRequest.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.models.MediaServicesForPatchRequest; +import com.azure.resourcemanager.vi.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Video Analyzer for Media account properties. */ +@Fluent +public final class AccountPropertiesForPatchRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountPropertiesForPatchRequest.class); + + /* + * The account's tenant id + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The account's data-plane ID + */ + @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * The media services details + */ + @JsonProperty(value = "mediaServices") + private MediaServicesForPatchRequest mediaServices; + + /* + * Gets the status of the account at the time the operation was called. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the tenantId property: The account's tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the mediaServices property: The media services details. + * + * @return the mediaServices value. + */ + public MediaServicesForPatchRequest mediaServices() { + return this.mediaServices; + } + + /** + * Set the mediaServices property: The media services details. + * + * @param mediaServices the mediaServices value to set. + * @return the AccountPropertiesForPatchRequest object itself. + */ + public AccountPropertiesForPatchRequest withMediaServices(MediaServicesForPatchRequest mediaServices) { + this.mediaServices = mediaServices; + return this; + } + + /** + * Get the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mediaServices() != null) { + mediaServices().validate(); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPutRequest.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPutRequest.java new file mode 100644 index 000000000000..328a1e6f7297 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/AccountPropertiesForPutRequest.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.models.MediaServicesForPutRequest; +import com.azure.resourcemanager.vi.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Video Analyzer for Media account properties. */ +@Fluent +public final class AccountPropertiesForPutRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountPropertiesForPutRequest.class); + + /* + * The account's tenant id + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The account's data-plane ID + */ + @JsonProperty(value = "accountId") + private String accountId; + + /* + * The account's name + */ + @JsonProperty(value = "accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /* + * The media services details + */ + @JsonProperty(value = "mediaServices") + private MediaServicesForPutRequest mediaServices; + + /* + * Gets the status of the account at the time the operation was called. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the tenantId property: The account's tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Set the accountId property: The account's data-plane ID. + * + * @param accountId the accountId value to set. + * @return the AccountPropertiesForPutRequest object itself. + */ + public AccountPropertiesForPutRequest withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the accountName property: The account's name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Get the mediaServices property: The media services details. + * + * @return the mediaServices value. + */ + public MediaServicesForPutRequest mediaServices() { + return this.mediaServices; + } + + /** + * Set the mediaServices property: The media services details. + * + * @param mediaServices the mediaServices value to set. + * @return the AccountPropertiesForPutRequest object itself. + */ + public AccountPropertiesForPutRequest withMediaServices(MediaServicesForPutRequest mediaServices) { + this.mediaServices = mediaServices; + return this; + } + + /** + * Get the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mediaServices() != null) { + mediaServices().validate(); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..6d3190cb05ea --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.models.Reason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CheckNameAvailability operation response. */ +@Immutable +public final class CheckNameAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class); + + /* + * Gets a boolean value that indicates whether the name is available for + * you to use. If true, the name is available. If false, the name has + * already been taken. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * Gets the reason that a Video Indexer account name could not be used. The + * Reason element is only returned if NameAvailable is false. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private Reason reason; + + /* + * Gets an error message explaining the Reason value in more detail. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable property: Gets a boolean value that indicates whether the name is available for you to use. + * If true, the name is available. If false, the name has already been taken. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: Gets the reason that a Video Indexer account name could not be used. The Reason element + * is only returned if NameAvailable is false. + * + * @return the reason value. + */ + public Reason reason() { + return this.reason; + } + + /** + * Get the message property: Gets an error message explaining the Reason value in more detail. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/OperationInner.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/OperationInner.java new file mode 100644 index 000000000000..0a9e91cbb0e9 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/OperationInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation detail payload. */ +@Immutable +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Name of the operation + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Indicates the action type. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private String actionType; + + /* + * Display of the operation + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the actionType property: Indicates the action type. + * + * @return the actionType value. + */ + public String actionType() { + return this.actionType; + } + + /** + * Get the display property: Display of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/package-info.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/package-info.java new file mode 100644 index 000000000000..b089e13ed65a --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for ViManagementClient. Microsoft Azure Video Analyzer for Media. */ +package com.azure.resourcemanager.vi.fluent.models; diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/package-info.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/package-info.java new file mode 100644 index 000000000000..2873f33d050e --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for ViManagementClient. Microsoft Azure Video Analyzer for Media. */ +package com.azure.resourcemanager.vi.fluent; diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccessTokenImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccessTokenImpl.java new file mode 100644 index 000000000000..b477a4813af3 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccessTokenImpl.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.resourcemanager.vi.fluent.models.AccessTokenInner; +import com.azure.resourcemanager.vi.models.AccessToken; + +public final class AccessTokenImpl implements AccessToken { + private AccessTokenInner innerObject; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + AccessTokenImpl(AccessTokenInner innerObject, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String accessToken() { + return this.innerModel().accessToken(); + } + + public AccessTokenInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountImpl.java new file mode 100644 index 000000000000..f3b85a1fd91f --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.fluent.models.AccountInner; +import com.azure.resourcemanager.vi.models.Account; +import com.azure.resourcemanager.vi.models.AccountPatch; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentity; +import com.azure.resourcemanager.vi.models.MediaServicesForPatchRequest; +import com.azure.resourcemanager.vi.models.MediaServicesForPutRequest; +import com.azure.resourcemanager.vi.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class AccountImpl implements Account, Account.Definition, Account.Update { + private AccountInner innerObject; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public MediaServicesForPutRequest mediaServices() { + return this.innerModel().mediaServices(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AccountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private AccountPatch updateParameters; + + public AccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Account create() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createOrUpdateWithResponse(resourceGroupName, accountName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Account create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .createOrUpdateWithResponse(resourceGroupName, accountName, this.innerModel(), context) + .getValue(); + return this; + } + + AccountImpl(String name, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerObject = new AccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public AccountImpl update() { + this.updateParameters = new AccountPatch(); + return this; + } + + public Account apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .updateWithResponse(resourceGroupName, accountName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Account apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .updateWithResponse(resourceGroupName, accountName, updateParameters, context) + .getValue(); + return this; + } + + AccountImpl(AccountInner innerObject, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + } + + public Account refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public Account refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public AccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public AccountImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public AccountImpl withAccountId(String accountId) { + this.innerModel().withAccountId(accountId); + return this; + } + + public AccountImpl withMediaServices(MediaServicesForPutRequest mediaServices) { + this.innerModel().withMediaServices(mediaServices); + return this; + } + + public AccountImpl withMediaServices(MediaServicesForPatchRequest mediaServices) { + this.updateParameters.withMediaServices(mediaServices); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsClientImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsClientImpl.java new file mode 100644 index 000000000000..cdcafc5ee87e --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsClientImpl.java @@ -0,0 +1,1440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.AccountsClient; +import com.azure.resourcemanager.vi.fluent.models.AccountInner; +import com.azure.resourcemanager.vi.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.vi.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.vi.models.AccountList; +import com.azure.resourcemanager.vi.models.AccountPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public final class AccountsClientImpl implements AccountsClient { + private final ClientLogger logger = new ClientLogger(AccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AccountsService service; + + /** The service client containing this operation class. */ + private final ViManagementClientImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(ViManagementClientImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ViManagementClientAccounts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ViManagementClientAc") + private interface AccountsService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer" + + "/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer" + + "/accounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer" + + "/accounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountPatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer" + + "/accounts/{accountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AccountInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer" + + "/accounts/{accountName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (checkNameAvailabilityParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter checkNameAvailabilityParameters is required and cannot be null.")); + } else { + checkNameAvailabilityParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + checkNameAvailabilityParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (checkNameAvailabilityParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter checkNameAvailabilityParameters is required and cannot be null.")); + } else { + checkNameAvailabilityParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + checkNameAvailabilityParameters, + accept, + context); + } + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters) { + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters) { + return checkNameAvailabilityAsync(checkNameAvailabilityParameters).block(); + } + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters, Context context) { + return checkNameAvailabilityWithResponseAsync(checkNameAvailabilityParameters, context).block(); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the current Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, AccountPatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the current Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, AccountPatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the current Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName, AccountPatch parameters) { + return updateWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName) { + final AccountPatch parameters = null; + return updateWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner update(String resourceGroupName, String accountName) { + final AccountPatch parameters = null; + return updateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Updates the properties of an existing Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the current Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String accountName, AccountPatch parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, AccountInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String accountName, AccountInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String accountName, AccountInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String accountName) { + final AccountInner parameters = null; + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountInner createOrUpdate(String resourceGroupName, String accountName) { + final AccountInner parameters = null; + return createOrUpdateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Creates or updates an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters to provide for the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Video Analyzer for Media account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String accountName, AccountInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName) { + return deleteWithResponseAsync(resourceGroupName, accountName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsImpl.java new file mode 100644 index 000000000000..dd1fc638f930 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/AccountsImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.AccountsClient; +import com.azure.resourcemanager.vi.fluent.models.AccountInner; +import com.azure.resourcemanager.vi.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.vi.models.Account; +import com.azure.resourcemanager.vi.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.vi.models.Accounts; +import com.azure.resourcemanager.vi.models.CheckNameAvailabilityResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AccountsImpl implements Accounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + public AccountsImpl(AccountsClient innerClient, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckNameAvailabilityResult checkNameAvailability( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters) { + CheckNameAvailabilityResultInner inner = + this.serviceClient().checkNameAvailability(checkNameAvailabilityParameters); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(checkNameAvailabilityParameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AccountImpl(inner1, this.manager())); + } + + public Account getByResourceGroup(String resourceGroupName, String accountName) { + AccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new AccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, context); + } + + public Account getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.deleteWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "accounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, context); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } + + public AccountImpl define(String name) { + return new AccountImpl(name, this.manager()); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/CheckNameAvailabilityResultImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..e9277b42423f --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.resourcemanager.vi.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.vi.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.vi.models.Reason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + CheckNameAvailabilityResultImpl( + CheckNameAvailabilityResultInner innerObject, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public Reason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesClientImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesClientImpl.java new file mode 100644 index 000000000000..7dccf65ba192 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesClientImpl.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.GeneratesClient; +import com.azure.resourcemanager.vi.fluent.models.AccessTokenInner; +import com.azure.resourcemanager.vi.models.GenerateAccessTokenParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GeneratesClient. */ +public final class GeneratesClientImpl implements GeneratesClient { + private final ClientLogger logger = new ClientLogger(GeneratesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GeneratesService service; + + /** The service client containing this operation class. */ + private final ViManagementClientImpl client; + + /** + * Initializes an instance of GeneratesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GeneratesClientImpl(ViManagementClientImpl client) { + this.service = + RestProxy.create(GeneratesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ViManagementClientGenerates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ViManagementClientGe") + private interface GeneratesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer" + + "/accounts/{accountName}/generateAccessToken") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> accessToken( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GenerateAccessTokenParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters for generating access token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> accessTokenWithResponseAsync( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .accessToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters for generating access token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> accessTokenWithResponseAsync( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .accessToken( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters for generating access token. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono accessTokenAsync( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters) { + return accessTokenWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono accessTokenAsync(String resourceGroupName, String accountName) { + final GenerateAccessTokenParameters parameters = null; + return accessTokenWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessTokenInner accessToken(String resourceGroupName, String accountName) { + final GenerateAccessTokenParameters parameters = null; + return accessTokenAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters for generating access token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response accessTokenWithResponse( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters, Context context) { + return accessTokenWithResponseAsync(resourceGroupName, accountName, parameters, context).block(); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesImpl.java new file mode 100644 index 000000000000..f4125ba7e93b --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/GeneratesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.GeneratesClient; +import com.azure.resourcemanager.vi.fluent.models.AccessTokenInner; +import com.azure.resourcemanager.vi.models.AccessToken; +import com.azure.resourcemanager.vi.models.GenerateAccessTokenParameters; +import com.azure.resourcemanager.vi.models.Generates; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GeneratesImpl implements Generates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GeneratesImpl.class); + + private final GeneratesClient innerClient; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + public GeneratesImpl(GeneratesClient innerClient, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AccessToken accessToken(String resourceGroupName, String accountName) { + AccessTokenInner inner = this.serviceClient().accessToken(resourceGroupName, accountName); + if (inner != null) { + return new AccessTokenImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response accessTokenWithResponse( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters, Context context) { + Response inner = + this.serviceClient().accessTokenWithResponse(resourceGroupName, accountName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccessTokenImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private GeneratesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationImpl.java new file mode 100644 index 000000000000..8054cef85f09 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.resourcemanager.vi.fluent.models.OperationInner; +import com.azure.resourcemanager.vi.models.Operation; +import com.azure.resourcemanager.vi.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String actionType() { + return this.innerModel().actionType(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsClientImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..fe1795cef7d8 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.OperationsClient; +import com.azure.resourcemanager.vi.fluent.models.OperationInner; +import com.azure.resourcemanager.vi.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ViManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ViManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ViManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ViManagementClientOp") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.VideoIndexer/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsImpl.java new file mode 100644 index 000000000000..370180b8b5e5 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.OperationsClient; +import com.azure.resourcemanager.vi.fluent.models.OperationInner; +import com.azure.resourcemanager.vi.models.Operation; +import com.azure.resourcemanager.vi.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.vi.ViManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.vi.ViManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.vi.ViManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/Utils.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/Utils.java new file mode 100644 index 000000000000..87f1a432af18 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientBuilder.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientBuilder.java new file mode 100644 index 000000000000..88d220ac1269 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ViManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ViManagementClientImpl.class}) +public final class ViManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the ViManagementClientBuilder. + */ + public ViManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ViManagementClientBuilder. + */ + public ViManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ViManagementClientBuilder. + */ + public ViManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ViManagementClientBuilder. + */ + public ViManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ViManagementClientBuilder. + */ + public ViManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ViManagementClientBuilder. + */ + public ViManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ViManagementClientImpl with the provided parameters. + * + * @return an instance of ViManagementClientImpl. + */ + public ViManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ViManagementClientImpl client = + new ViManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientImpl.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientImpl.java new file mode 100644 index 000000000000..5905094bad8d --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/ViManagementClientImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.vi.fluent.AccountsClient; +import com.azure.resourcemanager.vi.fluent.GeneratesClient; +import com.azure.resourcemanager.vi.fluent.OperationsClient; +import com.azure.resourcemanager.vi.fluent.ViManagementClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ViManagementClientImpl type. */ +@ServiceClient(builder = ViManagementClientBuilder.class) +public final class ViManagementClientImpl implements ViManagementClient { + private final ClientLogger logger = new ClientLogger(ViManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AccountsClient object to access its operations. */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** The GeneratesClient object to access its operations. */ + private final GeneratesClient generates; + + /** + * Gets the GeneratesClient object to access its operations. + * + * @return the GeneratesClient object. + */ + public GeneratesClient getGenerates() { + return this.generates; + } + + /** + * Initializes an instance of ViManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + ViManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-10-18-preview"; + this.operations = new OperationsClientImpl(this); + this.accounts = new AccountsClientImpl(this); + this.generates = new GeneratesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/package-info.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/package-info.java new file mode 100644 index 000000000000..aed24fa44060 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for ViManagementClient. Microsoft Azure Video Analyzer for Media. */ +package com.azure.resourcemanager.vi.implementation; diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccessToken.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccessToken.java new file mode 100644 index 000000000000..714efca399ee --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccessToken.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.resourcemanager.vi.fluent.models.AccessTokenInner; + +/** An immutable client-side representation of AccessToken. */ +public interface AccessToken { + /** + * Gets the accessToken property: The access token. + * + * @return the accessToken value. + */ + String accessToken(); + + /** + * Gets the inner com.azure.resourcemanager.vi.fluent.models.AccessTokenInner object. + * + * @return the inner object. + */ + AccessTokenInner innerModel(); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Account.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Account.java new file mode 100644 index 000000000000..16d75f7e5a20 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Account.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.fluent.models.AccountInner; +import java.util.Map; + +/** An immutable client-side representation of Account. */ +public interface Account { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: The system meta data relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the tenantId property: The account's tenant id. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the accountName property: The account's name. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the mediaServices property: The media services details. + * + * @return the mediaServices value. + */ + MediaServicesForPutRequest mediaServices(); + + /** + * Gets the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.vi.fluent.models.AccountInner object. + * + * @return the inner object. + */ + AccountInner innerModel(); + + /** The entirety of the Account definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Account definition stages. */ + interface DefinitionStages { + /** The first stage of the Account definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Account definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Account definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Account definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithAccountId, + DefinitionStages.WithMediaServices { + /** + * Executes the create request. + * + * @return the created resource. + */ + Account create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Account create(Context context); + } + /** The stage of the Account definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Account definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the Account definition allowing to specify accountId. */ + interface WithAccountId { + /** + * Specifies the accountId property: The account's data-plane ID. + * + * @param accountId The account's data-plane ID. + * @return the next definition stage. + */ + WithCreate withAccountId(String accountId); + } + /** The stage of the Account definition allowing to specify mediaServices. */ + interface WithMediaServices { + /** + * Specifies the mediaServices property: The media services details. + * + * @param mediaServices The media services details. + * @return the next definition stage. + */ + WithCreate withMediaServices(MediaServicesForPutRequest mediaServices); + } + } + /** + * Begins update for the Account resource. + * + * @return the stage of resource update. + */ + Account.Update update(); + + /** The template for Account update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithMediaServices { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Account apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Account apply(Context context); + } + /** The Account update stages. */ + interface UpdateStages { + /** The stage of the Account update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Account update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the Account update allowing to specify mediaServices. */ + interface WithMediaServices { + /** + * Specifies the mediaServices property: The media services details. + * + * @param mediaServices The media services details. + * @return the next definition stage. + */ + Update withMediaServices(MediaServicesForPatchRequest mediaServices); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Account refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Account refresh(Context context); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountCheckNameAvailabilityParameters.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountCheckNameAvailabilityParameters.java new file mode 100644 index 000000000000..d19dfd28fdde --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountCheckNameAvailabilityParameters.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters used to check the availability of the Video Indexer account name. */ +@Fluent +public final class AccountCheckNameAvailabilityParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountCheckNameAvailabilityParameters.class); + + /* + * The VideoIndexer account name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type of resource, Microsoft.VideoIndexer/accounts + */ + @JsonProperty(value = "type", required = true) + private Type type; + + /** + * Get the name property: The VideoIndexer account name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The VideoIndexer account name. + * + * @param name the name value to set. + * @return the AccountCheckNameAvailabilityParameters object itself. + */ + public AccountCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of resource, Microsoft.VideoIndexer/accounts. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: The type of resource, Microsoft.VideoIndexer/accounts. + * + * @param type the type value to set. + * @return the AccountCheckNameAvailabilityParameters object itself. + */ + public AccountCheckNameAvailabilityParameters withType(Type type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model AccountCheckNameAvailabilityParameters")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model AccountCheckNameAvailabilityParameters")); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountList.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountList.java new file mode 100644 index 000000000000..f4d3cc01fdc0 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.models.AccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list operation response, that contains the data pools and their properties. */ +@Fluent +public final class AccountList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountList.class); + + /* + * List of accounts and their properties. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of accounts and their properties. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the AccountList object itself. + */ + public AccountList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountPatch.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountPatch.java new file mode 100644 index 000000000000..987331ce3eaa --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/AccountPatch.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.models.AccountPropertiesForPatchRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Azure Video Analyzer for Media account. */ +@Fluent +public final class AccountPatch extends Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AccountPatch.class); + + /* + * List of account properties + */ + @JsonProperty(value = "properties") + private AccountPropertiesForPatchRequest innerProperties; + + /* + * Managed service identity (system assigned and/or user assigned + * identities) + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /** + * Get the innerProperties property: List of account properties. + * + * @return the innerProperties value. + */ + private AccountPropertiesForPatchRequest innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the AccountPatch object itself. + */ + public AccountPatch withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public AccountPatch withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the tenantId property: The account's tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the accountId property: The account's data-plane ID. + * + * @return the accountId value. + */ + public String accountId() { + return this.innerProperties() == null ? null : this.innerProperties().accountId(); + } + + /** + * Get the mediaServices property: The media services details. + * + * @return the mediaServices value. + */ + public MediaServicesForPatchRequest mediaServices() { + return this.innerProperties() == null ? null : this.innerProperties().mediaServices(); + } + + /** + * Set the mediaServices property: The media services details. + * + * @param mediaServices the mediaServices value to set. + * @return the AccountPatch object itself. + */ + public AccountPatch withMediaServices(MediaServicesForPatchRequest mediaServices) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountPropertiesForPatchRequest(); + } + this.innerProperties().withMediaServices(mediaServices); + return this; + } + + /** + * Get the provisioningState property: Gets the status of the account at the time the operation was called. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Accounts.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Accounts.java new file mode 100644 index 000000000000..933b277685a5 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Accounts.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Accounts. */ +public interface Accounts { + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + CheckNameAvailabilityResult checkNameAvailability( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters); + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique globally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + Response checkNameAvailabilityWithResponse( + AccountCheckNameAvailabilityParameters checkNameAvailabilityParameters, Context context); + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable list(); + + /** + * List all Azure Video Analyzer for Media accounts available under the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable list(Context context); + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all Azure Video Analyzer for Media accounts available under the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list operation response, that contains the data pools and their properties. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + Account getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String accountName); + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + Account getById(String id); + + /** + * Gets the properties of an Azure Video Analyzer for Media account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of an Azure Video Analyzer for Media account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an Azure Video Analyzer for Media account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Account resource. + * + * @param name resource name. + * @return the first stage of the new Account definition. + */ + Account.DefinitionStages.Blank define(String name); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/CheckNameAvailabilityResult.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..388424a4cdd4 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/CheckNameAvailabilityResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.resourcemanager.vi.fluent.models.CheckNameAvailabilityResultInner; + +/** An immutable client-side representation of CheckNameAvailabilityResult. */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: Gets a boolean value that indicates whether the name is available for you to + * use. If true, the name is available. If false, the name has already been taken. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Gets the reason that a Video Indexer account name could not be used. The Reason element + * is only returned if NameAvailable is false. + * + * @return the reason value. + */ + Reason reason(); + + /** + * Gets the message property: Gets an error message explaining the Reason value in more detail. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.vi.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/GenerateAccessTokenParameters.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/GenerateAccessTokenParameters.java new file mode 100644 index 000000000000..b8d13ec9e9b1 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/GenerateAccessTokenParameters.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Access token generation request's parameters. */ +@Fluent +public final class GenerateAccessTokenParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenerateAccessTokenParameters.class); + + /* + * The requested permission + */ + @JsonProperty(value = "permissionType", required = true) + private PermissionType permissionType; + + /* + * The requested media type + */ + @JsonProperty(value = "scope", required = true) + private Scope scope; + + /* + * The video ID + */ + @JsonProperty(value = "videoId") + private String videoId; + + /* + * The project ID + */ + @JsonProperty(value = "projectId") + private String projectId; + + /** + * Get the permissionType property: The requested permission. + * + * @return the permissionType value. + */ + public PermissionType permissionType() { + return this.permissionType; + } + + /** + * Set the permissionType property: The requested permission. + * + * @param permissionType the permissionType value to set. + * @return the GenerateAccessTokenParameters object itself. + */ + public GenerateAccessTokenParameters withPermissionType(PermissionType permissionType) { + this.permissionType = permissionType; + return this; + } + + /** + * Get the scope property: The requested media type. + * + * @return the scope value. + */ + public Scope scope() { + return this.scope; + } + + /** + * Set the scope property: The requested media type. + * + * @param scope the scope value to set. + * @return the GenerateAccessTokenParameters object itself. + */ + public GenerateAccessTokenParameters withScope(Scope scope) { + this.scope = scope; + return this; + } + + /** + * Get the videoId property: The video ID. + * + * @return the videoId value. + */ + public String videoId() { + return this.videoId; + } + + /** + * Set the videoId property: The video ID. + * + * @param videoId the videoId value to set. + * @return the GenerateAccessTokenParameters object itself. + */ + public GenerateAccessTokenParameters withVideoId(String videoId) { + this.videoId = videoId; + return this; + } + + /** + * Get the projectId property: The project ID. + * + * @return the projectId value. + */ + public String projectId() { + return this.projectId; + } + + /** + * Set the projectId property: The project ID. + * + * @param projectId the projectId value to set. + * @return the GenerateAccessTokenParameters object itself. + */ + public GenerateAccessTokenParameters withProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (permissionType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property permissionType in model GenerateAccessTokenParameters")); + } + if (scope() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property scope in model GenerateAccessTokenParameters")); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Generates.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Generates.java new file mode 100644 index 000000000000..b3c888c5300f --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Generates.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Generates. */ +public interface Generates { + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + AccessToken accessToken(String resourceGroupName, String accountName); + + /** + * Generate an Azure Video Analyzer for Media access token. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Analyzer for Media account. + * @param parameters The parameters for generating access token. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Video Analyzer for Media access token. + */ + Response accessTokenWithResponse( + String resourceGroupName, String accountName, GenerateAccessTokenParameters parameters, Context context); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentity.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..326bdb51660d --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentity.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public class ManagedServiceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagedServiceIdentity.class); + + /* + * The service principal ID of the system assigned identity. This property + * will only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and + * UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the + * form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentityType.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..5cbc8752973b --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ManagedServiceIdentityType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedServiceIdentityType. */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned,UserAssigned"); + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** @return known ManagedServiceIdentityType values. */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPatchRequest.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPatchRequest.java new file mode 100644 index 000000000000..5b355d96c86d --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPatchRequest.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The media services details. */ +@Fluent +public final class MediaServicesForPatchRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MediaServicesForPatchRequest.class); + + /* + * The user assigned identity to be used to grant permissions + */ + @JsonProperty(value = "userAssignedIdentity") + private String userAssignedIdentity; + + /** + * Get the userAssignedIdentity property: The user assigned identity to be used to grant permissions. + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The user assigned identity to be used to grant permissions. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the MediaServicesForPatchRequest object itself. + */ + public MediaServicesForPatchRequest withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPutRequest.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPutRequest.java new file mode 100644 index 000000000000..86f68c2aa6b5 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/MediaServicesForPutRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The media services details. */ +@Fluent +public final class MediaServicesForPutRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MediaServicesForPutRequest.class); + + /* + * The media services resource id + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The user assigned identity to be used to grant permissions + */ + @JsonProperty(value = "userAssignedIdentity") + private String userAssignedIdentity; + + /** + * Get the resourceId property: The media services resource id. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The media services resource id. + * + * @param resourceId the resourceId value to set. + * @return the MediaServicesForPutRequest object itself. + */ + public MediaServicesForPutRequest withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the userAssignedIdentity property: The user assigned identity to be used to grant permissions. + * + * @return the userAssignedIdentity value. + */ + public String userAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The user assigned identity to be used to grant permissions. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the MediaServicesForPutRequest object itself. + */ + public MediaServicesForPutRequest withUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operation.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operation.java new file mode 100644 index 000000000000..4466ba69577b --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operation.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.resourcemanager.vi.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the actionType property: Indicates the action type. + * + * @return the actionType value. + */ + String actionType(); + + /** + * Gets the display property: Display of the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the inner com.azure.resourcemanager.vi.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationDisplay.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationDisplay.java new file mode 100644 index 000000000000..07f3466dc4f5 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation display payload. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Resource provider of the operation + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource of the operation + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Localized friendly name for the operation + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Localized friendly description for the operation + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: Resource provider of the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource of the operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: Localized friendly description for the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationListResult.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationListResult.java new file mode 100644 index 000000000000..3a027c244d51 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/OperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.vi.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Available operations of the service. */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Resource Provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by the Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operations.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operations.java new file mode 100644 index 000000000000..1c6c914fc60e --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + PagedIterable list(); + + /** + * Lists all of the available Azure Video Analyzer for Media provider operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available operations of the service. + */ + PagedIterable list(Context context); +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/PermissionType.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/PermissionType.java new file mode 100644 index 000000000000..52ab8ffebd1e --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/PermissionType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PermissionType. */ +public final class PermissionType extends ExpandableStringEnum { + /** Static value Contributor for PermissionType. */ + public static final PermissionType CONTRIBUTOR = fromString("Contributor"); + + /** Static value Reader for PermissionType. */ + public static final PermissionType READER = fromString("Reader"); + + /** + * Creates or finds a PermissionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PermissionType. + */ + @JsonCreator + public static PermissionType fromString(String name) { + return fromString(name, PermissionType.class); + } + + /** @return known PermissionType values. */ + public static Collection values() { + return values(PermissionType.class); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ProvisioningState.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ProvisioningState.java new file mode 100644 index 000000000000..154b3c5b8991 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/ProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Provisioning for ProvisioningState. */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Reason.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Reason.java new file mode 100644 index 000000000000..b56c044b3006 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Reason.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Reason. */ +public final class Reason extends ExpandableStringEnum { + /** Static value AlreadyExists for Reason. */ + public static final Reason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a Reason from its string representation. + * + * @param name a name to look for. + * @return the corresponding Reason. + */ + @JsonCreator + public static Reason fromString(String name) { + return fromString(name, Reason.class); + } + + /** @return known Reason values. */ + public static Collection values() { + return values(Reason.class); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Scope.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Scope.java new file mode 100644 index 000000000000..e667a1f4bf4f --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Scope.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Scope. */ +public final class Scope extends ExpandableStringEnum { + /** Static value Video for Scope. */ + public static final Scope VIDEO = fromString("Video"); + + /** Static value Account for Scope. */ + public static final Scope ACCOUNT = fromString("Account"); + + /** Static value Project for Scope. */ + public static final Scope PROJECT = fromString("Project"); + + /** + * Creates or finds a Scope from its string representation. + * + * @param name a name to look for. + * @return the corresponding Scope. + */ + @JsonCreator + public static Scope fromString(String name) { + return fromString(name, Scope.class); + } + + /** @return known Scope values. */ + public static Collection values() { + return values(Scope.class); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Tags.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Tags.java new file mode 100644 index 000000000000..496eeaafea24 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Tags.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Resource tags. */ +@Fluent +public class Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tags.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Type.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Type.java new file mode 100644 index 000000000000..fdf7681282d3 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/Type.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value Microsoft.VideoIndexer/accounts for Type. */ + public static final Type MICROSOFT_VIDEO_INDEXER_ACCOUNTS = fromString("Microsoft.VideoIndexer/accounts"); + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** @return known Type values. */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/UserAssignedIdentity.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..668b2f695a4f --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/UserAssignedIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public class UserAssignedIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserAssignedIdentity.class); + + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/package-info.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/package-info.java new file mode 100644 index 000000000000..a387ae7c6763 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ViManagementClient. Microsoft Azure Video Analyzer for Media. */ +package com.azure.resourcemanager.vi.models; diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/package-info.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/package-info.java new file mode 100644 index 000000000000..ccaadbcdbdf4 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/com/azure/resourcemanager/vi/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ViManagementClient. Microsoft Azure Video Analyzer for Media. */ +package com.azure.resourcemanager.vi; diff --git a/sdk/vi/azure-resourcemanager-vi/src/main/java/module-info.java b/sdk/vi/azure-resourcemanager-vi/src/main/java/module-info.java new file mode 100644 index 000000000000..3f59681ce6b4 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.vi { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.vi; + exports com.azure.resourcemanager.vi.fluent; + exports com.azure.resourcemanager.vi.fluent.models; + exports com.azure.resourcemanager.vi.models; + + opens com.azure.resourcemanager.vi.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.vi.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCheckNameAvailabilitySamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..4fcfe7d9de05 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCheckNameAvailabilitySamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.models.AccountCheckNameAvailabilityParameters; +import com.azure.resourcemanager.vi.models.Type; + +/** Samples for Accounts CheckNameAvailability. */ +public final class AccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountCheckNameAvailabilityFree.json + */ + /** + * Sample code: Check free account name availability. + * + * @param manager Entry point to ViManager. + */ + public static void checkFreeAccountNameAvailability(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .checkNameAvailabilityWithResponse( + new AccountCheckNameAvailabilityParameters() + .withName("vi1") + .withType(Type.MICROSOFT_VIDEO_INDEXER_ACCOUNTS), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountCheckNameAvailabilityTaken.json + */ + /** + * Sample code: Check taken account name availability. + * + * @param manager Entry point to ViManager. + */ + public static void checkTakenAccountNameAvailability(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .checkNameAvailabilityWithResponse( + new AccountCheckNameAvailabilityParameters() + .withName("vi1") + .withType(Type.MICROSOFT_VIDEO_INDEXER_ACCOUNTS), + Context.NONE); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCreateOrUpdateSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..206a2ae6bec4 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsCreateOrUpdateSamples.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.resourcemanager.vi.models.ManagedServiceIdentity; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.vi.models.MediaServicesForPutRequest; +import com.azure.resourcemanager.vi.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts CreateOrUpdate. */ +public final class AccountsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut10.json + */ + /** + * Sample code: Put example #10. + * + * @param manager Entry point to ViManager. + */ + public static void putExample10(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut8.json + */ + /** + * Sample code: Put example #8. + * + * @param manager Entry point to ViManager. + */ + public static void putExample8(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "subscriptions/24237b72-8546-4da5-b204-8c3cb76dd930/resourceGroups/uratzmon-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/talshoham", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/24237b72-8546-4da5-b204-8c3cb76dd930/resourceGroups/uratzmon-rg/providers/Microsoft.Media/mediaservices/talshoham")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut9.json + */ + /** + * Sample code: Put example #9. + * + * @param manager Entry point to ViManager. + */ + public static void putExample9(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion((String) null) + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut4.json + */ + /** + * Sample code: Put example #4. + * + * @param manager Entry point to ViManager. + */ + public static void putExample4(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut5.json + */ + /** + * Sample code: Put example #5. + * + * @param manager Entry point to ViManager. + */ + public static void putExample5(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut6.json + */ + /** + * Sample code: Put example #6. + * + * @param manager Entry point to ViManager. + */ + public static void putExample6(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut7.json + */ + /** + * Sample code: Put example #7. + * + * @param manager Entry point to ViManager. + */ + public static void putExample7(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut1.json + */ + /** + * Sample code: Put example #1. + * + * @param manager Entry point to ViManager. + */ + public static void putExample1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut2.json + */ + /** + * Sample code: Put example #2. + * + * @param manager Entry point to ViManager. + */ + public static void putExample2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPut/ViAccountPut3.json + */ + /** + * Sample code: Put example #3. + * + * @param manager Entry point to ViManager. + */ + public static void putExample3(com.azure.resourcemanager.vi.ViManager manager) { + manager + .accounts() + .define("contosto-videoanalyzer") + .withRegion("NorthEurope") + .withExistingResourceGroup("contosto-videoanalyzer-rg") + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPutRequest() + .withResourceId( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.Media/mediaservices/contoso-videoanalyzer-ms") + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsDeleteSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsDeleteSamples.java new file mode 100644 index 000000000000..44c88d427490 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; + +/** Samples for Accounts Delete. */ +public final class AccountsDeleteSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountDelete.json + */ + /** + * Sample code: Delete account. + * + * @param manager Entry point to ViManager. + */ + public static void deleteAccount(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().deleteWithResponse("contoso-rg", "contosto-videoanalyzer", Context.NONE); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsGetByResourceGroupSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..0dce7b26aeb6 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; + +/** Samples for Accounts GetByResourceGroup. */ +public final class AccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountGet.json + */ + /** + * Sample code: Get account. + * + * @param manager Entry point to ViManager. + */ + public static void getAccount(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().getByResourceGroupWithResponse("contoso-rg", "contosto-videoanalyzer", Context.NONE); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListByResourceGroupSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListByResourceGroupSamples.java new file mode 100644 index 000000000000..f33efa77d320 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; + +/** Samples for Accounts ListByResourceGroup. */ +public final class AccountsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountsListByResourceGroup.json + */ + /** + * Sample code: List accounts by resource group. + * + * @param manager Entry point to ViManager. + */ + public static void listAccountsByResourceGroup(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().listByResourceGroup("contoso-videoanalyzer-rg", Context.NONE); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListSamples.java new file mode 100644 index 000000000000..c644b5b12e4d --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; + +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountsList.json + */ + /** + * Sample code: List accounts. + * + * @param manager Entry point to ViManager. + */ + public static void listAccounts(com.azure.resourcemanager.vi.ViManager manager) { + manager.accounts().list(Context.NONE); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsUpdateSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsUpdateSamples.java new file mode 100644 index 000000000000..962576c17d64 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/AccountsUpdateSamples.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.models.Account; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentity; +import com.azure.resourcemanager.vi.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.vi.models.MediaServicesForPatchRequest; +import com.azure.resourcemanager.vi.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts Update. */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch3.json + */ + /** + * Sample code: Patch example #3. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample3(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch4.json + */ + /** + * Sample code: Patch example #4. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample4(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch1.json + */ + /** + * Sample code: Patch example #1. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample1(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch2.json + */ + /** + * Sample code: Patch example #2. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample2(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch7.json + */ + /** + * Sample code: Patch example #7. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample7(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch8.json + */ + /** + * Sample code: Patch example #8. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample8(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch5.json + */ + /** + * Sample code: Patch example #5. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample5(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource + .update() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi", + new UserAssignedIdentity()))) + .withMediaServices( + new MediaServicesForPatchRequest() + .withUserAssignedIdentity( + "/subscriptions/xxx/resourceGroups/contoso-videoanalyzer-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-videoanalyzer-mi")) + .apply(); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViAccountPatch/ViAccountPatch6.json + */ + /** + * Sample code: Patch example #6. + * + * @param manager Entry point to ViManager. + */ + public static void patchExample6(com.azure.resourcemanager.vi.ViManager manager) { + Account resource = + manager + .accounts() + .getByResourceGroupWithResponse("contosto-videoanalyzer-rg", "contosto-videoanalyzer", Context.NONE) + .getValue(); + resource.update().apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/GenerateAccessTokenSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/GenerateAccessTokenSamples.java new file mode 100644 index 000000000000..7330af943893 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/GenerateAccessTokenSamples.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.vi.models.GenerateAccessTokenParameters; +import com.azure.resourcemanager.vi.models.PermissionType; +import com.azure.resourcemanager.vi.models.Scope; + +/** Samples for Generate AccessToken. */ +public final class GenerateAccessTokenSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoContributerAccessToken1.json + */ + /** + * Sample code: Generate accessToken for video contributor #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoContributor1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectReaderAccessToken1.json + */ + /** + * Sample code: Generate accessToken for project reader #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectReader1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoContributerAccessToken2.json + */ + /** + * Sample code: Generate accessToken for video contributor #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoContributor2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateAccountContributerAccessToken.json + */ + /** + * Sample code: Generate accessToken for account contributor. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForAccountContributor(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.ACCOUNT), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectContributerAccessToken2.json + */ + /** + * Sample code: Generate accessToken for project contributor #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectContributor2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateAccountReaderAccessToken.json + */ + /** + * Sample code: Generate accessToken for account reader. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForAccountReader(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters().withPermissionType(PermissionType.READER).withScope(Scope.ACCOUNT), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoReaderAccessToken1.json + */ + /** + * Sample code: Generate accessToken for video reader #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoReader1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectContributerAccessToken1.json + */ + /** + * Sample code: Generate accessToken for project contributor #1. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectContributor1(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.CONTRIBUTOR) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateVideoReaderAccessToken2.json + */ + /** + * Sample code: Generate accessToken for video reader #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForVideoReader2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.VIDEO) + .withVideoId("07ec9e38d4"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViGenerateAccessToken/ViGenerateProjectReaderAccessToken2.json + */ + /** + * Sample code: Generate accessToken for project reader #2. + * + * @param manager Entry point to ViManager. + */ + public static void generateAccessTokenForProjectReader2(com.azure.resourcemanager.vi.ViManager manager) { + manager + .generates() + .accessTokenWithResponse( + "contosto-videoanalyzer-rg", + "contosto-videoanalyzer", + new GenerateAccessTokenParameters() + .withPermissionType(PermissionType.READER) + .withScope(Scope.PROJECT) + .withProjectId("07ec9e38d4"), + Context.NONE); + } +} diff --git a/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/OperationsListSamples.java b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/OperationsListSamples.java new file mode 100644 index 000000000000..480655122a03 --- /dev/null +++ b/sdk/vi/azure-resourcemanager-vi/src/samples/java/com/azure/resourcemanager/vi/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.vi.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/vi/resource-manager/Microsoft.VideoIndexer/preview/2021-10-18-preview/examples/ViOperationsList.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to ViManager. + */ + public static void listOperations(com.azure.resourcemanager.vi.ViManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/vi/ci.yml b/sdk/vi/ci.yml new file mode 100644 index 000000000000..af9a0d61b0fa --- /dev/null +++ b/sdk/vi/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/vi/ci.yml + - sdk/vi/azure-resourcemanager-vi/ + exclude: + - sdk/vi/pom.xml + - sdk/vi/azure-resourcemanager-vi/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/vi/ci.yml + - sdk/vi/azure-resourcemanager-vi/ + exclude: + - sdk/vi/pom.xml + - sdk/vi/azure-resourcemanager-vi/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: vi + Artifacts: + - name: azure-resourcemanager-vi + groupId: com.azure.resourcemanager + safeName: azureresourcemanagervi diff --git a/sdk/vi/pom.xml b/sdk/vi/pom.xml new file mode 100644 index 000000000000..d7da0b4b6d0f --- /dev/null +++ b/sdk/vi/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-vi-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-vi + + + +