diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md index 1f2a3fd41efe..644135a8c454 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2023-10-12) + +- Azure Resource Manager ResourceGraph client library for Java. This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-preview-2023-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md index 6006edf2b3cf..2cedfe57cff4 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md @@ -2,7 +2,7 @@ Azure Resource Manager ResourceGraph client library for Java. -This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-2021-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-preview-2023-09. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-resourcegraph - 1.0.0 + 1.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -117,3 +117,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [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%2Fresourcegraph%2Fazure-resourcemanager-resourcegraph%2FREADME.png) diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md index e1910609c0d8..1c2738bbe7a4 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md @@ -5,18 +5,23 @@ - [List](#operations_list) +## Query + +- [GenerateQuery](#query_generatequery) + ## ResourceProvider +- [ResourceChangeDetails](#resourceprovider_resourcechangedetails) +- [ResourceChanges](#resourceprovider_resourcechanges) - [Resources](#resourceprovider_resources) +- [ResourcesHistory](#resourceprovider_resourceshistory) ### Operations_List ```java -import com.azure.core.util.Context; - /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/OperationsList.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/OperationsList.json */ /** * Sample code: OperationsList. @@ -24,7 +29,195 @@ public final class OperationsListSamples { * @param manager Entry point to ResourceGraphManager. */ public static void operationsList(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.operations().list(Context.NONE); + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Query_GenerateQuery + +```java +import com.azure.resourcemanager.resourcegraph.models.HistoryContext; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationRequest; +import com.azure.resourcemanager.resourcegraph.models.Role; +import java.util.Arrays; + +/** Samples for Query GenerateQuery. */ +public final class QueryGenerateQuerySamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesGenerateQuery.json + */ + /** + * Sample code: Succeeded ARG Query Generation. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void succeededARGQueryGeneration( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .queries() + .generateQueryWithResponse( + new QueryGenerationRequest().withPrompt("I want to see my virtual machines"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesGenerateQueryNoGeneration.json + */ + /** + * Sample code: Failed ARG Query Generation. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void failedARGQueryGeneration(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .queries() + .generateQueryWithResponse( + new QueryGenerationRequest().withPrompt("What is the weather today?"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesGenerateQueryWithHistory.json + */ + /** + * Sample code: ARG Query Generation with history. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void aRGQueryGenerationWithHistory( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .queries() + .generateQueryWithResponse( + new QueryGenerationRequest() + .withHistory( + Arrays + .asList( + new HistoryContext().withContent("I want all my virtual machines").withRole(Role.USER), + new HistoryContext() + .withContent("Resources | where type =~ 'Microsoft.Compute/virtualMachines'") + .withRole(Role.ASSISTANT))) + .withPrompt("I want to see only 5 of my virtual machines"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_ResourceChangeDetails + +```java +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChangeDetails. */ +public final class ResourceProviderResourceChangeDetailsSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangeDetails.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangeDetailsWithResponse( + new ResourceChangeDetailsRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withChangeIds(Arrays.asList("53dc0515-b86b-4bc2-979b-e4694ab4a556")), + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_ResourceChanges + +```java +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParametersInterval; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChanges. */ +public final class ResourceProviderResourceChangesSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChanges.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesNextPage.json + */ + /** + * Sample code: Next page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withSkipToken("fakeTokenPlaceholder") + .withTop(2), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesFirstPage.json + */ + /** + * Sample code: First page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withTop(2), + com.azure.core.util.Context.NONE); } } ``` @@ -32,7 +225,6 @@ public final class OperationsListSamples { ### ResourceProvider_Resources ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.resourcegraph.models.FacetRequest; import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; @@ -43,7 +235,7 @@ import java.util.Arrays; /** Samples for ResourceProvider Resources. */ public final class ResourceProviderResourcesSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesMgBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesMgBasicQuery.json */ /** * Sample code: Basic management group query. @@ -57,11 +249,11 @@ public final class ResourceProviderResourcesSamples { new QueryRequest() .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")) .withQuery("Resources | project id, name, type, location, tags | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesBasicQuery.json */ /** * Sample code: Basic query. @@ -75,11 +267,11 @@ public final class ResourceProviderResourcesSamples { new QueryRequest() .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | project id, name, type, location, tags | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFacetQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesFacetQuery.json */ /** * Sample code: Query with a facet request. @@ -123,11 +315,11 @@ public final class ResourceProviderResourcesSamples { new FacetRequestOptions() .withFilter("resourceGroup contains 'test'") .withTop(3)))), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFilterQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesFilterQuery.json */ /** * Sample code: Filter resources. @@ -143,11 +335,11 @@ public final class ResourceProviderResourcesSamples { .withQuery( "Resources | project id, name, type, location | where type =~" + " 'Microsoft.Compute/virtualMachines' | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesSummarizeQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesSummarizeQuery.json */ /** * Sample code: Summarize resources by location. @@ -162,11 +354,11 @@ public final class ResourceProviderResourcesSamples { new QueryRequest() .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | project id, name, type, location | summarize by location"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesPropertiesQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesPropertiesQuery.json */ /** * Sample code: Access a properties field. @@ -182,11 +374,11 @@ public final class ResourceProviderResourcesSamples { .withQuery( "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by" + " tostring(properties.storageProfile.osDisk.osType)"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesComplexQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesComplexQuery.json */ /** * Sample code: Complex query. @@ -202,11 +394,11 @@ public final class ResourceProviderResourcesSamples { .withQuery( "Resources | project id, name, type, location | where type =~" + " 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesNextPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesNextPageQuery.json */ /** * Sample code: Next page query. @@ -220,14 +412,12 @@ public final class ResourceProviderResourcesSamples { new QueryRequest() .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | where name contains 'test' | project id, name, type, location") - .withOptions( - new QueryRequestOptions() - .withSkipToken("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==")), - Context.NONE); + .withOptions(new QueryRequestOptions().withSkipToken("fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFirstPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesFirstPageQuery.json */ /** * Sample code: First page query. @@ -242,11 +432,11 @@ public final class ResourceProviderResourcesSamples { .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | where name contains 'test' | project id, name, type, location") .withOptions(new QueryRequestOptions().withTop(3).withSkip(0)), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesTenantBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesTenantBasicQuery.json */ /** * Sample code: Basic tenant query. @@ -258,11 +448,11 @@ public final class ResourceProviderResourcesSamples { .resourceProviders() .resourcesWithResponse( new QueryRequest().withQuery("Resources | project id, name, type, location, tags | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesRandomPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesRandomPageQuery.json */ /** * Sample code: Random page query. @@ -277,7 +467,69 @@ public final class ResourceProviderResourcesSamples { .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | where name contains 'test' | project id, name, type, location") .withOptions(new QueryRequestOptions().withTop(2).withSkip(10)), - Context.NONE); + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_ResourcesHistory + +```java +import com.azure.resourcemanager.resourcegraph.models.DateTimeInterval; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequestOptions; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourcesHistory. */ +public final class ResourceProviderResourcesHistorySamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ + /** + * Sample code: Resource History Management Group scope Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryManagementGroupScopeQuery( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))) + .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ + /** + * Sample code: Resource History Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withSubscriptions(Arrays.asList("a7f33fdb-e646-4f15-89aa-3a360210861e")) + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))), + com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml index d68c73fb4978..fef494c9aa62 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -13,7 +18,7 @@ jar Microsoft Azure SDK for ResourceGraph Management - This package contains Microsoft Azure SDK for ResourceGraph Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Resource Graph API Reference. Package tag package-2021-03. + This package contains Microsoft Azure SDK for ResourceGraph Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Resource Graph API Reference. Package tag package-preview-2023-09. https://github.com/Azure/azure-sdk-for-java @@ -38,7 +43,9 @@ UTF-8 - true + 0 + 0 + true diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/ResourceGraphManager.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/ResourceGraphManager.java index 77221a00072b..6e2c9723316e 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/ResourceGraphManager.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/ResourceGraphManager.java @@ -25,9 +25,11 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphClient; import com.azure.resourcemanager.resourcegraph.implementation.OperationsImpl; +import com.azure.resourcemanager.resourcegraph.implementation.QueriesImpl; import com.azure.resourcemanager.resourcegraph.implementation.ResourceGraphClientBuilder; import com.azure.resourcemanager.resourcegraph.implementation.ResourceProvidersImpl; import com.azure.resourcemanager.resourcegraph.models.Operations; +import com.azure.resourcemanager.resourcegraph.models.Queries; import com.azure.resourcemanager.resourcegraph.models.ResourceProviders; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -38,6 +40,8 @@ /** Entry point to ResourceGraphManager. Azure Resource Graph API Reference. */ public final class ResourceGraphManager { + private Queries queries; + private ResourceProviders resourceProviders; private Operations operations; @@ -206,7 +210,7 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.resourcegraph") .append("/") - .append("1.0.0"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -263,6 +267,18 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil } } + /** + * Gets the resource collection API of Queries. + * + * @return Resource collection API of Queries. + */ + public Queries queries() { + if (this.queries == null) { + this.queries = new QueriesImpl(clientObject.getQueries(), this); + } + return queries; + } + /** * Gets the resource collection API of ResourceProviders. * @@ -288,8 +304,10 @@ public Operations operations() { } /** - * @return Wrapped service client ResourceGraphClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets wrapped service client ResourceGraphClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ResourceGraphClient. */ public ResourceGraphClient serviceClient() { return this.clientObject; diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/QueriesClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/QueriesClient.java new file mode 100644 index 000000000000..b90c8e195665 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/QueriesClient.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.resourcegraph.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.fluent.models.QueryGenerationResponseInner; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationRequest; + +/** An instance of this class provides access to all the operations defined in QueriesClient. */ +public interface QueriesClient { + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateQueryWithResponse(QueryGenerationRequest body, Context context); + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryGenerationResponseInner generateQuery(QueryGenerationRequest body); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java index 16412a3b5883..b75ad704ce22 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java @@ -17,11 +17,11 @@ public interface ResourceGraphClient { String getEndpoint(); /** - * Gets Api Version. + * Gets server parameter. * - * @return the apiVersion value. + * @return the endpoint value. */ - String getApiVersion(); + String getEndpoint(); /** * Gets The HTTP pipeline to send requests through. @@ -37,6 +37,13 @@ public interface ResourceGraphClient { */ Duration getDefaultPollInterval(); + /** + * Gets the QueriesClient object to access its operations. + * + * @return the QueriesClient object. + */ + QueriesClient getQueries(); + /** * Gets the ResourceProvidersClient object to access its operations. * diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java index 0c06911802d0..f248a53a5522 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java @@ -9,7 +9,14 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.resourcegraph.fluent.models.QueryResponseInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; import com.azure.resourcemanager.resourcegraph.models.QueryRequest; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import java.util.List; +import java.util.Map; /** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ public interface ResourceProvidersClient { @@ -37,4 +44,81 @@ public interface ResourceProvidersClient { */ @ServiceMethod(returns = ReturnType.SINGLE) QueryResponseInner resources(QueryRequest query); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any> along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any>. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Map resourcesHistory(ResourcesHistoryRequest request); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceChangeListInner resourceChanges(ResourceChangesRequestParameters parameters); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryGenerationResponseInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryGenerationResponseInner.java new file mode 100644 index 000000000000..f863fbcf3ee2 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryGenerationResponseInner.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcegraph.models.StatusResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Query Generation Response. */ +@Fluent +public final class QueryGenerationResponseInner { + /* + * Query generated for a given user prompt text + */ + @JsonProperty(value = "query", required = true) + private String query; + + /* + * Status for the query generation result + */ + @JsonProperty(value = "status", required = true) + private StatusResponse status; + + /** Creates an instance of QueryGenerationResponseInner class. */ + public QueryGenerationResponseInner() { + } + + /** + * Get the query property: Query generated for a given user prompt text. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: Query generated for a given user prompt text. + * + * @param query the query value to set. + * @return the QueryGenerationResponseInner object itself. + */ + public QueryGenerationResponseInner withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the status property: Status for the query generation result. + * + * @return the status value. + */ + public StatusResponse status() { + return this.status; + } + + /** + * Set the status property: Status for the query generation result. + * + * @param status the status value to set. + * @return the QueryGenerationResponseInner object itself. + */ + public QueryGenerationResponseInner withStatus(StatusResponse status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (query() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property query in model QueryGenerationResponseInner")); + } + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model QueryGenerationResponseInner")); + } else { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(QueryGenerationResponseInner.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java new file mode 100644 index 000000000000..a4fca875be8f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcegraph.models.ChangeType; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataAfterSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataBeforeSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourcePropertyChange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Data on a specific change, represented by a pair of before and after resource snapshots. */ +@Fluent +public final class ResourceChangeDataInner { + /* + * The resource for a change. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The change ID. Valid and unique within the specified resource only. + */ + @JsonProperty(value = "changeId", required = true) + private String changeId; + + /* + * The snapshot before the change. + */ + @JsonProperty(value = "beforeSnapshot", required = true) + private ResourceChangeDataBeforeSnapshot beforeSnapshot; + + /* + * The snapshot after the change. + */ + @JsonProperty(value = "afterSnapshot", required = true) + private ResourceChangeDataAfterSnapshot afterSnapshot; + + /* + * The change type for snapshot. PropertyChanges will be provided in case of Update change type + */ + @JsonProperty(value = "changeType") + private ChangeType changeType; + + /* + * An array of resource property change + */ + @JsonProperty(value = "propertyChanges") + private List propertyChanges; + + /** Creates an instance of ResourceChangeDataInner class. */ + public ResourceChangeDataInner() { + } + + /** + * Get the resourceId property: The resource for a change. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource for a change. + * + * @param resourceId the resourceId value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the changeId property: The change ID. Valid and unique within the specified resource only. + * + * @return the changeId value. + */ + public String changeId() { + return this.changeId; + } + + /** + * Set the changeId property: The change ID. Valid and unique within the specified resource only. + * + * @param changeId the changeId value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withChangeId(String changeId) { + this.changeId = changeId; + return this; + } + + /** + * Get the beforeSnapshot property: The snapshot before the change. + * + * @return the beforeSnapshot value. + */ + public ResourceChangeDataBeforeSnapshot beforeSnapshot() { + return this.beforeSnapshot; + } + + /** + * Set the beforeSnapshot property: The snapshot before the change. + * + * @param beforeSnapshot the beforeSnapshot value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withBeforeSnapshot(ResourceChangeDataBeforeSnapshot beforeSnapshot) { + this.beforeSnapshot = beforeSnapshot; + return this; + } + + /** + * Get the afterSnapshot property: The snapshot after the change. + * + * @return the afterSnapshot value. + */ + public ResourceChangeDataAfterSnapshot afterSnapshot() { + return this.afterSnapshot; + } + + /** + * Set the afterSnapshot property: The snapshot after the change. + * + * @param afterSnapshot the afterSnapshot value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withAfterSnapshot(ResourceChangeDataAfterSnapshot afterSnapshot) { + this.afterSnapshot = afterSnapshot; + return this; + } + + /** + * Get the changeType property: The change type for snapshot. PropertyChanges will be provided in case of Update + * change type. + * + * @return the changeType value. + */ + public ChangeType changeType() { + return this.changeType; + } + + /** + * Set the changeType property: The change type for snapshot. PropertyChanges will be provided in case of Update + * change type. + * + * @param changeType the changeType value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withChangeType(ChangeType changeType) { + this.changeType = changeType; + return this; + } + + /** + * Get the propertyChanges property: An array of resource property change. + * + * @return the propertyChanges value. + */ + public List propertyChanges() { + return this.propertyChanges; + } + + /** + * Set the propertyChanges property: An array of resource property change. + * + * @param propertyChanges the propertyChanges value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withPropertyChanges(List propertyChanges) { + this.propertyChanges = propertyChanges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (changeId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property changeId in model ResourceChangeDataInner")); + } + if (beforeSnapshot() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property beforeSnapshot in model ResourceChangeDataInner")); + } else { + beforeSnapshot().validate(); + } + if (afterSnapshot() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property afterSnapshot in model ResourceChangeDataInner")); + } else { + afterSnapshot().validate(); + } + if (propertyChanges() != null) { + propertyChanges().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceChangeDataInner.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java new file mode 100644 index 000000000000..b3fa17d80639 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of changes associated with a resource over a specific time interval. */ +@Fluent +public final class ResourceChangeListInner { + /* + * The pageable value returned by the operation, i.e. a list of changes to the resource. + * + * - The list is ordered from the most recent changes to the least recent changes. + * - This list will be empty if there were no changes during the requested interval. + * - The `Before` snapshot timestamp value of the oldest change can be outside of the specified time interval. + */ + @JsonProperty(value = "changes") + private List changes; + + /* + * Skip token that encodes the skip information while executing the current request + */ + @JsonProperty(value = "$skipToken") + private Object skipToken; + + /** Creates an instance of ResourceChangeListInner class. */ + public ResourceChangeListInner() { + } + + /** + * Get the changes property: The pageable value returned by the operation, i.e. a list of changes to the resource. + * + *

- The list is ordered from the most recent changes to the least recent changes. - This list will be empty if + * there were no changes during the requested interval. - The `Before` snapshot timestamp value of the oldest change + * can be outside of the specified time interval. + * + * @return the changes value. + */ + public List changes() { + return this.changes; + } + + /** + * Set the changes property: The pageable value returned by the operation, i.e. a list of changes to the resource. + * + *

- The list is ordered from the most recent changes to the least recent changes. - This list will be empty if + * there were no changes during the requested interval. - The `Before` snapshot timestamp value of the oldest change + * can be outside of the specified time interval. + * + * @param changes the changes value to set. + * @return the ResourceChangeListInner object itself. + */ + public ResourceChangeListInner withChanges(List changes) { + this.changes = changes; + return this; + } + + /** + * Get the skipToken property: Skip token that encodes the skip information while executing the current request. + * + * @return the skipToken value. + */ + public Object skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: Skip token that encodes the skip information while executing the current request. + * + * @param skipToken the skipToken value to set. + * @return the ResourceChangeListInner object itself. + */ + public ResourceChangeListInner withSkipToken(Object skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (changes() != null) { + changes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java index 92e4e6c050be..d399a829cb41 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java @@ -54,7 +54,7 @@ public final class OperationsClientImpl implements OperationsClient { */ @Host("{$host}") @ServiceInterface(name = "ResourceGraphClientO") - private interface OperationsService { + public interface OperationsService { @Headers({"Content-Type: application/json"}) @Get("/providers/Microsoft.ResourceGraph/operations") @ExpectedResponses({200}) @@ -82,10 +82,10 @@ private Mono> listSinglePageAsync() { new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2023-09-01-preview"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .>map( res -> new PagedResponseBase<>( @@ -111,10 +111,11 @@ private Mono> listSinglePageAsync(Context context) new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2023-09-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .list(this.client.getEndpoint(), apiVersion, accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueriesClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueriesClientImpl.java new file mode 100644 index 000000000000..bc2f0a658728 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueriesClientImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.resourcegraph.fluent.QueriesClient; +import com.azure.resourcemanager.resourcegraph.fluent.models.QueryGenerationResponseInner; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in QueriesClient. */ +public final class QueriesClientImpl implements QueriesClient { + /** The proxy service used to perform REST calls. */ + private final QueriesService service; + + /** The service client containing this operation class. */ + private final ResourceGraphClientImpl client; + + /** + * Initializes an instance of QueriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueriesClientImpl(ResourceGraphClientImpl client) { + this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourceGraphClientQueries to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ResourceGraphClientQ") + public interface QueriesService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/generateQuery") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateQuery( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") QueryGenerationRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateQueryWithResponseAsync(QueryGenerationRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2023-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.generateQuery(this.client.getEndpoint(), apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateQueryWithResponseAsync( + QueryGenerationRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2023-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.generateQuery(this.client.getEndpoint(), apiVersion, body, accept, context); + } + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateQueryAsync(QueryGenerationRequest body) { + return generateQueryWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateQueryWithResponse( + QueryGenerationRequest body, Context context) { + return generateQueryWithResponseAsync(body, context).block(); + } + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryGenerationResponseInner generateQuery(QueryGenerationRequest body) { + return generateQueryWithResponse(body, Context.NONE).getValue(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueriesImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueriesImpl.java new file mode 100644 index 000000000000..b13f44bbe57d --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueriesImpl.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.resourcegraph.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcegraph.fluent.QueriesClient; +import com.azure.resourcemanager.resourcegraph.fluent.models.QueryGenerationResponseInner; +import com.azure.resourcemanager.resourcegraph.models.Queries; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationRequest; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationResponse; + +public final class QueriesImpl implements Queries { + private static final ClientLogger LOGGER = new ClientLogger(QueriesImpl.class); + + private final QueriesClient innerClient; + + private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; + + public QueriesImpl( + QueriesClient innerClient, com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response generateQueryWithResponse(QueryGenerationRequest body, Context context) { + Response inner = this.serviceClient().generateQueryWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryGenerationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public QueryGenerationResponse generateQuery(QueryGenerationRequest body) { + QueryGenerationResponseInner inner = this.serviceClient().generateQuery(body); + if (inner != null) { + return new QueryGenerationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private QueriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryGenerationResponseImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryGenerationResponseImpl.java new file mode 100644 index 000000000000..401efd643b49 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryGenerationResponseImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.implementation; + +import com.azure.resourcemanager.resourcegraph.fluent.models.QueryGenerationResponseInner; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationResponse; +import com.azure.resourcemanager.resourcegraph.models.StatusResponse; + +public final class QueryGenerationResponseImpl implements QueryGenerationResponse { + private QueryGenerationResponseInner innerObject; + + private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; + + QueryGenerationResponseImpl( + QueryGenerationResponseInner innerObject, + com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String query() { + return this.innerModel().query(); + } + + public StatusResponse status() { + return this.innerModel().status(); + } + + public QueryGenerationResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java new file mode 100644 index 000000000000..56cd4365f0f3 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.implementation; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.models.ChangeType; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataAfterSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataBeforeSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourcePropertyChange; +import java.util.Collections; +import java.util.List; + +public final class ResourceChangeDataImpl implements ResourceChangeData { + private ResourceChangeDataInner innerObject; + + private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; + + ResourceChangeDataImpl( + ResourceChangeDataInner innerObject, + com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String changeId() { + return this.innerModel().changeId(); + } + + public ResourceChangeDataBeforeSnapshot beforeSnapshot() { + return this.innerModel().beforeSnapshot(); + } + + public ResourceChangeDataAfterSnapshot afterSnapshot() { + return this.innerModel().afterSnapshot(); + } + + public ChangeType changeType() { + return this.innerModel().changeType(); + } + + public List propertyChanges() { + List inner = this.innerModel().propertyChanges(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceChangeDataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java new file mode 100644 index 000000000000..e0e7c8dca71a --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.implementation; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ResourceChangeListImpl implements ResourceChangeList { + private ResourceChangeListInner innerObject; + + private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; + + ResourceChangeListImpl( + ResourceChangeListInner innerObject, + com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List changes() { + List inner = this.innerModel().changes(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Object skipToken() { + return this.innerModel().skipToken(); + } + + public ResourceChangeListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java index 5620f7fc0065..be6ce8ba4820 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java @@ -33,6 +33,22 @@ public ResourceGraphClientBuilder endpoint(String endpoint) { return this; } + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ResourceGraphClientBuilder. + */ + public ResourceGraphClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + /* * The environment to connect to */ @@ -103,6 +119,7 @@ public ResourceGraphClientBuilder serializerAdapter(SerializerAdapter serializer * @return an instance of ResourceGraphClientImpl. */ public ResourceGraphClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : ""; String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = @@ -117,7 +134,12 @@ public ResourceGraphClientImpl buildClient() { : SerializerFactory.createDefaultManagementSerializerAdapter(); ResourceGraphClientImpl client = new ResourceGraphClientImpl( - localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + localEndpoint, + localEndpoint); return client; } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java index 1a59844481ff..5f1c2d6d119d 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java @@ -23,6 +23,7 @@ import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.resourcegraph.fluent.OperationsClient; +import com.azure.resourcemanager.resourcegraph.fluent.QueriesClient; import com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphClient; import com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient; import java.io.IOException; @@ -49,16 +50,16 @@ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ - private final String apiVersion; + /** server parameter. */ + private final String endpoint; /** - * Gets Api Version. + * Gets server parameter. * - * @return the apiVersion value. + * @return the endpoint value. */ - public String getApiVersion() { - return this.apiVersion; + public String getEndpoint() { + return this.endpoint; } /** The HTTP pipeline to send requests through. */ @@ -97,6 +98,18 @@ public Duration getDefaultPollInterval() { return this.defaultPollInterval; } + /** The QueriesClient object to access its operations. */ + private final QueriesClient queries; + + /** + * Gets the QueriesClient object to access its operations. + * + * @return the QueriesClient object. + */ + public QueriesClient getQueries() { + return this.queries; + } + /** The ResourceProvidersClient object to access its operations. */ private final ResourceProvidersClient resourceProviders; @@ -129,18 +142,21 @@ public OperationsClient getOperations() { * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. * @param endpoint server parameter. + * @param endpoint server parameter. */ ResourceGraphClientImpl( HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, + String endpoint, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; - this.apiVersion = "2021-03-01"; + this.endpoint = endpoint; + this.queries = new QueriesClientImpl(this); this.resourceProviders = new ResourceProvidersClientImpl(this); this.operations = new OperationsClientImpl(this); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java index dbeb1f57f27d..3ff5af2db6f2 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java @@ -23,7 +23,14 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient; import com.azure.resourcemanager.resourcegraph.fluent.models.QueryResponseInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; import com.azure.resourcemanager.resourcegraph.models.QueryRequest; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import java.util.List; +import java.util.Map; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ @@ -51,7 +58,7 @@ public final class ResourceProvidersClientImpl implements ResourceProvidersClien */ @Host("{$host}") @ServiceInterface(name = "ResourceGraphClientR") - private interface ResourceProvidersService { + public interface ResourceProvidersService { @Headers({"Content-Type: application/json"}) @Post("/providers/Microsoft.ResourceGraph/resources") @ExpectedResponses({200}) @@ -62,6 +69,39 @@ Mono> resources( @BodyParam("application/json") QueryRequest query, @HeaderParam("Accept") String accept, Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/resourcesHistory") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resourcesHistory( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcesHistoryRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/resourceChanges") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resourceChanges( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceChangesRequestParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/resourceChangeDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resourceChangeDetails( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceChangeDetailsRequestParameters parameters, + @HeaderParam("Accept") String accept, + Context context); } /** @@ -86,11 +126,10 @@ private Mono> resourcesWithResponseAsync(QueryReque } else { query.validate(); } + final String apiVersion = "2023-09-01-preview"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context)) + .withContext(context -> service.resources(this.client.getEndpoint(), apiVersion, query, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -117,9 +156,10 @@ private Mono> resourcesWithResponseAsync(QueryReque } else { query.validate(); } + final String apiVersion = "2023-09-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context); + return service.resources(this.client.getEndpoint(), apiVersion, query, accept, context); } /** @@ -164,4 +204,323 @@ public Response resourcesWithResponse(QueryRequest query, Co public QueryResponseInner resources(QueryRequest query) { return resourcesWithResponse(query, Context.NONE).getValue(); } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any> along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourcesHistoryWithResponseAsync(ResourcesHistoryRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String apiVersion = "2021-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.resourcesHistory(this.client.getEndpoint(), apiVersion, request, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any> along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourcesHistoryWithResponseAsync( + ResourcesHistoryRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String apiVersion = "2021-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resourcesHistory(this.client.getEndpoint(), apiVersion, request, accept, context); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any> on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourcesHistoryAsync(ResourcesHistoryRequest request) { + return resourcesHistoryWithResponseAsync(request).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any> along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> resourcesHistoryWithResponse( + ResourcesHistoryRequest request, Context context) { + return resourcesHistoryWithResponseAsync(request, context).block(); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any>. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Map resourcesHistory(ResourcesHistoryRequest request) { + return resourcesHistoryWithResponse(request, Context.NONE).getValue(); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourceChangesWithResponseAsync( + ResourceChangesRequestParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.resourceChanges(this.client.getEndpoint(), apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourceChangesWithResponseAsync( + ResourceChangesRequestParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resourceChanges(this.client.getEndpoint(), apiVersion, parameters, accept, context); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resourceChangesAsync(ResourceChangesRequestParameters parameters) { + return resourceChangesWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context) { + return resourceChangesWithResponseAsync(parameters, context).block(); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceChangeListInner resourceChanges(ResourceChangesRequestParameters parameters) { + return resourceChangesWithResponse(parameters, Context.NONE).getValue(); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourceChangeDetailsWithResponseAsync( + ResourceChangeDetailsRequestParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.resourceChangeDetails(this.client.getEndpoint(), apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourceChangeDetailsWithResponseAsync( + ResourceChangeDetailsRequestParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resourceChangeDetails(this.client.getEndpoint(), apiVersion, parameters, accept, context); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourceChangeDetailsAsync( + ResourceChangeDetailsRequestParameters parameters) { + return resourceChangeDetailsWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context) { + return resourceChangeDetailsWithResponseAsync(parameters, context).block(); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters) { + return resourceChangeDetailsWithResponse(parameters, Context.NONE).getValue(); + } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java index ae32593ba755..27eb01a42455 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java @@ -10,9 +10,20 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient; import com.azure.resourcemanager.resourcegraph.fluent.models.QueryResponseInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; import com.azure.resourcemanager.resourcegraph.models.QueryRequest; import com.azure.resourcemanager.resourcegraph.models.QueryResponse; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeList; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; import com.azure.resourcemanager.resourcegraph.models.ResourceProviders; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; public final class ResourceProvidersImpl implements ResourceProviders { private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); @@ -50,6 +61,76 @@ public QueryResponse resources(QueryRequest query) { } } + public Response> resourcesHistoryWithResponse( + ResourcesHistoryRequest request, Context context) { + return this.serviceClient().resourcesHistoryWithResponse(request, context); + } + + public Map resourcesHistory(ResourcesHistoryRequest request) { + Map inner = this.serviceClient().resourcesHistory(request); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context) { + Response inner = this.serviceClient().resourceChangesWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResourceChangeListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ResourceChangeList resourceChanges(ResourceChangesRequestParameters parameters) { + ResourceChangeListInner inner = this.serviceClient().resourceChanges(parameters); + if (inner != null) { + return new ResourceChangeListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context) { + Response> inner = + this.serviceClient().resourceChangeDetailsWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters) { + List inner = this.serviceClient().resourceChangeDetails(parameters); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + private ResourceProvidersClient serviceClient() { return this.innerClient; } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java new file mode 100644 index 000000000000..ab6c050484ce --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines what level of authorization resources should be returned based on the which subscriptions and management + * groups are passed as scopes. + */ +public enum AuthorizationScopeFilter { + /** Enum value AtScopeAndBelow. */ + AT_SCOPE_AND_BELOW("AtScopeAndBelow"), + + /** Enum value AtScopeAndAbove. */ + AT_SCOPE_AND_ABOVE("AtScopeAndAbove"), + + /** Enum value AtScopeExact. */ + AT_SCOPE_EXACT("AtScopeExact"), + + /** Enum value AtScopeAboveAndBelow. */ + AT_SCOPE_ABOVE_AND_BELOW("AtScopeAboveAndBelow"); + + /** The actual serialized value for a AuthorizationScopeFilter instance. */ + private final String value; + + AuthorizationScopeFilter(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthorizationScopeFilter instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthorizationScopeFilter object, or null if unable to parse. + */ + @JsonCreator + public static AuthorizationScopeFilter fromString(String value) { + if (value == null) { + return null; + } + AuthorizationScopeFilter[] items = AuthorizationScopeFilter.values(); + for (AuthorizationScopeFilter item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java new file mode 100644 index 000000000000..5b52538b3fae --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.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.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The change category. */ +public enum ChangeCategory { + /** Enum value User. */ + USER("User"), + + /** Enum value System. */ + SYSTEM("System"); + + /** The actual serialized value for a ChangeCategory instance. */ + private final String value; + + ChangeCategory(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeCategory instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeCategory object, or null if unable to parse. + */ + @JsonCreator + public static ChangeCategory fromString(String value) { + if (value == null) { + return null; + } + ChangeCategory[] items = ChangeCategory.values(); + for (ChangeCategory item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java new file mode 100644 index 000000000000..a90022c91624 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The change type for snapshot. PropertyChanges will be provided in case of Update change type. */ +public enum ChangeType { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Update. */ + UPDATE("Update"), + + /** Enum value Delete. */ + DELETE("Delete"); + + /** The actual serialized value for a ChangeType instance. */ + private final String value; + + ChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeType object, or null if unable to parse. + */ + @JsonCreator + public static ChangeType fromString(String value) { + if (value == null) { + return null; + } + ChangeType[] items = ChangeType.values(); + for (ChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java new file mode 100644 index 000000000000..aafb62317826 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.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.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. `[start, end)`. */ +@Fluent +public class DateTimeInterval { + /* + * A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, end)`. Specifying a + * `start` that occurs chronologically after `end` will result in an error. + */ + @JsonProperty(value = "start", required = true) + private OffsetDateTime start; + + /* + * A datetime indicating the exclusive/open end of the time interval, i.e. `[start, `**`end`**`)`. Specifying an + * `end` that occurs chronologically before `start` will result in an error. + */ + @JsonProperty(value = "end", required = true) + private OffsetDateTime end; + + /** Creates an instance of DateTimeInterval class. */ + public DateTimeInterval() { + } + + /** + * Get the start property: A datetime indicating the inclusive/closed start of the time interval, i.e. + * `[`**`start`**`, end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. + * + * @return the start value. + */ + public OffsetDateTime start() { + return this.start; + } + + /** + * Set the start property: A datetime indicating the inclusive/closed start of the time interval, i.e. + * `[`**`start`**`, end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. + * + * @param start the start value to set. + * @return the DateTimeInterval object itself. + */ + public DateTimeInterval withStart(OffsetDateTime start) { + this.start = start; + return this; + } + + /** + * Get the end property: A datetime indicating the exclusive/open end of the time interval, i.e. `[start, + * `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in an error. + * + * @return the end value. + */ + public OffsetDateTime end() { + return this.end; + } + + /** + * Set the end property: A datetime indicating the exclusive/open end of the time interval, i.e. `[start, + * `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in an error. + * + * @param end the end value to set. + * @return the DateTimeInterval object itself. + */ + public DateTimeInterval withEnd(OffsetDateTime end) { + this.end = end; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (start() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property start in model DateTimeInterval")); + } + if (end() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property end in model DateTimeInterval")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DateTimeInterval.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/HistoryContext.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/HistoryContext.java new file mode 100644 index 000000000000..e966a7eabb3f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/HistoryContext.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** History content generated by a user, assistant or system role. */ +@Fluent +public final class HistoryContext { + /* + * Content generated by a given role + */ + @JsonProperty(value = "content", required = true) + private String content; + + /* + * Role which generates the content e.g., user, assistant or system + */ + @JsonProperty(value = "role", required = true) + private Role role; + + /** Creates an instance of HistoryContext class. */ + public HistoryContext() { + } + + /** + * Get the content property: Content generated by a given role. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: Content generated by a given role. + * + * @param content the content value to set. + * @return the HistoryContext object itself. + */ + public HistoryContext withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the role property: Role which generates the content e.g., user, assistant or system. + * + * @return the role value. + */ + public Role role() { + return this.role; + } + + /** + * Set the role property: Role which generates the content e.g., user, assistant or system. + * + * @param role the role value to set. + * @return the HistoryContext object itself. + */ + public HistoryContext withRole(Role role) { + this.role = role; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (content() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property content in model HistoryContext")); + } + if (role() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property role in model HistoryContext")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HistoryContext.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java new file mode 100644 index 000000000000..0dc462cff3a4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The property change Type. */ +public enum PropertyChangeType { + /** Enum value Insert. */ + INSERT("Insert"), + + /** Enum value Update. */ + UPDATE("Update"), + + /** Enum value Remove. */ + REMOVE("Remove"); + + /** The actual serialized value for a PropertyChangeType instance. */ + private final String value; + + PropertyChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PropertyChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed PropertyChangeType object, or null if unable to parse. + */ + @JsonCreator + public static PropertyChangeType fromString(String value) { + if (value == null) { + return null; + } + PropertyChangeType[] items = PropertyChangeType.values(); + for (PropertyChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Queries.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Queries.java new file mode 100644 index 000000000000..3fd0d0076e27 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Queries.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Queries. */ +public interface Queries { + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response along with {@link Response}. + */ + Response generateQueryWithResponse(QueryGenerationRequest body, Context context); + + /** + * Generates ARG query for a given user prompt. + * + * @param body Query Generation Request. + * @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 query Generation Response. + */ + QueryGenerationResponse generateQuery(QueryGenerationRequest body); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryGenerationRequest.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryGenerationRequest.java new file mode 100644 index 000000000000..9cffd87eaa9a --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryGenerationRequest.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Query Generation Request. */ +@Fluent +public final class QueryGenerationRequest { + /* + * A collection of chat history to provide context in query generation + */ + @JsonProperty(value = "history") + private List history; + + /* + * Prompt text from user + */ + @JsonProperty(value = "prompt", required = true) + private String prompt; + + /** Creates an instance of QueryGenerationRequest class. */ + public QueryGenerationRequest() { + } + + /** + * Get the history property: A collection of chat history to provide context in query generation. + * + * @return the history value. + */ + public List history() { + return this.history; + } + + /** + * Set the history property: A collection of chat history to provide context in query generation. + * + * @param history the history value to set. + * @return the QueryGenerationRequest object itself. + */ + public QueryGenerationRequest withHistory(List history) { + this.history = history; + return this; + } + + /** + * Get the prompt property: Prompt text from user. + * + * @return the prompt value. + */ + public String prompt() { + return this.prompt; + } + + /** + * Set the prompt property: Prompt text from user. + * + * @param prompt the prompt value to set. + * @return the QueryGenerationRequest object itself. + */ + public QueryGenerationRequest withPrompt(String prompt) { + this.prompt = prompt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (history() != null) { + history().forEach(e -> e.validate()); + } + if (prompt() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property prompt in model QueryGenerationRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(QueryGenerationRequest.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryGenerationResponse.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryGenerationResponse.java new file mode 100644 index 000000000000..6d579bd73357 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryGenerationResponse.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.resourcegraph.models; + +import com.azure.resourcemanager.resourcegraph.fluent.models.QueryGenerationResponseInner; + +/** An immutable client-side representation of QueryGenerationResponse. */ +public interface QueryGenerationResponse { + /** + * Gets the query property: Query generated for a given user prompt text. + * + * @return the query value. + */ + String query(); + + /** + * Gets the status property: Status for the query generation result. + * + * @return the status value. + */ + StatusResponse status(); + + /** + * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.QueryGenerationResponseInner object. + * + * @return the inner object. + */ + QueryGenerationResponseInner innerModel(); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java index 4d3a2c177577..b0a1b7e5c4f1 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java @@ -43,6 +43,13 @@ public final class QueryRequestOptions { @JsonProperty(value = "allowPartialScopes") private Boolean allowPartialScopes; + /* + * Defines what level of authorization resources should be returned based on the which subscriptions and management + * groups are passed as scopes. + */ + @JsonProperty(value = "authorizationScopeFilter") + private AuthorizationScopeFilter authorizationScopeFilter; + /** Creates an instance of QueryRequestOptions class. */ public QueryRequestOptions() { } @@ -155,6 +162,28 @@ public QueryRequestOptions withAllowPartialScopes(Boolean allowPartialScopes) { return this; } + /** + * Get the authorizationScopeFilter property: Defines what level of authorization resources should be returned based + * on the which subscriptions and management groups are passed as scopes. + * + * @return the authorizationScopeFilter value. + */ + public AuthorizationScopeFilter authorizationScopeFilter() { + return this.authorizationScopeFilter; + } + + /** + * Set the authorizationScopeFilter property: Defines what level of authorization resources should be returned based + * on the which subscriptions and management groups are passed as scopes. + * + * @param authorizationScopeFilter the authorizationScopeFilter value to set. + * @return the QueryRequestOptions object itself. + */ + public QueryRequestOptions withAuthorizationScopeFilter(AuthorizationScopeFilter authorizationScopeFilter) { + this.authorizationScopeFilter = authorizationScopeFilter; + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java new file mode 100644 index 000000000000..9787266e2cc0 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import java.util.List; + +/** An immutable client-side representation of ResourceChangeData. */ +public interface ResourceChangeData { + /** + * Gets the resourceId property: The resource for a change. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the changeId property: The change ID. Valid and unique within the specified resource only. + * + * @return the changeId value. + */ + String changeId(); + + /** + * Gets the beforeSnapshot property: The snapshot before the change. + * + * @return the beforeSnapshot value. + */ + ResourceChangeDataBeforeSnapshot beforeSnapshot(); + + /** + * Gets the afterSnapshot property: The snapshot after the change. + * + * @return the afterSnapshot value. + */ + ResourceChangeDataAfterSnapshot afterSnapshot(); + + /** + * Gets the changeType property: The change type for snapshot. PropertyChanges will be provided in case of Update + * change type. + * + * @return the changeType value. + */ + ChangeType changeType(); + + /** + * Gets the propertyChanges property: An array of resource property change. + * + * @return the propertyChanges value. + */ + List propertyChanges(); + + /** + * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner object. + * + * @return the inner object. + */ + ResourceChangeDataInner innerModel(); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java new file mode 100644 index 000000000000..78abecca0c57 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import java.time.OffsetDateTime; + +/** The snapshot after the change. */ +@Fluent +public final class ResourceChangeDataAfterSnapshot extends ResourceSnapshotData { + /** Creates an instance of ResourceChangeDataAfterSnapshot class. */ + public ResourceChangeDataAfterSnapshot() { + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataAfterSnapshot withSnapshotId(String snapshotId) { + super.withSnapshotId(snapshotId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataAfterSnapshot withTimestamp(OffsetDateTime timestamp) { + super.withTimestamp(timestamp); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataAfterSnapshot withContent(Object content) { + super.withContent(content); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java new file mode 100644 index 000000000000..3c79a4420067 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import java.time.OffsetDateTime; + +/** The snapshot before the change. */ +@Fluent +public final class ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData { + /** Creates an instance of ResourceChangeDataBeforeSnapshot class. */ + public ResourceChangeDataBeforeSnapshot() { + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataBeforeSnapshot withSnapshotId(String snapshotId) { + super.withSnapshotId(snapshotId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataBeforeSnapshot withTimestamp(OffsetDateTime timestamp) { + super.withTimestamp(timestamp); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataBeforeSnapshot withContent(Object content) { + super.withContent(content); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java new file mode 100644 index 000000000000..0de22aa35e89 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The parameters for a specific change details request. */ +@Fluent +public final class ResourceChangeDetailsRequestParameters { + /* + * Specifies the list of resources for a change details request. + */ + @JsonProperty(value = "resourceIds", required = true) + private List resourceIds; + + /* + * Specifies the list of change IDs for a change details request. + */ + @JsonProperty(value = "changeIds", required = true) + private List changeIds; + + /** Creates an instance of ResourceChangeDetailsRequestParameters class. */ + public ResourceChangeDetailsRequestParameters() { + } + + /** + * Get the resourceIds property: Specifies the list of resources for a change details request. + * + * @return the resourceIds value. + */ + public List resourceIds() { + return this.resourceIds; + } + + /** + * Set the resourceIds property: Specifies the list of resources for a change details request. + * + * @param resourceIds the resourceIds value to set. + * @return the ResourceChangeDetailsRequestParameters object itself. + */ + public ResourceChangeDetailsRequestParameters withResourceIds(List resourceIds) { + this.resourceIds = resourceIds; + return this; + } + + /** + * Get the changeIds property: Specifies the list of change IDs for a change details request. + * + * @return the changeIds value. + */ + public List changeIds() { + return this.changeIds; + } + + /** + * Set the changeIds property: Specifies the list of change IDs for a change details request. + * + * @param changeIds the changeIds value to set. + * @return the ResourceChangeDetailsRequestParameters object itself. + */ + public ResourceChangeDetailsRequestParameters withChangeIds(List changeIds) { + this.changeIds = changeIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceIds() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resourceIds in model ResourceChangeDetailsRequestParameters")); + } + if (changeIds() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property changeIds in model ResourceChangeDetailsRequestParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceChangeDetailsRequestParameters.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java new file mode 100644 index 000000000000..b9fbc2f1986f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; +import java.util.List; + +/** An immutable client-side representation of ResourceChangeList. */ +public interface ResourceChangeList { + /** + * Gets the changes property: The pageable value returned by the operation, i.e. a list of changes to the resource. + * + *

- The list is ordered from the most recent changes to the least recent changes. - This list will be empty if + * there were no changes during the requested interval. - The `Before` snapshot timestamp value of the oldest change + * can be outside of the specified time interval. + * + * @return the changes value. + */ + List changes(); + + /** + * Gets the skipToken property: Skip token that encodes the skip information while executing the current request. + * + * @return the skipToken value. + */ + Object skipToken(); + + /** + * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner object. + * + * @return the inner object. + */ + ResourceChangeListInner innerModel(); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java new file mode 100644 index 000000000000..5db2ec4b608f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The parameters for a specific changes request. */ +@Fluent +public final class ResourceChangesRequestParameters { + /* + * Specifies the list of resources for a changes request. + */ + @JsonProperty(value = "resourceIds") + private List resourceIds; + + /* + * The subscription id of resources to query the changes from. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Specifies the date and time interval for a changes request. + */ + @JsonProperty(value = "interval", required = true) + private ResourceChangesRequestParametersInterval interval; + + /* + * Acts as the continuation token for paged responses. + */ + @JsonProperty(value = "$skipToken") + private String skipToken; + + /* + * The maximum number of changes the client can accept in a paged response. + */ + @JsonProperty(value = "$top") + private Integer top; + + /* + * The table name to query resources from. + */ + @JsonProperty(value = "table") + private String table; + + /* + * The flag if set to true will fetch property changes + */ + @JsonProperty(value = "fetchPropertyChanges") + private Boolean fetchPropertyChanges; + + /* + * The flag if set to true will fetch change snapshots + */ + @JsonProperty(value = "fetchSnapshots") + private Boolean fetchSnapshots; + + /** Creates an instance of ResourceChangesRequestParameters class. */ + public ResourceChangesRequestParameters() { + } + + /** + * Get the resourceIds property: Specifies the list of resources for a changes request. + * + * @return the resourceIds value. + */ + public List resourceIds() { + return this.resourceIds; + } + + /** + * Set the resourceIds property: Specifies the list of resources for a changes request. + * + * @param resourceIds the resourceIds value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withResourceIds(List resourceIds) { + this.resourceIds = resourceIds; + return this; + } + + /** + * Get the subscriptionId property: The subscription id of resources to query the changes from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription id of resources to query the changes from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the interval property: Specifies the date and time interval for a changes request. + * + * @return the interval value. + */ + public ResourceChangesRequestParametersInterval interval() { + return this.interval; + } + + /** + * Set the interval property: Specifies the date and time interval for a changes request. + * + * @param interval the interval value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withInterval(ResourceChangesRequestParametersInterval interval) { + this.interval = interval; + return this; + } + + /** + * Get the skipToken property: Acts as the continuation token for paged responses. + * + * @return the skipToken value. + */ + public String skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: Acts as the continuation token for paged responses. + * + * @param skipToken the skipToken value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withSkipToken(String skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Get the top property: The maximum number of changes the client can accept in a paged response. + * + * @return the top value. + */ + public Integer top() { + return this.top; + } + + /** + * Set the top property: The maximum number of changes the client can accept in a paged response. + * + * @param top the top value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get the table property: The table name to query resources from. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: The table name to query resources from. + * + * @param table the table value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the fetchPropertyChanges property: The flag if set to true will fetch property changes. + * + * @return the fetchPropertyChanges value. + */ + public Boolean fetchPropertyChanges() { + return this.fetchPropertyChanges; + } + + /** + * Set the fetchPropertyChanges property: The flag if set to true will fetch property changes. + * + * @param fetchPropertyChanges the fetchPropertyChanges value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withFetchPropertyChanges(Boolean fetchPropertyChanges) { + this.fetchPropertyChanges = fetchPropertyChanges; + return this; + } + + /** + * Get the fetchSnapshots property: The flag if set to true will fetch change snapshots. + * + * @return the fetchSnapshots value. + */ + public Boolean fetchSnapshots() { + return this.fetchSnapshots; + } + + /** + * Set the fetchSnapshots property: The flag if set to true will fetch change snapshots. + * + * @param fetchSnapshots the fetchSnapshots value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withFetchSnapshots(Boolean fetchSnapshots) { + this.fetchSnapshots = fetchSnapshots; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (interval() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property interval in model ResourceChangesRequestParameters")); + } else { + interval().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceChangesRequestParameters.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java new file mode 100644 index 000000000000..e6dd4a4bd24e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.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.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import java.time.OffsetDateTime; + +/** Specifies the date and time interval for a changes request. */ +@Fluent +public final class ResourceChangesRequestParametersInterval extends DateTimeInterval { + /** Creates an instance of ResourceChangesRequestParametersInterval class. */ + public ResourceChangesRequestParametersInterval() { + } + + /** {@inheritDoc} */ + @Override + public ResourceChangesRequestParametersInterval withStart(OffsetDateTime start) { + super.withStart(start); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangesRequestParametersInterval withEnd(OffsetDateTime end) { + super.withEnd(end); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java new file mode 100644 index 000000000000..776686cf803f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource property change. */ +@Fluent +public final class ResourcePropertyChange { + /* + * The property name + */ + @JsonProperty(value = "propertyName", required = true) + private String propertyName; + + /* + * The property value in before snapshot + */ + @JsonProperty(value = "beforeValue") + private String beforeValue; + + /* + * The property value in after snapshot + */ + @JsonProperty(value = "afterValue") + private String afterValue; + + /* + * The change category. + */ + @JsonProperty(value = "changeCategory", required = true) + private ChangeCategory changeCategory; + + /* + * The property change Type + */ + @JsonProperty(value = "propertyChangeType", required = true) + private PropertyChangeType propertyChangeType; + + /** Creates an instance of ResourcePropertyChange class. */ + public ResourcePropertyChange() { + } + + /** + * Get the propertyName property: The property name. + * + * @return the propertyName value. + */ + public String propertyName() { + return this.propertyName; + } + + /** + * Set the propertyName property: The property name. + * + * @param propertyName the propertyName value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withPropertyName(String propertyName) { + this.propertyName = propertyName; + return this; + } + + /** + * Get the beforeValue property: The property value in before snapshot. + * + * @return the beforeValue value. + */ + public String beforeValue() { + return this.beforeValue; + } + + /** + * Set the beforeValue property: The property value in before snapshot. + * + * @param beforeValue the beforeValue value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withBeforeValue(String beforeValue) { + this.beforeValue = beforeValue; + return this; + } + + /** + * Get the afterValue property: The property value in after snapshot. + * + * @return the afterValue value. + */ + public String afterValue() { + return this.afterValue; + } + + /** + * Set the afterValue property: The property value in after snapshot. + * + * @param afterValue the afterValue value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withAfterValue(String afterValue) { + this.afterValue = afterValue; + return this; + } + + /** + * Get the changeCategory property: The change category. + * + * @return the changeCategory value. + */ + public ChangeCategory changeCategory() { + return this.changeCategory; + } + + /** + * Set the changeCategory property: The change category. + * + * @param changeCategory the changeCategory value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withChangeCategory(ChangeCategory changeCategory) { + this.changeCategory = changeCategory; + return this; + } + + /** + * Get the propertyChangeType property: The property change Type. + * + * @return the propertyChangeType value. + */ + public PropertyChangeType propertyChangeType() { + return this.propertyChangeType; + } + + /** + * Set the propertyChangeType property: The property change Type. + * + * @param propertyChangeType the propertyChangeType value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withPropertyChangeType(PropertyChangeType propertyChangeType) { + this.propertyChangeType = propertyChangeType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (propertyName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property propertyName in model ResourcePropertyChange")); + } + if (changeCategory() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property changeCategory in model ResourcePropertyChange")); + } + if (propertyChangeType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property propertyChangeType in model ResourcePropertyChange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourcePropertyChange.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java index e01b3ef4a0fb..3223f540ddad 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java @@ -6,6 +6,8 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import java.util.List; +import java.util.Map; /** Resource collection API of ResourceProviders. */ public interface ResourceProviders { @@ -31,4 +33,75 @@ public interface ResourceProviders { * @return query result. */ QueryResponse resources(QueryRequest query); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any> along with {@link Response}. + */ + Response> resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @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 dictionary of <any>. + */ + Map resourcesHistory(ResourcesHistoryRequest request); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval along with {@link Response}. + */ + Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @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 changes associated with a resource over a specific time interval. + */ + ResourceChangeList resourceChanges(ResourceChangesRequestParameters parameters); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details along with {@link Response}. + */ + Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @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 resource change details. + */ + List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java new file mode 100644 index 000000000000..e291edfc8618 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.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.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Data on a specific resource snapshot. */ +@Fluent +public class ResourceSnapshotData { + /* + * The ID of the snapshot. + */ + @JsonProperty(value = "snapshotId") + private String snapshotId; + + /* + * The time when the snapshot was created. + * The snapshot timestamp provides an approximation as to when a modification to a resource was detected. There + * can be a difference between the actual modification time and the detection time. This is due to differences in + * how operations that modify a resource are processed, versus how operation that record resource snapshots are + * processed. + */ + @JsonProperty(value = "timestamp", required = true) + private OffsetDateTime timestamp; + + /* + * The resource snapshot content (in resourceChangeDetails response only). + */ + @JsonProperty(value = "content") + private Object content; + + /** Creates an instance of ResourceSnapshotData class. */ + public ResourceSnapshotData() { + } + + /** + * Get the snapshotId property: The ID of the snapshot. + * + * @return the snapshotId value. + */ + public String snapshotId() { + return this.snapshotId; + } + + /** + * Set the snapshotId property: The ID of the snapshot. + * + * @param snapshotId the snapshotId value to set. + * @return the ResourceSnapshotData object itself. + */ + public ResourceSnapshotData withSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + return this; + } + + /** + * Get the timestamp property: The time when the snapshot was created. The snapshot timestamp provides an + * approximation as to when a modification to a resource was detected. There can be a difference between the actual + * modification time and the detection time. This is due to differences in how operations that modify a resource are + * processed, versus how operation that record resource snapshots are processed. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The time when the snapshot was created. The snapshot timestamp provides an + * approximation as to when a modification to a resource was detected. There can be a difference between the actual + * modification time and the detection time. This is due to differences in how operations that modify a resource are + * processed, versus how operation that record resource snapshots are processed. + * + * @param timestamp the timestamp value to set. + * @return the ResourceSnapshotData object itself. + */ + public ResourceSnapshotData withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the content property: The resource snapshot content (in resourceChangeDetails response only). + * + * @return the content value. + */ + public Object content() { + return this.content; + } + + /** + * Set the content property: The resource snapshot content (in resourceChangeDetails response only). + * + * @param content the content value to set. + * @return the ResourceSnapshotData object itself. + */ + public ResourceSnapshotData withContent(Object content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timestamp() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timestamp in model ResourceSnapshotData")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceSnapshotData.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java new file mode 100644 index 000000000000..b3a8e26f67ee --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.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.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a history request to be executed. */ +@Fluent +public final class ResourcesHistoryRequest { + /* + * Azure subscriptions against which to execute the query. + */ + @JsonProperty(value = "subscriptions") + private List subscriptions; + + /* + * The resources query. + */ + @JsonProperty(value = "query") + private String query; + + /* + * The history request evaluation options + */ + @JsonProperty(value = "options") + private ResourcesHistoryRequestOptions options; + + /* + * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] + */ + @JsonProperty(value = "managementGroups") + private List managementGroups; + + /** Creates an instance of ResourcesHistoryRequest class. */ + public ResourcesHistoryRequest() { + } + + /** + * Get the subscriptions property: Azure subscriptions against which to execute the query. + * + * @return the subscriptions value. + */ + public List subscriptions() { + return this.subscriptions; + } + + /** + * Set the subscriptions property: Azure subscriptions against which to execute the query. + * + * @param subscriptions the subscriptions value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + return this; + } + + /** + * Get the query property: The resources query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The resources query. + * + * @param query the query value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the options property: The history request evaluation options. + * + * @return the options value. + */ + public ResourcesHistoryRequestOptions options() { + return this.options; + } + + /** + * Set the options property: The history request evaluation options. + * + * @param options the options value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withOptions(ResourcesHistoryRequestOptions options) { + this.options = options; + return this; + } + + /** + * Get the managementGroups property: Azure management groups against which to execute the query. Example: [ 'mg1', + * 'mg2' ]. + * + * @return the managementGroups value. + */ + public List managementGroups() { + return this.managementGroups; + } + + /** + * Set the managementGroups property: Azure management groups against which to execute the query. Example: [ 'mg1', + * 'mg2' ]. + * + * @param managementGroups the managementGroups value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withManagementGroups(List managementGroups) { + this.managementGroups = managementGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java new file mode 100644 index 000000000000..578cd6ef7a74 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.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.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The options for history request evaluation. */ +@Fluent +public final class ResourcesHistoryRequestOptions { + /* + * The time interval used to fetch history. + */ + @JsonProperty(value = "interval") + private DateTimeInterval interval; + + /* + * The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property + * is present. + */ + @JsonProperty(value = "$top") + private Integer top; + + /* + * The number of rows to skip from the beginning of the results. Overrides the next page offset when + * ```$skipToken``` property is present. + */ + @JsonProperty(value = "$skip") + private Integer skip; + + /* + * Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. + */ + @JsonProperty(value = "$skipToken") + private String skipToken; + + /* + * Defines in which format query result returned. + */ + @JsonProperty(value = "resultFormat") + private ResultFormat resultFormat; + + /** Creates an instance of ResourcesHistoryRequestOptions class. */ + public ResourcesHistoryRequestOptions() { + } + + /** + * Get the interval property: The time interval used to fetch history. + * + * @return the interval value. + */ + public DateTimeInterval interval() { + return this.interval; + } + + /** + * Set the interval property: The time interval used to fetch history. + * + * @param interval the interval value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withInterval(DateTimeInterval interval) { + this.interval = interval; + return this; + } + + /** + * Get the top property: The maximum number of rows that the query should return. Overrides the page size when + * ```$skipToken``` property is present. + * + * @return the top value. + */ + public Integer top() { + return this.top; + } + + /** + * Set the top property: The maximum number of rows that the query should return. Overrides the page size when + * ```$skipToken``` property is present. + * + * @param top the top value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get the skip property: The number of rows to skip from the beginning of the results. Overrides the next page + * offset when ```$skipToken``` property is present. + * + * @return the skip value. + */ + public Integer skip() { + return this.skip; + } + + /** + * Set the skip property: The number of rows to skip from the beginning of the results. Overrides the next page + * offset when ```$skipToken``` property is present. + * + * @param skip the skip value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withSkip(Integer skip) { + this.skip = skip; + return this; + } + + /** + * Get the skipToken property: Continuation token for pagination, capturing the next page size and offset, as well + * as the context of the query. + * + * @return the skipToken value. + */ + public String skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: Continuation token for pagination, capturing the next page size and offset, as well + * as the context of the query. + * + * @param skipToken the skipToken value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withSkipToken(String skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Get the resultFormat property: Defines in which format query result returned. + * + * @return the resultFormat value. + */ + public ResultFormat resultFormat() { + return this.resultFormat; + } + + /** + * Set the resultFormat property: Defines in which format query result returned. + * + * @param resultFormat the resultFormat value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withResultFormat(ResultFormat resultFormat) { + this.resultFormat = resultFormat; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (interval() != null) { + interval().validate(); + } + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Role.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Role.java new file mode 100644 index 000000000000..bb206182b6c6 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Role.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.resourcegraph.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The role which generates a specific message. Restricted to the user or assistant role. */ +public final class Role extends ExpandableStringEnum { + /** Static value user for Role. */ + public static final Role USER = fromString("user"); + + /** Static value assistant for Role. */ + public static final Role ASSISTANT = fromString("assistant"); + + /** Static value system for Role. */ + public static final Role SYSTEM = fromString("system"); + + /** + * Creates a new instance of Role value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Role() { + } + + /** + * Creates or finds a Role from its string representation. + * + * @param name a name to look for. + * @return the corresponding Role. + */ + @JsonCreator + public static Role fromString(String name) { + return fromString(name, Role.class); + } + + /** + * Gets known Role values. + * + * @return known Role values. + */ + public static Collection values() { + return values(Role.class); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/StatusCategory.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/StatusCategory.java new file mode 100644 index 000000000000..d552ff6a6810 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/StatusCategory.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Status Category. */ +public final class StatusCategory extends ExpandableStringEnum { + /** Static value Succeeded for StatusCategory. */ + public static final StatusCategory SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for StatusCategory. */ + public static final StatusCategory FAILED = fromString("Failed"); + + /** + * Creates a new instance of StatusCategory value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StatusCategory() { + } + + /** + * Creates or finds a StatusCategory from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusCategory. + */ + @JsonCreator + public static StatusCategory fromString(String name) { + return fromString(name, StatusCategory.class); + } + + /** + * Gets known StatusCategory values. + * + * @return known StatusCategory values. + */ + public static Collection values() { + return values(StatusCategory.class); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/StatusResponse.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/StatusResponse.java new file mode 100644 index 000000000000..5f4c79d64a0d --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/StatusResponse.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Status. */ +@Fluent +public final class StatusResponse { + /* + * Status category for query generation result + */ + @JsonProperty(value = "category", required = true) + private StatusCategory category; + + /* + * Status message for query generation result + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** Creates an instance of StatusResponse class. */ + public StatusResponse() { + } + + /** + * Get the category property: Status category for query generation result. + * + * @return the category value. + */ + public StatusCategory category() { + return this.category; + } + + /** + * Set the category property: Status category for query generation result. + * + * @param category the category value to set. + * @return the StatusResponse object itself. + */ + public StatusResponse withCategory(StatusCategory category) { + this.category = category; + return this; + } + + /** + * Get the message property: Status message for query generation result. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Status message for query generation result. + * + * @param message the message value to set. + * @return the StatusResponse object itself. + */ + public StatusResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (category() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property category in model StatusResponse")); + } + if (message() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property message in model StatusResponse")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StatusResponse.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java index 49bfe7fbb5f1..d684b96b2f97 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java @@ -4,12 +4,10 @@ package com.azure.resourcemanager.resourcegraph.generated; -import com.azure.core.util.Context; - /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/OperationsList.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/OperationsList.json */ /** * Sample code: OperationsList. @@ -17,6 +15,6 @@ public final class OperationsListSamples { * @param manager Entry point to ResourceGraphManager. */ public static void operationsList(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.operations().list(Context.NONE); + manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/QueryGenerateQuerySamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/QueryGenerateQuerySamples.java new file mode 100644 index 000000000000..d270f316700f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/QueryGenerateQuerySamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.resourcemanager.resourcegraph.models.HistoryContext; +import com.azure.resourcemanager.resourcegraph.models.QueryGenerationRequest; +import com.azure.resourcemanager.resourcegraph.models.Role; +import java.util.Arrays; + +/** Samples for Query GenerateQuery. */ +public final class QueryGenerateQuerySamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesGenerateQuery.json + */ + /** + * Sample code: Succeeded ARG Query Generation. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void succeededARGQueryGeneration( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .queries() + .generateQueryWithResponse( + new QueryGenerationRequest().withPrompt("I want to see my virtual machines"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesGenerateQueryNoGeneration.json + */ + /** + * Sample code: Failed ARG Query Generation. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void failedARGQueryGeneration(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .queries() + .generateQueryWithResponse( + new QueryGenerationRequest().withPrompt("What is the weather today?"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesGenerateQueryWithHistory.json + */ + /** + * Sample code: ARG Query Generation with history. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void aRGQueryGenerationWithHistory( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .queries() + .generateQueryWithResponse( + new QueryGenerationRequest() + .withHistory( + Arrays + .asList( + new HistoryContext().withContent("I want all my virtual machines").withRole(Role.USER), + new HistoryContext() + .withContent("Resources | where type =~ 'Microsoft.Compute/virtualMachines'") + .withRole(Role.ASSISTANT))) + .withPrompt("I want to see only 5 of my virtual machines"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangeDetailsSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangeDetailsSamples.java new file mode 100644 index 000000000000..165d1aa24592 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangeDetailsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChangeDetails. */ +public final class ResourceProviderResourceChangeDetailsSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangeDetails.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangeDetailsWithResponse( + new ResourceChangeDetailsRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withChangeIds(Arrays.asList("53dc0515-b86b-4bc2-979b-e4694ab4a556")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangesSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangesSamples.java new file mode 100644 index 000000000000..3c63ccdb180e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangesSamples.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParametersInterval; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChanges. */ +public final class ResourceProviderResourceChangesSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChanges.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesNextPage.json + */ + /** + * Sample code: Next page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withSkipToken("fakeTokenPlaceholder") + .withTop(2), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesFirstPage.json + */ + /** + * Sample code: First page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withTop(2), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesHistorySamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesHistorySamples.java new file mode 100644 index 000000000000..c23a653255c4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesHistorySamples.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.resourcemanager.resourcegraph.models.DateTimeInterval; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequestOptions; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourcesHistory. */ +public final class ResourceProviderResourcesHistorySamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ + /** + * Sample code: Resource History Management Group scope Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryManagementGroupScopeQuery( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))) + .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ + /** + * Sample code: Resource History Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withSubscriptions(Arrays.asList("a7f33fdb-e646-4f15-89aa-3a360210861e")) + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java index 73c1478468d1..ea267279e97a 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.resourcegraph.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.resourcegraph.models.FacetRequest; import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; @@ -15,7 +14,7 @@ /** Samples for ResourceProvider Resources. */ public final class ResourceProviderResourcesSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesMgBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesMgBasicQuery.json */ /** * Sample code: Basic management group query. @@ -29,11 +28,11 @@ public static void basicManagementGroupQuery(com.azure.resourcemanager.resourceg new QueryRequest() .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")) .withQuery("Resources | project id, name, type, location, tags | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesBasicQuery.json */ /** * Sample code: Basic query. @@ -47,11 +46,11 @@ public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGr new QueryRequest() .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | project id, name, type, location, tags | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFacetQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesFacetQuery.json */ /** * Sample code: Query with a facet request. @@ -95,11 +94,11 @@ public static void queryWithAFacetRequest(com.azure.resourcemanager.resourcegrap new FacetRequestOptions() .withFilter("resourceGroup contains 'test'") .withTop(3)))), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFilterQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesFilterQuery.json */ /** * Sample code: Filter resources. @@ -115,11 +114,11 @@ public static void filterResources(com.azure.resourcemanager.resourcegraph.Resou .withQuery( "Resources | project id, name, type, location | where type =~" + " 'Microsoft.Compute/virtualMachines' | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesSummarizeQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesSummarizeQuery.json */ /** * Sample code: Summarize resources by location. @@ -134,11 +133,11 @@ public static void summarizeResourcesByLocation( new QueryRequest() .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | project id, name, type, location | summarize by location"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesPropertiesQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesPropertiesQuery.json */ /** * Sample code: Access a properties field. @@ -154,11 +153,11 @@ public static void accessAPropertiesField(com.azure.resourcemanager.resourcegrap .withQuery( "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by" + " tostring(properties.storageProfile.osDisk.osType)"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesComplexQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesComplexQuery.json */ /** * Sample code: Complex query. @@ -174,11 +173,11 @@ public static void complexQuery(com.azure.resourcemanager.resourcegraph.Resource .withQuery( "Resources | project id, name, type, location | where type =~" + " 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesNextPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesNextPageQuery.json */ /** * Sample code: Next page query. @@ -192,14 +191,12 @@ public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.Resourc new QueryRequest() .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | where name contains 'test' | project id, name, type, location") - .withOptions( - new QueryRequestOptions() - .withSkipToken("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==")), - Context.NONE); + .withOptions(new QueryRequestOptions().withSkipToken("fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFirstPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesFirstPageQuery.json */ /** * Sample code: First page query. @@ -214,11 +211,11 @@ public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.Resour .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | where name contains 'test' | project id, name, type, location") .withOptions(new QueryRequestOptions().withTop(3).withSkip(0)), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesTenantBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesTenantBasicQuery.json */ /** * Sample code: Basic tenant query. @@ -230,11 +227,11 @@ public static void basicTenantQuery(com.azure.resourcemanager.resourcegraph.Reso .resourceProviders() .resourcesWithResponse( new QueryRequest().withQuery("Resources | project id, name, type, location, tags | limit 3"), - Context.NONE); + com.azure.core.util.Context.NONE); } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesRandomPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2023-09-01-preview/examples/ResourcesRandomPageQuery.json */ /** * Sample code: Random page query. @@ -249,6 +246,6 @@ public static void randomPageQuery(com.azure.resourcemanager.resourcegraph.Resou .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) .withQuery("Resources | where name contains 'test' | project id, name, type, location") .withOptions(new QueryRequestOptions().withTop(2).withSkip(10)), - Context.NONE); + com.azure.core.util.Context.NONE); } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetRequestOptionsTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetRequestOptionsTests.java deleted file mode 100644 index 4721c5f99b54..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetRequestOptionsTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; -import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class FacetRequestOptionsTests { - @Test - public void testDeserialize() { - FacetRequestOptions model = - BinaryData - .fromString("{\"sortBy\":\"ufo\",\"sortOrder\":\"asc\",\"filter\":\"wifsq\",\"$top\":1701108276}") - .toObject(FacetRequestOptions.class); - Assertions.assertEquals("ufo", model.sortBy()); - Assertions.assertEquals(FacetSortOrder.ASC, model.sortOrder()); - Assertions.assertEquals("wifsq", model.filter()); - Assertions.assertEquals(1701108276, model.top()); - } - - @Test - public void testSerialize() { - FacetRequestOptions model = - new FacetRequestOptions() - .withSortBy("ufo") - .withSortOrder(FacetSortOrder.ASC) - .withFilter("wifsq") - .withTop(1701108276); - model = BinaryData.fromObject(model).toObject(FacetRequestOptions.class); - Assertions.assertEquals("ufo", model.sortBy()); - Assertions.assertEquals(FacetSortOrder.ASC, model.sortOrder()); - Assertions.assertEquals("wifsq", model.filter()); - Assertions.assertEquals(1701108276, model.top()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetRequestTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetRequestTests.java deleted file mode 100644 index 175cafeb1d12..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetRequestTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.models.FacetRequest; -import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; -import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class FacetRequestTests { - @Test - public void testDeserialize() { - FacetRequest model = - BinaryData - .fromString( - "{\"expression\":\"soqijg\",\"options\":{\"sortBy\":\"bpazlobcufpdzn\",\"sortOrder\":\"asc\",\"filter\":\"qqjnqgl\",\"$top\":2127527772}}") - .toObject(FacetRequest.class); - Assertions.assertEquals("soqijg", model.expression()); - Assertions.assertEquals("bpazlobcufpdzn", model.options().sortBy()); - Assertions.assertEquals(FacetSortOrder.ASC, model.options().sortOrder()); - Assertions.assertEquals("qqjnqgl", model.options().filter()); - Assertions.assertEquals(2127527772, model.options().top()); - } - - @Test - public void testSerialize() { - FacetRequest model = - new FacetRequest() - .withExpression("soqijg") - .withOptions( - new FacetRequestOptions() - .withSortBy("bpazlobcufpdzn") - .withSortOrder(FacetSortOrder.ASC) - .withFilter("qqjnqgl") - .withTop(2127527772)); - model = BinaryData.fromObject(model).toObject(FacetRequest.class); - Assertions.assertEquals("soqijg", model.expression()); - Assertions.assertEquals("bpazlobcufpdzn", model.options().sortBy()); - Assertions.assertEquals(FacetSortOrder.ASC, model.options().sortOrder()); - Assertions.assertEquals("qqjnqgl", model.options().filter()); - Assertions.assertEquals(2127527772, model.options().top()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetResultTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetResultTests.java deleted file mode 100644 index 80643f0ccaf5..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetResultTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.models.FacetResult; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class FacetResultTests { - @Test - public void testDeserialize() { - FacetResult model = - BinaryData - .fromString( - "{\"resultType\":\"FacetResult\",\"totalRecords\":8819753813869121711,\"count\":1725970823,\"expression\":\"qnjaqwix\"}") - .toObject(FacetResult.class); - Assertions.assertEquals("qnjaqwix", model.expression()); - Assertions.assertEquals(8819753813869121711L, model.totalRecords()); - Assertions.assertEquals(1725970823, model.count()); - } - - @Test - public void testSerialize() { - FacetResult model = - new FacetResult().withExpression("qnjaqwix").withTotalRecords(8819753813869121711L).withCount(1725970823); - model = BinaryData.fromObject(model).toObject(FacetResult.class); - Assertions.assertEquals("qnjaqwix", model.expression()); - Assertions.assertEquals(8819753813869121711L, model.totalRecords()); - Assertions.assertEquals(1725970823, model.count()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetTests.java deleted file mode 100644 index b4eb70e5bf54..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/FacetTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.models.Facet; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class FacetTests { - @Test - public void testDeserialize() { - Facet model = BinaryData.fromString("{\"resultType\":\"Facet\",\"expression\":\"j\"}").toObject(Facet.class); - Assertions.assertEquals("j", model.expression()); - } - - @Test - public void testSerialize() { - Facet model = new Facet().withExpression("j"); - model = BinaryData.fromObject(model).toObject(Facet.class); - Assertions.assertEquals("j", model.expression()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationDisplayTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationDisplayTests.java deleted file mode 100644 index 1e9fae20a9dc..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationDisplayTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OperationDisplayTests { - @Test - public void testDeserialize() { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"nchgej\",\"resource\":\"odmailzyd\",\"operation\":\"o\",\"description\":\"yahux\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("nchgej", model.provider()); - Assertions.assertEquals("odmailzyd", model.resource()); - Assertions.assertEquals("o", model.operation()); - Assertions.assertEquals("yahux", model.description()); - } - - @Test - public void testSerialize() { - OperationDisplay model = - new OperationDisplay() - .withProvider("nchgej") - .withResource("odmailzyd") - .withOperation("o") - .withDescription("yahux"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("nchgej", model.provider()); - Assertions.assertEquals("odmailzyd", model.resource()); - Assertions.assertEquals("o", model.operation()); - Assertions.assertEquals("yahux", model.description()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationInnerTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationInnerTests.java deleted file mode 100644 index 17fe01cbd71e..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationInnerTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import com.azure.resourcemanager.resourcegraph.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OperationInnerTests { - @Test - public void testDeserialize() { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"iwbybrkxvdumjg\",\"display\":{\"provider\":\"wvukx\",\"resource\":\"udccsnhsjc\",\"operation\":\"ejhkry\",\"description\":\"napczwlokjy\"},\"origin\":\"kkvnipjox\"}") - .toObject(OperationInner.class); - Assertions.assertEquals("iwbybrkxvdumjg", model.name()); - Assertions.assertEquals("wvukx", model.display().provider()); - Assertions.assertEquals("udccsnhsjc", model.display().resource()); - Assertions.assertEquals("ejhkry", model.display().operation()); - Assertions.assertEquals("napczwlokjy", model.display().description()); - Assertions.assertEquals("kkvnipjox", model.origin()); - } - - @Test - public void testSerialize() { - OperationInner model = - new OperationInner() - .withName("iwbybrkxvdumjg") - .withDisplay( - new OperationDisplay() - .withProvider("wvukx") - .withResource("udccsnhsjc") - .withOperation("ejhkry") - .withDescription("napczwlokjy")) - .withOrigin("kkvnipjox"); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals("iwbybrkxvdumjg", model.name()); - Assertions.assertEquals("wvukx", model.display().provider()); - Assertions.assertEquals("udccsnhsjc", model.display().resource()); - Assertions.assertEquals("ejhkry", model.display().operation()); - Assertions.assertEquals("napczwlokjy", model.display().description()); - Assertions.assertEquals("kkvnipjox", model.origin()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationListResultTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationListResultTests.java deleted file mode 100644 index bb0b7d2c5318..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationListResultTests.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import com.azure.resourcemanager.resourcegraph.models.OperationDisplay; -import com.azure.resourcemanager.resourcegraph.models.OperationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OperationListResultTests { - @Test - public void testDeserialize() { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"siznto\",\"display\":{\"provider\":\"a\",\"resource\":\"ajpsquc\",\"operation\":\"o\",\"description\":\"dkfo\"},\"origin\":\"nygj\"},{\"name\":\"jddeqsrdeupewnw\",\"display\":{\"provider\":\"tjzyflus\",\"resource\":\"hmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"txukcdmp\"},{\"name\":\"cryuan\",\"display\":{\"provider\":\"xzdxtayrlhmwh\",\"resource\":\"mrqobmtukknr\",\"operation\":\"tihfx\",\"description\":\"jbpzvgnwzsymg\"},\"origin\":\"uf\"},{\"name\":\"zk\",\"display\":{\"provider\":\"bihanuf\",\"resource\":\"cbjy\",\"operation\":\"git\",\"description\":\"qhabifpikxwcz\"},\"origin\":\"scnpqxuhivy\"}]}") - .toObject(OperationListResult.class); - Assertions.assertEquals("siznto", model.value().get(0).name()); - Assertions.assertEquals("a", model.value().get(0).display().provider()); - Assertions.assertEquals("ajpsquc", model.value().get(0).display().resource()); - Assertions.assertEquals("o", model.value().get(0).display().operation()); - Assertions.assertEquals("dkfo", model.value().get(0).display().description()); - Assertions.assertEquals("nygj", model.value().get(0).origin()); - } - - @Test - public void testSerialize() { - OperationListResult model = - new OperationListResult() - .withValue( - Arrays - .asList( - new OperationInner() - .withName("siznto") - .withDisplay( - new OperationDisplay() - .withProvider("a") - .withResource("ajpsquc") - .withOperation("o") - .withDescription("dkfo")) - .withOrigin("nygj"), - new OperationInner() - .withName("jddeqsrdeupewnw") - .withDisplay( - new OperationDisplay() - .withProvider("tjzyflus") - .withResource("hmofc") - .withOperation("smy") - .withDescription("kdtmlxhekuk")) - .withOrigin("txukcdmp"), - new OperationInner() - .withName("cryuan") - .withDisplay( - new OperationDisplay() - .withProvider("xzdxtayrlhmwh") - .withResource("mrqobmtukknr") - .withOperation("tihfx") - .withDescription("jbpzvgnwzsymg")) - .withOrigin("uf"), - new OperationInner() - .withName("zk") - .withDisplay( - new OperationDisplay() - .withProvider("bihanuf") - .withResource("cbjy") - .withOperation("git") - .withDescription("qhabifpikxwcz")) - .withOrigin("scnpqxuhivy"))); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - Assertions.assertEquals("siznto", model.value().get(0).name()); - Assertions.assertEquals("a", model.value().get(0).display().provider()); - Assertions.assertEquals("ajpsquc", model.value().get(0).display().resource()); - Assertions.assertEquals("o", model.value().get(0).display().operation()); - Assertions.assertEquals("dkfo", model.value().get(0).display().description()); - Assertions.assertEquals("nygj", model.value().get(0).origin()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListMockTests.java deleted file mode 100644 index f2d03196642d..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListMockTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import com.azure.resourcemanager.resourcegraph.models.Operation; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"t\",\"display\":{\"provider\":\"dvpjhulsuuvmk\",\"resource\":\"zkrwfn\",\"operation\":\"odjpslwejd\",\"description\":\"wryoqpsoacc\"},\"origin\":\"zakljlahbc\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ResourceGraphManager manager = - ResourceGraphManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(Context.NONE); - - Assertions.assertEquals("t", response.iterator().next().name()); - Assertions.assertEquals("dvpjhulsuuvmk", response.iterator().next().display().provider()); - Assertions.assertEquals("zkrwfn", response.iterator().next().display().resource()); - Assertions.assertEquals("odjpslwejd", response.iterator().next().display().operation()); - Assertions.assertEquals("wryoqpsoacc", response.iterator().next().display().description()); - Assertions.assertEquals("zakljlahbc", response.iterator().next().origin()); - } -}