diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 61d11f7a8cc68..a8f6887dda6b2 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -476,6 +476,7 @@ com.azure.resourcemanager:azure-resourcemanager-computeschedule;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-trustedsigning;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iotoperations;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-containerorchestratorruntime;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-impact;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 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 866c8c788a53b..17dcca9a6703a 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,7 @@ sdk/hybridnetwork sdk/identity sdk/imagebuilder + sdk/impact sdk/informaticadatamanagement sdk/iotcentral sdk/iotfirmwaredefense diff --git a/sdk/impact/azure-resourcemanager-impact/CHANGELOG.md b/sdk/impact/azure-resourcemanager-impact/CHANGELOG.md new file mode 100644 index 0000000000000..3d82f73ac7d6b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-10-25) + +- Azure Resource Manager impact client library for Java. This package contains Microsoft Azure SDK for impact Management SDK. Package tag package-2024-05-01-preview. 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-impact Java SDK. diff --git a/sdk/impact/azure-resourcemanager-impact/README.md b/sdk/impact/azure-resourcemanager-impact/README.md new file mode 100644 index 0000000000000..1e1a22e9bee88 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager impact client library for Java + +Azure Resource Manager impact client library for Java. + +This package contains Microsoft Azure SDK for impact Management SDK. Package tag package-2024-05-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-impact;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-impact + 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(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ImpactManager manager = ImpactManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/impact/azure-resourcemanager-impact/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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fimpact%2Fazure-resourcemanager-impact%2FREADME.png) diff --git a/sdk/impact/azure-resourcemanager-impact/SAMPLE.md b/sdk/impact/azure-resourcemanager-impact/SAMPLE.md new file mode 100644 index 0000000000000..403ac926534ea --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/SAMPLE.md @@ -0,0 +1,561 @@ +# Code snippets and samples + + +## Connectors + +- [CreateOrUpdate](#connectors_createorupdate) +- [Delete](#connectors_delete) +- [Get](#connectors_get) +- [List](#connectors_list) +- [Update](#connectors_update) + +## ImpactCategories + +- [Get](#impactcategories_get) +- [List](#impactcategories_list) + +## Insights + +- [Create](#insights_create) +- [Delete](#insights_delete) +- [Get](#insights_get) +- [ListBySubscription](#insights_listbysubscription) + +## Operations + +- [List](#operations_list) + +## WorkloadImpacts + +- [Create](#workloadimpacts_create) +- [Delete](#workloadimpacts_delete) +- [Get](#workloadimpacts_get) +- [List](#workloadimpacts_list) +### Connectors_CreateOrUpdate + +```java +import com.azure.resourcemanager.impact.models.ConnectorProperties; +import com.azure.resourcemanager.impact.models.Platform; + +/** + * Samples for Connectors CreateOrUpdate. + */ +public final class ConnectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Connectors_CreateOrUpdate.json + */ + /** + * Sample code: Connectors_CreateOrUpdate. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsCreateOrUpdate(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors() + .define("testconnector1") + .withProperties(new ConnectorProperties().withConnectorType(Platform.AZURE_MONITOR)) + .create(); + } +} +``` + +### Connectors_Delete + +```java +/** + * Samples for Connectors Delete. + */ +public final class ConnectorsDeleteSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Connectors_Delete.json + */ + /** + * Sample code: Connectors_Delete. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsDelete(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors().deleteWithResponse("testconnector1", com.azure.core.util.Context.NONE); + } +} +``` + +### Connectors_Get + +```java +/** + * Samples for Connectors Get. + */ +public final class ConnectorsGetSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Connectors_Get.json + */ + /** + * Sample code: Connectors_Get. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsGet(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors().getWithResponse("testconnector1", com.azure.core.util.Context.NONE); + } +} +``` + +### Connectors_List + +```java +/** + * Samples for Connectors List. + */ +public final class ConnectorsListSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Connectors_ListBySubscription.json + */ + /** + * Sample code: Connectors_ListBySubscription. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsListBySubscription(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Connectors_Update + +```java +import com.azure.resourcemanager.impact.models.Connector; +import com.azure.resourcemanager.impact.models.ConnectorPropertiesUpdate; +import com.azure.resourcemanager.impact.models.Platform; + +/** + * Samples for Connectors Update. + */ +public final class ConnectorsUpdateSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Connectors_Update.json + */ + /** + * Sample code: Connectors_Update. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsUpdate(com.azure.resourcemanager.impact.ImpactManager manager) { + Connector resource + = manager.connectors().getWithResponse("testconnector1", com.azure.core.util.Context.NONE).getValue(); + resource.update() + .withProperties(new ConnectorPropertiesUpdate().withConnectorType(Platform.AZURE_MONITOR)) + .apply(); + } +} +``` + +### ImpactCategories_Get + +```java +/** + * Samples for ImpactCategories Get. + */ +public final class ImpactCategoriesGetSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ImpactCategories_Get. + * json + */ + /** + * Sample code: Get WorkloadImpact Resource by name. + * + * @param manager Entry point to ImpactManager. + */ + public static void getWorkloadImpactResourceByName(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.impactCategories().getWithResponse("ARMOperation.Create", com.azure.core.util.Context.NONE); + } +} +``` + +### ImpactCategories_List + +```java +/** + * Samples for ImpactCategories List. + */ +public final class ImpactCategoriesListSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * ImpactCategories_ListBySubscription.json + */ + /** + * Sample code: Get ImpactCategories list by subscription. + * + * @param manager Entry point to ImpactManager. + */ + public static void getImpactCategoriesListBySubscription(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.impactCategories().list(null, "microsoft.compute/virtualmachines", com.azure.core.util.Context.NONE); + } +} +``` + +### Insights_Create + +```java +import com.azure.resourcemanager.impact.models.Content; +import com.azure.resourcemanager.impact.models.ImpactDetails; +import com.azure.resourcemanager.impact.models.InsightProperties; +import java.time.OffsetDateTime; + +/** + * Samples for Insights Create. + */ +public final class InsightsCreateSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Insights_Create.json + */ + /** + * Sample code: Creating an insight. + * + * @param manager Entry point to ImpactManager. + */ + public static void creatingAnInsight(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights() + .define("insightId12") + .withExistingWorkloadImpact("impactid22") + .withProperties(new InsightProperties().withCategory("repair") + .withStatus("resolved") + .withContent(new Content().withTitle("Impact Has been correlated to an outage") + .withDescription( + "At 2018-11-08T00:00:00Z UTC, your services dependent on these resources VM1 may have experienced an issue.
We have identified an outage that affected these resources(s). You can look at outage information on NL2W-VCZ link.
")) + .withEventTime(OffsetDateTime.parse("2023-06-15T04:00:00.009223Z")) + .withInsightUniqueId("00000000-0000-0000-0000-000000000000") + .withImpact(new ImpactDetails().withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservername") + .withStartTime(OffsetDateTime.parse("2023-06-15T01:00:00.009223Z")) + .withImpactId( + "/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.Impact/workloadImpacts/impactid22"))) + .create(); + } +} +``` + +### Insights_Delete + +```java +/** + * Samples for Insights Delete. + */ +public final class InsightsDeleteSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Insights_Delete.json + */ + /** + * Sample code: Delete an Insight. + * + * @param manager Entry point to ImpactManager. + */ + public static void deleteAnInsight(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights() + .deleteByResourceGroupWithResponse("impactid22", "insightId12", com.azure.core.util.Context.NONE); + } +} +``` + +### Insights_Get + +```java +/** + * Samples for Insights Get. + */ +public final class InsightsGetSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_Get_mitigationAction.json + */ + /** + * Sample code: Get Insight sample for MitigationAction category. + * + * @param manager Entry point to ImpactManager. + */ + public static void + getInsightSampleForMitigationActionCategory(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().getWithResponse("impactId", "HPCUASucceeded", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_Get_diagnostics.json + */ + /** + * Sample code: Get Insight sample for Diagnostics category. + * + * @param manager Entry point to ImpactManager. + */ + public static void getInsightSampleForDiagnosticsCategory(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().getWithResponse("impactid", "insight1", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_Get_servicehealth.json + */ + /** + * Sample code: Get Insight sample for service health category. + * + * @param manager Entry point to ImpactManager. + */ + public static void + getInsightSampleForServiceHealthCategory(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().getWithResponse("impactid", "insightname", com.azure.core.util.Context.NONE); + } +} +``` + +### Insights_ListBySubscription + +```java +/** + * Samples for Insights ListBySubscription. + */ +public final class InsightsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_ListBySubscription.json + */ + /** + * Sample code: List Insight resources by workloadImpactName. + * + * @param manager Entry point to ImpactManager. + */ + public static void + listInsightResourcesByWorkloadImpactName(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().listBySubscription("impactid22", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Operations_List.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to ImpactManager. + */ + public static void operationsList(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### WorkloadImpacts_Create + +```java +import com.azure.resourcemanager.impact.models.ClientIncidentDetails; +import com.azure.resourcemanager.impact.models.Connectivity; +import com.azure.resourcemanager.impact.models.IncidentSource; +import com.azure.resourcemanager.impact.models.MetricUnit; +import com.azure.resourcemanager.impact.models.Performance; +import com.azure.resourcemanager.impact.models.Protocol; +import com.azure.resourcemanager.impact.models.SourceOrTarget; +import com.azure.resourcemanager.impact.models.Toolset; +import com.azure.resourcemanager.impact.models.Workload; +import com.azure.resourcemanager.impact.models.WorkloadImpactProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for WorkloadImpacts Create. + */ +public final class WorkloadImpactsCreateSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadAvailability_Create.json + */ + /** + * Sample code: Reporting availability related impact. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingAvailabilityRelatedImpact(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-002") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("Availability") + .withImpactDescription("read calls failed") + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadConnectivityImpact_Create.json + */ + /** + * Sample code: Reporting a connectivity impact. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingAConnectivityImpact(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-001") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("Resource.Connectivity") + .withImpactDescription("conection failure") + .withConnectivity(new Connectivity().withProtocol(Protocol.TCP) + .withPort(1443) + .withSource(new SourceOrTarget().withAzureResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm1")) + .withTarget(new SourceOrTarget().withAzureResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm2"))) + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadArmOperation_create.json + */ + /** + * Sample code: Reporting Arm operation failure. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingArmOperationFailure(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-002") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("ArmOperation") + .withImpactDescription("deletion of resource failed") + .withArmCorrelationIds(Arrays.asList("00000000-0000-0000-0000-000000000000")) + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadPerformance_Create.json + */ + /** + * Sample code: Reporting performance related impact. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingPerformanceRelatedImpact(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-002") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("Resource.Performance") + .withImpactDescription("high cpu utilization") + .withPerformance(Arrays.asList(new Performance().withMetricName("CPU") + .withExpected(60.0D) + .withActual(90.0D) + .withUnit(MetricUnit.fromString("garbage")))) + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } +} +``` + +### WorkloadImpacts_Delete + +```java +/** + * Samples for WorkloadImpacts Delete. + */ +public final class WorkloadImpactsDeleteSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/WorkloadImpact_Delete. + * json + */ + /** + * Sample code: Delete WorkloadImpact Resource by name example. + * + * @param manager Entry point to ImpactManager. + */ + public static void + deleteWorkloadImpactResourceByNameExample(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts().deleteWithResponse("impact-001", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkloadImpacts_Get + +```java +/** + * Samples for WorkloadImpacts Get. + */ +public final class WorkloadImpactsGetSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/WorkloadImpact_Get. + * json + */ + /** + * Sample code: Get WorkloadImpact Resource by name example. + * + * @param manager Entry point to ImpactManager. + */ + public static void getWorkloadImpactResourceByNameExample(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts().getWithResponse("impact-001", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkloadImpacts_List + +```java +/** + * Samples for WorkloadImpacts List. + */ +public final class WorkloadImpactsListSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadImpacts_ListBySubscription.json + */ + /** + * Sample code: List WorkloadImpact resources by subscription. + * + * @param manager Entry point to ImpactManager. + */ + public static void + listWorkloadImpactResourcesBySubscription(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/impact/azure-resourcemanager-impact/pom.xml b/sdk/impact/azure-resourcemanager-impact/pom.xml new file mode 100644 index 0000000000000..71cabeefaa9e1 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-impact + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for impact Management + This package contains Microsoft Azure SDK for impact Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-05-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + false + + + + com.azure + azure-core + 1.53.0 + + + com.azure + azure-core-management + 1.15.4 + + + diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/ImpactManager.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/ImpactManager.java new file mode 100644 index 0000000000000..51bc1bf47733e --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/ImpactManager.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact; + +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.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.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.impact.fluent.MicrosoftImpact; +import com.azure.resourcemanager.impact.implementation.ConnectorsImpl; +import com.azure.resourcemanager.impact.implementation.ImpactCategoriesImpl; +import com.azure.resourcemanager.impact.implementation.InsightsImpl; +import com.azure.resourcemanager.impact.implementation.MicrosoftImpactBuilder; +import com.azure.resourcemanager.impact.implementation.OperationsImpl; +import com.azure.resourcemanager.impact.implementation.WorkloadImpactsImpl; +import com.azure.resourcemanager.impact.models.Connectors; +import com.azure.resourcemanager.impact.models.ImpactCategories; +import com.azure.resourcemanager.impact.models.Insights; +import com.azure.resourcemanager.impact.models.Operations; +import com.azure.resourcemanager.impact.models.WorkloadImpacts; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ImpactManager. + */ +public final class ImpactManager { + private Operations operations; + + private Connectors connectors; + + private ImpactCategories impactCategories; + + private WorkloadImpacts workloadImpacts; + + private Insights insights; + + private final MicrosoftImpact clientObject; + + private ImpactManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MicrosoftImpactBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of impact service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the impact service API instance. + */ + public static ImpactManager 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 impact service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the impact service API instance. + */ + public static ImpactManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ImpactManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ImpactManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ImpactManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private 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 impact service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the impact service API instance. + */ + public ImpactManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.impact") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + 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 ArmChallengeAuthenticationPolicy(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 ImpactManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Connectors. It manages Connector. + * + * @return Resource collection API of Connectors. + */ + public Connectors connectors() { + if (this.connectors == null) { + this.connectors = new ConnectorsImpl(clientObject.getConnectors(), this); + } + return connectors; + } + + /** + * Gets the resource collection API of ImpactCategories. + * + * @return Resource collection API of ImpactCategories. + */ + public ImpactCategories impactCategories() { + if (this.impactCategories == null) { + this.impactCategories = new ImpactCategoriesImpl(clientObject.getImpactCategories(), this); + } + return impactCategories; + } + + /** + * Gets the resource collection API of WorkloadImpacts. It manages WorkloadImpact. + * + * @return Resource collection API of WorkloadImpacts. + */ + public WorkloadImpacts workloadImpacts() { + if (this.workloadImpacts == null) { + this.workloadImpacts = new WorkloadImpactsImpl(clientObject.getWorkloadImpacts(), this); + } + return workloadImpacts; + } + + /** + * Gets the resource collection API of Insights. It manages Insight. + * + * @return Resource collection API of Insights. + */ + public Insights insights() { + if (this.insights == null) { + this.insights = new InsightsImpl(clientObject.getInsights(), this); + } + return insights; + } + + /** + * Gets wrapped service client MicrosoftImpact providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client MicrosoftImpact. + */ + public MicrosoftImpact serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/ConnectorsClient.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/ConnectorsClient.java new file mode 100644 index 0000000000000..c37e1edffbb44 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/ConnectorsClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.models.ConnectorInner; +import com.azure.resourcemanager.impact.models.ConnectorUpdate; + +/** + * An instance of this class provides access to all the operations defined in ConnectorsClient. + */ +public interface ConnectorsClient { + /** + * List Connector resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Connector resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String connectorName, Context context); + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorInner get(String connectorName); + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 a connector is a resource that can be used to proactively report + * impacts against workloads in Azure to Microsoft. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConnectorInner> beginCreateOrUpdate(String connectorName, + ConnectorInner resource); + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 a connector is a resource that can be used to proactively report + * impacts against workloads in Azure to Microsoft. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ConnectorInner> beginCreateOrUpdate(String connectorName, + ConnectorInner resource, Context context); + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorInner createOrUpdate(String connectorName, ConnectorInner resource); + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorInner createOrUpdate(String connectorName, ConnectorInner resource, Context context); + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties 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 a connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String connectorName, ConnectorUpdate properties, Context context); + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties to be updated. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConnectorInner update(String connectorName, ConnectorUpdate properties); + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName, Context context); + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/ImpactCategoriesClient.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/ImpactCategoriesClient.java new file mode 100644 index 0000000000000..eab0b3367ae3a --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/ImpactCategoriesClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner; + +/** + * An instance of this class provides access to all the operations defined in ImpactCategoriesClient. + */ +public interface ImpactCategoriesClient { + /** + * List ImpactCategory resources by subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String categoryName, String resourceType, Context context); + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String impactCategoryName, Context context); + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImpactCategoryInner get(String impactCategoryName); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/InsightsClient.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/InsightsClient.java new file mode 100644 index 0000000000000..d3a94a3cbcec1 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/InsightsClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.InsightInner; + +/** + * An instance of this class provides access to all the operations defined in InsightsClient. + */ +public interface InsightsClient { + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String workloadImpactName); + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String workloadImpactName, Context context); + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String workloadImpactName, String insightName, Context context); + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InsightInner get(String workloadImpactName, String insightName); + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String workloadImpactName, String insightName, InsightInner resource, + Context context); + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InsightInner create(String workloadImpactName, String insightName, InsightInner resource); + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName, Context context); + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/MicrosoftImpact.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/MicrosoftImpact.java new file mode 100644 index 0000000000000..4443001611de4 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/MicrosoftImpact.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MicrosoftImpact class. + */ +public interface MicrosoftImpact { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ConnectorsClient object to access its operations. + * + * @return the ConnectorsClient object. + */ + ConnectorsClient getConnectors(); + + /** + * Gets the ImpactCategoriesClient object to access its operations. + * + * @return the ImpactCategoriesClient object. + */ + ImpactCategoriesClient getImpactCategories(); + + /** + * Gets the WorkloadImpactsClient object to access its operations. + * + * @return the WorkloadImpactsClient object. + */ + WorkloadImpactsClient getWorkloadImpacts(); + + /** + * Gets the InsightsClient object to access its operations. + * + * @return the InsightsClient object. + */ + InsightsClient getInsights(); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/OperationsClient.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/OperationsClient.java new file mode 100644 index 0000000000000..09079da3d92fd --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/WorkloadImpactsClient.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/WorkloadImpactsClient.java new file mode 100644 index 0000000000000..12fff22641140 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/WorkloadImpactsClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.models.WorkloadImpactInner; + +/** + * An instance of this class provides access to all the operations defined in WorkloadImpactsClient. + */ +public interface WorkloadImpactsClient { + /** + * List WorkloadImpact resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List WorkloadImpact resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String workloadImpactName, Context context); + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadImpactInner get(String workloadImpactName); + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadImpactInner> beginCreate(String workloadImpactName, + WorkloadImpactInner resource); + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadImpactInner> beginCreate(String workloadImpactName, + WorkloadImpactInner resource, Context context); + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadImpactInner create(String workloadImpactName, WorkloadImpactInner resource); + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadImpactInner create(String workloadImpactName, WorkloadImpactInner resource, Context context); + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName, Context context); + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/ConnectorInner.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/ConnectorInner.java new file mode 100644 index 0000000000000..6734c2c98743a --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/ConnectorInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.impact.models.ConnectorProperties; +import java.io.IOException; + +/** + * A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft. + */ +@Fluent +public final class ConnectorInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ConnectorProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + 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 ConnectorInner class. + */ + public ConnectorInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ConnectorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ConnectorInner object itself. + */ + public ConnectorInner withProperties(ConnectorProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorInner 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 ConnectorInner. + */ + public static ConnectorInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorInner deserializedConnectorInner = new ConnectorInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConnectorInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedConnectorInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConnectorInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedConnectorInner.properties = ConnectorProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedConnectorInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorInner; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/ImpactCategoryInner.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/ImpactCategoryInner.java new file mode 100644 index 0000000000000..3dcec3eb27c68 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/ImpactCategoryInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.impact.models.ImpactCategoryProperties; +import java.io.IOException; + +/** + * ImpactCategory resource. + */ +@Fluent +public final class ImpactCategoryInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ImpactCategoryProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + 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 ImpactCategoryInner class. + */ + public ImpactCategoryInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ImpactCategoryProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ImpactCategoryInner object itself. + */ + public ImpactCategoryInner withProperties(ImpactCategoryProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImpactCategoryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImpactCategoryInner 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 ImpactCategoryInner. + */ + public static ImpactCategoryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImpactCategoryInner deserializedImpactCategoryInner = new ImpactCategoryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedImpactCategoryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedImpactCategoryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedImpactCategoryInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedImpactCategoryInner.properties = ImpactCategoryProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedImpactCategoryInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedImpactCategoryInner; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/InsightInner.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/InsightInner.java new file mode 100644 index 0000000000000..6a7e745e55735 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/InsightInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.impact.models.InsightProperties; +import java.io.IOException; + +/** + * Insight resource. + */ +@Fluent +public final class InsightInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private InsightProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + 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 InsightInner class. + */ + public InsightInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public InsightProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the InsightInner object itself. + */ + public InsightInner withProperties(InsightProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightInner 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 InsightInner. + */ + public static InsightInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightInner deserializedInsightInner = new InsightInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedInsightInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedInsightInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedInsightInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedInsightInner.properties = InsightProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedInsightInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightInner; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/OperationInner.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..f5eb83bc1ba17 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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 com.azure.resourcemanager.impact.models.ActionType; +import com.azure.resourcemanager.impact.models.OperationDisplay; +import com.azure.resourcemanager.impact.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner 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 OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/WorkloadImpactInner.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/WorkloadImpactInner.java new file mode 100644 index 0000000000000..c8e31bb77914b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/WorkloadImpactInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.impact.models.WorkloadImpactProperties; +import java.io.IOException; + +/** + * Workload Impact properties. + */ +@Fluent +public final class WorkloadImpactInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private WorkloadImpactProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + 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 WorkloadImpactInner class. + */ + public WorkloadImpactInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public WorkloadImpactProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the WorkloadImpactInner object itself. + */ + public WorkloadImpactInner withProperties(WorkloadImpactProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadImpactInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadImpactInner 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 WorkloadImpactInner. + */ + public static WorkloadImpactInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadImpactInner deserializedWorkloadImpactInner = new WorkloadImpactInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkloadImpactInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkloadImpactInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkloadImpactInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedWorkloadImpactInner.properties = WorkloadImpactProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkloadImpactInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadImpactInner; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/package-info.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/models/package-info.java new file mode 100644 index 0000000000000..5adc9cfeda58b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/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 MicrosoftImpact. + * null. + */ +package com.azure.resourcemanager.impact.fluent.models; diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/package-info.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/fluent/package-info.java new file mode 100644 index 0000000000000..a3410daa4502c --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/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 MicrosoftImpact. + * null. + */ +package com.azure.resourcemanager.impact.fluent; diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorImpl.java new file mode 100644 index 0000000000000..78137f485fd5e --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.ConnectorInner; +import com.azure.resourcemanager.impact.models.Connector; +import com.azure.resourcemanager.impact.models.ConnectorProperties; +import com.azure.resourcemanager.impact.models.ConnectorPropertiesUpdate; +import com.azure.resourcemanager.impact.models.ConnectorUpdate; + +public final class ConnectorImpl implements Connector, Connector.Definition, Connector.Update { + private ConnectorInner innerObject; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ConnectorProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ConnectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } + + private String connectorName; + + private ConnectorUpdate updateProperties; + + public Connector create() { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .createOrUpdate(connectorName, this.innerModel(), Context.NONE); + return this; + } + + public Connector create(Context context) { + this.innerObject + = serviceManager.serviceClient().getConnectors().createOrUpdate(connectorName, this.innerModel(), context); + return this; + } + + ConnectorImpl(String name, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerObject = new ConnectorInner(); + this.serviceManager = serviceManager; + this.connectorName = name; + } + + public ConnectorImpl update() { + this.updateProperties = new ConnectorUpdate(); + return this; + } + + public Connector apply() { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .updateWithResponse(connectorName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Connector apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getConnectors() + .updateWithResponse(connectorName, updateProperties, context) + .getValue(); + return this; + } + + ConnectorImpl(ConnectorInner innerObject, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.connectorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "connectors"); + } + + public Connector refresh() { + this.innerObject + = serviceManager.serviceClient().getConnectors().getWithResponse(connectorName, Context.NONE).getValue(); + return this; + } + + public Connector refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getConnectors().getWithResponse(connectorName, context).getValue(); + return this; + } + + public ConnectorImpl withProperties(ConnectorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ConnectorImpl withProperties(ConnectorPropertiesUpdate properties) { + this.updateProperties.withProperties(properties); + return this; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorsClientImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorsClientImpl.java new file mode 100644 index 0000000000000..e630212d45418 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorsClientImpl.java @@ -0,0 +1,831 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.ConnectorsClient; +import com.azure.resourcemanager.impact.fluent.models.ConnectorInner; +import com.azure.resourcemanager.impact.models.ConnectorListResult; +import com.azure.resourcemanager.impact.models.ConnectorUpdate; +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 ConnectorsClient. + */ +public final class ConnectorsClientImpl implements ConnectorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ConnectorsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftImpactImpl client; + + /** + * Initializes an instance of ConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConnectorsClientImpl(MicrosoftImpactImpl client) { + this.service + = RestProxy.create(ConnectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftImpactConnectors to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftImpactConne") + public interface ConnectorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, @BodyParam("application/json") ConnectorInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("connectorName") String connectorName, @BodyParam("application/json") ConnectorUpdate properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("connectorName") String connectorName, + @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); + } + + /** + * List Connector resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation 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.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Connector resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation 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.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Connector resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Connector resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Connector resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Connector resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String connectorName) { + 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), connectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String connectorName, 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + connectorName, accept, context); + } + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String connectorName) { + return getWithResponseAsync(connectorName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String connectorName, Context context) { + return getWithResponseAsync(connectorName, context).block(); + } + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorInner get(String connectorName) { + return getWithResponse(connectorName, Context.NONE).getValue(); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String connectorName, + ConnectorInner resource) { + 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), connectorName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String connectorName, + ConnectorInner resource, 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), connectorName, resource, accept, context); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 a connector is a resource that can be used to proactively report + * impacts against workloads in Azure to Microsoft. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ConnectorInner> beginCreateOrUpdateAsync(String connectorName, + ConnectorInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(connectorName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ConnectorInner.class, ConnectorInner.class, this.client.getContext()); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 a connector is a resource that can be used to proactively report + * impacts against workloads in Azure to Microsoft. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ConnectorInner> beginCreateOrUpdateAsync(String connectorName, + ConnectorInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(connectorName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ConnectorInner.class, ConnectorInner.class, context); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 a connector is a resource that can be used to proactively report + * impacts against workloads in Azure to Microsoft. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConnectorInner> beginCreateOrUpdate(String connectorName, + ConnectorInner resource) { + return this.beginCreateOrUpdateAsync(connectorName, resource).getSyncPoller(); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 a connector is a resource that can be used to proactively report + * impacts against workloads in Azure to Microsoft. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ConnectorInner> beginCreateOrUpdate(String connectorName, + ConnectorInner resource, Context context) { + return this.beginCreateOrUpdateAsync(connectorName, resource, context).getSyncPoller(); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String connectorName, ConnectorInner resource) { + return beginCreateOrUpdateAsync(connectorName, resource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String connectorName, ConnectorInner resource, Context context) { + return beginCreateOrUpdateAsync(connectorName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorInner createOrUpdate(String connectorName, ConnectorInner resource) { + return createOrUpdateAsync(connectorName, resource).block(); + } + + /** + * Create a Connector. + * + * @param connectorName The name of the connector. + * @param resource Resource create parameters. + * @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 connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorInner createOrUpdate(String connectorName, ConnectorInner resource, Context context) { + return createOrUpdateAsync(connectorName, resource, context).block(); + } + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties 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 a connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String connectorName, ConnectorUpdate properties) { + 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), connectorName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties 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 a connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String connectorName, ConnectorUpdate properties, + 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + connectorName, properties, accept, context); + } + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties 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 a connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String connectorName, ConnectorUpdate properties) { + return updateWithResponseAsync(connectorName, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties 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 a connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String connectorName, ConnectorUpdate properties, + Context context) { + return updateWithResponseAsync(connectorName, properties, context).block(); + } + + /** + * Update a Connector. + * + * @param connectorName The name of the connector. + * @param properties The resource properties 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 a connector is a resource that can be used to proactively report impacts against workloads in Azure to + * Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConnectorInner update(String connectorName, ConnectorUpdate properties) { + return updateWithResponse(connectorName, properties, Context.NONE).getValue(); + } + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName) { + 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), connectorName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName, 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 (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + connectorName, accept, context); + } + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName) { + return deleteWithResponseAsync(connectorName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName, Context context) { + return deleteWithResponseAsync(connectorName, context).block(); + } + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 connectorName) { + deleteWithResponse(connectorName, Context.NONE); + } + + /** + * 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 the response of a Connector list operation 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 the response of a Connector list operation 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)); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorsImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorsImpl.java new file mode 100644 index 0000000000000..a3515f0eac91b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ConnectorsImpl.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.ConnectorsClient; +import com.azure.resourcemanager.impact.fluent.models.ConnectorInner; +import com.azure.resourcemanager.impact.models.Connector; +import com.azure.resourcemanager.impact.models.Connectors; + +public final class ConnectorsImpl implements Connectors { + private static final ClientLogger LOGGER = new ClientLogger(ConnectorsImpl.class); + + private final ConnectorsClient innerClient; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + public ConnectorsImpl(ConnectorsClient innerClient, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ConnectorImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ConnectorImpl(inner1, this.manager())); + } + + public Response getWithResponse(String connectorName, Context context) { + Response inner = this.serviceClient().getWithResponse(connectorName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ConnectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Connector get(String connectorName) { + ConnectorInner inner = this.serviceClient().get(connectorName); + if (inner != null) { + return new ConnectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String connectorName, Context context) { + return this.serviceClient().deleteWithResponse(connectorName, context); + } + + public void delete(String connectorName) { + this.serviceClient().delete(connectorName); + } + + public Connector getById(String id) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.getWithResponse(connectorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.getWithResponse(connectorName, context); + } + + public void deleteById(String id) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + this.deleteWithResponse(connectorName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String connectorName = ResourceManagerUtils.getValueFromIdByName(id, "connectors"); + if (connectorName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'connectors'.", id))); + } + return this.deleteWithResponse(connectorName, context); + } + + private ConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } + + public ConnectorImpl define(String name) { + return new ConnectorImpl(name, this.manager()); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoriesClientImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoriesClientImpl.java new file mode 100644 index 0000000000000..dd9ae39ba9018 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoriesClientImpl.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.impact.fluent.ImpactCategoriesClient; +import com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner; +import com.azure.resourcemanager.impact.models.ImpactCategoryListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ImpactCategoriesClient. + */ +public final class ImpactCategoriesClientImpl implements ImpactCategoriesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ImpactCategoriesService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftImpactImpl client; + + /** + * Initializes an instance of ImpactCategoriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImpactCategoriesClientImpl(MicrosoftImpactImpl client) { + this.service + = RestProxy.create(ImpactCategoriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftImpactImpactCategories to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftImpactImpac") + public interface ImpactCategoriesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("categoryName") String categoryName, @QueryParam("resourceType") String resourceType, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("impactCategoryName") String impactCategoryName, @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); + } + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String categoryName, String resourceType) { + 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.getApiVersion(), + this.client.getSubscriptionId(), categoryName, resourceType, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String categoryName, String resourceType, + 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.getApiVersion(), this.client.getSubscriptionId(), categoryName, + resourceType, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String categoryName, String resourceType) { + return new PagedFlux<>(() -> listSinglePageAsync(categoryName, resourceType), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List ImpactCategory resources by subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String categoryName = null; + final String resourceType = null; + return new PagedFlux<>(() -> listSinglePageAsync(categoryName, resourceType), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String categoryName, String resourceType, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(categoryName, resourceType, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List ImpactCategory resources by subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String categoryName = null; + final String resourceType = null; + return new PagedIterable<>(listAsync(categoryName, resourceType)); + } + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String categoryName, String resourceType, Context context) { + return new PagedIterable<>(listAsync(categoryName, resourceType, context)); + } + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String impactCategoryName) { + 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 (impactCategoryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactCategoryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), impactCategoryName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String impactCategoryName, 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 (impactCategoryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactCategoryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + impactCategoryName, accept, context); + } + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String impactCategoryName) { + return getWithResponseAsync(impactCategoryName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String impactCategoryName, Context context) { + return getWithResponseAsync(impactCategoryName, context).block(); + } + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImpactCategoryInner get(String impactCategoryName) { + return getWithResponse(impactCategoryName, Context.NONE).getValue(); + } + + /** + * 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 the response of a ImpactCategory list operation 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 the response of a ImpactCategory list operation 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)); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoriesImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoriesImpl.java new file mode 100644 index 0000000000000..54449d036bd7f --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoriesImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.ImpactCategoriesClient; +import com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner; +import com.azure.resourcemanager.impact.models.ImpactCategories; +import com.azure.resourcemanager.impact.models.ImpactCategory; + +public final class ImpactCategoriesImpl implements ImpactCategories { + private static final ClientLogger LOGGER = new ClientLogger(ImpactCategoriesImpl.class); + + private final ImpactCategoriesClient innerClient; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + public ImpactCategoriesImpl(ImpactCategoriesClient innerClient, + com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ImpactCategoryImpl(inner1, this.manager())); + } + + public PagedIterable list(String categoryName, String resourceType, Context context) { + PagedIterable inner = this.serviceClient().list(categoryName, resourceType, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ImpactCategoryImpl(inner1, this.manager())); + } + + public Response getWithResponse(String impactCategoryName, Context context) { + Response inner = this.serviceClient().getWithResponse(impactCategoryName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ImpactCategoryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ImpactCategory get(String impactCategoryName) { + ImpactCategoryInner inner = this.serviceClient().get(impactCategoryName); + if (inner != null) { + return new ImpactCategoryImpl(inner, this.manager()); + } else { + return null; + } + } + + private ImpactCategoriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoryImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoryImpl.java new file mode 100644 index 0000000000000..649a2e469062b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ImpactCategoryImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner; +import com.azure.resourcemanager.impact.models.ImpactCategory; +import com.azure.resourcemanager.impact.models.ImpactCategoryProperties; + +public final class ImpactCategoryImpl implements ImpactCategory { + private ImpactCategoryInner innerObject; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + ImpactCategoryImpl(ImpactCategoryInner innerObject, com.azure.resourcemanager.impact.ImpactManager 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 ImpactCategoryProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ImpactCategoryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightImpl.java new file mode 100644 index 0000000000000..2fe8c2a8e6037 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightImpl.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.InsightInner; +import com.azure.resourcemanager.impact.models.Insight; +import com.azure.resourcemanager.impact.models.InsightProperties; + +public final class InsightImpl implements Insight, Insight.Definition { + private InsightInner innerObject; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + InsightImpl(InsightInner innerObject, com.azure.resourcemanager.impact.ImpactManager 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 InsightProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public InsightInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } + + private String workloadImpactName; + + private String insightName; + + public InsightImpl withExistingWorkloadImpact(String workloadImpactName) { + this.workloadImpactName = workloadImpactName; + return this; + } + + public Insight create() { + this.innerObject = serviceManager.serviceClient() + .getInsights() + .createWithResponse(workloadImpactName, insightName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Insight create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInsights() + .createWithResponse(workloadImpactName, insightName, this.innerModel(), context) + .getValue(); + return this; + } + + InsightImpl(String name, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerObject = new InsightInner(); + this.serviceManager = serviceManager; + this.insightName = name; + } + + public Insight refresh() { + this.innerObject = serviceManager.serviceClient() + .getInsights() + .getWithResponse(workloadImpactName, insightName, Context.NONE) + .getValue(); + return this; + } + + public Insight refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getInsights() + .getWithResponse(workloadImpactName, insightName, context) + .getValue(); + return this; + } + + public InsightImpl withProperties(InsightProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightsClientImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightsClientImpl.java new file mode 100644 index 0000000000000..73a36a9c3c7c1 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightsClientImpl.java @@ -0,0 +1,659 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.impact.fluent.InsightsClient; +import com.azure.resourcemanager.impact.fluent.models.InsightInner; +import com.azure.resourcemanager.impact.models.InsightListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in InsightsClient. + */ +public final class InsightsClientImpl implements InsightsClient { + /** + * The proxy service used to perform REST calls. + */ + private final InsightsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftImpactImpl client; + + /** + * Initializes an instance of InsightsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InsightsClientImpl(MicrosoftImpactImpl client) { + this.service = RestProxy.create(InsightsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftImpactInsights to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftImpactInsig") + public interface InsightsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, @PathParam("insightName") String insightName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, @PathParam("insightName") String insightName, + @BodyParam("application/json") InsightInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, @PathParam("insightName") String insightName, + @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); + } + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String workloadImpactName) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String workloadImpactName, + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String workloadImpactName) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(workloadImpactName), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String workloadImpactName, Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(workloadImpactName, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String workloadImpactName) { + return new PagedIterable<>(listBySubscriptionAsync(workloadImpactName)); + } + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String workloadImpactName, Context context) { + return new PagedIterable<>(listBySubscriptionAsync(workloadImpactName, context)); + } + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workloadImpactName, String insightName) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (insightName == null) { + return Mono.error(new IllegalArgumentException("Parameter insightName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, insightName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workloadImpactName, String insightName, + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (insightName == null) { + return Mono.error(new IllegalArgumentException("Parameter insightName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, insightName, accept, context); + } + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String workloadImpactName, String insightName) { + return getWithResponseAsync(workloadImpactName, insightName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String workloadImpactName, String insightName, Context context) { + return getWithResponseAsync(workloadImpactName, insightName, context).block(); + } + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InsightInner get(String workloadImpactName, String insightName) { + return getWithResponse(workloadImpactName, insightName, Context.NONE).getValue(); + } + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String workloadImpactName, String insightName, + InsightInner resource) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (insightName == null) { + return Mono.error(new IllegalArgumentException("Parameter insightName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, insightName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String workloadImpactName, String insightName, + InsightInner resource, 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (insightName == null) { + return Mono.error(new IllegalArgumentException("Parameter insightName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, insightName, resource, accept, context); + } + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String workloadImpactName, String insightName, InsightInner resource) { + return createWithResponseAsync(workloadImpactName, insightName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String workloadImpactName, String insightName, + InsightInner resource, Context context) { + return createWithResponseAsync(workloadImpactName, insightName, resource, context).block(); + } + + /** + * Create Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @param resource Resource create parameters. + * @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 insight resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InsightInner create(String workloadImpactName, String insightName, InsightInner resource) { + return createWithResponse(workloadImpactName, insightName, resource, Context.NONE).getValue(); + } + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (insightName == null) { + return Mono.error(new IllegalArgumentException("Parameter insightName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, insightName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName, + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (insightName == null) { + return Mono.error(new IllegalArgumentException("Parameter insightName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, insightName, accept, context); + } + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName) { + return deleteWithResponseAsync(workloadImpactName, insightName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName, Context context) { + return deleteWithResponseAsync(workloadImpactName, insightName, context).block(); + } + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName) { + deleteWithResponse(workloadImpactName, insightName, Context.NONE); + } + + /** + * 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 the response of a Insight list operation 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 the response of a Insight list operation 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)); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightsImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightsImpl.java new file mode 100644 index 0000000000000..5dfc3211a5d42 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/InsightsImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.InsightsClient; +import com.azure.resourcemanager.impact.fluent.models.InsightInner; +import com.azure.resourcemanager.impact.models.Insight; +import com.azure.resourcemanager.impact.models.Insights; + +public final class InsightsImpl implements Insights { + private static final ClientLogger LOGGER = new ClientLogger(InsightsImpl.class); + + private final InsightsClient innerClient; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + public InsightsImpl(InsightsClient innerClient, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySubscription(String workloadImpactName) { + PagedIterable inner = this.serviceClient().listBySubscription(workloadImpactName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new InsightImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String workloadImpactName, Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(workloadImpactName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new InsightImpl(inner1, this.manager())); + } + + public Response getWithResponse(String workloadImpactName, String insightName, Context context) { + Response inner = this.serviceClient().getWithResponse(workloadImpactName, insightName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new InsightImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Insight get(String workloadImpactName, String insightName) { + InsightInner inner = this.serviceClient().get(workloadImpactName, insightName); + if (inner != null) { + return new InsightImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String workloadImpactName, String insightName, + Context context) { + return this.serviceClient().deleteWithResponse(workloadImpactName, insightName, context); + } + + public void deleteByResourceGroup(String workloadImpactName, String insightName) { + this.serviceClient().delete(workloadImpactName, insightName); + } + + public Insight getById(String id) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + String insightName = ResourceManagerUtils.getValueFromIdByName(id, "insights"); + if (insightName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'insights'.", id))); + } + return this.getWithResponse(workloadImpactName, insightName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + String insightName = ResourceManagerUtils.getValueFromIdByName(id, "insights"); + if (insightName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'insights'.", id))); + } + return this.getWithResponse(workloadImpactName, insightName, context); + } + + public void deleteById(String id) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + String insightName = ResourceManagerUtils.getValueFromIdByName(id, "insights"); + if (insightName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'insights'.", id))); + } + this.deleteByResourceGroupWithResponse(workloadImpactName, insightName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + String insightName = ResourceManagerUtils.getValueFromIdByName(id, "insights"); + if (insightName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'insights'.", id))); + } + return this.deleteByResourceGroupWithResponse(workloadImpactName, insightName, context); + } + + private InsightsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } + + public InsightImpl define(String name) { + return new InsightImpl(name, this.manager()); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/MicrosoftImpactBuilder.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/MicrosoftImpactBuilder.java new file mode 100644 index 0000000000000..416c52d6ee8a6 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/MicrosoftImpactBuilder.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.impact.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 MicrosoftImpactImpl type. + */ +@ServiceClientBuilder(serviceClients = { MicrosoftImpactImpl.class }) +public final class MicrosoftImpactBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftImpactBuilder. + */ + public MicrosoftImpactBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftImpactBuilder. + */ + public MicrosoftImpactBuilder 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 MicrosoftImpactBuilder. + */ + public MicrosoftImpactBuilder 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 MicrosoftImpactBuilder. + */ + public MicrosoftImpactBuilder 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 MicrosoftImpactBuilder. + */ + public MicrosoftImpactBuilder 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 MicrosoftImpactBuilder. + */ + public MicrosoftImpactBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftImpactImpl with the provided parameters. + * + * @return an instance of MicrosoftImpactImpl. + */ + public MicrosoftImpactImpl 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(); + MicrosoftImpactImpl client = new MicrosoftImpactImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/MicrosoftImpactImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/MicrosoftImpactImpl.java new file mode 100644 index 0000000000000..c5a5d9da9bc03 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/MicrosoftImpactImpl.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.ConnectorsClient; +import com.azure.resourcemanager.impact.fluent.ImpactCategoriesClient; +import com.azure.resourcemanager.impact.fluent.InsightsClient; +import com.azure.resourcemanager.impact.fluent.MicrosoftImpact; +import com.azure.resourcemanager.impact.fluent.OperationsClient; +import com.azure.resourcemanager.impact.fluent.WorkloadImpactsClient; +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 MicrosoftImpactImpl type. + */ +@ServiceClient(builder = MicrosoftImpactBuilder.class) +public final class MicrosoftImpactImpl implements MicrosoftImpact { + /** + * The ID of the target subscription. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The ConnectorsClient object to access its operations. + */ + private final ConnectorsClient connectors; + + /** + * Gets the ConnectorsClient object to access its operations. + * + * @return the ConnectorsClient object. + */ + public ConnectorsClient getConnectors() { + return this.connectors; + } + + /** + * The ImpactCategoriesClient object to access its operations. + */ + private final ImpactCategoriesClient impactCategories; + + /** + * Gets the ImpactCategoriesClient object to access its operations. + * + * @return the ImpactCategoriesClient object. + */ + public ImpactCategoriesClient getImpactCategories() { + return this.impactCategories; + } + + /** + * The WorkloadImpactsClient object to access its operations. + */ + private final WorkloadImpactsClient workloadImpacts; + + /** + * Gets the WorkloadImpactsClient object to access its operations. + * + * @return the WorkloadImpactsClient object. + */ + public WorkloadImpactsClient getWorkloadImpacts() { + return this.workloadImpacts; + } + + /** + * The InsightsClient object to access its operations. + */ + private final InsightsClient insights; + + /** + * Gets the InsightsClient object to access its operations. + * + * @return the InsightsClient object. + */ + public InsightsClient getInsights() { + return this.insights; + } + + /** + * Initializes an instance of MicrosoftImpact client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + MicrosoftImpactImpl(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 = "2024-05-01-preview"; + this.operations = new OperationsClientImpl(this); + this.connectors = new ConnectorsClientImpl(this); + this.impactCategories = new ImpactCategoriesClientImpl(this); + this.workloadImpacts = new WorkloadImpactsClientImpl(this); + this.insights = new InsightsClientImpl(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(MicrosoftImpactImpl.class); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationImpl.java new file mode 100644 index 0000000000000..153ac50e5ed26 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.resourcemanager.impact.fluent.models.OperationInner; +import com.azure.resourcemanager.impact.models.ActionType; +import com.azure.resourcemanager.impact.models.Operation; +import com.azure.resourcemanager.impact.models.OperationDisplay; +import com.azure.resourcemanager.impact.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationsClientImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..fada5bac0bb52 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.impact.fluent.OperationsClient; +import com.azure.resourcemanager.impact.fluent.models.OperationInner; +import com.azure.resourcemanager.impact.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftImpactImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftImpactImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftImpactOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftImpactOpera") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Impact/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationsImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..371d300d2b84d --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/OperationsImpl.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.impact.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.impact.fluent.OperationsClient; +import com.azure.resourcemanager.impact.fluent.models.OperationInner; +import com.azure.resourcemanager.impact.models.Operation; +import com.azure.resourcemanager.impact.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ResourceManagerUtils.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..dd5f8caf8012f --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/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.impact.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/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactImpl.java new file mode 100644 index 0000000000000..8a2af52f978e6 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.WorkloadImpactInner; +import com.azure.resourcemanager.impact.models.WorkloadImpact; +import com.azure.resourcemanager.impact.models.WorkloadImpactProperties; + +public final class WorkloadImpactImpl implements WorkloadImpact, WorkloadImpact.Definition { + private WorkloadImpactInner innerObject; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + WorkloadImpactImpl(WorkloadImpactInner innerObject, com.azure.resourcemanager.impact.ImpactManager 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 WorkloadImpactProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public WorkloadImpactInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } + + private String workloadImpactName; + + public WorkloadImpact create() { + this.innerObject = serviceManager.serviceClient() + .getWorkloadImpacts() + .create(workloadImpactName, this.innerModel(), Context.NONE); + return this; + } + + public WorkloadImpact create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkloadImpacts() + .create(workloadImpactName, this.innerModel(), context); + return this; + } + + WorkloadImpactImpl(String name, com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerObject = new WorkloadImpactInner(); + this.serviceManager = serviceManager; + this.workloadImpactName = name; + } + + public WorkloadImpact refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkloadImpacts() + .getWithResponse(workloadImpactName, Context.NONE) + .getValue(); + return this; + } + + public WorkloadImpact refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkloadImpacts() + .getWithResponse(workloadImpactName, context) + .getValue(); + return this; + } + + public WorkloadImpactImpl withProperties(WorkloadImpactProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactsClientImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactsClientImpl.java new file mode 100644 index 0000000000000..20fdfe57972ff --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactsClientImpl.java @@ -0,0 +1,697 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.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.impact.fluent.WorkloadImpactsClient; +import com.azure.resourcemanager.impact.fluent.models.WorkloadImpactInner; +import com.azure.resourcemanager.impact.models.WorkloadImpactListResult; +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 WorkloadImpactsClient. + */ +public final class WorkloadImpactsClientImpl implements WorkloadImpactsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkloadImpactsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftImpactImpl client; + + /** + * Initializes an instance of WorkloadImpactsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadImpactsClientImpl(MicrosoftImpactImpl client) { + this.service + = RestProxy.create(WorkloadImpactsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftImpactWorkloadImpacts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftImpactWorkl") + public interface WorkloadImpactsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, + @BodyParam("application/json") WorkloadImpactInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("workloadImpactName") String workloadImpactName, @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); + } + + /** + * List WorkloadImpact resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation 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.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List WorkloadImpact resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation 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.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List WorkloadImpact resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List WorkloadImpact resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List WorkloadImpact resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List WorkloadImpact resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workloadImpactName) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String workloadImpactName, 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, accept, context); + } + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String workloadImpactName) { + return getWithResponseAsync(workloadImpactName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String workloadImpactName, Context context) { + return getWithResponseAsync(workloadImpactName, context).block(); + } + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadImpactInner get(String workloadImpactName) { + return getWithResponse(workloadImpactName, Context.NONE).getValue(); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String workloadImpactName, + WorkloadImpactInner resource) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String workloadImpactName, + WorkloadImpactInner resource, 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, resource, accept, context); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadImpactInner> beginCreateAsync(String workloadImpactName, + WorkloadImpactInner resource) { + Mono>> mono = createWithResponseAsync(workloadImpactName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + WorkloadImpactInner.class, WorkloadImpactInner.class, this.client.getContext()); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadImpactInner> beginCreateAsync(String workloadImpactName, + WorkloadImpactInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(workloadImpactName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + WorkloadImpactInner.class, WorkloadImpactInner.class, context); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadImpactInner> beginCreate(String workloadImpactName, + WorkloadImpactInner resource) { + return this.beginCreateAsync(workloadImpactName, resource).getSyncPoller(); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadImpactInner> beginCreate(String workloadImpactName, + WorkloadImpactInner resource, Context context) { + return this.beginCreateAsync(workloadImpactName, resource, context).getSyncPoller(); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String workloadImpactName, WorkloadImpactInner resource) { + return beginCreateAsync(workloadImpactName, resource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String workloadImpactName, WorkloadImpactInner resource, + Context context) { + return beginCreateAsync(workloadImpactName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadImpactInner create(String workloadImpactName, WorkloadImpactInner resource) { + return createAsync(workloadImpactName, resource).block(); + } + + /** + * Create a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @param resource Resource create parameters. + * @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 workload Impact properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadImpactInner create(String workloadImpactName, WorkloadImpactInner resource, Context context) { + return createAsync(workloadImpactName, resource, context).block(); + } + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName) { + 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), workloadImpactName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName, 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 (workloadImpactName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadImpactName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + workloadImpactName, accept, context); + } + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName) { + return deleteWithResponseAsync(workloadImpactName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName, Context context) { + return deleteWithResponseAsync(workloadImpactName, context).block(); + } + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 workloadImpactName) { + deleteWithResponse(workloadImpactName, Context.NONE); + } + + /** + * 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 the response of a WorkloadImpact list operation 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 the response of a WorkloadImpact list operation 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)); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactsImpl.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactsImpl.java new file mode 100644 index 0000000000000..85c09e1d254b4 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/WorkloadImpactsImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.impact.fluent.WorkloadImpactsClient; +import com.azure.resourcemanager.impact.fluent.models.WorkloadImpactInner; +import com.azure.resourcemanager.impact.models.WorkloadImpact; +import com.azure.resourcemanager.impact.models.WorkloadImpacts; + +public final class WorkloadImpactsImpl implements WorkloadImpacts { + private static final ClientLogger LOGGER = new ClientLogger(WorkloadImpactsImpl.class); + + private final WorkloadImpactsClient innerClient; + + private final com.azure.resourcemanager.impact.ImpactManager serviceManager; + + public WorkloadImpactsImpl(WorkloadImpactsClient innerClient, + com.azure.resourcemanager.impact.ImpactManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadImpactImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadImpactImpl(inner1, this.manager())); + } + + public Response getWithResponse(String workloadImpactName, Context context) { + Response inner = this.serviceClient().getWithResponse(workloadImpactName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkloadImpactImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkloadImpact get(String workloadImpactName) { + WorkloadImpactInner inner = this.serviceClient().get(workloadImpactName); + if (inner != null) { + return new WorkloadImpactImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String workloadImpactName, Context context) { + return this.serviceClient().deleteWithResponse(workloadImpactName, context); + } + + public void delete(String workloadImpactName) { + this.serviceClient().delete(workloadImpactName); + } + + public WorkloadImpact getById(String id) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + return this.getWithResponse(workloadImpactName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + return this.getWithResponse(workloadImpactName, context); + } + + public void deleteById(String id) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + this.deleteWithResponse(workloadImpactName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String workloadImpactName = ResourceManagerUtils.getValueFromIdByName(id, "workloadImpacts"); + if (workloadImpactName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloadImpacts'.", id))); + } + return this.deleteWithResponse(workloadImpactName, context); + } + + private WorkloadImpactsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.impact.ImpactManager manager() { + return this.serviceManager; + } + + public WorkloadImpactImpl define(String name) { + return new WorkloadImpactImpl(name, this.manager()); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/package-info.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/implementation/package-info.java new file mode 100644 index 0000000000000..08f7a0654ca7a --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/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 MicrosoftImpact. + * null. + */ +package com.azure.resourcemanager.impact.implementation; diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ActionType.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ActionType.java new file mode 100644 index 0000000000000..b4dd46a0461e2 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ActionType.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.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ClientIncidentDetails.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ClientIncidentDetails.java new file mode 100644 index 0000000000000..8504ff98baa5a --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ClientIncidentDetails.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Client incident details ex: incidentId , incident source. + */ +@Fluent +public final class ClientIncidentDetails implements JsonSerializable { + /* + * Client incident id. ex : id of the incident created to investigate and address the impact if any. + */ + private String clientIncidentId; + + /* + * Client incident source. ex : source system name where the incident is created + */ + private IncidentSource clientIncidentSource; + + /** + * Creates an instance of ClientIncidentDetails class. + */ + public ClientIncidentDetails() { + } + + /** + * Get the clientIncidentId property: Client incident id. ex : id of the incident created to investigate and address + * the impact if any. + * + * @return the clientIncidentId value. + */ + public String clientIncidentId() { + return this.clientIncidentId; + } + + /** + * Set the clientIncidentId property: Client incident id. ex : id of the incident created to investigate and address + * the impact if any. + * + * @param clientIncidentId the clientIncidentId value to set. + * @return the ClientIncidentDetails object itself. + */ + public ClientIncidentDetails withClientIncidentId(String clientIncidentId) { + this.clientIncidentId = clientIncidentId; + return this; + } + + /** + * Get the clientIncidentSource property: Client incident source. ex : source system name where the incident is + * created. + * + * @return the clientIncidentSource value. + */ + public IncidentSource clientIncidentSource() { + return this.clientIncidentSource; + } + + /** + * Set the clientIncidentSource property: Client incident source. ex : source system name where the incident is + * created. + * + * @param clientIncidentSource the clientIncidentSource value to set. + * @return the ClientIncidentDetails object itself. + */ + public ClientIncidentDetails withClientIncidentSource(IncidentSource clientIncidentSource) { + this.clientIncidentSource = clientIncidentSource; + 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("clientIncidentId", this.clientIncidentId); + jsonWriter.writeStringField("clientIncidentSource", + this.clientIncidentSource == null ? null : this.clientIncidentSource.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientIncidentDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientIncidentDetails 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 ClientIncidentDetails. + */ + public static ClientIncidentDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ClientIncidentDetails deserializedClientIncidentDetails = new ClientIncidentDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clientIncidentId".equals(fieldName)) { + deserializedClientIncidentDetails.clientIncidentId = reader.getString(); + } else if ("clientIncidentSource".equals(fieldName)) { + deserializedClientIncidentDetails.clientIncidentSource + = IncidentSource.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedClientIncidentDetails; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConfidenceLevel.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConfidenceLevel.java new file mode 100644 index 0000000000000..4afbbe8692b3b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConfidenceLevel.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.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Degree of confidence on the impact being a platform issue. + */ +public final class ConfidenceLevel extends ExpandableStringEnum { + /** + * Static value Low for ConfidenceLevel. + */ + public static final ConfidenceLevel LOW = fromString("Low"); + + /** + * Static value Medium for ConfidenceLevel. + */ + public static final ConfidenceLevel MEDIUM = fromString("Medium"); + + /** + * Static value High for ConfidenceLevel. + */ + public static final ConfidenceLevel HIGH = fromString("High"); + + /** + * Creates a new instance of ConfidenceLevel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ConfidenceLevel() { + } + + /** + * Creates or finds a ConfidenceLevel from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConfidenceLevel. + */ + public static ConfidenceLevel fromString(String name) { + return fromString(name, ConfidenceLevel.class); + } + + /** + * Gets known ConfidenceLevel values. + * + * @return known ConfidenceLevel values. + */ + public static Collection values() { + return values(ConfidenceLevel.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connectivity.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connectivity.java new file mode 100644 index 0000000000000..f217f3d4a46fd --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connectivity.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, + * when a VM is impacted due to a network issue, the impacted resource could be VM or the network. In such cases, the + * connectivity field will have the details about both VM and network. + */ +@Fluent +public final class Connectivity implements JsonSerializable { + /* + * Protocol used for the connection + */ + private Protocol protocol; + + /* + * Port number for the connection + */ + private Integer port; + + /* + * Source from which the connection was attempted + */ + private SourceOrTarget source; + + /* + * target which connection was attempted + */ + private SourceOrTarget target; + + /** + * Creates an instance of Connectivity class. + */ + public Connectivity() { + } + + /** + * Get the protocol property: Protocol used for the connection. + * + * @return the protocol value. + */ + public Protocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: Protocol used for the connection. + * + * @param protocol the protocol value to set. + * @return the Connectivity object itself. + */ + public Connectivity withProtocol(Protocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the port property: Port number for the connection. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Set the port property: Port number for the connection. + * + * @param port the port value to set. + * @return the Connectivity object itself. + */ + public Connectivity withPort(Integer port) { + this.port = port; + return this; + } + + /** + * Get the source property: Source from which the connection was attempted. + * + * @return the source value. + */ + public SourceOrTarget source() { + return this.source; + } + + /** + * Set the source property: Source from which the connection was attempted. + * + * @param source the source value to set. + * @return the Connectivity object itself. + */ + public Connectivity withSource(SourceOrTarget source) { + this.source = source; + return this; + } + + /** + * Get the target property: target which connection was attempted. + * + * @return the target value. + */ + public SourceOrTarget target() { + return this.target; + } + + /** + * Set the target property: target which connection was attempted. + * + * @param target the target value to set. + * @return the Connectivity object itself. + */ + public Connectivity withTarget(SourceOrTarget target) { + this.target = target; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() != null) { + source().validate(); + } + if (target() != null) { + target().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protocol", this.protocol == null ? null : this.protocol.toString()); + jsonWriter.writeNumberField("port", this.port); + jsonWriter.writeJsonField("source", this.source); + jsonWriter.writeJsonField("target", this.target); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Connectivity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Connectivity 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 Connectivity. + */ + public static Connectivity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Connectivity deserializedConnectivity = new Connectivity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protocol".equals(fieldName)) { + deserializedConnectivity.protocol = Protocol.fromString(reader.getString()); + } else if ("port".equals(fieldName)) { + deserializedConnectivity.port = reader.getNullable(JsonReader::getInt); + } else if ("source".equals(fieldName)) { + deserializedConnectivity.source = SourceOrTarget.fromJson(reader); + } else if ("target".equals(fieldName)) { + deserializedConnectivity.target = SourceOrTarget.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectivity; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connector.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connector.java new file mode 100644 index 0000000000000..29b9de2aaa91b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connector.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.ConnectorInner; + +/** + * An immutable client-side representation of Connector. + */ +public interface Connector { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ConnectorProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.impact.fluent.models.ConnectorInner object. + * + * @return the inner object. + */ + ConnectorInner innerModel(); + + /** + * The entirety of the Connector definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The Connector definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Connector definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the Connector definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Connector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Connector create(Context context); + } + + /** + * The stage of the Connector definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ConnectorProperties properties); + } + } + + /** + * Begins update for the Connector resource. + * + * @return the stage of resource update. + */ + Connector.Update update(); + + /** + * The template for Connector update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Connector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Connector apply(Context context); + } + + /** + * The Connector update stages. + */ + interface UpdateStages { + /** + * The stage of the Connector update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ConnectorPropertiesUpdate properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Connector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Connector refresh(Context context); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorListResult.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorListResult.java new file mode 100644 index 0000000000000..25b528d9c717d --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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 com.azure.resourcemanager.impact.fluent.models.ConnectorInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Connector list operation. + */ +@Fluent +public final class ConnectorListResult implements JsonSerializable { + /* + * The Connector items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ConnectorListResult class. + */ + public ConnectorListResult() { + } + + /** + * Get the value property: The Connector items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Connector items on this page. + * + * @param value the value value to set. + * @return the ConnectorListResult object itself. + */ + public ConnectorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ConnectorListResult object itself. + */ + public ConnectorListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ConnectorListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectorListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorListResult 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 ConnectorListResult. + */ + public static ConnectorListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorListResult deserializedConnectorListResult = new ConnectorListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ConnectorInner.fromJson(reader1)); + deserializedConnectorListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedConnectorListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorListResult; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorProperties.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorProperties.java new file mode 100644 index 0000000000000..ba21ed656ae0d --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.OffsetDateTime; + +/** + * Details of the Connector. + */ +@Fluent +public final class ConnectorProperties implements JsonSerializable { + /* + * Resource provisioning state. + */ + private ProvisioningState provisioningState; + + /* + * unique id of the connector. + */ + private String connectorId; + + /* + * tenant id of this connector + */ + private String tenantId; + + /* + * connector type + */ + private Platform connectorType; + + /* + * last run time stamp of this connector in UTC time zone + */ + private OffsetDateTime lastRunTimestamp; + + /** + * Creates an instance of ConnectorProperties class. + */ + public ConnectorProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the connectorId property: unique id of the connector. + * + * @return the connectorId value. + */ + public String connectorId() { + return this.connectorId; + } + + /** + * Get the tenantId property: tenant id of this connector. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the connectorType property: connector type. + * + * @return the connectorType value. + */ + public Platform connectorType() { + return this.connectorType; + } + + /** + * Set the connectorType property: connector type. + * + * @param connectorType the connectorType value to set. + * @return the ConnectorProperties object itself. + */ + public ConnectorProperties withConnectorType(Platform connectorType) { + this.connectorType = connectorType; + return this; + } + + /** + * Get the lastRunTimestamp property: last run time stamp of this connector in UTC time zone. + * + * @return the lastRunTimestamp value. + */ + public OffsetDateTime lastRunTimestamp() { + return this.lastRunTimestamp; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectorType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectorType in model ConnectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ConnectorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("connectorType", this.connectorType == null ? null : this.connectorType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorProperties 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 ConnectorProperties. + */ + public static ConnectorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorProperties deserializedConnectorProperties = new ConnectorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorId".equals(fieldName)) { + deserializedConnectorProperties.connectorId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedConnectorProperties.tenantId = reader.getString(); + } else if ("connectorType".equals(fieldName)) { + deserializedConnectorProperties.connectorType = Platform.fromString(reader.getString()); + } else if ("lastRunTimeStamp".equals(fieldName)) { + deserializedConnectorProperties.lastRunTimestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("provisioningState".equals(fieldName)) { + deserializedConnectorProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorProperties; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorPropertiesUpdate.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorPropertiesUpdate.java new file mode 100644 index 0000000000000..70d6ba8a62517 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorPropertiesUpdate.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Details of the Connector. + */ +@Fluent +public final class ConnectorPropertiesUpdate implements JsonSerializable { + /* + * connector type + */ + private Platform connectorType; + + /** + * Creates an instance of ConnectorPropertiesUpdate class. + */ + public ConnectorPropertiesUpdate() { + } + + /** + * Get the connectorType property: connector type. + * + * @return the connectorType value. + */ + public Platform connectorType() { + return this.connectorType; + } + + /** + * Set the connectorType property: connector type. + * + * @param connectorType the connectorType value to set. + * @return the ConnectorPropertiesUpdate object itself. + */ + public ConnectorPropertiesUpdate withConnectorType(Platform connectorType) { + this.connectorType = connectorType; + 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("connectorType", this.connectorType == null ? null : this.connectorType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorPropertiesUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorPropertiesUpdate 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 ConnectorPropertiesUpdate. + */ + public static ConnectorPropertiesUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorPropertiesUpdate deserializedConnectorPropertiesUpdate = new ConnectorPropertiesUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("connectorType".equals(fieldName)) { + deserializedConnectorPropertiesUpdate.connectorType = Platform.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorPropertiesUpdate; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorUpdate.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorUpdate.java new file mode 100644 index 0000000000000..e1e5ae703b1cf --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ConnectorUpdate.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft. + */ +@Fluent +public final class ConnectorUpdate extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ConnectorPropertiesUpdate properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + 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 ConnectorUpdate class. + */ + public ConnectorUpdate() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ConnectorPropertiesUpdate properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ConnectorUpdate object itself. + */ + public ConnectorUpdate withProperties(ConnectorPropertiesUpdate properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConnectorUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConnectorUpdate 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 ConnectorUpdate. + */ + public static ConnectorUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConnectorUpdate deserializedConnectorUpdate = new ConnectorUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConnectorUpdate.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedConnectorUpdate.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConnectorUpdate.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedConnectorUpdate.properties = ConnectorPropertiesUpdate.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedConnectorUpdate.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConnectorUpdate; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connectors.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connectors.java new file mode 100644 index 0000000000000..4ecd85a5b2270 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Connectors.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Connectors. + */ +public interface Connectors { + /** + * List Connector resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Connector resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Connector list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector along with {@link Response}. + */ + Response getWithResponse(String connectorName, Context context); + + /** + * Get a Connector. + * + * @param connectorName The name of the connector. + * @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 Connector. + */ + Connector get(String connectorName); + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 deleteWithResponse(String connectorName, Context context); + + /** + * Delete a Connector. + * + * @param connectorName The name of the connector. + * @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 delete(String connectorName); + + /** + * Get a Connector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Connector along with {@link Response}. + */ + Connector getById(String id); + + /** + * Get a Connector. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Connector along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Connector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Connector. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Connector resource. + * + * @param name resource name. + * @return the first stage of the new Connector definition. + */ + Connector.DefinitionStages.Blank define(String name); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Content.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Content.java new file mode 100644 index 0000000000000..67edea13977d5 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Content.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Article details of the insight like title, description etc. + */ +@Fluent +public final class Content implements JsonSerializable { + /* + * Title of the insight + */ + private String title; + + /* + * Description of the insight + */ + private String description; + + /** + * Creates an instance of Content class. + */ + public Content() { + } + + /** + * Get the title property: Title of the insight. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title of the insight. + * + * @param title the title value to set. + * @return the Content object itself. + */ + public Content withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: Description of the insight. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the insight. + * + * @param description the description value to set. + * @return the Content object itself. + */ + public Content withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property title in model Content")); + } + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property description in model Content")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Content.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Content from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Content 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 Content. + */ + public static Content fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Content deserializedContent = new Content(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedContent.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedContent.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedContent; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ErrorDetailProperties.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ErrorDetailProperties.java new file mode 100644 index 0000000000000..c4db171fd17a6 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ErrorDetailProperties.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.impact.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; + +/** + * ARM error code and error message associated with the impact. + */ +@Fluent +public final class ErrorDetailProperties implements JsonSerializable { + /* + * ARM Error code associated with the impact. + */ + private String errorCode; + + /* + * ARM Error Message associated with the impact + */ + private String errorMessage; + + /** + * Creates an instance of ErrorDetailProperties class. + */ + public ErrorDetailProperties() { + } + + /** + * Get the errorCode property: ARM Error code associated with the impact. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: ARM Error code associated with the impact. + * + * @param errorCode the errorCode value to set. + * @return the ErrorDetailProperties object itself. + */ + public ErrorDetailProperties withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the errorMessage property: ARM Error Message associated with the impact. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: ARM Error Message associated with the impact. + * + * @param errorMessage the errorMessage value to set. + * @return the ErrorDetailProperties object itself. + */ + public ErrorDetailProperties withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + 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("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorDetailProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorDetailProperties 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 ErrorDetailProperties. + */ + public static ErrorDetailProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorDetailProperties deserializedErrorDetailProperties = new ErrorDetailProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedErrorDetailProperties.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedErrorDetailProperties.errorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedErrorDetailProperties; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ExpectedValueRange.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ExpectedValueRange.java new file mode 100644 index 0000000000000..9935e007b6889 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ExpectedValueRange.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Max and Min Threshold values for the metric. + */ +@Fluent +public final class ExpectedValueRange implements JsonSerializable { + /* + * Min threshold value for the metric + */ + private double min; + + /* + * Max threshold value for the metric + */ + private double max; + + /** + * Creates an instance of ExpectedValueRange class. + */ + public ExpectedValueRange() { + } + + /** + * Get the min property: Min threshold value for the metric. + * + * @return the min value. + */ + public double min() { + return this.min; + } + + /** + * Set the min property: Min threshold value for the metric. + * + * @param min the min value to set. + * @return the ExpectedValueRange object itself. + */ + public ExpectedValueRange withMin(double min) { + this.min = min; + return this; + } + + /** + * Get the max property: Max threshold value for the metric. + * + * @return the max value. + */ + public double max() { + return this.max; + } + + /** + * Set the max property: Max threshold value for the metric. + * + * @param max the max value to set. + * @return the ExpectedValueRange object itself. + */ + public ExpectedValueRange withMax(double max) { + this.max = max; + 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.writeDoubleField("min", this.min); + jsonWriter.writeDoubleField("max", this.max); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExpectedValueRange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExpectedValueRange 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 ExpectedValueRange. + */ + public static ExpectedValueRange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExpectedValueRange deserializedExpectedValueRange = new ExpectedValueRange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("min".equals(fieldName)) { + deserializedExpectedValueRange.min = reader.getDouble(); + } else if ("max".equals(fieldName)) { + deserializedExpectedValueRange.max = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + + return deserializedExpectedValueRange; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategories.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategories.java new file mode 100644 index 0000000000000..5cb8a25cc3afe --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategories.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ImpactCategories. + */ +public interface ImpactCategories { + /** + * List ImpactCategory resources by subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List ImpactCategory resources by subscription. + * + * @param categoryName Filter by category name. + * @param resourceType Filter by resource type. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ImpactCategory list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String categoryName, String resourceType, Context context); + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory along with {@link Response}. + */ + Response getWithResponse(String impactCategoryName, Context context); + + /** + * Get a ImpactCategory. + * + * @param impactCategoryName Name of the impact category. + * @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 ImpactCategory. + */ + ImpactCategory get(String impactCategoryName); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategory.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategory.java new file mode 100644 index 0000000000000..190830992f619 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategory.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.impact.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner; + +/** + * An immutable client-side representation of ImpactCategory. + */ +public interface ImpactCategory { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ImpactCategoryProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner object. + * + * @return the inner object. + */ + ImpactCategoryInner innerModel(); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategoryListResult.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategoryListResult.java new file mode 100644 index 0000000000000..b89bb42df74ab --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategoryListResult.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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 com.azure.resourcemanager.impact.fluent.models.ImpactCategoryInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ImpactCategory list operation. + */ +@Fluent +public final class ImpactCategoryListResult implements JsonSerializable { + /* + * The ImpactCategory items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ImpactCategoryListResult class. + */ + public ImpactCategoryListResult() { + } + + /** + * Get the value property: The ImpactCategory items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The ImpactCategory items on this page. + * + * @param value the value value to set. + * @return the ImpactCategoryListResult object itself. + */ + public ImpactCategoryListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ImpactCategoryListResult object itself. + */ + public ImpactCategoryListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model ImpactCategoryListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImpactCategoryListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImpactCategoryListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImpactCategoryListResult 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 ImpactCategoryListResult. + */ + public static ImpactCategoryListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImpactCategoryListResult deserializedImpactCategoryListResult = new ImpactCategoryListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ImpactCategoryInner.fromJson(reader1)); + deserializedImpactCategoryListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedImpactCategoryListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedImpactCategoryListResult; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategoryProperties.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategoryProperties.java new file mode 100644 index 0000000000000..b3f327ed4d216 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactCategoryProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; +import java.util.List; + +/** + * Impact category properties. + */ +@Fluent +public final class ImpactCategoryProperties implements JsonSerializable { + /* + * Resource provisioning state. + */ + private ProvisioningState provisioningState; + + /* + * Unique ID of the category + */ + private String categoryId; + + /* + * Unique ID of the parent category + */ + private String parentCategoryId; + + /* + * Description of the category + */ + private String description; + + /* + * The workloadImpact properties which are required when reporting with the impact category + */ + private List requiredImpactProperties; + + /** + * Creates an instance of ImpactCategoryProperties class. + */ + public ImpactCategoryProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the categoryId property: Unique ID of the category. + * + * @return the categoryId value. + */ + public String categoryId() { + return this.categoryId; + } + + /** + * Set the categoryId property: Unique ID of the category. + * + * @param categoryId the categoryId value to set. + * @return the ImpactCategoryProperties object itself. + */ + public ImpactCategoryProperties withCategoryId(String categoryId) { + this.categoryId = categoryId; + return this; + } + + /** + * Get the parentCategoryId property: Unique ID of the parent category. + * + * @return the parentCategoryId value. + */ + public String parentCategoryId() { + return this.parentCategoryId; + } + + /** + * Set the parentCategoryId property: Unique ID of the parent category. + * + * @param parentCategoryId the parentCategoryId value to set. + * @return the ImpactCategoryProperties object itself. + */ + public ImpactCategoryProperties withParentCategoryId(String parentCategoryId) { + this.parentCategoryId = parentCategoryId; + return this; + } + + /** + * Get the description property: Description of the category. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the category. + * + * @param description the description value to set. + * @return the ImpactCategoryProperties object itself. + */ + public ImpactCategoryProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the requiredImpactProperties property: The workloadImpact properties which are required when reporting with + * the impact category. + * + * @return the requiredImpactProperties value. + */ + public List requiredImpactProperties() { + return this.requiredImpactProperties; + } + + /** + * Set the requiredImpactProperties property: The workloadImpact properties which are required when reporting with + * the impact category. + * + * @param requiredImpactProperties the requiredImpactProperties value to set. + * @return the ImpactCategoryProperties object itself. + */ + public ImpactCategoryProperties + withRequiredImpactProperties(List requiredImpactProperties) { + this.requiredImpactProperties = requiredImpactProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (categoryId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property categoryId in model ImpactCategoryProperties")); + } + if (requiredImpactProperties() != null) { + requiredImpactProperties().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImpactCategoryProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("categoryId", this.categoryId); + jsonWriter.writeStringField("parentCategoryId", this.parentCategoryId); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("requiredImpactProperties", this.requiredImpactProperties, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImpactCategoryProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImpactCategoryProperties 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 ImpactCategoryProperties. + */ + public static ImpactCategoryProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImpactCategoryProperties deserializedImpactCategoryProperties = new ImpactCategoryProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("categoryId".equals(fieldName)) { + deserializedImpactCategoryProperties.categoryId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedImpactCategoryProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("parentCategoryId".equals(fieldName)) { + deserializedImpactCategoryProperties.parentCategoryId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedImpactCategoryProperties.description = reader.getString(); + } else if ("requiredImpactProperties".equals(fieldName)) { + List requiredImpactProperties + = reader.readArray(reader1 -> RequiredImpactProperties.fromJson(reader1)); + deserializedImpactCategoryProperties.requiredImpactProperties = requiredImpactProperties; + } else { + reader.skipChildren(); + } + } + + return deserializedImpactCategoryProperties; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactDetails.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactDetails.java new file mode 100644 index 0000000000000..39322c6007dcd --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ImpactDetails.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * details of of the impact for which insight has been generated. + */ +@Fluent +public final class ImpactDetails implements JsonSerializable { + /* + * List of impacted Azure resources. + */ + private String impactedResourceId; + + /* + * Time at which impact was started according to reported impact. + */ + private OffsetDateTime startTime; + + /* + * Time at which impact was ended according to reported impact. + */ + private OffsetDateTime endTime; + + /* + * Azure Id of the impact. + */ + private String impactId; + + /** + * Creates an instance of ImpactDetails class. + */ + public ImpactDetails() { + } + + /** + * Get the impactedResourceId property: List of impacted Azure resources. + * + * @return the impactedResourceId value. + */ + public String impactedResourceId() { + return this.impactedResourceId; + } + + /** + * Set the impactedResourceId property: List of impacted Azure resources. + * + * @param impactedResourceId the impactedResourceId value to set. + * @return the ImpactDetails object itself. + */ + public ImpactDetails withImpactedResourceId(String impactedResourceId) { + this.impactedResourceId = impactedResourceId; + return this; + } + + /** + * Get the startTime property: Time at which impact was started according to reported impact. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Time at which impact was started according to reported impact. + * + * @param startTime the startTime value to set. + * @return the ImpactDetails object itself. + */ + public ImpactDetails withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Time at which impact was ended according to reported impact. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Time at which impact was ended according to reported impact. + * + * @param endTime the endTime value to set. + * @return the ImpactDetails object itself. + */ + public ImpactDetails withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the impactId property: Azure Id of the impact. + * + * @return the impactId value. + */ + public String impactId() { + return this.impactId; + } + + /** + * Set the impactId property: Azure Id of the impact. + * + * @param impactId the impactId value to set. + * @return the ImpactDetails object itself. + */ + public ImpactDetails withImpactId(String impactId) { + this.impactId = impactId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (impactedResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property impactedResourceId in model ImpactDetails")); + } + if (startTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property startTime in model ImpactDetails")); + } + if (impactId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property impactId in model ImpactDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImpactDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("impactedResourceId", this.impactedResourceId); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("impactId", this.impactId); + jsonWriter.writeStringField("endTime", + this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImpactDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImpactDetails 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 ImpactDetails. + */ + public static ImpactDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImpactDetails deserializedImpactDetails = new ImpactDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("impactedResourceId".equals(fieldName)) { + deserializedImpactDetails.impactedResourceId = reader.getString(); + } else if ("startTime".equals(fieldName)) { + deserializedImpactDetails.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("impactId".equals(fieldName)) { + deserializedImpactDetails.impactId = reader.getString(); + } else if ("endTime".equals(fieldName)) { + deserializedImpactDetails.endTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedImpactDetails; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/IncidentSource.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/IncidentSource.java new file mode 100644 index 0000000000000..e87ec99ea1f52 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/IncidentSource.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * List of incident interfaces. + */ +public final class IncidentSource extends ExpandableStringEnum { + /** + * Static value AzureDevops for IncidentSource. + */ + public static final IncidentSource AZURE_DEVOPS = fromString("AzureDevops"); + + /** + * Static value ICM for IncidentSource. + */ + public static final IncidentSource ICM = fromString("ICM"); + + /** + * Static value Jira for IncidentSource. + */ + public static final IncidentSource JIRA = fromString("Jira"); + + /** + * Static value ServiceNow for IncidentSource. + */ + public static final IncidentSource SERVICE_NOW = fromString("ServiceNow"); + + /** + * Static value Other for IncidentSource. + */ + public static final IncidentSource OTHER = fromString("Other"); + + /** + * Creates a new instance of IncidentSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IncidentSource() { + } + + /** + * Creates or finds a IncidentSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding IncidentSource. + */ + public static IncidentSource fromString(String name) { + return fromString(name, IncidentSource.class); + } + + /** + * Gets known IncidentSource values. + * + * @return known IncidentSource values. + */ + public static Collection values() { + return values(IncidentSource.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Insight.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Insight.java new file mode 100644 index 0000000000000..747f776cb480f --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Insight.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.InsightInner; + +/** + * An immutable client-side representation of Insight. + */ +public interface Insight { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + InsightProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.impact.fluent.models.InsightInner object. + * + * @return the inner object. + */ + InsightInner innerModel(); + + /** + * The entirety of the Insight definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Insight definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Insight definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the Insight definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @return the next definition stage. + */ + WithCreate withExistingWorkloadImpact(String workloadImpactName); + } + + /** + * The stage of the Insight definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Insight create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Insight create(Context context); + } + + /** + * The stage of the Insight definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(InsightProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Insight refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Insight refresh(Context context); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/InsightListResult.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/InsightListResult.java new file mode 100644 index 0000000000000..db08f73e80cd5 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/InsightListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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 com.azure.resourcemanager.impact.fluent.models.InsightInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Insight list operation. + */ +@Fluent +public final class InsightListResult implements JsonSerializable { + /* + * The Insight items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of InsightListResult class. + */ + public InsightListResult() { + } + + /** + * Get the value property: The Insight items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Insight items on this page. + * + * @param value the value value to set. + * @return the InsightListResult object itself. + */ + public InsightListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the InsightListResult object itself. + */ + public InsightListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model InsightListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InsightListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightListResult 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 InsightListResult. + */ + public static InsightListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightListResult deserializedInsightListResult = new InsightListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> InsightInner.fromJson(reader1)); + deserializedInsightListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedInsightListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightListResult; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/InsightProperties.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/InsightProperties.java new file mode 100644 index 0000000000000..43dd0ea94d5a4 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/InsightProperties.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Impact category properties. + */ +@Fluent +public final class InsightProperties implements JsonSerializable { + /* + * Resource provisioning state. + */ + private ProvisioningState provisioningState; + + /* + * category of the insight. + */ + private String category; + + /* + * status of the insight. example resolved, repaired, other. + */ + private String status; + + /* + * Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for + * the same event. + */ + private String eventId; + + /* + * Identifier that can be used to group similar insights. + */ + private String groupId; + + /* + * Contains title & description for the insight + */ + private Content content; + + /* + * Time of the event, which has been correlated the impact. + */ + private OffsetDateTime eventTime; + + /* + * unique id of the insight. + */ + private String insightUniqueId; + + /* + * details of of the impact for which insight has been generated. + */ + private ImpactDetails impact; + + /* + * additional details of the insight. + */ + private Object additionalDetails; + + /** + * Creates an instance of InsightProperties class. + */ + public InsightProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the category property: category of the insight. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: category of the insight. + * + * @param category the category value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the status property: status of the insight. example resolved, repaired, other. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: status of the insight. example resolved, repaired, other. + * + * @param status the status value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the eventId property: Identifier of the event that has been correlated with this insight. This can be used to + * aggregate insights for the same event. + * + * @return the eventId value. + */ + public String eventId() { + return this.eventId; + } + + /** + * Set the eventId property: Identifier of the event that has been correlated with this insight. This can be used to + * aggregate insights for the same event. + * + * @param eventId the eventId value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withEventId(String eventId) { + this.eventId = eventId; + return this; + } + + /** + * Get the groupId property: Identifier that can be used to group similar insights. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Set the groupId property: Identifier that can be used to group similar insights. + * + * @param groupId the groupId value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the content property: Contains title & description for the insight. + * + * @return the content value. + */ + public Content content() { + return this.content; + } + + /** + * Set the content property: Contains title & description for the insight. + * + * @param content the content value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withContent(Content content) { + this.content = content; + return this; + } + + /** + * Get the eventTime property: Time of the event, which has been correlated the impact. + * + * @return the eventTime value. + */ + public OffsetDateTime eventTime() { + return this.eventTime; + } + + /** + * Set the eventTime property: Time of the event, which has been correlated the impact. + * + * @param eventTime the eventTime value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + return this; + } + + /** + * Get the insightUniqueId property: unique id of the insight. + * + * @return the insightUniqueId value. + */ + public String insightUniqueId() { + return this.insightUniqueId; + } + + /** + * Set the insightUniqueId property: unique id of the insight. + * + * @param insightUniqueId the insightUniqueId value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withInsightUniqueId(String insightUniqueId) { + this.insightUniqueId = insightUniqueId; + return this; + } + + /** + * Get the impact property: details of of the impact for which insight has been generated. + * + * @return the impact value. + */ + public ImpactDetails impact() { + return this.impact; + } + + /** + * Set the impact property: details of of the impact for which insight has been generated. + * + * @param impact the impact value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withImpact(ImpactDetails impact) { + this.impact = impact; + return this; + } + + /** + * Get the additionalDetails property: additional details of the insight. + * + * @return the additionalDetails value. + */ + public Object additionalDetails() { + return this.additionalDetails; + } + + /** + * Set the additionalDetails property: additional details of the insight. + * + * @param additionalDetails the additionalDetails value to set. + * @return the InsightProperties object itself. + */ + public InsightProperties withAdditionalDetails(Object additionalDetails) { + this.additionalDetails = additionalDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (category() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property category in model InsightProperties")); + } + if (content() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property content in model InsightProperties")); + } else { + content().validate(); + } + if (insightUniqueId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property insightUniqueId in model InsightProperties")); + } + if (impact() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property impact in model InsightProperties")); + } else { + impact().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InsightProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("category", this.category); + jsonWriter.writeJsonField("content", this.content); + jsonWriter.writeStringField("insightUniqueId", this.insightUniqueId); + jsonWriter.writeJsonField("impact", this.impact); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("eventId", this.eventId); + jsonWriter.writeStringField("groupId", this.groupId); + jsonWriter.writeStringField("eventTime", + this.eventTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.eventTime)); + jsonWriter.writeUntypedField("additionalDetails", this.additionalDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InsightProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InsightProperties 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 InsightProperties. + */ + public static InsightProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InsightProperties deserializedInsightProperties = new InsightProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedInsightProperties.category = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedInsightProperties.content = Content.fromJson(reader); + } else if ("insightUniqueId".equals(fieldName)) { + deserializedInsightProperties.insightUniqueId = reader.getString(); + } else if ("impact".equals(fieldName)) { + deserializedInsightProperties.impact = ImpactDetails.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedInsightProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedInsightProperties.status = reader.getString(); + } else if ("eventId".equals(fieldName)) { + deserializedInsightProperties.eventId = reader.getString(); + } else if ("groupId".equals(fieldName)) { + deserializedInsightProperties.groupId = reader.getString(); + } else if ("eventTime".equals(fieldName)) { + deserializedInsightProperties.eventTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("additionalDetails".equals(fieldName)) { + deserializedInsightProperties.additionalDetails = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedInsightProperties; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Insights.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Insights.java new file mode 100644 index 0000000000000..521ff6ebc0197 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Insights.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Insights. + */ +public interface Insights { + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String workloadImpactName); + + /** + * List Insight resources by workloadImpactName. + * + * @param workloadImpactName workloadImpact resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Insight list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String workloadImpactName, Context context); + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName along with {@link Response}. + */ + Response getWithResponse(String workloadImpactName, String insightName, Context context); + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 insight resources by workloadImpactName and insightName. + */ + Insight get(String workloadImpactName, String insightName); + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName, Context context); + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param workloadImpactName workloadImpact resource. + * @param insightName Name of the insight. + * @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 workloadImpactName, String insightName); + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insight resources by workloadImpactName and insightName along with {@link Response}. + */ + Insight getById(String id); + + /** + * Get Insight resources by workloadImpactName and insightName. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return insight resources by workloadImpactName and insightName along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete Insight resource, This is Admin only operation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Insight resource. + * + * @param name resource name. + * @return the first stage of the new Insight definition. + */ + Insight.DefinitionStages.Blank define(String name); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/MetricUnit.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/MetricUnit.java new file mode 100644 index 0000000000000..b519559bf629b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/MetricUnit.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * List of unit of the metric. + */ +public final class MetricUnit extends ExpandableStringEnum { + /** + * Static value ByteSeconds for MetricUnit. + */ + public static final MetricUnit BYTE_SECONDS = fromString("ByteSeconds"); + + /** + * Static value Bytes for MetricUnit. + */ + public static final MetricUnit BYTES = fromString("Bytes"); + + /** + * Static value BytesPerSecond for MetricUnit. + */ + public static final MetricUnit BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** + * Static value Cores for MetricUnit. + */ + public static final MetricUnit CORES = fromString("Cores"); + + /** + * Static value Count for MetricUnit. + */ + public static final MetricUnit COUNT = fromString("Count"); + + /** + * Static value CountPerSecond for MetricUnit. + */ + public static final MetricUnit COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** + * Static value MilliCores for MetricUnit. + */ + public static final MetricUnit MILLI_CORES = fromString("MilliCores"); + + /** + * Static value MilliSeconds for MetricUnit. + */ + public static final MetricUnit MILLI_SECONDS = fromString("MilliSeconds"); + + /** + * Static value NanoCores for MetricUnit. + */ + public static final MetricUnit NANO_CORES = fromString("NanoCores"); + + /** + * Static value Percent for MetricUnit. + */ + public static final MetricUnit PERCENT = fromString("Percent"); + + /** + * Static value Seconds for MetricUnit. + */ + public static final MetricUnit SECONDS = fromString("Seconds"); + + /** + * Static value Other for MetricUnit. + */ + public static final MetricUnit OTHER = fromString("Other"); + + /** + * Creates a new instance of MetricUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MetricUnit() { + } + + /** + * Creates or finds a MetricUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricUnit. + */ + public static MetricUnit fromString(String name) { + return fromString(name, MetricUnit.class); + } + + /** + * Gets known MetricUnit values. + * + * @return known MetricUnit values. + */ + public static Collection values() { + return values(MetricUnit.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Operation.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Operation.java new file mode 100644 index 0000000000000..c0a3fb2e04eaa --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.resourcemanager.impact.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.impact.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/OperationDisplay.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/OperationDisplay.java new file mode 100644 index 0000000000000..ca66646eed341 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay 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 OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/OperationListResult.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/OperationListResult.java new file mode 100644 index 0000000000000..6441b3cbba516 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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 com.azure.resourcemanager.impact.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult 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 OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Operations.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Operations.java new file mode 100644 index 0000000000000..f77b59f55ec3b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @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 list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Origin.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Origin.java new file mode 100644 index 0000000000000..0030654bfb3bd --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Performance.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Performance.java new file mode 100644 index 0000000000000..7cf83e525c517 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Performance.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Details about impacted performance metrics. Applicable for performance related impact. + */ +@Fluent +public final class Performance implements JsonSerializable { + /* + * Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from /impactCategories API + */ + private String metricName; + + /* + * Threshold value for the metric + */ + private Double expected; + + /* + * Observed value for the metric + */ + private Double actual; + + /* + * Max and Min Threshold values for the metric + */ + private ExpectedValueRange expectedValueRange; + + /* + * Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, Count/Second, etc.., Other + */ + private MetricUnit unit; + + /** + * Creates an instance of Performance class. + */ + public Performance() { + } + + /** + * Get the metricName property: Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from + * /impactCategories API. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from + * /impactCategories API. + * + * @param metricName the metricName value to set. + * @return the Performance object itself. + */ + public Performance withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the expected property: Threshold value for the metric. + * + * @return the expected value. + */ + public Double expected() { + return this.expected; + } + + /** + * Set the expected property: Threshold value for the metric. + * + * @param expected the expected value to set. + * @return the Performance object itself. + */ + public Performance withExpected(Double expected) { + this.expected = expected; + return this; + } + + /** + * Get the actual property: Observed value for the metric. + * + * @return the actual value. + */ + public Double actual() { + return this.actual; + } + + /** + * Set the actual property: Observed value for the metric. + * + * @param actual the actual value to set. + * @return the Performance object itself. + */ + public Performance withActual(Double actual) { + this.actual = actual; + return this; + } + + /** + * Get the expectedValueRange property: Max and Min Threshold values for the metric. + * + * @return the expectedValueRange value. + */ + public ExpectedValueRange expectedValueRange() { + return this.expectedValueRange; + } + + /** + * Set the expectedValueRange property: Max and Min Threshold values for the metric. + * + * @param expectedValueRange the expectedValueRange value to set. + * @return the Performance object itself. + */ + public Performance withExpectedValueRange(ExpectedValueRange expectedValueRange) { + this.expectedValueRange = expectedValueRange; + return this; + } + + /** + * Get the unit property: Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, + * Count/Second, etc.., Other. + * + * @return the unit value. + */ + public MetricUnit unit() { + return this.unit; + } + + /** + * Set the unit property: Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, + * Count/Second, etc.., Other. + * + * @param unit the unit value to set. + * @return the Performance object itself. + */ + public Performance withUnit(MetricUnit unit) { + this.unit = unit; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (expectedValueRange() != null) { + expectedValueRange().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("metricName", this.metricName); + jsonWriter.writeNumberField("expected", this.expected); + jsonWriter.writeNumberField("actual", this.actual); + jsonWriter.writeJsonField("expectedValueRange", this.expectedValueRange); + jsonWriter.writeStringField("unit", this.unit == null ? null : this.unit.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Performance from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Performance 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 Performance. + */ + public static Performance fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Performance deserializedPerformance = new Performance(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metricName".equals(fieldName)) { + deserializedPerformance.metricName = reader.getString(); + } else if ("expected".equals(fieldName)) { + deserializedPerformance.expected = reader.getNullable(JsonReader::getDouble); + } else if ("actual".equals(fieldName)) { + deserializedPerformance.actual = reader.getNullable(JsonReader::getDouble); + } else if ("expectedValueRange".equals(fieldName)) { + deserializedPerformance.expectedValueRange = ExpectedValueRange.fromJson(reader); + } else if ("unit".equals(fieldName)) { + deserializedPerformance.unit = MetricUnit.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPerformance; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Platform.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Platform.java new file mode 100644 index 0000000000000..e5c6b3b891d5e --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Platform.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.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum for connector types. + */ +public final class Platform extends ExpandableStringEnum { + /** + * Static value AzureMonitor for Platform. + */ + public static final Platform AZURE_MONITOR = fromString("AzureMonitor"); + + /** + * Creates a new instance of Platform value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Platform() { + } + + /** + * Creates or finds a Platform from its string representation. + * + * @param name a name to look for. + * @return the corresponding Platform. + */ + public static Platform fromString(String name) { + return fromString(name, Platform.class); + } + + /** + * Gets known Platform values. + * + * @return known Platform values. + */ + public static Collection values() { + return values(Platform.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Protocol.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Protocol.java new file mode 100644 index 0000000000000..9587ca2670fca --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Protocol.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.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * List of protocols. + */ +public final class Protocol extends ExpandableStringEnum { + /** + * Static value TCP for Protocol. + */ + public static final Protocol TCP = fromString("TCP"); + + /** + * Static value UDP for Protocol. + */ + public static final Protocol UDP = fromString("UDP"); + + /** + * Static value HTTP for Protocol. + */ + public static final Protocol HTTP = fromString("HTTP"); + + /** + * Static value HTTPS for Protocol. + */ + public static final Protocol HTTPS = fromString("HTTPS"); + + /** + * Static value RDP for Protocol. + */ + public static final Protocol RDP = fromString("RDP"); + + /** + * Static value FTP for Protocol. + */ + public static final Protocol FTP = fromString("FTP"); + + /** + * Static value SSH for Protocol. + */ + public static final Protocol SSH = fromString("SSH"); + + /** + * Static value Other for Protocol. + */ + public static final Protocol OTHER = fromString("Other"); + + /** + * Creates a new instance of Protocol value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Protocol() { + } + + /** + * Creates or finds a Protocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding Protocol. + */ + public static Protocol fromString(String name) { + return fromString(name, Protocol.class); + } + + /** + * Gets known Protocol values. + * + * @return known Protocol values. + */ + public static Collection values() { + return values(Protocol.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ProvisioningState.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ProvisioningState.java new file mode 100644 index 0000000000000..1be700606d5bf --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/ProvisioningState.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.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state of the resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/RequiredImpactProperties.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/RequiredImpactProperties.java new file mode 100644 index 0000000000000..01e7c23eb0b59 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/RequiredImpactProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; +import java.util.List; + +/** + * Required impact properties. + */ +@Fluent +public final class RequiredImpactProperties implements JsonSerializable { + /* + * Name of the property + */ + private String name; + + /* + * Allowed values values for the property + */ + private List allowedValues; + + /** + * Creates an instance of RequiredImpactProperties class. + */ + public RequiredImpactProperties() { + } + + /** + * Get the name property: Name of the property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the property. + * + * @param name the name value to set. + * @return the RequiredImpactProperties object itself. + */ + public RequiredImpactProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the allowedValues property: Allowed values values for the property. + * + * @return the allowedValues value. + */ + public List allowedValues() { + return this.allowedValues; + } + + /** + * Set the allowedValues property: Allowed values values for the property. + * + * @param allowedValues the allowedValues value to set. + * @return the RequiredImpactProperties object itself. + */ + public RequiredImpactProperties withAllowedValues(List allowedValues) { + this.allowedValues = allowedValues; + 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 RequiredImpactProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RequiredImpactProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("allowedValues", this.allowedValues, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredImpactProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredImpactProperties 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 RequiredImpactProperties. + */ + public static RequiredImpactProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequiredImpactProperties deserializedRequiredImpactProperties = new RequiredImpactProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedRequiredImpactProperties.name = reader.getString(); + } else if ("allowedValues".equals(fieldName)) { + List allowedValues = reader.readArray(reader1 -> reader1.getString()); + deserializedRequiredImpactProperties.allowedValues = allowedValues; + } else { + reader.skipChildren(); + } + } + + return deserializedRequiredImpactProperties; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/SourceOrTarget.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/SourceOrTarget.java new file mode 100644 index 0000000000000..e3ae4a4b238a7 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/SourceOrTarget.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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; + +/** + * Resource details. + */ +@Fluent +public final class SourceOrTarget implements JsonSerializable { + /* + * Azure resource id, example + * /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName} + */ + private String azureResourceId; + + /** + * Creates an instance of SourceOrTarget class. + */ + public SourceOrTarget() { + } + + /** + * Get the azureResourceId property: Azure resource id, example + * /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: Azure resource id, example + * /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + * + * @param azureResourceId the azureResourceId value to set. + * @return the SourceOrTarget object itself. + */ + public SourceOrTarget withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + 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("azureResourceId", this.azureResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceOrTarget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceOrTarget 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 SourceOrTarget. + */ + public static SourceOrTarget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceOrTarget deserializedSourceOrTarget = new SourceOrTarget(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureResourceId".equals(fieldName)) { + deserializedSourceOrTarget.azureResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceOrTarget; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Toolset.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Toolset.java new file mode 100644 index 0000000000000..b3de5970bf8a4 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Toolset.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * List of azure interfaces. + */ +public final class Toolset extends ExpandableStringEnum { + /** + * Static value Terraform for Toolset. + */ + public static final Toolset TERRAFORM = fromString("Terraform"); + + /** + * Static value Puppet for Toolset. + */ + public static final Toolset PUPPET = fromString("Puppet"); + + /** + * Static value Chef for Toolset. + */ + public static final Toolset CHEF = fromString("Chef"); + + /** + * Static value SDK for Toolset. + */ + public static final Toolset SDK = fromString("SDK"); + + /** + * Static value Ansible for Toolset. + */ + public static final Toolset ANSIBLE = fromString("Ansible"); + + /** + * Static value ARM for Toolset. + */ + public static final Toolset ARM = fromString("ARM"); + + /** + * Static value Portal for Toolset. + */ + public static final Toolset PORTAL = fromString("Portal"); + + /** + * Static value Shell for Toolset. + */ + public static final Toolset SHELL = fromString("Shell"); + + /** + * Static value Other for Toolset. + */ + public static final Toolset OTHER = fromString("Other"); + + /** + * Creates a new instance of Toolset value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Toolset() { + } + + /** + * Creates or finds a Toolset from its string representation. + * + * @param name a name to look for. + * @return the corresponding Toolset. + */ + public static Toolset fromString(String name) { + return fromString(name, Toolset.class); + } + + /** + * Gets known Toolset values. + * + * @return known Toolset values. + */ + public static Collection values() { + return values(Toolset.class); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Workload.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Workload.java new file mode 100644 index 0000000000000..b9fbd9ff9c3a1 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/Workload.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.impact.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; + +/** + * Information about the impacted workload. + */ +@Fluent +public final class Workload implements JsonSerializable { + /* + * the scenario for the workload + */ + private String context; + + /* + * Tool used to interact with Azure. SDK, AzPortal, etc.., Other + */ + private Toolset toolset; + + /** + * Creates an instance of Workload class. + */ + public Workload() { + } + + /** + * Get the context property: the scenario for the workload. + * + * @return the context value. + */ + public String context() { + return this.context; + } + + /** + * Set the context property: the scenario for the workload. + * + * @param context the context value to set. + * @return the Workload object itself. + */ + public Workload withContext(String context) { + this.context = context; + return this; + } + + /** + * Get the toolset property: Tool used to interact with Azure. SDK, AzPortal, etc.., Other. + * + * @return the toolset value. + */ + public Toolset toolset() { + return this.toolset; + } + + /** + * Set the toolset property: Tool used to interact with Azure. SDK, AzPortal, etc.., Other. + * + * @param toolset the toolset value to set. + * @return the Workload object itself. + */ + public Workload withToolset(Toolset toolset) { + this.toolset = toolset; + 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("context", this.context); + jsonWriter.writeStringField("toolset", this.toolset == null ? null : this.toolset.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Workload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Workload 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 Workload. + */ + public static Workload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Workload deserializedWorkload = new Workload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("context".equals(fieldName)) { + deserializedWorkload.context = reader.getString(); + } else if ("toolset".equals(fieldName)) { + deserializedWorkload.toolset = Toolset.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkload; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpact.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpact.java new file mode 100644 index 0000000000000..06eee155d81d9 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpact.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.impact.fluent.models.WorkloadImpactInner; + +/** + * An immutable client-side representation of WorkloadImpact. + */ +public interface WorkloadImpact { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + WorkloadImpactProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.impact.fluent.models.WorkloadImpactInner object. + * + * @return the inner object. + */ + WorkloadImpactInner innerModel(); + + /** + * The entirety of the WorkloadImpact definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The WorkloadImpact definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkloadImpact definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the WorkloadImpact definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkloadImpact create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkloadImpact create(Context context); + } + + /** + * The stage of the WorkloadImpact definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(WorkloadImpactProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkloadImpact refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkloadImpact refresh(Context context); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpactListResult.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpactListResult.java new file mode 100644 index 0000000000000..2ee7ceb69e6e4 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpactListResult.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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 com.azure.resourcemanager.impact.fluent.models.WorkloadImpactInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a WorkloadImpact list operation. + */ +@Fluent +public final class WorkloadImpactListResult implements JsonSerializable { + /* + * The WorkloadImpact items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WorkloadImpactListResult class. + */ + public WorkloadImpactListResult() { + } + + /** + * Get the value property: The WorkloadImpact items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The WorkloadImpact items on this page. + * + * @param value the value value to set. + * @return the WorkloadImpactListResult object itself. + */ + public WorkloadImpactListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the WorkloadImpactListResult object itself. + */ + public WorkloadImpactListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model WorkloadImpactListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkloadImpactListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadImpactListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadImpactListResult 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 WorkloadImpactListResult. + */ + public static WorkloadImpactListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadImpactListResult deserializedWorkloadImpactListResult = new WorkloadImpactListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkloadImpactInner.fromJson(reader1)); + deserializedWorkloadImpactListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkloadImpactListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadImpactListResult; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpactProperties.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpactProperties.java new file mode 100644 index 0000000000000..782cf72535d47 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpactProperties.java @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.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.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Workload impact properties. + */ +@Fluent +public final class WorkloadImpactProperties implements JsonSerializable { + /* + * Resource provisioning state. + */ + private ProvisioningState provisioningState; + + /* + * Time at which impact was observed + */ + private OffsetDateTime startDateTime; + + /* + * Time at which impact has ended + */ + private OffsetDateTime endDateTime; + + /* + * Azure resource id of the impacted resource + */ + private String impactedResourceId; + + /* + * Unique ID of the impact (UUID) + */ + private String impactUniqueId; + + /* + * Time at which impact is reported + */ + private OffsetDateTime reportedTimeUtc; + + /* + * Category of the impact, details can found from /impactCategories API + */ + private String impactCategory; + + /* + * A detailed description of the impact + */ + private String impactDescription; + + /* + * The ARM correlation ids, this is important field for control plane related impacts + */ + private List armCorrelationIds; + + /* + * Details about performance issue. Applicable for performance impacts. + */ + private List performance; + + /* + * Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, + * when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause + * is the network. In such cases, the connectivity field will have the details about the network issue + */ + private Connectivity connectivity; + + /* + * Additional fields related to impact, applicable fields per resource type are list under /impactCategories API + */ + private Object additionalProperties; + + /* + * ARM error code and error message associated with the impact + */ + private ErrorDetailProperties errorDetails; + + /* + * Information about the impacted workload + */ + private Workload workload; + + /* + * Use this field to group impacts + */ + private String impactGroupId; + + /* + * Degree of confidence on the impact being a platform issue + */ + private ConfidenceLevel confidenceLevel; + + /* + * Client incident details ex: incidentId , incident source + */ + private ClientIncidentDetails clientIncidentDetails; + + /** + * Creates an instance of WorkloadImpactProperties class. + */ + public WorkloadImpactProperties() { + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the startDateTime property: Time at which impact was observed. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Set the startDateTime property: Time at which impact was observed. + * + * @param startDateTime the startDateTime value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withStartDateTime(OffsetDateTime startDateTime) { + this.startDateTime = startDateTime; + return this; + } + + /** + * Get the endDateTime property: Time at which impact has ended. + * + * @return the endDateTime value. + */ + public OffsetDateTime endDateTime() { + return this.endDateTime; + } + + /** + * Set the endDateTime property: Time at which impact has ended. + * + * @param endDateTime the endDateTime value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withEndDateTime(OffsetDateTime endDateTime) { + this.endDateTime = endDateTime; + return this; + } + + /** + * Get the impactedResourceId property: Azure resource id of the impacted resource. + * + * @return the impactedResourceId value. + */ + public String impactedResourceId() { + return this.impactedResourceId; + } + + /** + * Set the impactedResourceId property: Azure resource id of the impacted resource. + * + * @param impactedResourceId the impactedResourceId value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withImpactedResourceId(String impactedResourceId) { + this.impactedResourceId = impactedResourceId; + return this; + } + + /** + * Get the impactUniqueId property: Unique ID of the impact (UUID). + * + * @return the impactUniqueId value. + */ + public String impactUniqueId() { + return this.impactUniqueId; + } + + /** + * Get the reportedTimeUtc property: Time at which impact is reported. + * + * @return the reportedTimeUtc value. + */ + public OffsetDateTime reportedTimeUtc() { + return this.reportedTimeUtc; + } + + /** + * Get the impactCategory property: Category of the impact, details can found from /impactCategories API. + * + * @return the impactCategory value. + */ + public String impactCategory() { + return this.impactCategory; + } + + /** + * Set the impactCategory property: Category of the impact, details can found from /impactCategories API. + * + * @param impactCategory the impactCategory value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withImpactCategory(String impactCategory) { + this.impactCategory = impactCategory; + return this; + } + + /** + * Get the impactDescription property: A detailed description of the impact. + * + * @return the impactDescription value. + */ + public String impactDescription() { + return this.impactDescription; + } + + /** + * Set the impactDescription property: A detailed description of the impact. + * + * @param impactDescription the impactDescription value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withImpactDescription(String impactDescription) { + this.impactDescription = impactDescription; + return this; + } + + /** + * Get the armCorrelationIds property: The ARM correlation ids, this is important field for control plane related + * impacts. + * + * @return the armCorrelationIds value. + */ + public List armCorrelationIds() { + return this.armCorrelationIds; + } + + /** + * Set the armCorrelationIds property: The ARM correlation ids, this is important field for control plane related + * impacts. + * + * @param armCorrelationIds the armCorrelationIds value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withArmCorrelationIds(List armCorrelationIds) { + this.armCorrelationIds = armCorrelationIds; + return this; + } + + /** + * Get the performance property: Details about performance issue. Applicable for performance impacts. + * + * @return the performance value. + */ + public List performance() { + return this.performance; + } + + /** + * Set the performance property: Details about performance issue. Applicable for performance impacts. + * + * @param performance the performance value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withPerformance(List performance) { + this.performance = performance; + return this; + } + + /** + * Get the connectivity property: Details about connectivity issue. Applicable when root resource causing the issue + * is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified + * as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about + * the network issue. + * + * @return the connectivity value. + */ + public Connectivity connectivity() { + return this.connectivity; + } + + /** + * Set the connectivity property: Details about connectivity issue. Applicable when root resource causing the issue + * is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified + * as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about + * the network issue. + * + * @param connectivity the connectivity value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withConnectivity(Connectivity connectivity) { + this.connectivity = connectivity; + return this; + } + + /** + * Get the additionalProperties property: Additional fields related to impact, applicable fields per resource type + * are list under /impactCategories API. + * + * @return the additionalProperties value. + */ + public Object additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Additional fields related to impact, applicable fields per resource type + * are list under /impactCategories API. + * + * @param additionalProperties the additionalProperties value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withAdditionalProperties(Object additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get the errorDetails property: ARM error code and error message associated with the impact. + * + * @return the errorDetails value. + */ + public ErrorDetailProperties errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails property: ARM error code and error message associated with the impact. + * + * @param errorDetails the errorDetails value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withErrorDetails(ErrorDetailProperties errorDetails) { + this.errorDetails = errorDetails; + return this; + } + + /** + * Get the workload property: Information about the impacted workload. + * + * @return the workload value. + */ + public Workload workload() { + return this.workload; + } + + /** + * Set the workload property: Information about the impacted workload. + * + * @param workload the workload value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withWorkload(Workload workload) { + this.workload = workload; + return this; + } + + /** + * Get the impactGroupId property: Use this field to group impacts. + * + * @return the impactGroupId value. + */ + public String impactGroupId() { + return this.impactGroupId; + } + + /** + * Set the impactGroupId property: Use this field to group impacts. + * + * @param impactGroupId the impactGroupId value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withImpactGroupId(String impactGroupId) { + this.impactGroupId = impactGroupId; + return this; + } + + /** + * Get the confidenceLevel property: Degree of confidence on the impact being a platform issue. + * + * @return the confidenceLevel value. + */ + public ConfidenceLevel confidenceLevel() { + return this.confidenceLevel; + } + + /** + * Set the confidenceLevel property: Degree of confidence on the impact being a platform issue. + * + * @param confidenceLevel the confidenceLevel value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withConfidenceLevel(ConfidenceLevel confidenceLevel) { + this.confidenceLevel = confidenceLevel; + return this; + } + + /** + * Get the clientIncidentDetails property: Client incident details ex: incidentId , incident source. + * + * @return the clientIncidentDetails value. + */ + public ClientIncidentDetails clientIncidentDetails() { + return this.clientIncidentDetails; + } + + /** + * Set the clientIncidentDetails property: Client incident details ex: incidentId , incident source. + * + * @param clientIncidentDetails the clientIncidentDetails value to set. + * @return the WorkloadImpactProperties object itself. + */ + public WorkloadImpactProperties withClientIncidentDetails(ClientIncidentDetails clientIncidentDetails) { + this.clientIncidentDetails = clientIncidentDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startDateTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startDateTime in model WorkloadImpactProperties")); + } + if (impactedResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property impactedResourceId in model WorkloadImpactProperties")); + } + if (impactCategory() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property impactCategory in model WorkloadImpactProperties")); + } + if (performance() != null) { + performance().forEach(e -> e.validate()); + } + if (connectivity() != null) { + connectivity().validate(); + } + if (errorDetails() != null) { + errorDetails().validate(); + } + if (workload() != null) { + workload().validate(); + } + if (clientIncidentDetails() != null) { + clientIncidentDetails().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkloadImpactProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startDateTime", + this.startDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startDateTime)); + jsonWriter.writeStringField("impactedResourceId", this.impactedResourceId); + jsonWriter.writeStringField("impactCategory", this.impactCategory); + jsonWriter.writeStringField("endDateTime", + this.endDateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endDateTime)); + jsonWriter.writeStringField("impactDescription", this.impactDescription); + jsonWriter.writeArrayField("armCorrelationIds", this.armCorrelationIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("performance", this.performance, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("connectivity", this.connectivity); + jsonWriter.writeUntypedField("additionalProperties", this.additionalProperties); + jsonWriter.writeJsonField("errorDetails", this.errorDetails); + jsonWriter.writeJsonField("workload", this.workload); + jsonWriter.writeStringField("impactGroupId", this.impactGroupId); + jsonWriter.writeStringField("confidenceLevel", + this.confidenceLevel == null ? null : this.confidenceLevel.toString()); + jsonWriter.writeJsonField("clientIncidentDetails", this.clientIncidentDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadImpactProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadImpactProperties 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 WorkloadImpactProperties. + */ + public static WorkloadImpactProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadImpactProperties deserializedWorkloadImpactProperties = new WorkloadImpactProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startDateTime".equals(fieldName)) { + deserializedWorkloadImpactProperties.startDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("impactedResourceId".equals(fieldName)) { + deserializedWorkloadImpactProperties.impactedResourceId = reader.getString(); + } else if ("impactCategory".equals(fieldName)) { + deserializedWorkloadImpactProperties.impactCategory = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedWorkloadImpactProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("endDateTime".equals(fieldName)) { + deserializedWorkloadImpactProperties.endDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("impactUniqueId".equals(fieldName)) { + deserializedWorkloadImpactProperties.impactUniqueId = reader.getString(); + } else if ("reportedTimeUtc".equals(fieldName)) { + deserializedWorkloadImpactProperties.reportedTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("impactDescription".equals(fieldName)) { + deserializedWorkloadImpactProperties.impactDescription = reader.getString(); + } else if ("armCorrelationIds".equals(fieldName)) { + List armCorrelationIds = reader.readArray(reader1 -> reader1.getString()); + deserializedWorkloadImpactProperties.armCorrelationIds = armCorrelationIds; + } else if ("performance".equals(fieldName)) { + List performance = reader.readArray(reader1 -> Performance.fromJson(reader1)); + deserializedWorkloadImpactProperties.performance = performance; + } else if ("connectivity".equals(fieldName)) { + deserializedWorkloadImpactProperties.connectivity = Connectivity.fromJson(reader); + } else if ("additionalProperties".equals(fieldName)) { + deserializedWorkloadImpactProperties.additionalProperties = reader.readUntyped(); + } else if ("errorDetails".equals(fieldName)) { + deserializedWorkloadImpactProperties.errorDetails = ErrorDetailProperties.fromJson(reader); + } else if ("workload".equals(fieldName)) { + deserializedWorkloadImpactProperties.workload = Workload.fromJson(reader); + } else if ("impactGroupId".equals(fieldName)) { + deserializedWorkloadImpactProperties.impactGroupId = reader.getString(); + } else if ("confidenceLevel".equals(fieldName)) { + deserializedWorkloadImpactProperties.confidenceLevel + = ConfidenceLevel.fromString(reader.getString()); + } else if ("clientIncidentDetails".equals(fieldName)) { + deserializedWorkloadImpactProperties.clientIncidentDetails = ClientIncidentDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadImpactProperties; + }); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpacts.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpacts.java new file mode 100644 index 0000000000000..d7d1e0cbb965c --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/WorkloadImpacts.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of WorkloadImpacts. + */ +public interface WorkloadImpacts { + /** + * List WorkloadImpact resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List WorkloadImpact resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadImpact list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact along with {@link Response}. + */ + Response getWithResponse(String workloadImpactName, Context context); + + /** + * Get a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 WorkloadImpact. + */ + WorkloadImpact get(String workloadImpactName); + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 deleteWithResponse(String workloadImpactName, Context context); + + /** + * Delete a WorkloadImpact. + * + * @param workloadImpactName workloadImpact resource. + * @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 delete(String workloadImpactName); + + /** + * Get a WorkloadImpact. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadImpact along with {@link Response}. + */ + WorkloadImpact getById(String id); + + /** + * Get a WorkloadImpact. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadImpact along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a WorkloadImpact. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a WorkloadImpact. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkloadImpact resource. + * + * @param name resource name. + * @return the first stage of the new WorkloadImpact definition. + */ + WorkloadImpact.DefinitionStages.Blank define(String name); +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/package-info.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/models/package-info.java new file mode 100644 index 0000000000000..39aa75e39c64e --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/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 MicrosoftImpact. + * null. + */ +package com.azure.resourcemanager.impact.models; diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/package-info.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/package-info.java new file mode 100644 index 0000000000000..c8b884f47e910 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/java/com/azure/resourcemanager/impact/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 MicrosoftImpact. + * null. + */ +package com.azure.resourcemanager.impact; diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/java/module-info.java b/sdk/impact/azure-resourcemanager-impact/src/main/java/module-info.java new file mode 100644 index 0000000000000..94b330499d32f --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/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.impact { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.impact; + exports com.azure.resourcemanager.impact.fluent; + exports com.azure.resourcemanager.impact.fluent.models; + exports com.azure.resourcemanager.impact.models; + + opens com.azure.resourcemanager.impact.fluent.models to com.azure.core; + opens com.azure.resourcemanager.impact.models to com.azure.core; +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-impact/proxy-config.json b/sdk/impact/azure-resourcemanager-impact/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-impact/proxy-config.json new file mode 100644 index 0000000000000..d4a7c8f8d67db --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-impact/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.impact.implementation.ConnectorsClientImpl$ConnectorsService"],["com.azure.resourcemanager.impact.implementation.ImpactCategoriesClientImpl$ImpactCategoriesService"],["com.azure.resourcemanager.impact.implementation.InsightsClientImpl$InsightsService"],["com.azure.resourcemanager.impact.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.impact.implementation.WorkloadImpactsClientImpl$WorkloadImpactsService"]] \ No newline at end of file diff --git a/sdk/impact/azure-resourcemanager-impact/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-impact/reflect-config.json b/sdk/impact/azure-resourcemanager-impact/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-impact/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-impact/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsCreateOrUpdateSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..bd93f9d1558bc --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +import com.azure.resourcemanager.impact.models.ConnectorProperties; +import com.azure.resourcemanager.impact.models.Platform; + +/** + * Samples for Connectors CreateOrUpdate. + */ +public final class ConnectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Connectors_CreateOrUpdate.json + */ + /** + * Sample code: Connectors_CreateOrUpdate. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsCreateOrUpdate(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors() + .define("testconnector1") + .withProperties(new ConnectorProperties().withConnectorType(Platform.AZURE_MONITOR)) + .create(); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsDeleteSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsDeleteSamples.java new file mode 100644 index 0000000000000..a30ea0c57ff7b --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for Connectors Delete. + */ +public final class ConnectorsDeleteSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Connectors_Delete.json + */ + /** + * Sample code: Connectors_Delete. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsDelete(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors().deleteWithResponse("testconnector1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsGetSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsGetSamples.java new file mode 100644 index 0000000000000..5e667027726f8 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for Connectors Get. + */ +public final class ConnectorsGetSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Connectors_Get.json + */ + /** + * Sample code: Connectors_Get. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsGet(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors().getWithResponse("testconnector1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsListSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsListSamples.java new file mode 100644 index 0000000000000..906257ffbef41 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for Connectors List. + */ +public final class ConnectorsListSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Connectors_ListBySubscription.json + */ + /** + * Sample code: Connectors_ListBySubscription. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsListBySubscription(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.connectors().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsUpdateSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsUpdateSamples.java new file mode 100644 index 0000000000000..7826c1fe8c4c1 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ConnectorsUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +import com.azure.resourcemanager.impact.models.Connector; +import com.azure.resourcemanager.impact.models.ConnectorPropertiesUpdate; +import com.azure.resourcemanager.impact.models.Platform; + +/** + * Samples for Connectors Update. + */ +public final class ConnectorsUpdateSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Connectors_Update.json + */ + /** + * Sample code: Connectors_Update. + * + * @param manager Entry point to ImpactManager. + */ + public static void connectorsUpdate(com.azure.resourcemanager.impact.ImpactManager manager) { + Connector resource + = manager.connectors().getWithResponse("testconnector1", com.azure.core.util.Context.NONE).getValue(); + resource.update() + .withProperties(new ConnectorPropertiesUpdate().withConnectorType(Platform.AZURE_MONITOR)) + .apply(); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ImpactCategoriesGetSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ImpactCategoriesGetSamples.java new file mode 100644 index 0000000000000..8a85228358536 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ImpactCategoriesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for ImpactCategories Get. + */ +public final class ImpactCategoriesGetSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ImpactCategories_Get. + * json + */ + /** + * Sample code: Get WorkloadImpact Resource by name. + * + * @param manager Entry point to ImpactManager. + */ + public static void getWorkloadImpactResourceByName(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.impactCategories().getWithResponse("ARMOperation.Create", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ImpactCategoriesListSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ImpactCategoriesListSamples.java new file mode 100644 index 0000000000000..e9fe62d52e63f --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/ImpactCategoriesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for ImpactCategories List. + */ +public final class ImpactCategoriesListSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * ImpactCategories_ListBySubscription.json + */ + /** + * Sample code: Get ImpactCategories list by subscription. + * + * @param manager Entry point to ImpactManager. + */ + public static void getImpactCategoriesListBySubscription(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.impactCategories().list(null, "microsoft.compute/virtualmachines", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsCreateSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsCreateSamples.java new file mode 100644 index 0000000000000..a4d0239ec34cc --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsCreateSamples.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.impact.generated; + +import com.azure.resourcemanager.impact.models.Content; +import com.azure.resourcemanager.impact.models.ImpactDetails; +import com.azure.resourcemanager.impact.models.InsightProperties; +import java.time.OffsetDateTime; + +/** + * Samples for Insights Create. + */ +public final class InsightsCreateSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Insights_Create.json + */ + /** + * Sample code: Creating an insight. + * + * @param manager Entry point to ImpactManager. + */ + public static void creatingAnInsight(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights() + .define("insightId12") + .withExistingWorkloadImpact("impactid22") + .withProperties(new InsightProperties().withCategory("repair") + .withStatus("resolved") + .withContent(new Content().withTitle("Impact Has been correlated to an outage") + .withDescription( + "At 2018-11-08T00:00:00Z UTC, your services dependent on these resources VM1 may have experienced an issue.

We have identified an outage that affected these resources(s). You can look at outage information on NL2W-VCZ link.
")) + .withEventTime(OffsetDateTime.parse("2023-06-15T04:00:00.009223Z")) + .withInsightUniqueId("00000000-0000-0000-0000-000000000000") + .withImpact(new ImpactDetails().withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservername") + .withStartTime(OffsetDateTime.parse("2023-06-15T01:00:00.009223Z")) + .withImpactId( + "/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.Impact/workloadImpacts/impactid22"))) + .create(); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsDeleteSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsDeleteSamples.java new file mode 100644 index 0000000000000..7084a79f9d736 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for Insights Delete. + */ +public final class InsightsDeleteSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Insights_Delete.json + */ + /** + * Sample code: Delete an Insight. + * + * @param manager Entry point to ImpactManager. + */ + public static void deleteAnInsight(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights() + .deleteByResourceGroupWithResponse("impactid22", "insightId12", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsGetSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsGetSamples.java new file mode 100644 index 0000000000000..48b1f18e996ea --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsGetSamples.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.impact.generated; + +/** + * Samples for Insights Get. + */ +public final class InsightsGetSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_Get_mitigationAction.json + */ + /** + * Sample code: Get Insight sample for MitigationAction category. + * + * @param manager Entry point to ImpactManager. + */ + public static void + getInsightSampleForMitigationActionCategory(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().getWithResponse("impactId", "HPCUASucceeded", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_Get_diagnostics.json + */ + /** + * Sample code: Get Insight sample for Diagnostics category. + * + * @param manager Entry point to ImpactManager. + */ + public static void getInsightSampleForDiagnosticsCategory(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().getWithResponse("impactid", "insight1", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_Get_servicehealth.json + */ + /** + * Sample code: Get Insight sample for service health category. + * + * @param manager Entry point to ImpactManager. + */ + public static void + getInsightSampleForServiceHealthCategory(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().getWithResponse("impactid", "insightname", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsListBySubscriptionSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsListBySubscriptionSamples.java new file mode 100644 index 0000000000000..e4cc856d25e38 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/InsightsListBySubscriptionSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for Insights ListBySubscription. + */ +public final class InsightsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * Insights_ListBySubscription.json + */ + /** + * Sample code: List Insight resources by workloadImpactName. + * + * @param manager Entry point to ImpactManager. + */ + public static void + listInsightResourcesByWorkloadImpactName(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.insights().listBySubscription("impactid22", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/OperationsListSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..5b9ce3021fb00 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/Operations_List.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to ImpactManager. + */ + public static void operationsList(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsCreateSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsCreateSamples.java new file mode 100644 index 0000000000000..22c427effd7c6 --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsCreateSamples.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +import com.azure.resourcemanager.impact.models.ClientIncidentDetails; +import com.azure.resourcemanager.impact.models.Connectivity; +import com.azure.resourcemanager.impact.models.IncidentSource; +import com.azure.resourcemanager.impact.models.MetricUnit; +import com.azure.resourcemanager.impact.models.Performance; +import com.azure.resourcemanager.impact.models.Protocol; +import com.azure.resourcemanager.impact.models.SourceOrTarget; +import com.azure.resourcemanager.impact.models.Toolset; +import com.azure.resourcemanager.impact.models.Workload; +import com.azure.resourcemanager.impact.models.WorkloadImpactProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for WorkloadImpacts Create. + */ +public final class WorkloadImpactsCreateSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadAvailability_Create.json + */ + /** + * Sample code: Reporting availability related impact. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingAvailabilityRelatedImpact(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-002") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("Availability") + .withImpactDescription("read calls failed") + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadConnectivityImpact_Create.json + */ + /** + * Sample code: Reporting a connectivity impact. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingAConnectivityImpact(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-001") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("Resource.Connectivity") + .withImpactDescription("conection failure") + .withConnectivity(new Connectivity().withProtocol(Protocol.TCP) + .withPort(1443) + .withSource(new SourceOrTarget().withAzureResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm1")) + .withTarget(new SourceOrTarget().withAzureResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm2"))) + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadArmOperation_create.json + */ + /** + * Sample code: Reporting Arm operation failure. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingArmOperationFailure(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-002") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("ArmOperation") + .withImpactDescription("deletion of resource failed") + .withArmCorrelationIds(Arrays.asList("00000000-0000-0000-0000-000000000000")) + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } + + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadPerformance_Create.json + */ + /** + * Sample code: Reporting performance related impact. + * + * @param manager Entry point to ImpactManager. + */ + public static void reportingPerformanceRelatedImpact(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts() + .define("impact-002") + .withProperties(new WorkloadImpactProperties() + .withStartDateTime(OffsetDateTime.parse("2022-06-15T05:59:46.6517821Z")) + .withImpactedResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext") + .withImpactCategory("Resource.Performance") + .withImpactDescription("high cpu utilization") + .withPerformance(Arrays.asList(new Performance().withMetricName("CPU") + .withExpected(60.0D) + .withActual(90.0D) + .withUnit(MetricUnit.fromString("garbage")))) + .withWorkload(new Workload().withContext("webapp/scenario1").withToolset(Toolset.OTHER)) + .withClientIncidentDetails(new ClientIncidentDetails().withClientIncidentId("AA123") + .withClientIncidentSource(IncidentSource.JIRA))) + .create(); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsDeleteSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsDeleteSamples.java new file mode 100644 index 0000000000000..615a43a19d2db --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsDeleteSamples.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.impact.generated; + +/** + * Samples for WorkloadImpacts Delete. + */ +public final class WorkloadImpactsDeleteSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/WorkloadImpact_Delete. + * json + */ + /** + * Sample code: Delete WorkloadImpact Resource by name example. + * + * @param manager Entry point to ImpactManager. + */ + public static void + deleteWorkloadImpactResourceByNameExample(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts().deleteWithResponse("impact-001", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsGetSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsGetSamples.java new file mode 100644 index 0000000000000..d94e3af9d5c6c --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for WorkloadImpacts Get. + */ +public final class WorkloadImpactsGetSamples { + /* + * x-ms-original-file: + * specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/WorkloadImpact_Get. + * json + */ + /** + * Sample code: Get WorkloadImpact Resource by name example. + * + * @param manager Entry point to ImpactManager. + */ + public static void getWorkloadImpactResourceByNameExample(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts().getWithResponse("impact-001", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsListSamples.java b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsListSamples.java new file mode 100644 index 0000000000000..90dca15ba933d --- /dev/null +++ b/sdk/impact/azure-resourcemanager-impact/src/samples/java/com/azure/resourcemanager/impact/generated/WorkloadImpactsListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.impact.generated; + +/** + * Samples for WorkloadImpacts List. + */ +public final class WorkloadImpactsListSamples { + /* + * x-ms-original-file: specification/impact/resource-manager/Microsoft.Impact/preview/2024-05-01-preview/examples/ + * WorkloadImpacts_ListBySubscription.json + */ + /** + * Sample code: List WorkloadImpact resources by subscription. + * + * @param manager Entry point to ImpactManager. + */ + public static void + listWorkloadImpactResourcesBySubscription(com.azure.resourcemanager.impact.ImpactManager manager) { + manager.workloadImpacts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/impact/ci.yml b/sdk/impact/ci.yml new file mode 100644 index 0000000000000..11e6525597591 --- /dev/null +++ b/sdk/impact/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/impact/ci.yml + - sdk/impact/azure-resourcemanager-impact/ + exclude: + - sdk/impact/pom.xml + - sdk/impact/azure-resourcemanager-impact/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/impact/ci.yml + - sdk/impact/azure-resourcemanager-impact/ + exclude: + - sdk/impact/pom.xml + - sdk/impact/azure-resourcemanager-impact/pom.xml + +parameters: + - name: release_azureresourcemanagerimpact + displayName: azure-resourcemanager-impact + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: impact + Artifacts: + - name: azure-resourcemanager-impact + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerimpact + releaseInBatch: ${{ parameters.release_azureresourcemanagerimpact }} diff --git a/sdk/impact/pom.xml b/sdk/impact/pom.xml new file mode 100644 index 0000000000000..ec19182968e86 --- /dev/null +++ b/sdk/impact/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-impact-service + pom + 1.0.0 + + + azure-resourcemanager-impact + +