diff --git a/eng/automation/api-specs.yaml b/eng/automation/api-specs.yaml index e1784ce597af..26a9acaf68f0 100644 --- a/eng/automation/api-specs.yaml +++ b/eng/automation/api-specs.yaml @@ -107,6 +107,8 @@ redis: suffix: generated resources: suffix: generated +resources/Microsoft.Resources/deploymentScripts: + service: resourcesmicrosoftresourcesdeploymentscripts riskiq: service: defendereasm service-map: diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 6c19a3d0aa1d..bfac525106cc 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -476,6 +476,7 @@ com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-carbonoptimization;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-portalservicescopilot;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 6c4b23cb4b9d..bda0eee0b677 100644 --- a/pom.xml +++ b/pom.xml @@ -198,6 +198,7 @@ sdk/resourcehealth sdk/resourcemanager sdk/resourcemover + sdk/resourcesmicrosoftresourcesdeploymentscripts sdk/schemaregistry sdk/scvmm sdk/search diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/CHANGELOG.md b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/CHANGELOG.md new file mode 100644 index 000000000000..7e337a28e1b2 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-28) + +- Azure Resource Manager DeploymentScripts client library for Java. This package contains Microsoft Azure SDK for DeploymentScripts Management SDK. DeploymentScripts Client. Package tag package-2023-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts Java SDK. diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/README.md b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/README.md new file mode 100644 index 000000000000..8d59fa972e32 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager DeploymentScripts client library for Java + +Azure Resource Manager DeploymentScripts client library for Java. + +This package contains Microsoft Azure SDK for DeploymentScripts Management SDK. DeploymentScripts Client. Package tag package-2023-08. 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-resourcesmicrosoftresourcesdeploymentscripts;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DeploymentScriptsManager manager = DeploymentScriptsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/SAMPLE.md b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/SAMPLE.md new file mode 100644 index 000000000000..8649c76e2e97 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/SAMPLE.md @@ -0,0 +1,432 @@ +# Code snippets and samples + + +## DeploymentScripts + +- [Create](#deploymentscripts_create) +- [Delete](#deploymentscripts_delete) +- [GetByResourceGroup](#deploymentscripts_getbyresourcegroup) +- [GetLogs](#deploymentscripts_getlogs) +- [GetLogsDefault](#deploymentscripts_getlogsdefault) +- [List](#deploymentscripts_list) +- [ListByResourceGroup](#deploymentscripts_listbyresourcegroup) +- [Update](#deploymentscripts_update) +### DeploymentScripts_Create + +```java +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.AzurePowerShellScript; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.CleanupOptions; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ContainerConfiguration; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ContainerGroupSubnetId; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.StorageAccountConfiguration; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.UserAssignedIdentity; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DeploymentScripts Create. + */ +public final class DeploymentScriptsCreateSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_Using_Custom_Aci_Name.json + */ + /** + * Sample code: DeploymentScriptsCreate_UsingCustomACIName. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateUsingCustomACIName( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withContainerSettings(new ContainerConfiguration().withContainerGroupName("contoso-aci")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_Using_Custom_Aci_Name_With_SubnetIds.json + */ + /** + * Sample code: DeploymentScriptsCreate_UsingAciWithSubnets. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateUsingAciWithSubnets( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withContainerSettings(new ContainerConfiguration().withContainerGroupName("contoso-aci") + .withSubnetIds(Arrays.asList(new ContainerGroupSubnetId().withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Network/virtualNetworks/scriptSubnet/subnets/subnetwork1"), + new ContainerGroupSubnetId().withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Network/virtualNetworks/scriptSubnet/subnets/subnetwork2")))) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_Using_Existing_StorageAccount.json + */ + /** + * Sample code: DeploymentScriptsCreate_UsingExistingStorageAccount. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateUsingExistingStorageAccount( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withStorageAccountSettings(new StorageAccountConfiguration().withStorageAccountName("contosostorage") + .withStorageAccountKey("fakeTokenPlaceholder")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Min_Create.json + */ + /** + * Sample code: DeploymentScriptsCreate_MinCreate. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateMinCreate( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create.json + */ + /** + * Sample code: DeploymentScriptsCreate. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreate( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_No_UserManagedIdentity.json + */ + /** + * Sample code: DeploymentScriptsCreateNoUserManagedIdentity. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateNoUserManagedIdentity( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript().withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### DeploymentScripts_Delete + +```java +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptUpdateParameter; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DeploymentScripts Update. + */ +public final class DeploymentScriptsUpdateSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Update.json + */ + /** + * Sample code: DeploymentScriptsUpdate. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsUpdate( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .updateWithResponse("script-rg", "MyDeploymentScript", + new DeploymentScriptUpdateParameter().withTags(mapOf()), com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### DeploymentScripts_GetByResourceGroup + +```java +/** + * Samples for DeploymentScripts Delete. + */ +public final class DeploymentScriptsDeleteSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Delete.json + */ + /** + * Sample code: DeploymentScriptsDelete. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsDelete( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .deleteByResourceGroupWithResponse("script-rg", "MyDeploymentScript", com.azure.core.util.Context.NONE); + } +} +``` + +### DeploymentScripts_GetLogs + +```java +/** + * Samples for DeploymentScripts List. + */ +public final class DeploymentScriptsListSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_ListBySubscription.json + */ + /** + * Sample code: DeploymentScriptsListBySubscription. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsListBySubscription( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DeploymentScripts_GetLogsDefault + +```java +/** + * Samples for DeploymentScripts GetLogs. + */ +public final class DeploymentScriptsGetLogsSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_GetLogs.json + */ + /** + * Sample code: DeploymentScriptsGetLogs. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGetLogs( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getLogsWithResponse("script-rg", "MyDeploymentScript", com.azure.core.util.Context.NONE); + } +} +``` + +### DeploymentScripts_List + +```java +/** + * Samples for DeploymentScripts GetLogsDefault. + */ +public final class DeploymentScriptsGetLogsDefaultSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_GetLogsDefault.json + */ + /** + * Sample code: DeploymentScriptsGetLogs. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGetLogs( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getLogsDefaultWithResponse("script-rg", "MyDeploymentScript", null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_GetLogsDefaultWithTail.json + */ + /** + * Sample code: DeploymentScriptsGetLogsWithTail. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGetLogsWithTail( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getLogsDefaultWithResponse("script-rg", "MyDeploymentScript", 5, com.azure.core.util.Context.NONE); + } +} +``` + +### DeploymentScripts_ListByResourceGroup + +```java +/** + * Samples for DeploymentScripts ListByResourceGroup. + */ +public final class DeploymentScriptsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_ListByResourceGroup.json + */ + /** + * Sample code: DeploymentScriptsList. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsList( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts().listByResourceGroup("script-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### DeploymentScripts_Update + +```java +/** + * Samples for DeploymentScripts GetByResourceGroup. + */ +public final class DeploymentScriptsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Get.json + */ + /** + * Sample code: DeploymentScriptsGet. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGet( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getByResourceGroupWithResponse("script-rg", "MyDeploymentScript", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/pom.xml b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/pom.xml new file mode 100644 index 000000000000..b450bc0aac50 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DeploymentScripts Management + This package contains Microsoft Azure SDK for DeploymentScripts Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. DeploymentScripts Client. Package tag package-2023-08. + 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 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/DeploymentScriptsManager.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/DeploymentScriptsManager.java new file mode 100644 index 000000000000..f3313eeb815b --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/DeploymentScriptsManager.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts; + +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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.DeploymentScriptsManagementClient; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.implementation.DeploymentScriptsImpl; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.implementation.DeploymentScriptsManagementClientBuilder; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScripts; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to DeploymentScriptsManager. + * DeploymentScripts Client. + */ +public final class DeploymentScriptsManager { + private DeploymentScripts deploymentScripts; + + private final DeploymentScriptsManagementClient clientObject; + + private DeploymentScriptsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DeploymentScriptsManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of DeploymentScripts service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DeploymentScripts service API instance. + */ + public static DeploymentScriptsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of DeploymentScripts service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the DeploymentScripts service API instance. + */ + public static DeploymentScriptsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DeploymentScriptsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DeploymentScriptsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DeploymentScriptsManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + 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 retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of DeploymentScripts service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DeploymentScripts service API instance. + */ + public DeploymentScriptsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts") + .append("/") + .append(clientVersion); + 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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DeploymentScriptsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of DeploymentScripts. + * + * @return Resource collection API of DeploymentScripts. + */ + public DeploymentScripts deploymentScripts() { + if (this.deploymentScripts == null) { + this.deploymentScripts = new DeploymentScriptsImpl(clientObject.getDeploymentScripts(), this); + } + return deploymentScripts; + } + + /** + * Gets wrapped service client DeploymentScriptsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client DeploymentScriptsManagementClient. + */ + public DeploymentScriptsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/DeploymentScriptsClient.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/DeploymentScriptsClient.java new file mode 100644 index 000000000000..e3f7764c9a90 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/DeploymentScriptsClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogsListInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptUpdateParameter; + +/** + * An instance of this class provides access to all the operations defined in DeploymentScriptsClient. + */ +public interface DeploymentScriptsClient { + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 {@link SyncPoller} for polling of deployment script object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentScriptInner> beginCreate(String resourceGroupName, + String scriptName, DeploymentScriptInner deploymentScript); + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 {@link SyncPoller} for polling of deployment script object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentScriptInner> beginCreate(String resourceGroupName, + String scriptName, DeploymentScriptInner deploymentScript, Context context); + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 deployment script object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentScriptInner create(String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript); + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 deployment script object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentScriptInner create(String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript, + Context context); + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script resource with the tags to be updated. + * @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 deployment script object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String scriptName, + DeploymentScriptUpdateParameter deploymentScript, Context context); + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentScriptInner update(String resourceGroupName, String scriptName); + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String scriptName, + Context context); + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentScriptInner getByResourceGroup(String resourceGroupName, String scriptName); + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String scriptName, Context context); + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 scriptName); + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getLogsWithResponse(String resourceGroupName, String scriptName, Context context); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScriptLogsListInner getLogs(String resourceGroupName, String scriptName); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param tail The number of lines to show from the tail of the deployment script log. Valid value is a positive + * number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity + * of 4mb. + * @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 deployment script logs for a given deployment script name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getLogsDefaultWithResponse(String resourceGroupName, String scriptName, Integer tail, + Context context); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScriptLogInner getLogsDefault(String resourceGroupName, String scriptName); + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/DeploymentScriptsManagementClient.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/DeploymentScriptsManagementClient.java new file mode 100644 index 000000000000..a801323cef6c --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/DeploymentScriptsManagementClient.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.resourcesmicrosoftresourcesdeploymentscripts.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for DeploymentScriptsManagementClient class. + */ +public interface DeploymentScriptsManagementClient { + /** + * Gets Subscription Id which forms part of the URI for every service call. + * + * @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 DeploymentScriptsClient object to access its operations. + * + * @return the DeploymentScriptsClient object. + */ + DeploymentScriptsClient getDeploymentScripts(); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/AzureCliScriptProperties.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/AzureCliScriptProperties.java new file mode 100644 index 000000000000..c349a0c4e88c --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/AzureCliScriptProperties.java @@ -0,0 +1,466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.CleanupOptions; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ContainerConfiguration; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptPropertiesBase; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.EnvironmentVariable; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptProvisioningState; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptStatus; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.StorageAccountConfiguration; +import java.io.IOException; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** + * Properties of the Azure CLI script object. + */ +@Fluent +public final class AzureCliScriptProperties extends DeploymentScriptPropertiesBase { + /* + * Azure CLI module version to be used. + */ + private String azCliVersion; + + /* + * Uri for the script. This is the entry point for the external script. + */ + private String primaryScriptUri; + + /* + * Supporting files for the external script. + */ + private List supportingScriptUris; + + /* + * Script body. + */ + private String scriptContent; + + /* + * Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West + * US 2' + */ + private String arguments; + + /* + * The environment variables to pass over to the script. + */ + private List environmentVariables; + + /* + * Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. + * Can be current time stamp or a GUID. + */ + private String forceUpdateTag; + + /* + * Interval for which the service retains the script resource after it reaches a terminal state. Resource will be + * deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P1D means one day). + */ + private Duration retentionInterval; + + /* + * Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D + */ + private Duration timeout; + + /* + * List of script outputs. + */ + private Map outputs; + + /* + * Contains the results of script execution. + */ + private ScriptStatus status; + + /* + * State of the script execution. This only appears in the response. + */ + private ScriptProvisioningState provisioningState; + + /** + * Creates an instance of AzureCliScriptProperties class. + */ + public AzureCliScriptProperties() { + } + + /** + * Get the azCliVersion property: Azure CLI module version to be used. + * + * @return the azCliVersion value. + */ + public String azCliVersion() { + return this.azCliVersion; + } + + /** + * Set the azCliVersion property: Azure CLI module version to be used. + * + * @param azCliVersion the azCliVersion value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withAzCliVersion(String azCliVersion) { + this.azCliVersion = azCliVersion; + return this; + } + + /** + * Get the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @return the primaryScriptUri value. + */ + public String primaryScriptUri() { + return this.primaryScriptUri; + } + + /** + * Set the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @param primaryScriptUri the primaryScriptUri value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withPrimaryScriptUri(String primaryScriptUri) { + this.primaryScriptUri = primaryScriptUri; + return this; + } + + /** + * Get the supportingScriptUris property: Supporting files for the external script. + * + * @return the supportingScriptUris value. + */ + public List supportingScriptUris() { + return this.supportingScriptUris; + } + + /** + * Set the supportingScriptUris property: Supporting files for the external script. + * + * @param supportingScriptUris the supportingScriptUris value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withSupportingScriptUris(List supportingScriptUris) { + this.supportingScriptUris = supportingScriptUris; + return this; + } + + /** + * Get the scriptContent property: Script body. + * + * @return the scriptContent value. + */ + public String scriptContent() { + return this.scriptContent; + } + + /** + * Set the scriptContent property: Script body. + * + * @param scriptContent the scriptContent value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withScriptContent(String scriptContent) { + this.scriptContent = scriptContent; + return this; + } + + /** + * Get the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @return the arguments value. + */ + public String arguments() { + return this.arguments; + } + + /** + * Set the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @param arguments the arguments value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withArguments(String arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the environmentVariables property: The environment variables to pass over to the script. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: The environment variables to pass over to the script. + * + * @param environmentVariables the environmentVariables value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @return the retentionInterval value. + */ + public Duration retentionInterval() { + return this.retentionInterval; + } + + /** + * Set the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @param retentionInterval the retentionInterval value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withRetentionInterval(Duration retentionInterval) { + this.retentionInterval = retentionInterval; + return this; + } + + /** + * Get the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @return the timeout value. + */ + public Duration timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @param timeout the timeout value to set. + * @return the AzureCliScriptProperties object itself. + */ + public AzureCliScriptProperties withTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the outputs property: List of script outputs. + * + * @return the outputs value. + */ + @Override + public Map outputs() { + return this.outputs; + } + + /** + * Get the status property: Contains the results of script execution. + * + * @return the status value. + */ + @Override + public ScriptStatus status() { + return this.status; + } + + /** + * Get the provisioningState property: State of the script execution. This only appears in the response. + * + * @return the provisioningState value. + */ + @Override + public ScriptProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureCliScriptProperties withContainerSettings(ContainerConfiguration containerSettings) { + super.withContainerSettings(containerSettings); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureCliScriptProperties withStorageAccountSettings(StorageAccountConfiguration storageAccountSettings) { + super.withStorageAccountSettings(storageAccountSettings); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureCliScriptProperties withCleanupPreference(CleanupOptions cleanupPreference) { + super.withCleanupPreference(cleanupPreference); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azCliVersion() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azCliVersion in model AzureCliScriptProperties")); + } + if (environmentVariables() != null) { + environmentVariables().forEach(e -> e.validate()); + } + if (retentionInterval() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property retentionInterval in model AzureCliScriptProperties")); + } + if (containerSettings() != null) { + containerSettings().validate(); + } + if (storageAccountSettings() != null) { + storageAccountSettings().validate(); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureCliScriptProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("containerSettings", containerSettings()); + jsonWriter.writeJsonField("storageAccountSettings", storageAccountSettings()); + jsonWriter.writeStringField("cleanupPreference", + cleanupPreference() == null ? null : cleanupPreference().toString()); + jsonWriter.writeStringField("azCliVersion", this.azCliVersion); + jsonWriter.writeStringField("retentionInterval", CoreUtils.durationToStringWithDays(this.retentionInterval)); + jsonWriter.writeStringField("primaryScriptUri", this.primaryScriptUri); + jsonWriter.writeArrayField("supportingScriptUris", this.supportingScriptUris, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("scriptContent", this.scriptContent); + jsonWriter.writeStringField("arguments", this.arguments); + jsonWriter.writeArrayField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("forceUpdateTag", this.forceUpdateTag); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureCliScriptProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureCliScriptProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureCliScriptProperties. + */ + public static AzureCliScriptProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureCliScriptProperties deserializedAzureCliScriptProperties = new AzureCliScriptProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerSettings".equals(fieldName)) { + deserializedAzureCliScriptProperties.withContainerSettings(ContainerConfiguration.fromJson(reader)); + } else if ("storageAccountSettings".equals(fieldName)) { + deserializedAzureCliScriptProperties + .withStorageAccountSettings(StorageAccountConfiguration.fromJson(reader)); + } else if ("cleanupPreference".equals(fieldName)) { + deserializedAzureCliScriptProperties + .withCleanupPreference(CleanupOptions.fromString(reader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureCliScriptProperties.provisioningState + = ScriptProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedAzureCliScriptProperties.status = ScriptStatus.fromJson(reader); + } else if ("outputs".equals(fieldName)) { + Map outputs = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedAzureCliScriptProperties.outputs = outputs; + } else if ("azCliVersion".equals(fieldName)) { + deserializedAzureCliScriptProperties.azCliVersion = reader.getString(); + } else if ("retentionInterval".equals(fieldName)) { + deserializedAzureCliScriptProperties.retentionInterval + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("primaryScriptUri".equals(fieldName)) { + deserializedAzureCliScriptProperties.primaryScriptUri = reader.getString(); + } else if ("supportingScriptUris".equals(fieldName)) { + List supportingScriptUris = reader.readArray(reader1 -> reader1.getString()); + deserializedAzureCliScriptProperties.supportingScriptUris = supportingScriptUris; + } else if ("scriptContent".equals(fieldName)) { + deserializedAzureCliScriptProperties.scriptContent = reader.getString(); + } else if ("arguments".equals(fieldName)) { + deserializedAzureCliScriptProperties.arguments = reader.getString(); + } else if ("environmentVariables".equals(fieldName)) { + List environmentVariables + = reader.readArray(reader1 -> EnvironmentVariable.fromJson(reader1)); + deserializedAzureCliScriptProperties.environmentVariables = environmentVariables; + } else if ("forceUpdateTag".equals(fieldName)) { + deserializedAzureCliScriptProperties.forceUpdateTag = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedAzureCliScriptProperties.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureCliScriptProperties; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/AzurePowerShellScriptProperties.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/AzurePowerShellScriptProperties.java new file mode 100644 index 000000000000..26fd3d2758d2 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/AzurePowerShellScriptProperties.java @@ -0,0 +1,469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.CleanupOptions; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ContainerConfiguration; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptPropertiesBase; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.EnvironmentVariable; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptProvisioningState; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptStatus; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.StorageAccountConfiguration; +import java.io.IOException; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** + * Properties of the Azure PowerShell script object. + */ +@Fluent +public final class AzurePowerShellScriptProperties extends DeploymentScriptPropertiesBase { + /* + * Azure PowerShell module version to be used. + */ + private String azPowerShellVersion; + + /* + * Uri for the script. This is the entry point for the external script. + */ + private String primaryScriptUri; + + /* + * Supporting files for the external script. + */ + private List supportingScriptUris; + + /* + * Script body. + */ + private String scriptContent; + + /* + * Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West + * US 2' + */ + private String arguments; + + /* + * The environment variables to pass over to the script. + */ + private List environmentVariables; + + /* + * Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. + * Can be current time stamp or a GUID. + */ + private String forceUpdateTag; + + /* + * Interval for which the service retains the script resource after it reaches a terminal state. Resource will be + * deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P1D means one day). + */ + private Duration retentionInterval; + + /* + * Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D + */ + private Duration timeout; + + /* + * List of script outputs. + */ + private Map outputs; + + /* + * Contains the results of script execution. + */ + private ScriptStatus status; + + /* + * State of the script execution. This only appears in the response. + */ + private ScriptProvisioningState provisioningState; + + /** + * Creates an instance of AzurePowerShellScriptProperties class. + */ + public AzurePowerShellScriptProperties() { + } + + /** + * Get the azPowerShellVersion property: Azure PowerShell module version to be used. + * + * @return the azPowerShellVersion value. + */ + public String azPowerShellVersion() { + return this.azPowerShellVersion; + } + + /** + * Set the azPowerShellVersion property: Azure PowerShell module version to be used. + * + * @param azPowerShellVersion the azPowerShellVersion value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withAzPowerShellVersion(String azPowerShellVersion) { + this.azPowerShellVersion = azPowerShellVersion; + return this; + } + + /** + * Get the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @return the primaryScriptUri value. + */ + public String primaryScriptUri() { + return this.primaryScriptUri; + } + + /** + * Set the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @param primaryScriptUri the primaryScriptUri value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withPrimaryScriptUri(String primaryScriptUri) { + this.primaryScriptUri = primaryScriptUri; + return this; + } + + /** + * Get the supportingScriptUris property: Supporting files for the external script. + * + * @return the supportingScriptUris value. + */ + public List supportingScriptUris() { + return this.supportingScriptUris; + } + + /** + * Set the supportingScriptUris property: Supporting files for the external script. + * + * @param supportingScriptUris the supportingScriptUris value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withSupportingScriptUris(List supportingScriptUris) { + this.supportingScriptUris = supportingScriptUris; + return this; + } + + /** + * Get the scriptContent property: Script body. + * + * @return the scriptContent value. + */ + public String scriptContent() { + return this.scriptContent; + } + + /** + * Set the scriptContent property: Script body. + * + * @param scriptContent the scriptContent value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withScriptContent(String scriptContent) { + this.scriptContent = scriptContent; + return this; + } + + /** + * Get the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @return the arguments value. + */ + public String arguments() { + return this.arguments; + } + + /** + * Set the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @param arguments the arguments value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withArguments(String arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the environmentVariables property: The environment variables to pass over to the script. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: The environment variables to pass over to the script. + * + * @param environmentVariables the environmentVariables value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @return the retentionInterval value. + */ + public Duration retentionInterval() { + return this.retentionInterval; + } + + /** + * Set the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @param retentionInterval the retentionInterval value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withRetentionInterval(Duration retentionInterval) { + this.retentionInterval = retentionInterval; + return this; + } + + /** + * Get the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @return the timeout value. + */ + public Duration timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @param timeout the timeout value to set. + * @return the AzurePowerShellScriptProperties object itself. + */ + public AzurePowerShellScriptProperties withTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the outputs property: List of script outputs. + * + * @return the outputs value. + */ + @Override + public Map outputs() { + return this.outputs; + } + + /** + * Get the status property: Contains the results of script execution. + * + * @return the status value. + */ + @Override + public ScriptStatus status() { + return this.status; + } + + /** + * Get the provisioningState property: State of the script execution. This only appears in the response. + * + * @return the provisioningState value. + */ + @Override + public ScriptProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public AzurePowerShellScriptProperties withContainerSettings(ContainerConfiguration containerSettings) { + super.withContainerSettings(containerSettings); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzurePowerShellScriptProperties + withStorageAccountSettings(StorageAccountConfiguration storageAccountSettings) { + super.withStorageAccountSettings(storageAccountSettings); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzurePowerShellScriptProperties withCleanupPreference(CleanupOptions cleanupPreference) { + super.withCleanupPreference(cleanupPreference); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (azPowerShellVersion() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azPowerShellVersion in model AzurePowerShellScriptProperties")); + } + if (environmentVariables() != null) { + environmentVariables().forEach(e -> e.validate()); + } + if (retentionInterval() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property retentionInterval in model AzurePowerShellScriptProperties")); + } + if (containerSettings() != null) { + containerSettings().validate(); + } + if (storageAccountSettings() != null) { + storageAccountSettings().validate(); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzurePowerShellScriptProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("containerSettings", containerSettings()); + jsonWriter.writeJsonField("storageAccountSettings", storageAccountSettings()); + jsonWriter.writeStringField("cleanupPreference", + cleanupPreference() == null ? null : cleanupPreference().toString()); + jsonWriter.writeStringField("azPowerShellVersion", this.azPowerShellVersion); + jsonWriter.writeStringField("retentionInterval", CoreUtils.durationToStringWithDays(this.retentionInterval)); + jsonWriter.writeStringField("primaryScriptUri", this.primaryScriptUri); + jsonWriter.writeArrayField("supportingScriptUris", this.supportingScriptUris, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("scriptContent", this.scriptContent); + jsonWriter.writeStringField("arguments", this.arguments); + jsonWriter.writeArrayField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("forceUpdateTag", this.forceUpdateTag); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzurePowerShellScriptProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzurePowerShellScriptProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzurePowerShellScriptProperties. + */ + public static AzurePowerShellScriptProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzurePowerShellScriptProperties deserializedAzurePowerShellScriptProperties + = new AzurePowerShellScriptProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerSettings".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties + .withContainerSettings(ContainerConfiguration.fromJson(reader)); + } else if ("storageAccountSettings".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties + .withStorageAccountSettings(StorageAccountConfiguration.fromJson(reader)); + } else if ("cleanupPreference".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties + .withCleanupPreference(CleanupOptions.fromString(reader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.provisioningState + = ScriptProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.status = ScriptStatus.fromJson(reader); + } else if ("outputs".equals(fieldName)) { + Map outputs = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedAzurePowerShellScriptProperties.outputs = outputs; + } else if ("azPowerShellVersion".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.azPowerShellVersion = reader.getString(); + } else if ("retentionInterval".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.retentionInterval + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("primaryScriptUri".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.primaryScriptUri = reader.getString(); + } else if ("supportingScriptUris".equals(fieldName)) { + List supportingScriptUris = reader.readArray(reader1 -> reader1.getString()); + deserializedAzurePowerShellScriptProperties.supportingScriptUris = supportingScriptUris; + } else if ("scriptContent".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.scriptContent = reader.getString(); + } else if ("arguments".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.arguments = reader.getString(); + } else if ("environmentVariables".equals(fieldName)) { + List environmentVariables + = reader.readArray(reader1 -> EnvironmentVariable.fromJson(reader1)); + deserializedAzurePowerShellScriptProperties.environmentVariables = environmentVariables; + } else if ("forceUpdateTag".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.forceUpdateTag = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedAzurePowerShellScriptProperties.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedAzurePowerShellScriptProperties; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/DeploymentScriptInner.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/DeploymentScriptInner.java new file mode 100644 index 000000000000..e2ff197796b9 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/DeploymentScriptInner.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.AzureCliScript; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.AzurePowerShellScript; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.AzureResourceBase; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptType; +import java.io.IOException; +import java.util.Map; + +/** + * Deployment script object. + */ +@Fluent +public class DeploymentScriptInner extends AzureResourceBase { + /* + * Type of the script. + */ + private ScriptType kind = ScriptType.fromString("DeploymentScript"); + + /* + * Optional property. Managed identity to be used for this deployment script. Currently, only user-assigned MSI is + * supported. + */ + private ManagedServiceIdentity identity; + + /* + * The location of the ACI and the storage account for the deployment script. + */ + private String location; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The system metadata related to this resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DeploymentScriptInner class. + */ + public DeploymentScriptInner() { + } + + /** + * Get the kind property: Type of the script. + * + * @return the kind value. + */ + public ScriptType kind() { + return this.kind; + } + + /** + * Get the identity property: Optional property. Managed identity to be used for this deployment script. Currently, + * only user-assigned MSI is supported. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Optional property. Managed identity to be used for this deployment script. Currently, + * only user-assigned MSI is supported. + * + * @param identity the identity value to set. + * @return the DeploymentScriptInner object itself. + */ + public DeploymentScriptInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the location property: The location of the ACI and the storage account for the deployment script. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the ACI and the storage account for the deployment script. + * + * @param location the location value to set. + * @return the DeploymentScriptInner object itself. + */ + public DeploymentScriptInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * 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 DeploymentScriptInner object itself. + */ + public DeploymentScriptInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: The system metadata related to this resource. + * + * @param systemData the systemData value to set. + * @return the DeploymentScriptInner object itself. + */ + DeploymentScriptInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model DeploymentScriptInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeploymentScriptInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentScriptInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentScriptInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeploymentScriptInner. + */ + public static DeploymentScriptInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzurePowerShell".equals(discriminatorValue)) { + return AzurePowerShellScript.fromJson(readerToUse.reset()); + } else if ("AzureCLI".equals(discriminatorValue)) { + return AzureCliScript.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static DeploymentScriptInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentScriptInner deserializedDeploymentScriptInner = new DeploymentScriptInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeploymentScriptInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeploymentScriptInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeploymentScriptInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDeploymentScriptInner.location = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedDeploymentScriptInner.kind = ScriptType.fromString(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedDeploymentScriptInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDeploymentScriptInner.tags = tags; + } else if ("systemData".equals(fieldName)) { + deserializedDeploymentScriptInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentScriptInner; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/LogProperties.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/LogProperties.java new file mode 100644 index 000000000000..7df1398a9f0b --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/LogProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Script log properties. + */ +@Immutable +public final class LogProperties implements JsonSerializable { + /* + * Script execution logs in text format. + */ + private String log; + + /** + * Creates an instance of LogProperties class. + */ + public LogProperties() { + } + + /** + * Get the log property: Script execution logs in text format. + * + * @return the log value. + */ + public String log() { + return this.log; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LogProperties. + */ + public static LogProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogProperties deserializedLogProperties = new LogProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("log".equals(fieldName)) { + deserializedLogProperties.log = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLogProperties; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/ScriptLogInner.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/ScriptLogInner.java new file mode 100644 index 000000000000..77ba282681a9 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/ScriptLogInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.AzureResourceBase; +import java.io.IOException; + +/** + * Script execution log object. + */ +@Immutable +public final class ScriptLogInner extends AzureResourceBase { + /* + * Script log properties. + */ + private LogProperties innerProperties; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ScriptLogInner class. + */ + public ScriptLogInner() { + } + + /** + * Get the innerProperties property: Script log properties. + * + * @return the innerProperties value. + */ + private LogProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the log property: Script execution logs in text format. + * + * @return the log value. + */ + public String log() { + return this.innerProperties() == null ? null : this.innerProperties().log(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScriptLogInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScriptLogInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScriptLogInner. + */ + public static ScriptLogInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScriptLogInner deserializedScriptLogInner = new ScriptLogInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedScriptLogInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedScriptLogInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedScriptLogInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedScriptLogInner.innerProperties = LogProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScriptLogInner; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/ScriptLogsListInner.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/ScriptLogsListInner.java new file mode 100644 index 000000000000..82c9ef55a124 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/ScriptLogsListInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Deployment script execution logs. + */ +@Fluent +public final class ScriptLogsListInner implements JsonSerializable { + /* + * Deployment scripts logs. + */ + private List value; + + /** + * Creates an instance of ScriptLogsListInner class. + */ + public ScriptLogsListInner() { + } + + /** + * Get the value property: Deployment scripts logs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Deployment scripts logs. + * + * @param value the value value to set. + * @return the ScriptLogsListInner object itself. + */ + public ScriptLogsListInner withValue(List value) { + this.value = value; + 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScriptLogsListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScriptLogsListInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScriptLogsListInner. + */ + public static ScriptLogsListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScriptLogsListInner deserializedScriptLogsListInner = new ScriptLogsListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ScriptLogInner.fromJson(reader1)); + deserializedScriptLogsListInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedScriptLogsListInner; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/package-info.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/package-info.java new file mode 100644 index 000000000000..baaa85bfd878 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 DeploymentScriptsManagementClient. + * DeploymentScripts Client. + */ +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/package-info.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/package-info.java new file mode 100644 index 000000000000..a873266e31cf --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 DeploymentScriptsManagementClient. + * DeploymentScripts Client. + */ +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent; diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptImpl.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptImpl.java new file mode 100644 index 000000000000..b88933e08c67 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptImpl.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.resourcesmicrosoftresourcesdeploymentscripts.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScript; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptType; +import java.util.Collections; +import java.util.Map; + +public final class DeploymentScriptImpl implements DeploymentScript { + private DeploymentScriptInner innerObject; + + private final com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager; + + DeploymentScriptImpl(DeploymentScriptInner innerObject, + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ScriptType kind() { + return this.innerModel().kind(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public DeploymentScriptInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsClientImpl.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsClientImpl.java new file mode 100644 index 000000000000..54109defcb07 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsClientImpl.java @@ -0,0 +1,1357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.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.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.DeploymentScriptsClient; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogsListInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptListResult; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptUpdateParameter; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DeploymentScriptsClient. + */ +public final class DeploymentScriptsClientImpl implements DeploymentScriptsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DeploymentScriptsService service; + + /** + * The service client containing this operation class. + */ + private final DeploymentScriptsManagementClientImpl client; + + /** + * Initializes an instance of DeploymentScriptsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeploymentScriptsClientImpl(DeploymentScriptsManagementClientImpl client) { + this.service + = RestProxy.create(DeploymentScriptsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeploymentScriptsManagementClientDeploymentScripts to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DeploymentScriptsMan") + public interface DeploymentScriptsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("scriptName") String scriptName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DeploymentScriptInner deploymentScript, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("scriptName") String scriptName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DeploymentScriptUpdateParameter deploymentScript, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("scriptName") String scriptName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("scriptName") String scriptName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentScripts") + @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.Resources/deploymentScripts/{scriptName}/logs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getLogs(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("scriptName") String scriptName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getLogsDefault(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("scriptName") String scriptName, + @QueryParam("api-version") String apiVersion, @QueryParam("tail") Integer tail, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts") + @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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @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); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 deployment script object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript) { + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + if (deploymentScript == null) { + return Mono + .error(new IllegalArgumentException("Parameter deploymentScript is required and cannot be null.")); + } else { + deploymentScript.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, scriptName, this.client.getApiVersion(), deploymentScript, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 deployment script object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript, 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + if (deploymentScript == null) { + return Mono + .error(new IllegalArgumentException("Parameter deploymentScript is required and cannot be null.")); + } else { + deploymentScript.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, scriptName, + this.client.getApiVersion(), deploymentScript, accept, context); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 {@link PollerFlux} for polling of deployment script object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentScriptInner> + beginCreateAsync(String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, scriptName, deploymentScript); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DeploymentScriptInner.class, DeploymentScriptInner.class, + this.client.getContext()); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 {@link PollerFlux} for polling of deployment script object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentScriptInner> beginCreateAsync( + String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, scriptName, deploymentScript, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DeploymentScriptInner.class, DeploymentScriptInner.class, context); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 {@link SyncPoller} for polling of deployment script object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentScriptInner> beginCreate(String resourceGroupName, + String scriptName, DeploymentScriptInner deploymentScript) { + return this.beginCreateAsync(resourceGroupName, scriptName, deploymentScript).getSyncPoller(); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 {@link SyncPoller} for polling of deployment script object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentScriptInner> beginCreate(String resourceGroupName, + String scriptName, DeploymentScriptInner deploymentScript, Context context) { + return this.beginCreateAsync(resourceGroupName, scriptName, deploymentScript, context).getSyncPoller(); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 deployment script object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript) { + return beginCreateAsync(resourceGroupName, scriptName, deploymentScript).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 deployment script object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript, Context context) { + return beginCreateAsync(resourceGroupName, scriptName, deploymentScript, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 deployment script object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentScriptInner create(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript) { + return createAsync(resourceGroupName, scriptName, deploymentScript).block(); + } + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 deployment script object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentScriptInner create(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript, Context context) { + return createAsync(resourceGroupName, scriptName, deploymentScript, context).block(); + } + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script resource with the tags to be updated. + * @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 deployment script object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String scriptName, + DeploymentScriptUpdateParameter deploymentScript) { + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + if (deploymentScript != null) { + deploymentScript.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, scriptName, this.client.getApiVersion(), deploymentScript, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script resource with the tags to be updated. + * @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 deployment script object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String scriptName, + DeploymentScriptUpdateParameter deploymentScript, 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + if (deploymentScript != null) { + deploymentScript.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, scriptName, + this.client.getApiVersion(), deploymentScript, accept, context); + } + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String scriptName) { + final DeploymentScriptUpdateParameter deploymentScript = null; + return updateWithResponseAsync(resourceGroupName, scriptName, deploymentScript) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script resource with the tags to be updated. + * @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 deployment script object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String scriptName, + DeploymentScriptUpdateParameter deploymentScript, Context context) { + return updateWithResponseAsync(resourceGroupName, scriptName, deploymentScript, context).block(); + } + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentScriptInner update(String resourceGroupName, String scriptName) { + final DeploymentScriptUpdateParameter deploymentScript = null; + return updateWithResponse(resourceGroupName, scriptName, deploymentScript, Context.NONE).getValue(); + } + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String scriptName) { + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, scriptName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String scriptName, 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName 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, + scriptName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String scriptName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, scriptName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String scriptName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, scriptName, context).block(); + } + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentScriptInner getByResourceGroup(String resourceGroupName, String scriptName) { + return getByResourceGroupWithResponse(resourceGroupName, scriptName, Context.NONE).getValue(); + } + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String scriptName) { + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, scriptName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String scriptName, 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName 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, scriptName, + this.client.getApiVersion(), accept, context); + } + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scriptName) { + return deleteWithResponseAsync(resourceGroupName, scriptName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String scriptName, Context context) { + return deleteWithResponseAsync(resourceGroupName, scriptName, context).block(); + } + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 scriptName) { + deleteWithResponse(resourceGroupName, scriptName, Context.NONE); + } + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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())); + } + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)); + } + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLogsWithResponseAsync(String resourceGroupName, String scriptName) { + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getLogs(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, scriptName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLogsWithResponseAsync(String resourceGroupName, String scriptName, + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getLogs(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + scriptName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getLogsAsync(String resourceGroupName, String scriptName) { + return getLogsWithResponseAsync(resourceGroupName, scriptName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLogsWithResponse(String resourceGroupName, String scriptName, + Context context) { + return getLogsWithResponseAsync(resourceGroupName, scriptName, context).block(); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScriptLogsListInner getLogs(String resourceGroupName, String scriptName) { + return getLogsWithResponse(resourceGroupName, scriptName, Context.NONE).getValue(); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param tail The number of lines to show from the tail of the deployment script log. Valid value is a positive + * number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity + * of 4mb. + * @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 deployment script logs for a given deployment script name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLogsDefaultWithResponseAsync(String resourceGroupName, String scriptName, + Integer tail) { + 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getLogsDefault(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, scriptName, this.client.getApiVersion(), tail, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param tail The number of lines to show from the tail of the deployment script log. Valid value is a positive + * number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity + * of 4mb. + * @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 deployment script logs for a given deployment script name along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLogsDefaultWithResponseAsync(String resourceGroupName, String scriptName, + Integer tail, 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 (scriptName == null) { + return Mono.error(new IllegalArgumentException("Parameter scriptName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getLogsDefault(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + scriptName, this.client.getApiVersion(), tail, accept, context); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getLogsDefaultAsync(String resourceGroupName, String scriptName) { + final Integer tail = null; + return getLogsDefaultWithResponseAsync(resourceGroupName, scriptName, tail) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param tail The number of lines to show from the tail of the deployment script log. Valid value is a positive + * number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity + * of 4mb. + * @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 deployment script logs for a given deployment script name along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLogsDefaultWithResponse(String resourceGroupName, String scriptName, + Integer tail, Context context) { + return getLogsDefaultWithResponseAsync(resourceGroupName, scriptName, tail, context).block(); + } + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScriptLogInner getLogsDefault(String resourceGroupName, String scriptName) { + final Integer tail = null; + return getLogsDefaultWithResponse(resourceGroupName, scriptName, tail, Context.NONE).getValue(); + } + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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())); + } + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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)); + } + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 URL to get the next list of items. + * @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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 URL to get the next list of items. + * @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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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 URL to get the next list of items. + * @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 list of deployment scripts along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @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/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsImpl.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsImpl.java new file mode 100644 index 000000000000..dee57561e719 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.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.resourcesmicrosoftresourcesdeploymentscripts.fluent.DeploymentScriptsClient; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogsListInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScript; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptUpdateParameter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScripts; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptLog; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptLogsList; + +public final class DeploymentScriptsImpl implements DeploymentScripts { + private static final ClientLogger LOGGER = new ClientLogger(DeploymentScriptsImpl.class); + + private final DeploymentScriptsClient innerClient; + + private final com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager; + + public DeploymentScriptsImpl(DeploymentScriptsClient innerClient, + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public DeploymentScript create(String resourceGroupName, String scriptName, + DeploymentScriptInner deploymentScript) { + DeploymentScriptInner inner = this.serviceClient().create(resourceGroupName, scriptName, deploymentScript); + if (inner != null) { + return new DeploymentScriptImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeploymentScript create(String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript, + Context context) { + DeploymentScriptInner inner + = this.serviceClient().create(resourceGroupName, scriptName, deploymentScript, context); + if (inner != null) { + return new DeploymentScriptImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse(String resourceGroupName, String scriptName, + DeploymentScriptUpdateParameter deploymentScript, Context context) { + Response inner + = this.serviceClient().updateWithResponse(resourceGroupName, scriptName, deploymentScript, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeploymentScriptImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeploymentScript update(String resourceGroupName, String scriptName) { + DeploymentScriptInner inner = this.serviceClient().update(resourceGroupName, scriptName); + if (inner != null) { + return new DeploymentScriptImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String scriptName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, scriptName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeploymentScriptImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeploymentScript getByResourceGroup(String resourceGroupName, String scriptName) { + DeploymentScriptInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, scriptName); + if (inner != null) { + return new DeploymentScriptImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String scriptName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, scriptName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String scriptName) { + this.serviceClient().delete(resourceGroupName, scriptName); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeploymentScriptImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeploymentScriptImpl(inner1, this.manager())); + } + + public Response getLogsWithResponse(String resourceGroupName, String scriptName, Context context) { + Response inner + = this.serviceClient().getLogsWithResponse(resourceGroupName, scriptName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScriptLogsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScriptLogsList getLogs(String resourceGroupName, String scriptName) { + ScriptLogsListInner inner = this.serviceClient().getLogs(resourceGroupName, scriptName); + if (inner != null) { + return new ScriptLogsListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getLogsDefaultWithResponse(String resourceGroupName, String scriptName, Integer tail, + Context context) { + Response inner + = this.serviceClient().getLogsDefaultWithResponse(resourceGroupName, scriptName, tail, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ScriptLogImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScriptLog getLogsDefault(String resourceGroupName, String scriptName) { + ScriptLogInner inner = this.serviceClient().getLogsDefault(resourceGroupName, scriptName); + if (inner != null) { + return new ScriptLogImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeploymentScriptImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DeploymentScriptImpl(inner1, this.manager())); + } + + private DeploymentScriptsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsManagementClientBuilder.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsManagementClientBuilder.java new file mode 100644 index 000000000000..1948775ac246 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.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.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 DeploymentScriptsManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { DeploymentScriptsManagementClientImpl.class }) +public final class DeploymentScriptsManagementClientBuilder { + /* + * Subscription Id which forms part of the URI for every service call. + */ + private String subscriptionId; + + /** + * Sets Subscription Id which forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the DeploymentScriptsManagementClientBuilder. + */ + public DeploymentScriptsManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the DeploymentScriptsManagementClientBuilder. + */ + public DeploymentScriptsManagementClientBuilder 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 DeploymentScriptsManagementClientBuilder. + */ + public DeploymentScriptsManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 DeploymentScriptsManagementClientBuilder. + */ + public DeploymentScriptsManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 DeploymentScriptsManagementClientBuilder. + */ + public DeploymentScriptsManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 DeploymentScriptsManagementClientBuilder. + */ + public DeploymentScriptsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DeploymentScriptsManagementClientImpl with the provided parameters. + * + * @return an instance of DeploymentScriptsManagementClientImpl. + */ + public DeploymentScriptsManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + DeploymentScriptsManagementClientImpl client = new DeploymentScriptsManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsManagementClientImpl.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsManagementClientImpl.java new file mode 100644 index 000000000000..39a31d1dbc81 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/DeploymentScriptsManagementClientImpl.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.CoreUtils; +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.resourcesmicrosoftresourcesdeploymentscripts.fluent.DeploymentScriptsClient; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.DeploymentScriptsManagementClient; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the DeploymentScriptsManagementClientImpl type. + */ +@ServiceClient(builder = DeploymentScriptsManagementClientBuilder.class) +public final class DeploymentScriptsManagementClientImpl implements DeploymentScriptsManagementClient { + /** + * Subscription Id which forms part of the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Subscription Id which forms part of the URI for every service call. + * + * @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 DeploymentScriptsClient object to access its operations. + */ + private final DeploymentScriptsClient deploymentScripts; + + /** + * Gets the DeploymentScriptsClient object to access its operations. + * + * @return the DeploymentScriptsClient object. + */ + public DeploymentScriptsClient getDeploymentScripts() { + return this.deploymentScripts; + } + + /** + * Initializes an instance of DeploymentScriptsManagementClient 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 Subscription Id which forms part of the URI for every service call. + * @param endpoint server parameter. + */ + DeploymentScriptsManagementClientImpl(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 = "2023-08-01"; + this.deploymentScripts = new DeploymentScriptsClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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(HttpHeaderName.fromString(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeploymentScriptsManagementClientImpl.class); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ResourceManagerUtils.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..b5e6faac4d18 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ScriptLogImpl.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ScriptLogImpl.java new file mode 100644 index 000000000000..85faf6a1edaa --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ScriptLogImpl.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.resourcesmicrosoftresourcesdeploymentscripts.implementation; + +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptLog; + +public final class ScriptLogImpl implements ScriptLog { + private ScriptLogInner innerObject; + + private final com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager; + + ScriptLogImpl(ScriptLogInner innerObject, + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String log() { + return this.innerModel().log(); + } + + public ScriptLogInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ScriptLogsListImpl.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ScriptLogsListImpl.java new file mode 100644 index 000000000000..17b46c2053e7 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/ScriptLogsListImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.implementation; + +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogsListInner; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptLog; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ScriptLogsList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ScriptLogsListImpl implements ScriptLogsList { + private ScriptLogsListInner innerObject; + + private final com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager; + + ScriptLogsListImpl(ScriptLogsListInner innerObject, + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList( + inner.stream().map(inner1 -> new ScriptLogImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ScriptLogsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/package-info.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/package-info.java new file mode 100644 index 000000000000..558412a1bc40 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 DeploymentScriptsManagementClient. + * DeploymentScripts Client. + */ +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.implementation; diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzureCliScript.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzureCliScript.java new file mode 100644 index 000000000000..84655b25be75 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzureCliScript.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.AzureCliScriptProperties; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import java.io.IOException; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** + * Object model for the Azure CLI script. + */ +@Fluent +public final class AzureCliScript extends DeploymentScriptInner { + /* + * Type of the script. + */ + private ScriptType kind = ScriptType.AZURE_CLI; + + /* + * Properties of the Azure CLI script object. + */ + private AzureCliScriptProperties innerProperties = new AzureCliScriptProperties(); + + /* + * The system metadata related to this resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureCliScript class. + */ + public AzureCliScript() { + } + + /** + * Get the kind property: Type of the script. + * + * @return the kind value. + */ + @Override + public ScriptType kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Properties of the Azure CLI script object. + * + * @return the innerProperties value. + */ + private AzureCliScriptProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureCliScript withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureCliScript withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureCliScript withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the azCliVersion property: Azure CLI module version to be used. + * + * @return the azCliVersion value. + */ + public String azCliVersion() { + return this.innerProperties() == null ? null : this.innerProperties().azCliVersion(); + } + + /** + * Set the azCliVersion property: Azure CLI module version to be used. + * + * @param azCliVersion the azCliVersion value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withAzCliVersion(String azCliVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withAzCliVersion(azCliVersion); + return this; + } + + /** + * Get the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @return the primaryScriptUri value. + */ + public String primaryScriptUri() { + return this.innerProperties() == null ? null : this.innerProperties().primaryScriptUri(); + } + + /** + * Set the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @param primaryScriptUri the primaryScriptUri value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withPrimaryScriptUri(String primaryScriptUri) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withPrimaryScriptUri(primaryScriptUri); + return this; + } + + /** + * Get the supportingScriptUris property: Supporting files for the external script. + * + * @return the supportingScriptUris value. + */ + public List supportingScriptUris() { + return this.innerProperties() == null ? null : this.innerProperties().supportingScriptUris(); + } + + /** + * Set the supportingScriptUris property: Supporting files for the external script. + * + * @param supportingScriptUris the supportingScriptUris value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withSupportingScriptUris(List supportingScriptUris) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withSupportingScriptUris(supportingScriptUris); + return this; + } + + /** + * Get the scriptContent property: Script body. + * + * @return the scriptContent value. + */ + public String scriptContent() { + return this.innerProperties() == null ? null : this.innerProperties().scriptContent(); + } + + /** + * Set the scriptContent property: Script body. + * + * @param scriptContent the scriptContent value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withScriptContent(String scriptContent) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withScriptContent(scriptContent); + return this; + } + + /** + * Get the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @return the arguments value. + */ + public String arguments() { + return this.innerProperties() == null ? null : this.innerProperties().arguments(); + } + + /** + * Set the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @param arguments the arguments value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withArguments(String arguments) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withArguments(arguments); + return this; + } + + /** + * Get the environmentVariables property: The environment variables to pass over to the script. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.innerProperties() == null ? null : this.innerProperties().environmentVariables(); + } + + /** + * Set the environmentVariables property: The environment variables to pass over to the script. + * + * @param environmentVariables the environmentVariables value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withEnvironmentVariables(List environmentVariables) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withEnvironmentVariables(environmentVariables); + return this; + } + + /** + * Get the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @return the retentionInterval value. + */ + public Duration retentionInterval() { + return this.innerProperties() == null ? null : this.innerProperties().retentionInterval(); + } + + /** + * Set the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @param retentionInterval the retentionInterval value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withRetentionInterval(Duration retentionInterval) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withRetentionInterval(retentionInterval); + return this; + } + + /** + * Get the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @return the timeout value. + */ + public Duration timeout() { + return this.innerProperties() == null ? null : this.innerProperties().timeout(); + } + + /** + * Set the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @param timeout the timeout value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withTimeout(Duration timeout) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withTimeout(timeout); + return this; + } + + /** + * Get the containerSettings property: Container settings. + * + * @return the containerSettings value. + */ + public ContainerConfiguration containerSettings() { + return this.innerProperties() == null ? null : this.innerProperties().containerSettings(); + } + + /** + * Set the containerSettings property: Container settings. + * + * @param containerSettings the containerSettings value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withContainerSettings(ContainerConfiguration containerSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withContainerSettings(containerSettings); + return this; + } + + /** + * Get the storageAccountSettings property: Storage Account settings. + * + * @return the storageAccountSettings value. + */ + public StorageAccountConfiguration storageAccountSettings() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSettings(); + } + + /** + * Set the storageAccountSettings property: Storage Account settings. + * + * @param storageAccountSettings the storageAccountSettings value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withStorageAccountSettings(StorageAccountConfiguration storageAccountSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withStorageAccountSettings(storageAccountSettings); + return this; + } + + /** + * Get the cleanupPreference property: The clean up preference when the script execution gets in a terminal state. + * Default setting is 'Always'. + * + * @return the cleanupPreference value. + */ + public CleanupOptions cleanupPreference() { + return this.innerProperties() == null ? null : this.innerProperties().cleanupPreference(); + } + + /** + * Set the cleanupPreference property: The clean up preference when the script execution gets in a terminal state. + * Default setting is 'Always'. + * + * @param cleanupPreference the cleanupPreference value to set. + * @return the AzureCliScript object itself. + */ + public AzureCliScript withCleanupPreference(CleanupOptions cleanupPreference) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureCliScriptProperties(); + } + this.innerProperties().withCleanupPreference(cleanupPreference); + return this; + } + + /** + * Get the provisioningState property: State of the script execution. This only appears in the response. + * + * @return the provisioningState value. + */ + public ScriptProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the status property: Contains the results of script execution. + * + * @return the status value. + */ + public ScriptStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the outputs property: List of script outputs. + * + * @return the outputs value. + */ + public Map outputs() { + return this.innerProperties() == null ? null : this.innerProperties().outputs(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model AzureCliScript")); + } else { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model AzureCliScript")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureCliScript.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeJsonField("identity", identity()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureCliScript from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureCliScript if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureCliScript. + */ + public static AzureCliScript fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureCliScript deserializedAzureCliScript = new AzureCliScript(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureCliScript.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureCliScript.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureCliScript.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAzureCliScript.withLocation(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedAzureCliScript.withIdentity(ManagedServiceIdentity.fromJson(reader)); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureCliScript.withTags(tags); + } else if ("systemData".equals(fieldName)) { + deserializedAzureCliScript.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzureCliScript.innerProperties = AzureCliScriptProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAzureCliScript.kind = ScriptType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureCliScript; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzurePowerShellScript.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzurePowerShellScript.java new file mode 100644 index 000000000000..ca58c1c701a9 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzurePowerShellScript.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.AzurePowerShellScriptProperties; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import java.io.IOException; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** + * Object model for the Azure PowerShell script. + */ +@Fluent +public final class AzurePowerShellScript extends DeploymentScriptInner { + /* + * Type of the script. + */ + private ScriptType kind = ScriptType.AZURE_POWER_SHELL; + + /* + * Properties of the Azure PowerShell script object. + */ + private AzurePowerShellScriptProperties innerProperties = new AzurePowerShellScriptProperties(); + + /* + * The system metadata related to this resource. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzurePowerShellScript class. + */ + public AzurePowerShellScript() { + } + + /** + * Get the kind property: Type of the script. + * + * @return the kind value. + */ + @Override + public ScriptType kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Properties of the Azure PowerShell script object. + * + * @return the innerProperties value. + */ + private AzurePowerShellScriptProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + @Override + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AzurePowerShellScript withIdentity(ManagedServiceIdentity identity) { + super.withIdentity(identity); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzurePowerShellScript withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzurePowerShellScript withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the azPowerShellVersion property: Azure PowerShell module version to be used. + * + * @return the azPowerShellVersion value. + */ + public String azPowerShellVersion() { + return this.innerProperties() == null ? null : this.innerProperties().azPowerShellVersion(); + } + + /** + * Set the azPowerShellVersion property: Azure PowerShell module version to be used. + * + * @param azPowerShellVersion the azPowerShellVersion value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withAzPowerShellVersion(String azPowerShellVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withAzPowerShellVersion(azPowerShellVersion); + return this; + } + + /** + * Get the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @return the primaryScriptUri value. + */ + public String primaryScriptUri() { + return this.innerProperties() == null ? null : this.innerProperties().primaryScriptUri(); + } + + /** + * Set the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @param primaryScriptUri the primaryScriptUri value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withPrimaryScriptUri(String primaryScriptUri) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withPrimaryScriptUri(primaryScriptUri); + return this; + } + + /** + * Get the supportingScriptUris property: Supporting files for the external script. + * + * @return the supportingScriptUris value. + */ + public List supportingScriptUris() { + return this.innerProperties() == null ? null : this.innerProperties().supportingScriptUris(); + } + + /** + * Set the supportingScriptUris property: Supporting files for the external script. + * + * @param supportingScriptUris the supportingScriptUris value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withSupportingScriptUris(List supportingScriptUris) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withSupportingScriptUris(supportingScriptUris); + return this; + } + + /** + * Get the scriptContent property: Script body. + * + * @return the scriptContent value. + */ + public String scriptContent() { + return this.innerProperties() == null ? null : this.innerProperties().scriptContent(); + } + + /** + * Set the scriptContent property: Script body. + * + * @param scriptContent the scriptContent value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withScriptContent(String scriptContent) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withScriptContent(scriptContent); + return this; + } + + /** + * Get the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @return the arguments value. + */ + public String arguments() { + return this.innerProperties() == null ? null : this.innerProperties().arguments(); + } + + /** + * Set the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @param arguments the arguments value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withArguments(String arguments) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withArguments(arguments); + return this; + } + + /** + * Get the environmentVariables property: The environment variables to pass over to the script. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.innerProperties() == null ? null : this.innerProperties().environmentVariables(); + } + + /** + * Set the environmentVariables property: The environment variables to pass over to the script. + * + * @param environmentVariables the environmentVariables value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withEnvironmentVariables(List environmentVariables) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withEnvironmentVariables(environmentVariables); + return this; + } + + /** + * Get the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * Get the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @return the retentionInterval value. + */ + public Duration retentionInterval() { + return this.innerProperties() == null ? null : this.innerProperties().retentionInterval(); + } + + /** + * Set the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @param retentionInterval the retentionInterval value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withRetentionInterval(Duration retentionInterval) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withRetentionInterval(retentionInterval); + return this; + } + + /** + * Get the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @return the timeout value. + */ + public Duration timeout() { + return this.innerProperties() == null ? null : this.innerProperties().timeout(); + } + + /** + * Set the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @param timeout the timeout value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withTimeout(Duration timeout) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withTimeout(timeout); + return this; + } + + /** + * Get the containerSettings property: Container settings. + * + * @return the containerSettings value. + */ + public ContainerConfiguration containerSettings() { + return this.innerProperties() == null ? null : this.innerProperties().containerSettings(); + } + + /** + * Set the containerSettings property: Container settings. + * + * @param containerSettings the containerSettings value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withContainerSettings(ContainerConfiguration containerSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withContainerSettings(containerSettings); + return this; + } + + /** + * Get the storageAccountSettings property: Storage Account settings. + * + * @return the storageAccountSettings value. + */ + public StorageAccountConfiguration storageAccountSettings() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSettings(); + } + + /** + * Set the storageAccountSettings property: Storage Account settings. + * + * @param storageAccountSettings the storageAccountSettings value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withStorageAccountSettings(StorageAccountConfiguration storageAccountSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withStorageAccountSettings(storageAccountSettings); + return this; + } + + /** + * Get the cleanupPreference property: The clean up preference when the script execution gets in a terminal state. + * Default setting is 'Always'. + * + * @return the cleanupPreference value. + */ + public CleanupOptions cleanupPreference() { + return this.innerProperties() == null ? null : this.innerProperties().cleanupPreference(); + } + + /** + * Set the cleanupPreference property: The clean up preference when the script execution gets in a terminal state. + * Default setting is 'Always'. + * + * @param cleanupPreference the cleanupPreference value to set. + * @return the AzurePowerShellScript object itself. + */ + public AzurePowerShellScript withCleanupPreference(CleanupOptions cleanupPreference) { + if (this.innerProperties() == null) { + this.innerProperties = new AzurePowerShellScriptProperties(); + } + this.innerProperties().withCleanupPreference(cleanupPreference); + return this; + } + + /** + * Get the provisioningState property: State of the script execution. This only appears in the response. + * + * @return the provisioningState value. + */ + public ScriptProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the status property: Contains the results of script execution. + * + * @return the status value. + */ + public ScriptStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the outputs property: List of script outputs. + * + * @return the outputs value. + */ + public Map outputs() { + return this.innerProperties() == null ? null : this.innerProperties().outputs(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model AzurePowerShellScript")); + } else { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model AzurePowerShellScript")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzurePowerShellScript.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeJsonField("identity", identity()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzurePowerShellScript from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzurePowerShellScript if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzurePowerShellScript. + */ + public static AzurePowerShellScript fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzurePowerShellScript deserializedAzurePowerShellScript = new AzurePowerShellScript(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzurePowerShellScript.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzurePowerShellScript.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzurePowerShellScript.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAzurePowerShellScript.withLocation(reader.getString()); + } else if ("identity".equals(fieldName)) { + deserializedAzurePowerShellScript.withIdentity(ManagedServiceIdentity.fromJson(reader)); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAzurePowerShellScript.withTags(tags); + } else if ("systemData".equals(fieldName)) { + deserializedAzurePowerShellScript.systemData = SystemData.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedAzurePowerShellScript.innerProperties + = AzurePowerShellScriptProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedAzurePowerShellScript.kind = ScriptType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzurePowerShellScript; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzureResourceBase.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzureResourceBase.java new file mode 100644 index 000000000000..1691cb1a6e57 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/AzureResourceBase.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Common properties for all Azure resources. + */ +@Immutable +public class AzureResourceBase extends ProxyResource { + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureResourceBase class. + */ + public AzureResourceBase() { + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureResourceBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureResourceBase if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureResourceBase. + */ + public static AzureResourceBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureResourceBase deserializedAzureResourceBase = new AzureResourceBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureResourceBase.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureResourceBase.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureResourceBase.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureResourceBase; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/CleanupOptions.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/CleanupOptions.java new file mode 100644 index 000000000000..42e787af2d2d --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/CleanupOptions.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + */ +public final class CleanupOptions extends ExpandableStringEnum { + /** + * Static value Always for CleanupOptions. + */ + public static final CleanupOptions ALWAYS = fromString("Always"); + + /** + * Static value OnSuccess for CleanupOptions. + */ + public static final CleanupOptions ON_SUCCESS = fromString("OnSuccess"); + + /** + * Static value OnExpiration for CleanupOptions. + */ + public static final CleanupOptions ON_EXPIRATION = fromString("OnExpiration"); + + /** + * Creates a new instance of CleanupOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CleanupOptions() { + } + + /** + * Creates or finds a CleanupOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding CleanupOptions. + */ + public static CleanupOptions fromString(String name) { + return fromString(name, CleanupOptions.class); + } + + /** + * Gets known CleanupOptions values. + * + * @return known CleanupOptions values. + */ + public static Collection values() { + return values(CleanupOptions.class); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ContainerConfiguration.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ContainerConfiguration.java new file mode 100644 index 000000000000..dad7df35440c --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ContainerConfiguration.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Settings to customize ACI container instance. + */ +@Fluent +public final class ContainerConfiguration implements JsonSerializable { + /* + * Container group name, if not specified then the name will get auto-generated. Not specifying a + * 'containerGroupName' indicates the system to generate a unique name which might end up flagging an Azure Policy + * as non-compliant. Use 'containerGroupName' when you have an Azure Policy that expects a specific naming + * convention or when you want to fully control the name. 'containerGroupName' property must be between 1 and 63 + * characters long, must contain only lowercase letters, numbers, and dashes and it cannot start or end with a dash + * and consecutive dashes are not allowed. To specify a 'containerGroupName', add the following object to + * properties: { "containerSettings": { "containerGroupName": "contoso-container" } }. If you do not want to specify + * a 'containerGroupName' then do not add 'containerSettings' property. + */ + private String containerGroupName; + + /* + * The subnet resource IDs for a container group. + */ + private List subnetIds; + + /** + * Creates an instance of ContainerConfiguration class. + */ + public ContainerConfiguration() { + } + + /** + * Get the containerGroupName property: Container group name, if not specified then the name will get + * auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique name which might + * end up flagging an Azure Policy as non-compliant. Use 'containerGroupName' when you have an Azure Policy that + * expects a specific naming convention or when you want to fully control the name. 'containerGroupName' property + * must be between 1 and 63 characters long, must contain only lowercase letters, numbers, and dashes and it cannot + * start or end with a dash and consecutive dashes are not allowed. To specify a 'containerGroupName', add the + * following object to properties: { "containerSettings": { "containerGroupName": "contoso-container" } }. If you do + * not want to specify a 'containerGroupName' then do not add 'containerSettings' property. + * + * @return the containerGroupName value. + */ + public String containerGroupName() { + return this.containerGroupName; + } + + /** + * Set the containerGroupName property: Container group name, if not specified then the name will get + * auto-generated. Not specifying a 'containerGroupName' indicates the system to generate a unique name which might + * end up flagging an Azure Policy as non-compliant. Use 'containerGroupName' when you have an Azure Policy that + * expects a specific naming convention or when you want to fully control the name. 'containerGroupName' property + * must be between 1 and 63 characters long, must contain only lowercase letters, numbers, and dashes and it cannot + * start or end with a dash and consecutive dashes are not allowed. To specify a 'containerGroupName', add the + * following object to properties: { "containerSettings": { "containerGroupName": "contoso-container" } }. If you do + * not want to specify a 'containerGroupName' then do not add 'containerSettings' property. + * + * @param containerGroupName the containerGroupName value to set. + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withContainerGroupName(String containerGroupName) { + this.containerGroupName = containerGroupName; + return this; + } + + /** + * Get the subnetIds property: The subnet resource IDs for a container group. + * + * @return the subnetIds value. + */ + public List subnetIds() { + return this.subnetIds; + } + + /** + * Set the subnetIds property: The subnet resource IDs for a container group. + * + * @param subnetIds the subnetIds value to set. + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withSubnetIds(List subnetIds) { + this.subnetIds = subnetIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnetIds() != null) { + subnetIds().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("containerGroupName", this.containerGroupName); + jsonWriter.writeArrayField("subnetIds", this.subnetIds, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContainerConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContainerConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ContainerConfiguration. + */ + public static ContainerConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContainerConfiguration deserializedContainerConfiguration = new ContainerConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerGroupName".equals(fieldName)) { + deserializedContainerConfiguration.containerGroupName = reader.getString(); + } else if ("subnetIds".equals(fieldName)) { + List subnetIds + = reader.readArray(reader1 -> ContainerGroupSubnetId.fromJson(reader1)); + deserializedContainerConfiguration.subnetIds = subnetIds; + } else { + reader.skipChildren(); + } + } + + return deserializedContainerConfiguration; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ContainerGroupSubnetId.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ContainerGroupSubnetId.java new file mode 100644 index 000000000000..8a53c2202543 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ContainerGroupSubnetId.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Container group subnet information. + */ +@Fluent +public final class ContainerGroupSubnetId implements JsonSerializable { + /* + * Resource ID of subnet. + */ + private String id; + + /* + * Friendly name for the subnet. + */ + private String name; + + /** + * Creates an instance of ContainerGroupSubnetId class. + */ + public ContainerGroupSubnetId() { + } + + /** + * Get the id property: Resource ID of subnet. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource ID of subnet. + * + * @param id the id value to set. + * @return the ContainerGroupSubnetId object itself. + */ + public ContainerGroupSubnetId withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Friendly name for the subnet. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Friendly name for the subnet. + * + * @param name the name value to set. + * @return the ContainerGroupSubnetId object itself. + */ + public ContainerGroupSubnetId withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model ContainerGroupSubnetId")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ContainerGroupSubnetId.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ContainerGroupSubnetId from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ContainerGroupSubnetId if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ContainerGroupSubnetId. + */ + public static ContainerGroupSubnetId fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ContainerGroupSubnetId deserializedContainerGroupSubnetId = new ContainerGroupSubnetId(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedContainerGroupSubnetId.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedContainerGroupSubnetId.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContainerGroupSubnetId; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScript.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScript.java new file mode 100644 index 000000000000..faef9f29173a --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScript.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import java.util.Map; + +/** + * An immutable client-side representation of DeploymentScript. + */ +public interface DeploymentScript { + /** + * 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 kind property: Type of the script. + * + * @return the kind value. + */ + ScriptType kind(); + + /** + * Gets the identity property: Optional property. Managed identity to be used for this deployment script. Currently, + * only user-assigned MSI is supported. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the location property: The location of the ACI and the storage account for the deployment script. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner + * com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner + * object. + * + * @return the inner object. + */ + DeploymentScriptInner innerModel(); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptListResult.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptListResult.java new file mode 100644 index 000000000000..90c49a98a2ff --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptListResult.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; +import java.io.IOException; +import java.util.List; + +/** + * List of deployment scripts. + */ +@Fluent +public final class DeploymentScriptListResult implements JsonSerializable { + /* + * An array of deployment scripts. + */ + private List value; + + /* + * The URL to use for getting the next set of results. + */ + private String nextLink; + + /** + * Creates an instance of DeploymentScriptListResult class. + */ + public DeploymentScriptListResult() { + } + + /** + * Get the value property: An array of deployment scripts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of deployment scripts. + * + * @param value the value value to set. + * @return the DeploymentScriptListResult object itself. + */ + public DeploymentScriptListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentScriptListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentScriptListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DeploymentScriptListResult. + */ + public static DeploymentScriptListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentScriptListResult deserializedDeploymentScriptListResult = new DeploymentScriptListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DeploymentScriptInner.fromJson(reader1)); + deserializedDeploymentScriptListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDeploymentScriptListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentScriptListResult; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptPropertiesBase.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptPropertiesBase.java new file mode 100644 index 000000000000..1d08e16bd452 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptPropertiesBase.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Common properties for the deployment script. + */ +@Fluent +public class DeploymentScriptPropertiesBase implements JsonSerializable { + /* + * Container settings. + */ + private ContainerConfiguration containerSettings; + + /* + * Storage Account settings. + */ + private StorageAccountConfiguration storageAccountSettings; + + /* + * The clean up preference when the script execution gets in a terminal state. Default setting is 'Always'. + */ + private CleanupOptions cleanupPreference; + + /* + * State of the script execution. This only appears in the response. + */ + private ScriptProvisioningState provisioningState; + + /* + * Contains the results of script execution. + */ + private ScriptStatus status; + + /* + * List of script outputs. + */ + private Map outputs; + + /** + * Creates an instance of DeploymentScriptPropertiesBase class. + */ + public DeploymentScriptPropertiesBase() { + } + + /** + * Get the containerSettings property: Container settings. + * + * @return the containerSettings value. + */ + public ContainerConfiguration containerSettings() { + return this.containerSettings; + } + + /** + * Set the containerSettings property: Container settings. + * + * @param containerSettings the containerSettings value to set. + * @return the DeploymentScriptPropertiesBase object itself. + */ + public DeploymentScriptPropertiesBase withContainerSettings(ContainerConfiguration containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Get the storageAccountSettings property: Storage Account settings. + * + * @return the storageAccountSettings value. + */ + public StorageAccountConfiguration storageAccountSettings() { + return this.storageAccountSettings; + } + + /** + * Set the storageAccountSettings property: Storage Account settings. + * + * @param storageAccountSettings the storageAccountSettings value to set. + * @return the DeploymentScriptPropertiesBase object itself. + */ + public DeploymentScriptPropertiesBase + withStorageAccountSettings(StorageAccountConfiguration storageAccountSettings) { + this.storageAccountSettings = storageAccountSettings; + return this; + } + + /** + * Get the cleanupPreference property: The clean up preference when the script execution gets in a terminal state. + * Default setting is 'Always'. + * + * @return the cleanupPreference value. + */ + public CleanupOptions cleanupPreference() { + return this.cleanupPreference; + } + + /** + * Set the cleanupPreference property: The clean up preference when the script execution gets in a terminal state. + * Default setting is 'Always'. + * + * @param cleanupPreference the cleanupPreference value to set. + * @return the DeploymentScriptPropertiesBase object itself. + */ + public DeploymentScriptPropertiesBase withCleanupPreference(CleanupOptions cleanupPreference) { + this.cleanupPreference = cleanupPreference; + return this; + } + + /** + * Get the provisioningState property: State of the script execution. This only appears in the response. + * + * @return the provisioningState value. + */ + public ScriptProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: State of the script execution. This only appears in the response. + * + * @param provisioningState the provisioningState value to set. + * @return the DeploymentScriptPropertiesBase object itself. + */ + DeploymentScriptPropertiesBase withProvisioningState(ScriptProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the status property: Contains the results of script execution. + * + * @return the status value. + */ + public ScriptStatus status() { + return this.status; + } + + /** + * Set the status property: Contains the results of script execution. + * + * @param status the status value to set. + * @return the DeploymentScriptPropertiesBase object itself. + */ + DeploymentScriptPropertiesBase withStatus(ScriptStatus status) { + this.status = status; + return this; + } + + /** + * Get the outputs property: List of script outputs. + * + * @return the outputs value. + */ + public Map outputs() { + return this.outputs; + } + + /** + * Set the outputs property: List of script outputs. + * + * @param outputs the outputs value to set. + * @return the DeploymentScriptPropertiesBase object itself. + */ + DeploymentScriptPropertiesBase withOutputs(Map outputs) { + this.outputs = outputs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (containerSettings() != null) { + containerSettings().validate(); + } + if (storageAccountSettings() != null) { + storageAccountSettings().validate(); + } + if (status() != null) { + status().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("containerSettings", this.containerSettings); + jsonWriter.writeJsonField("storageAccountSettings", this.storageAccountSettings); + jsonWriter.writeStringField("cleanupPreference", + this.cleanupPreference == null ? null : this.cleanupPreference.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentScriptPropertiesBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentScriptPropertiesBase if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DeploymentScriptPropertiesBase. + */ + public static DeploymentScriptPropertiesBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentScriptPropertiesBase deserializedDeploymentScriptPropertiesBase + = new DeploymentScriptPropertiesBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerSettings".equals(fieldName)) { + deserializedDeploymentScriptPropertiesBase.containerSettings + = ContainerConfiguration.fromJson(reader); + } else if ("storageAccountSettings".equals(fieldName)) { + deserializedDeploymentScriptPropertiesBase.storageAccountSettings + = StorageAccountConfiguration.fromJson(reader); + } else if ("cleanupPreference".equals(fieldName)) { + deserializedDeploymentScriptPropertiesBase.cleanupPreference + = CleanupOptions.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedDeploymentScriptPropertiesBase.provisioningState + = ScriptProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedDeploymentScriptPropertiesBase.status = ScriptStatus.fromJson(reader); + } else if ("outputs".equals(fieldName)) { + Map outputs = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedDeploymentScriptPropertiesBase.outputs = outputs; + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentScriptPropertiesBase; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptUpdateParameter.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptUpdateParameter.java new file mode 100644 index 000000000000..b26923827fc4 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScriptUpdateParameter.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Deployment script parameters to be updated. + */ +@Fluent +public final class DeploymentScriptUpdateParameter extends AzureResourceBase { + /* + * Resource tags to be updated. + */ + private Map tags; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DeploymentScriptUpdateParameter class. + */ + public DeploymentScriptUpdateParameter() { + } + + /** + * Get the tags property: Resource tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags to be updated. + * + * @param tags the tags value to set. + * @return the DeploymentScriptUpdateParameter object itself. + */ + public DeploymentScriptUpdateParameter withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeploymentScriptUpdateParameter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeploymentScriptUpdateParameter if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeploymentScriptUpdateParameter. + */ + public static DeploymentScriptUpdateParameter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeploymentScriptUpdateParameter deserializedDeploymentScriptUpdateParameter + = new DeploymentScriptUpdateParameter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDeploymentScriptUpdateParameter.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDeploymentScriptUpdateParameter.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeploymentScriptUpdateParameter.type = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDeploymentScriptUpdateParameter.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedDeploymentScriptUpdateParameter; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScripts.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScripts.java new file mode 100644 index 000000000000..59cb888413a4 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/DeploymentScripts.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.DeploymentScriptInner; + +/** + * Resource collection API of DeploymentScripts. + */ +public interface DeploymentScripts { + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the 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 deployment script object. + */ + DeploymentScript create(String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript); + + /** + * Creates a deployment script. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script supplied to the operation. + * @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 deployment script object. + */ + DeploymentScript create(String resourceGroupName, String scriptName, DeploymentScriptInner deploymentScript, + Context context); + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param deploymentScript Deployment script resource with the tags to be updated. + * @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 deployment script object along with {@link Response}. + */ + Response updateWithResponse(String resourceGroupName, String scriptName, + DeploymentScriptUpdateParameter deploymentScript, Context context); + + /** + * Updates deployment script tags with specified values. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script object. + */ + DeploymentScript update(String resourceGroupName, String scriptName); + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String scriptName, + Context context); + + /** + * Gets a deployment script with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 a deployment script with a given name. + */ + DeploymentScript getByResourceGroup(String resourceGroupName, String scriptName); + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String scriptName, Context context); + + /** + * Deletes a deployment script. When operation completes, status code 200 returned without content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 scriptName); + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all deployment scripts for a given 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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name along with {@link Response}. + */ + Response getLogsWithResponse(String resourceGroupName, String scriptName, Context context); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name. + */ + ScriptLogsList getLogs(String resourceGroupName, String scriptName); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @param tail The number of lines to show from the tail of the deployment script log. Valid value is a positive + * number up to 1000. If 'tail' is not provided, all available logs are shown up to container instance log capacity + * of 4mb. + * @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 deployment script logs for a given deployment script name along with {@link Response}. + */ + Response getLogsDefaultWithResponse(String resourceGroupName, String scriptName, Integer tail, + Context context); + + /** + * Gets deployment script logs for a given deployment script name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scriptName Name of the deployment script. + * @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 deployment script logs for a given deployment script name. + */ + ScriptLog getLogsDefault(String resourceGroupName, String scriptName); + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists deployments scripts. + * + * @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 list of deployment scripts as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/EnvironmentVariable.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/EnvironmentVariable.java new file mode 100644 index 000000000000..662e844b291c --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/EnvironmentVariable.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The environment variable to pass to the script in the container instance. + */ +@Fluent +public final class EnvironmentVariable implements JsonSerializable { + /* + * The name of the environment variable. + */ + private String name; + + /* + * The value of the environment variable. + */ + private String value; + + /* + * The value of the secure environment variable. + */ + private String secureValue; + + /** + * Creates an instance of EnvironmentVariable class. + */ + public EnvironmentVariable() { + } + + /** + * Get the name property: The name of the environment variable. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the environment variable. + * + * @param name the name value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the environment variable. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the environment variable. + * + * @param value the value value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the secureValue property: The value of the secure environment variable. + * + * @return the secureValue value. + */ + public String secureValue() { + return this.secureValue; + } + + /** + * Set the secureValue property: The value of the secure environment variable. + * + * @param secureValue the secureValue value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withSecureValue(String secureValue) { + this.secureValue = secureValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model EnvironmentVariable")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnvironmentVariable.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("secureValue", this.secureValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnvironmentVariable from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnvironmentVariable if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnvironmentVariable. + */ + public static EnvironmentVariable fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnvironmentVariable deserializedEnvironmentVariable = new EnvironmentVariable(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEnvironmentVariable.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedEnvironmentVariable.value = reader.getString(); + } else if ("secureValue".equals(fieldName)) { + deserializedEnvironmentVariable.secureValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnvironmentVariable; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ManagedServiceIdentity.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..0c521c1d7e94 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ManagedServiceIdentity.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed identity generic object. + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * Type of the managed identity. + */ + private ManagedServiceIdentityType type; + + /* + * ID of the Azure Active Directory. + */ + private String tenantId; + + /* + * The list of user-assigned managed identities associated with the resource. Key is the Azure resource Id of the + * managed identity. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the type property: Type of the managed identity. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of the managed identity. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: ID of the Azure Active Directory. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the userAssignedIdentities property: The list of user-assigned managed identities associated with the + * resource. Key is the Azure resource Id of the managed identity. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user-assigned managed identities associated with the + * resource. Key is the Azure resource Id of the managed identity. + * + * @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 (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ManagedServiceIdentityType.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..f76f4b5f1629 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ManagedServiceIdentityType.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.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the managed identity. + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptConfigurationBase.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptConfigurationBase.java new file mode 100644 index 000000000000..58e9d993b655 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptConfigurationBase.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.util.List; + +/** + * Common configuration settings for both Azure PowerShell and Azure CLI scripts. + */ +@Fluent +public class ScriptConfigurationBase implements JsonSerializable { + /* + * Uri for the script. This is the entry point for the external script. + */ + private String primaryScriptUri; + + /* + * Supporting files for the external script. + */ + private List supportingScriptUris; + + /* + * Script body. + */ + private String scriptContent; + + /* + * Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -Location 'West + * US 2' + */ + private String arguments; + + /* + * The environment variables to pass over to the script. + */ + private List environmentVariables; + + /* + * Gets or sets how the deployment script should be forced to execute even if the script resource has not changed. + * Can be current time stamp or a GUID. + */ + private String forceUpdateTag; + + /* + * Interval for which the service retains the script resource after it reaches a terminal state. Resource will be + * deleted when this duration expires. Duration is based on ISO 8601 pattern (for example P1D means one day). + */ + private Duration retentionInterval; + + /* + * Maximum allowed script execution time specified in ISO 8601 format. Default value is P1D + */ + private Duration timeout; + + /** + * Creates an instance of ScriptConfigurationBase class. + */ + public ScriptConfigurationBase() { + } + + /** + * Get the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @return the primaryScriptUri value. + */ + public String primaryScriptUri() { + return this.primaryScriptUri; + } + + /** + * Set the primaryScriptUri property: Uri for the script. This is the entry point for the external script. + * + * @param primaryScriptUri the primaryScriptUri value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withPrimaryScriptUri(String primaryScriptUri) { + this.primaryScriptUri = primaryScriptUri; + return this; + } + + /** + * Get the supportingScriptUris property: Supporting files for the external script. + * + * @return the supportingScriptUris value. + */ + public List supportingScriptUris() { + return this.supportingScriptUris; + } + + /** + * Set the supportingScriptUris property: Supporting files for the external script. + * + * @param supportingScriptUris the supportingScriptUris value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withSupportingScriptUris(List supportingScriptUris) { + this.supportingScriptUris = supportingScriptUris; + return this; + } + + /** + * Get the scriptContent property: Script body. + * + * @return the scriptContent value. + */ + public String scriptContent() { + return this.scriptContent; + } + + /** + * Set the scriptContent property: Script body. + * + * @param scriptContent the scriptContent value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withScriptContent(String scriptContent) { + this.scriptContent = scriptContent; + return this; + } + + /** + * Get the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @return the arguments value. + */ + public String arguments() { + return this.arguments; + } + + /** + * Set the arguments property: Command line arguments to pass to the script. Arguments are separated by spaces. ex: + * -Name blue* -Location 'West US 2'. + * + * @param arguments the arguments value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withArguments(String arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the environmentVariables property: The environment variables to pass over to the script. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: The environment variables to pass over to the script. + * + * @param environmentVariables the environmentVariables value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: Gets or sets how the deployment script should be forced to execute even if the + * script resource has not changed. Can be current time stamp or a GUID. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @return the retentionInterval value. + */ + public Duration retentionInterval() { + return this.retentionInterval; + } + + /** + * Set the retentionInterval property: Interval for which the service retains the script resource after it reaches a + * terminal state. Resource will be deleted when this duration expires. Duration is based on ISO 8601 pattern (for + * example P1D means one day). + * + * @param retentionInterval the retentionInterval value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withRetentionInterval(Duration retentionInterval) { + this.retentionInterval = retentionInterval; + return this; + } + + /** + * Get the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @return the timeout value. + */ + public Duration timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Maximum allowed script execution time specified in ISO 8601 format. Default value is + * P1D. + * + * @param timeout the timeout value to set. + * @return the ScriptConfigurationBase object itself. + */ + public ScriptConfigurationBase withTimeout(Duration timeout) { + this.timeout = timeout; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (environmentVariables() != null) { + environmentVariables().forEach(e -> e.validate()); + } + if (retentionInterval() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property retentionInterval in model ScriptConfigurationBase")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScriptConfigurationBase.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("retentionInterval", CoreUtils.durationToStringWithDays(this.retentionInterval)); + jsonWriter.writeStringField("primaryScriptUri", this.primaryScriptUri); + jsonWriter.writeArrayField("supportingScriptUris", this.supportingScriptUris, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("scriptContent", this.scriptContent); + jsonWriter.writeStringField("arguments", this.arguments); + jsonWriter.writeArrayField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("forceUpdateTag", this.forceUpdateTag); + jsonWriter.writeStringField("timeout", CoreUtils.durationToStringWithDays(this.timeout)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScriptConfigurationBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScriptConfigurationBase if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ScriptConfigurationBase. + */ + public static ScriptConfigurationBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScriptConfigurationBase deserializedScriptConfigurationBase = new ScriptConfigurationBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionInterval".equals(fieldName)) { + deserializedScriptConfigurationBase.retentionInterval + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("primaryScriptUri".equals(fieldName)) { + deserializedScriptConfigurationBase.primaryScriptUri = reader.getString(); + } else if ("supportingScriptUris".equals(fieldName)) { + List supportingScriptUris = reader.readArray(reader1 -> reader1.getString()); + deserializedScriptConfigurationBase.supportingScriptUris = supportingScriptUris; + } else if ("scriptContent".equals(fieldName)) { + deserializedScriptConfigurationBase.scriptContent = reader.getString(); + } else if ("arguments".equals(fieldName)) { + deserializedScriptConfigurationBase.arguments = reader.getString(); + } else if ("environmentVariables".equals(fieldName)) { + List environmentVariables + = reader.readArray(reader1 -> EnvironmentVariable.fromJson(reader1)); + deserializedScriptConfigurationBase.environmentVariables = environmentVariables; + } else if ("forceUpdateTag".equals(fieldName)) { + deserializedScriptConfigurationBase.forceUpdateTag = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedScriptConfigurationBase.timeout + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedScriptConfigurationBase; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptLog.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptLog.java new file mode 100644 index 000000000000..bdcc4f6e8dd0 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptLog.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.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner; + +/** + * An immutable client-side representation of ScriptLog. + */ +public interface ScriptLog { + /** + * 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 log property: Script execution logs in text format. + * + * @return the log value. + */ + String log(); + + /** + * Gets the inner + * com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogInner object. + * + * @return the inner object. + */ + ScriptLogInner innerModel(); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptLogsList.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptLogsList.java new file mode 100644 index 000000000000..e25bf9459337 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptLogsList.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogsListInner; +import java.util.List; + +/** + * An immutable client-side representation of ScriptLogsList. + */ +public interface ScriptLogsList { + /** + * Gets the value property: Deployment scripts logs. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner + * com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models.ScriptLogsListInner object. + * + * @return the inner object. + */ + ScriptLogsListInner innerModel(); +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptProvisioningState.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptProvisioningState.java new file mode 100644 index 000000000000..8bf589178b3a --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of the script execution. This only appears in the response. + */ +public final class ScriptProvisioningState extends ExpandableStringEnum { + /** + * Static value Creating for ScriptProvisioningState. + */ + public static final ScriptProvisioningState CREATING = fromString("Creating"); + + /** + * Static value ProvisioningResources for ScriptProvisioningState. + */ + public static final ScriptProvisioningState PROVISIONING_RESOURCES = fromString("ProvisioningResources"); + + /** + * Static value Running for ScriptProvisioningState. + */ + public static final ScriptProvisioningState RUNNING = fromString("Running"); + + /** + * Static value Succeeded for ScriptProvisioningState. + */ + public static final ScriptProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ScriptProvisioningState. + */ + public static final ScriptProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ScriptProvisioningState. + */ + public static final ScriptProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ScriptProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScriptProvisioningState() { + } + + /** + * Creates or finds a ScriptProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScriptProvisioningState. + */ + public static ScriptProvisioningState fromString(String name) { + return fromString(name, ScriptProvisioningState.class); + } + + /** + * Gets known ScriptProvisioningState values. + * + * @return known ScriptProvisioningState values. + */ + public static Collection values() { + return values(ScriptProvisioningState.class); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptStatus.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptStatus.java new file mode 100644 index 000000000000..3db723493dc6 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptStatus.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Generic object modeling results of script execution. + */ +@Fluent +public final class ScriptStatus implements JsonSerializable { + /* + * ACI resource Id. + */ + private String containerInstanceId; + + /* + * Storage account resource Id. + */ + private String storageAccountId; + + /* + * Start time of the script execution. + */ + private OffsetDateTime startTime; + + /* + * End time of the script execution. + */ + private OffsetDateTime endTime; + + /* + * Time the deployment script resource will expire. + */ + private OffsetDateTime expirationTime; + + /* + * Error that is relayed from the script execution. + */ + private ManagementError error; + + /** + * Creates an instance of ScriptStatus class. + */ + public ScriptStatus() { + } + + /** + * Get the containerInstanceId property: ACI resource Id. + * + * @return the containerInstanceId value. + */ + public String containerInstanceId() { + return this.containerInstanceId; + } + + /** + * Get the storageAccountId property: Storage account resource Id. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Get the startTime property: Start time of the script execution. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: End time of the script execution. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the expirationTime property: Time the deployment script resource will expire. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Get the error property: Error that is relayed from the script execution. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: Error that is relayed from the script execution. + * + * @param error the error value to set. + * @return the ScriptStatus object itself. + */ + public ScriptStatus withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScriptStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScriptStatus if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScriptStatus. + */ + public static ScriptStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScriptStatus deserializedScriptStatus = new ScriptStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("containerInstanceId".equals(fieldName)) { + deserializedScriptStatus.containerInstanceId = reader.getString(); + } else if ("storageAccountId".equals(fieldName)) { + deserializedScriptStatus.storageAccountId = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedScriptStatus.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endTime".equals(fieldName)) { + deserializedScriptStatus.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expirationTime".equals(fieldName)) { + deserializedScriptStatus.expirationTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("error".equals(fieldName)) { + deserializedScriptStatus.error = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScriptStatus; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptType.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptType.java new file mode 100644 index 000000000000..eccd46443c3a --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/ScriptType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the script. + */ +public final class ScriptType extends ExpandableStringEnum { + /** + * Static value AzurePowerShell for ScriptType. + */ + public static final ScriptType AZURE_POWER_SHELL = fromString("AzurePowerShell"); + + /** + * Static value AzureCLI for ScriptType. + */ + public static final ScriptType AZURE_CLI = fromString("AzureCLI"); + + /** + * Creates a new instance of ScriptType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScriptType() { + } + + /** + * Creates or finds a ScriptType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScriptType. + */ + public static ScriptType fromString(String name) { + return fromString(name, ScriptType.class); + } + + /** + * Gets known ScriptType values. + * + * @return known ScriptType values. + */ + public static Collection values() { + return values(ScriptType.class); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/StorageAccountConfiguration.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/StorageAccountConfiguration.java new file mode 100644 index 000000000000..a7d7880c0d82 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/StorageAccountConfiguration.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Settings to use an existing storage account. Valid storage account kinds are: Storage, StorageV2 and FileStorage. + */ +@Fluent +public final class StorageAccountConfiguration implements JsonSerializable { + /* + * The storage account name. + */ + private String storageAccountName; + + /* + * The storage account access key. + */ + private String storageAccountKey; + + /** + * Creates an instance of StorageAccountConfiguration class. + */ + public StorageAccountConfiguration() { + } + + /** + * Get the storageAccountName property: The storage account name. + * + * @return the storageAccountName value. + */ + public String storageAccountName() { + return this.storageAccountName; + } + + /** + * Set the storageAccountName property: The storage account name. + * + * @param storageAccountName the storageAccountName value to set. + * @return the StorageAccountConfiguration object itself. + */ + public StorageAccountConfiguration withStorageAccountName(String storageAccountName) { + this.storageAccountName = storageAccountName; + return this; + } + + /** + * Get the storageAccountKey property: The storage account access key. + * + * @return the storageAccountKey value. + */ + public String storageAccountKey() { + return this.storageAccountKey; + } + + /** + * Set the storageAccountKey property: The storage account access key. + * + * @param storageAccountKey the storageAccountKey value to set. + * @return the StorageAccountConfiguration object itself. + */ + public StorageAccountConfiguration withStorageAccountKey(String storageAccountKey) { + this.storageAccountKey = storageAccountKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageAccountName", this.storageAccountName); + jsonWriter.writeStringField("storageAccountKey", this.storageAccountKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageAccountConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageAccountConfiguration if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageAccountConfiguration. + */ + public static StorageAccountConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageAccountConfiguration deserializedStorageAccountConfiguration = new StorageAccountConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageAccountName".equals(fieldName)) { + deserializedStorageAccountConfiguration.storageAccountName = reader.getString(); + } else if ("storageAccountKey".equals(fieldName)) { + deserializedStorageAccountConfiguration.storageAccountKey = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageAccountConfiguration; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/UserAssignedIdentity.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..5d522c4b89d6 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/UserAssignedIdentity.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User-assigned managed identity. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * Azure Active Directory principal ID associated with this identity. + */ + private String principalId; + + /* + * Client App Id associated with this identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: Azure Active Directory principal ID associated with this identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: Client App Id associated with this identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/package-info.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/package-info.java new file mode 100644 index 000000000000..8167222a8341 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/models/package-info.java @@ -0,0 +1,9 @@ +// 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 DeploymentScriptsManagementClient. + * DeploymentScripts Client. + */ +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/package-info.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/package-info.java new file mode 100644 index 000000000000..db3e2e9bdc54 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/package-info.java @@ -0,0 +1,9 @@ +// 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 DeploymentScriptsManagementClient. + * DeploymentScripts Client. + */ +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts; diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/module-info.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/module-info.java new file mode 100644 index 000000000000..776ce6d5fdfa --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts; + exports com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent; + exports com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models; + exports com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models; + + opens com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.fluent.models to com.azure.core; + opens com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models to com.azure.core; +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/proxy-config.json b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/proxy-config.json new file mode 100644 index 000000000000..0cb4de2ef0e9 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.implementation.DeploymentScriptsClientImpl$DeploymentScriptsService"]] \ No newline at end of file diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/reflect-config.json b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts.properties b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/main/resources/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsCreateSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsCreateSamples.java new file mode 100644 index 000000000000..112f1d8cb8c3 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsCreateSamples.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.AzurePowerShellScript; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.CleanupOptions; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ContainerConfiguration; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ContainerGroupSubnetId; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.StorageAccountConfiguration; +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.UserAssignedIdentity; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DeploymentScripts Create. + */ +public final class DeploymentScriptsCreateSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_Using_Custom_Aci_Name.json + */ + /** + * Sample code: DeploymentScriptsCreate_UsingCustomACIName. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateUsingCustomACIName( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withContainerSettings(new ContainerConfiguration().withContainerGroupName("contoso-aci")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_Using_Custom_Aci_Name_With_SubnetIds.json + */ + /** + * Sample code: DeploymentScriptsCreate_UsingAciWithSubnets. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateUsingAciWithSubnets( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withContainerSettings(new ContainerConfiguration().withContainerGroupName("contoso-aci") + .withSubnetIds(Arrays.asList(new ContainerGroupSubnetId().withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Network/virtualNetworks/scriptSubnet/subnets/subnetwork1"), + new ContainerGroupSubnetId().withId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.Network/virtualNetworks/scriptSubnet/subnets/subnetwork2")))) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_Using_Existing_StorageAccount.json + */ + /** + * Sample code: DeploymentScriptsCreate_UsingExistingStorageAccount. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateUsingExistingStorageAccount( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withStorageAccountSettings(new StorageAccountConfiguration().withStorageAccountName("contosostorage") + .withStorageAccountKey("fakeTokenPlaceholder")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Min_Create.json + */ + /** + * Sample code: DeploymentScriptsCreate_MinCreate. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateMinCreate( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create.json + */ + /** + * Sample code: DeploymentScriptsCreate. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreate( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scriptRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/uai", + new UserAssignedIdentity()))) + .withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Create_No_UserManagedIdentity.json + */ + /** + * Sample code: DeploymentScriptsCreateNoUserManagedIdentity. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsCreateNoUserManagedIdentity( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .create("script-rg", "MyDeploymentScript", new AzurePowerShellScript().withLocation("westus") + .withAzPowerShellVersion("1.7.0") + .withSupportingScriptUris( + Arrays.asList("https://uri1.to.supporting.script", "https://uri2.to.supporting.script")) + .withScriptContent( + "Param([string]$Location,[string]$Name) $deploymentScriptOutputs['test'] = 'value' Get-AzResourceGroup -Location $Location -Name $Name") + .withArguments("-Location 'westus' -Name \"*rg2\"") + .withRetentionInterval(Duration.parse("P7D")) + .withTimeout(Duration.parse("PT1H")) + .withCleanupPreference(CleanupOptions.ALWAYS), com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsDeleteSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsDeleteSamples.java new file mode 100644 index 000000000000..b9e6c1547b2b --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +/** + * Samples for DeploymentScripts Delete. + */ +public final class DeploymentScriptsDeleteSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Delete.json + */ + /** + * Sample code: DeploymentScriptsDelete. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsDelete( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .deleteByResourceGroupWithResponse("script-rg", "MyDeploymentScript", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetByResourceGroupSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..1ed097959f70 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetByResourceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +/** + * Samples for DeploymentScripts GetByResourceGroup. + */ +public final class DeploymentScriptsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Get.json + */ + /** + * Sample code: DeploymentScriptsGet. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGet( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getByResourceGroupWithResponse("script-rg", "MyDeploymentScript", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetLogsDefaultSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetLogsDefaultSamples.java new file mode 100644 index 000000000000..a7dbeaa0944e --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetLogsDefaultSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +/** + * Samples for DeploymentScripts GetLogsDefault. + */ +public final class DeploymentScriptsGetLogsDefaultSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_GetLogsDefault.json + */ + /** + * Sample code: DeploymentScriptsGetLogs. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGetLogs( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getLogsDefaultWithResponse("script-rg", "MyDeploymentScript", null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_GetLogsDefaultWithTail.json + */ + /** + * Sample code: DeploymentScriptsGetLogsWithTail. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGetLogsWithTail( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getLogsDefaultWithResponse("script-rg", "MyDeploymentScript", 5, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetLogsSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetLogsSamples.java new file mode 100644 index 000000000000..2d509d0d1712 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsGetLogsSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +/** + * Samples for DeploymentScripts GetLogs. + */ +public final class DeploymentScriptsGetLogsSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_GetLogs.json + */ + /** + * Sample code: DeploymentScriptsGetLogs. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsGetLogs( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .getLogsWithResponse("script-rg", "MyDeploymentScript", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsListByResourceGroupSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsListByResourceGroupSamples.java new file mode 100644 index 000000000000..b9ff7f9aee52 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +/** + * Samples for DeploymentScripts ListByResourceGroup. + */ +public final class DeploymentScriptsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_ListByResourceGroup.json + */ + /** + * Sample code: DeploymentScriptsList. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsList( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts().listByResourceGroup("script-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsListSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsListSamples.java new file mode 100644 index 000000000000..a8c5b4825667 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +/** + * Samples for DeploymentScripts List. + */ +public final class DeploymentScriptsListSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_ListBySubscription.json + */ + /** + * Sample code: DeploymentScriptsListBySubscription. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsListBySubscription( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsUpdateSamples.java b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsUpdateSamples.java new file mode 100644 index 000000000000..c188b589ccaa --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/src/samples/java/com/azure/resourcemanager/resourcesmicrosoftresourcesdeploymentscripts/generated/DeploymentScriptsUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.generated; + +import com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.models.DeploymentScriptUpdateParameter; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DeploymentScripts Update. + */ +public final class DeploymentScriptsUpdateSamples { + /* + * x-ms-original-file: + * specification/resources/resource-manager/Microsoft.Resources/deploymentScripts/stable/2023-08-01/examples/ + * DeploymentScripts_Update.json + */ + /** + * Sample code: DeploymentScriptsUpdate. + * + * @param manager Entry point to DeploymentScriptsManager. + */ + public static void deploymentScriptsUpdate( + com.azure.resourcemanager.resourcesmicrosoftresourcesdeploymentscripts.DeploymentScriptsManager manager) { + manager.deploymentScripts() + .updateWithResponse("script-rg", "MyDeploymentScript", + new DeploymentScriptUpdateParameter().withTags(mapOf()), com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/resourcesmicrosoftresourcesdeploymentscripts/ci.yml b/sdk/resourcesmicrosoftresourcesdeploymentscripts/ci.yml new file mode 100644 index 000000000000..8fe9e43aca7c --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/resourcesmicrosoftresourcesdeploymentscripts/ci.yml + - sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/ + exclude: + - sdk/resourcesmicrosoftresourcesdeploymentscripts/pom.xml + - sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcesmicrosoftresourcesdeploymentscripts/ci.yml + - sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/ + exclude: + - sdk/resourcesmicrosoftresourcesdeploymentscripts/pom.xml + - sdk/resourcesmicrosoftresourcesdeploymentscripts/azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts/pom.xml + +parameters: + - name: release_azureresourcemanagerresourcesmicrosoftresourcesdeploymentscripts + displayName: azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resourcesmicrosoftresourcesdeploymentscripts + Artifacts: + - name: azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerresourcesmicrosoftresourcesdeploymentscripts + releaseInBatch: ${{ parameters.release_azureresourcemanagerresourcesmicrosoftresourcesdeploymentscripts }} diff --git a/sdk/resourcesmicrosoftresourcesdeploymentscripts/pom.xml b/sdk/resourcesmicrosoftresourcesdeploymentscripts/pom.xml new file mode 100644 index 000000000000..e10e10f58cc2 --- /dev/null +++ b/sdk/resourcesmicrosoftresourcesdeploymentscripts/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-resourcesmicrosoftresourcesdeploymentscripts-service + pom + 1.0.0 + + + azure-resourcemanager-resourcesmicrosoftresourcesdeploymentscripts + +