diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md index 41b67def351a..882959c61723 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md @@ -1,14 +1,135 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.2.0-beta.1 (2026-05-09) -### Features Added +- Azure Resource Manager ResourceGraph client library for Java. This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package api-version ResourceChanges: 2020-09-01-preview, ResourceGraphApi: 2024-04-01, ResourceHistory: 2021-06-01-preview, GraphQueryApi: 2024-04-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.GraphQueryUpdateParameters` was removed + +#### `models.GraphQueryResource` was removed + +#### `models.Operation` was removed + +#### `models.GraphQueryResource$Definition` was removed + +#### `models.GraphQueryResource$DefinitionStages` was removed + +#### `models.Operations` was removed + +#### `models.GraphQueryListResult` was removed + +#### `models.GraphQueryResource$UpdateStages` was removed + +#### `models.ResultKind` was removed + +#### `models.OperationListResult` was removed + +#### `models.GraphQueryResource$Update` was removed + +#### `models.GraphQueries` was removed + +#### `models.OperationDisplay` was removed + +#### `models.FacetError` was modified + +* `FacetError()` was changed to private access +* `validate()` was removed +* `withExpression(java.lang.String)` was removed +* `withErrors(java.util.List)` was removed + +#### `models.FacetResult` was modified + +* `FacetResult()` was changed to private access +* `withCount(int)` was removed +* `withExpression(java.lang.String)` was removed +* `withTotalRecords(long)` was removed +* `validate()` was removed +* `withData(java.lang.Object)` was removed + +#### `ResourceGraphManager` was modified + +* `fluent.ResourceGraphClient serviceClient()` -> `fluent.ResourceGraphManagementClient serviceClient()` +* `graphQueries()` was removed +* `operations()` was removed + +#### `models.FacetRequestOptions` was modified + +* `validate()` was removed + +#### `models.Facet` was modified + +* `validate()` was removed +* `models.Facet withExpression(java.lang.String)` -> `models.Facet withExpression(java.lang.String)` + +#### `models.ErrorDetails` was modified + +* `ErrorDetails()` was changed to private access +* `withAdditionalProperties(java.util.Map)` was removed +* `withMessage(java.lang.String)` was removed +* `validate()` was removed +* `withCode(java.lang.String)` was removed + +#### `models.FacetRequest` was modified + +* `validate()` was removed + +#### `models.QueryRequestOptions` was modified + +* `validate()` was removed + +#### `models.QueryRequest` was modified + +* `validate()` was removed + +### Features Added + +* `models.ResourcesHistoryRequest` was added + +* `models.ResourceSnapshotData` was added + +* `models.DateTimeInterval` was added + +* `models.ChangeCategory` was added + +* `models.ResourceChangeDetailsRequestParameters` was added + +* `models.ResourceChangeData` was added + +* `models.ResourceChangesRequestParameters` was added + +* `models.ChangeType` was added + +* `models.ResourceChangesRequestParametersInterval` was added + +* `models.ResourceChangeDataBeforeSnapshot` was added + +* `models.ResourcesHistoryRequestOptions` was added + +* `models.ResourceChangeDataAfterSnapshot` was added + +* `models.ResourcePropertyChange` was added + +* `models.AuthorizationScopeFilter` was added + +* `models.PropertyChangeType` was added + +* `models.ResourceChangeList` was added + +#### `models.ResourceProviders` was modified + +* `resourceChangesWithResponse(models.ResourceChangesRequestParameters,com.azure.core.util.Context)` was added +* `resourcesHistoryWithResponse(models.ResourcesHistoryRequest,com.azure.core.util.Context)` was added +* `resourceChangeDetails(models.ResourceChangeDetailsRequestParameters)` was added +* `resourceChangeDetailsWithResponse(models.ResourceChangeDetailsRequestParameters,com.azure.core.util.Context)` was added +* `resourceChanges(models.ResourceChangesRequestParameters)` was added +* `resourcesHistory(models.ResourcesHistoryRequest)` was added + +#### `models.QueryRequestOptions` was modified -### Other Changes +* `withAuthorizationScopeFilter(models.AuthorizationScopeFilter)` was added +* `authorizationScopeFilter()` was added ## 1.1.0 (2024-12-06) diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md index 83254ecd5402..05512de7e9af 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 api-version ResourceChanges: 2020-09-01-preview, ResourceGraphApi: 2024-04-01, ResourceHistory: 2021-06-01-preview, GraphQueryApi: 2024-04-01. 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 @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ ResourceGraphManager manager = ResourceGraphManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -113,5 +113,3 @@ 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/ - - diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md index 3357edcd9024..24943eded9f4 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md @@ -1,258 +1,54 @@ # Code snippets and samples -## GraphQuery - -- [CreateOrUpdate](#graphquery_createorupdate) -- [Delete](#graphquery_delete) -- [GetByResourceGroup](#graphquery_getbyresourcegroup) -- [List](#graphquery_list) -- [ListByResourceGroup](#graphquery_listbyresourcegroup) -- [Update](#graphquery_update) - -## Operations - -- [List](#operations_list) - ## ResourceProvider -- [Resources](#resourceprovider_resources) -### GraphQuery_CreateOrUpdate - -```java -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for GraphQuery CreateOrUpdate. - */ -public final class GraphQueryCreateOrUpdateSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryAdd. - * json - */ - /** - * Sample code: Create Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void createGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .define("MyDockerVMs") - .withRegion((String) null) - .withExistingResourceGroup("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group") - .withTags(mapOf()) - .withDescription("Docker VMs in PROD") - .withQuery("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'") - .create(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} -``` - -### GraphQuery_Delete +- [ResourceChangeDetails](#resourceprovider_resourcechangedetails) +- [ResourceChanges](#resourceprovider_resourcechanges) +- [ResourcesHistory](#resourceprovider_resourceshistory) +### ResourceProvider_ResourceChangeDetails ```java -/** - * Samples for GraphQuery Delete. - */ -public final class GraphQueryDeleteSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryDelete. - * json - */ - /** - * Sample code: Delete Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void deleteGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .deleteWithResponse("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", "MyDockerVM", - com.azure.core.util.Context.NONE); - } -} -``` - -### GraphQuery_GetByResourceGroup - -```java -/** - * Samples for GraphQuery GetByResourceGroup. - */ -public final class GraphQueryGetByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryGet. - * json - */ - /** - * Sample code: Get Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void getGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .getByResourceGroupWithResponse("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", "MyDockerVMs", - com.azure.core.util.Context.NONE); - } -} -``` - -### GraphQuery_List - -```java -/** - * Samples for GraphQuery List. - */ -public final class GraphQueryListSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryList. - * json - */ - /** - * Sample code: Get a list of Graph Queries. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void getAListOfGraphQueries(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries().list("024e2271-06fa-46b6-9079-f1ed3c7b070e", com.azure.core.util.Context.NONE); - } -} -``` - -### GraphQuery_ListByResourceGroup +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.util.Arrays; -```java /** - * Samples for GraphQuery ListByResourceGroup. + * Samples for ResourceProvider ResourceChangeDetails. */ -public final class GraphQueryListByResourceGroupSamples { +public final class ResourceProviderResourceChangeDetailsSamples { /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryList. - * json + * x-ms-original-file: 2020-09-01-preview/ResourceChangeDetails.json */ /** - * Sample code: Get a list of Graph Queries. + * Sample code: Basic query. * * @param manager Entry point to ResourceGraphManager. */ - public static void getAListOfGraphQueries(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .listByResourceGroup("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", + 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); } } ``` -### GraphQuery_Update +### ResourceProvider_ResourceChanges ```java -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; - -/** - * Samples for GraphQuery Update. - */ -public final class GraphQueryUpdateSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryUpdate. - * json - */ - /** - * Sample code: Update Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void updateGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - GraphQueryResource resource = manager.graphQueries() - .getByResourceGroupWithResponse("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", "MyDockerVMs", - com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withEtag("b0809832-ca62-4133-8f13-0c46580f9db1") - .withDescription("Modified description") - .withQuery("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'") - .apply(); - } -} -``` - -### Operations_List - -```java -/** - * 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 - */ - /** - * Sample code: OperationsList. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void operationsList(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); - } -} -``` - -### ResourceProvider_Resources - -```java -import com.azure.resourcemanager.resourcegraph.models.FacetRequest; -import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; -import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; -import com.azure.resourcemanager.resourcegraph.models.QueryRequest; -import com.azure.resourcemanager.resourcegraph.models.QueryRequestOptions; +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 Resources. + * Samples for ResourceProvider ResourceChanges. */ -public final class ResourceProviderResourcesSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesMgBasicQuery.json - */ - /** - * Sample code: Basic management group query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void basicManagementGroupQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest() - .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")) - .withQuery("Resources | project id, name, type, location, tags | limit 3"), - com.azure.core.util.Context.NONE); - } - +public final class ResourceProviderResourceChangesSamples { /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesBasicQuery.json + * x-ms-original-file: 2020-09-01-preview/ResourceChanges.json */ /** * Sample code: Basic query. @@ -261,125 +57,16 @@ public final class ResourceProviderResourcesSamples { */ public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery("Resources | project id, name, type, location, tags | limit 3"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesFacetQuery.json - */ - /** - * Sample code: Query with a facet request. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void queryWithAFacetRequest(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5") - .withFacets(Arrays.asList( - new FacetRequest().withExpression("location") - .withOptions(new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), - new FacetRequest().withExpression("properties.storageProfile.osDisk.osType") - .withOptions(new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), - new FacetRequest().withExpression("nonExistingColumn") - .withOptions(new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), - new FacetRequest().withExpression("resourceGroup") - .withOptions(new FacetRequestOptions().withSortBy("tolower(resourceGroup)") - .withSortOrder(FacetSortOrder.ASC) - .withTop(3)), - new FacetRequest().withExpression("resourceGroup") - .withOptions( - new FacetRequestOptions().withFilter("resourceGroup contains 'test'").withTop(3)))), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesFilterQuery.json - */ - /** - * Sample code: Filter resources. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void filterResources(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3"), + .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/stable/2021-03-01/examples/ - * ResourcesSummarizeQuery.json - */ - /** - * Sample code: Summarize resources by location. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void - summarizeResourcesByLocation(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery("Resources | project id, name, type, location | summarize by location"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesPropertiesQuery.json - */ - /** - * Sample code: Access a properties field. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void accessAPropertiesField(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesComplexQuery.json - */ - /** - * Sample code: Complex query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void complexQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"), - 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: 2020-09-01-preview/ResourceChangesNextPage.json */ /** * Sample code: Next page query. @@ -388,17 +75,17 @@ public final class ResourceProviderResourcesSamples { */ public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { manager.resourceProviders() - .resourcesWithResponse( - 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("fakeTokenPlaceholder")), - com.azure.core.util.Context.NONE); + .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/stable/2021-03-01/examples/ - * ResourcesFirstPageQuery.json + * x-ms-original-file: 2020-09-01-preview/ResourceChangesFirstPage.json */ /** * Sample code: First page query. @@ -407,46 +94,66 @@ public final class ResourceProviderResourcesSamples { */ public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().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)), - com.azure.core.util.Context.NONE); + .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); } +} +``` + +### 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/stable/2021-03-01/examples/ - * ResourcesTenantBasicQuery.json + * x-ms-original-file: 2021-06-01-preview/ResourcesHistoryMgsGet.json */ /** - * Sample code: Basic tenant query. + * Sample code: Resource History Management Group scope Query. * * @param manager Entry point to ResourceGraphManager. */ - public static void basicTenantQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + public static void + resourceHistoryManagementGroupScopeQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().withQuery("Resources | project id, name, type, location, tags | limit 3"), + .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/stable/2021-03-01/examples/ - * ResourcesRandomPageQuery.json + * x-ms-original-file: 2021-06-01-preview/ResourcesHistoryGet.json */ /** - * Sample code: Random page query. + * Sample code: Resource History Query. * * @param manager Entry point to ResourceGraphManager. */ - public static void randomPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + public static void resourceHistoryQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().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)), + .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 c1607dd21f35..1236ccafb0e5 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml @@ -1,9 +1,9 @@ - + 4.0.0 com.azure @@ -18,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 api-version ResourceChanges: 2020-09-01-preview, ResourceGraphApi: 2024-04-01, ResourceHistory: 2021-06-01-preview, GraphQueryApi: 2024-04-01. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ UTF-8 0 0 - false + 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 d6a7c1f721ff..3525286dbc9e 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph; @@ -22,19 +22,17 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphClient; -import com.azure.resourcemanager.resourcegraph.implementation.GraphQueriesImpl; -import com.azure.resourcemanager.resourcegraph.implementation.OperationsImpl; -import com.azure.resourcemanager.resourcegraph.implementation.ResourceGraphClientBuilder; +import com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphManagementClient; +import com.azure.resourcemanager.resourcegraph.implementation.ResourceGraphManagementClientBuilder; import com.azure.resourcemanager.resourcegraph.implementation.ResourceProvidersImpl; -import com.azure.resourcemanager.resourcegraph.models.GraphQueries; -import com.azure.resourcemanager.resourcegraph.models.Operations; import com.azure.resourcemanager.resourcegraph.models.ResourceProviders; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -45,16 +43,12 @@ public final class ResourceGraphManager { private ResourceProviders resourceProviders; - private Operations operations; - - private GraphQueries graphQueries; - - private final ResourceGraphClient clientObject; + private final ResourceGraphManagementClient clientObject; private ResourceGraphManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ResourceGraphClientBuilder().pipeline(httpPipeline) + this.clientObject = new ResourceGraphManagementClientBuilder().pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) .defaultPollInterval(defaultPollInterval) .buildClient(); @@ -100,6 +94,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-resourcegraph.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -207,12 +204,14 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.resourcegraph") .append("/") - .append("1.1.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -271,36 +270,12 @@ public ResourceProviders resourceProviders() { } /** - * Gets the resource collection API of Operations. - * - * @return Resource collection API of Operations. - */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); - } - return operations; - } - - /** - * Gets the resource collection API of GraphQueries. It manages GraphQueryResource. - * - * @return Resource collection API of GraphQueries. - */ - public GraphQueries graphQueries() { - if (this.graphQueries == null) { - this.graphQueries = new GraphQueriesImpl(clientObject.getGraphQueries(), this); - } - return graphQueries; - } - - /** - * Gets wrapped service client ResourceGraphClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets wrapped service client ResourceGraphManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. * - * @return Wrapped service client ResourceGraphClient. + * @return Wrapped service client ResourceGraphManagementClient. */ - public ResourceGraphClient serviceClient() { + public ResourceGraphManagementClient serviceClient() { return this.clientObject; } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/GraphQueriesClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/GraphQueriesClient.java deleted file mode 100644 index 4fd7133340f9..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/GraphQueriesClient.java +++ /dev/null @@ -1,200 +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.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryUpdateParameters; - -/** - * An instance of this class provides access to all the operations defined in GraphQueriesClient. - */ -public interface GraphQueriesClient { - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String subscriptionId); - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String subscriptionId, Context context); - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName); - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName, - Context context); - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, Context context); - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - GraphQueryResourceInner getByResourceGroup(String subscriptionId, String resourceGroupName, String resourceName); - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String subscriptionId, String resourceGroupName, String resourceName, - Context context); - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String subscriptionId, String resourceGroupName, String resourceName); - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, GraphQueryResourceInner properties, Context context); - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - GraphQueryResourceInner createOrUpdate(String subscriptionId, String resourceGroupName, String resourceName, - GraphQueryResourceInner properties); - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, GraphQueryUpdateParameters body, Context context); - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - GraphQueryResourceInner update(String subscriptionId, String resourceGroupName, String resourceName, - GraphQueryUpdateParameters body); -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java deleted file mode 100644 index f8983340695d..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java +++ /dev/null @@ -1,38 +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.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public interface OperationsClient { - /** - * Lists all of the available REST API operations. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * Lists all of the available REST API operations. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); -} 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/ResourceGraphManagementClient.java similarity index 56% rename from sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java rename to sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphManagementClient.java index f5b27a5b2543..5df2854ce540 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/ResourceGraphManagementClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.fluent; @@ -8,23 +8,16 @@ import java.time.Duration; /** - * The interface for ResourceGraphClient class. + * The interface for ResourceGraphManagementClient class. */ -public interface ResourceGraphClient { +public interface ResourceGraphManagementClient { /** - * Gets server parameter. + * Gets Service host. * * @return the endpoint value. */ String getEndpoint(); - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - /** * Gets The HTTP pipeline to send requests through. * @@ -45,18 +38,4 @@ public interface ResourceGraphClient { * @return the ResourceProvidersClient object. */ ResourceProvidersClient getResourceProviders(); - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - OperationsClient getOperations(); - - /** - * Gets the GraphQueriesClient object to access its operations. - * - * @return the GraphQueriesClient object. - */ - GraphQueriesClient getGraphQueries(); } 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 9c2a089f0239..e41d07f3230a 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.fluent; @@ -9,16 +9,75 @@ 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 { + /** + * List changes to a resource for a given time interval. + * + * @param parameters The request body. + * @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 request body. + * @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 request body. + * @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 request body. + * @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); + /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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. @@ -31,7 +90,7 @@ public interface ResourceProvidersClient { /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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. @@ -39,4 +98,29 @@ public interface ResourceProvidersClient { */ @ServiceMethod(returns = ReturnType.SINGLE) QueryResponseInner resources(QueryRequest query); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body 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 The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Map resourcesHistory(ResourcesHistoryRequest request); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryProperties.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryProperties.java deleted file mode 100644 index 4f9c3ad57bc9..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryProperties.java +++ /dev/null @@ -1,166 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.resourcegraph.models.ResultKind; -import java.io.IOException; -import java.time.OffsetDateTime; - -/** - * Properties that contain a graph query. - */ -@Fluent -public final class GraphQueryProperties implements JsonSerializable { - /* - * Date and time in UTC of the last modification that was made to this graph query definition. - */ - private OffsetDateTime timeModified; - - /* - * The description of a graph query. - */ - private String description; - - /* - * KQL query that will be graph. - */ - private String query; - - /* - * Enum indicating a type of graph query. - */ - private ResultKind resultKind; - - /** - * Creates an instance of GraphQueryProperties class. - */ - public GraphQueryProperties() { - } - - /** - * Get the timeModified property: Date and time in UTC of the last modification that was made to this graph query - * definition. - * - * @return the timeModified value. - */ - public OffsetDateTime timeModified() { - return this.timeModified; - } - - /** - * Get the description property: The description of a graph query. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of a graph query. - * - * @param description the description value to set. - * @return the GraphQueryProperties object itself. - */ - public GraphQueryProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the query property: KQL query that will be graph. - * - * @return the query value. - */ - public String query() { - return this.query; - } - - /** - * Set the query property: KQL query that will be graph. - * - * @param query the query value to set. - * @return the GraphQueryProperties object itself. - */ - public GraphQueryProperties withQuery(String query) { - this.query = query; - return this; - } - - /** - * Get the resultKind property: Enum indicating a type of graph query. - * - * @return the resultKind value. - */ - public ResultKind resultKind() { - return this.resultKind; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (query() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property query in model GraphQueryProperties")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(GraphQueryProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("query", this.query); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GraphQueryProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GraphQueryProperties if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GraphQueryProperties. - */ - public static GraphQueryProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GraphQueryProperties deserializedGraphQueryProperties = new GraphQueryProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("query".equals(fieldName)) { - deserializedGraphQueryProperties.query = reader.getString(); - } else if ("timeModified".equals(fieldName)) { - deserializedGraphQueryProperties.timeModified = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("description".equals(fieldName)) { - deserializedGraphQueryProperties.description = reader.getString(); - } else if ("resultKind".equals(fieldName)) { - deserializedGraphQueryProperties.resultKind = ResultKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedGraphQueryProperties; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryPropertiesUpdateParameters.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryPropertiesUpdateParameters.java deleted file mode 100644 index abc5861de097..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryPropertiesUpdateParameters.java +++ /dev/null @@ -1,123 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Properties that contain a workbook for PATCH operation. - */ -@Fluent -public final class GraphQueryPropertiesUpdateParameters - implements JsonSerializable { - /* - * The description of a graph query. - */ - private String description; - - /* - * KQL query that will be graph. - */ - private String query; - - /** - * Creates an instance of GraphQueryPropertiesUpdateParameters class. - */ - public GraphQueryPropertiesUpdateParameters() { - } - - /** - * Get the description property: The description of a graph query. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of a graph query. - * - * @param description the description value to set. - * @return the GraphQueryPropertiesUpdateParameters object itself. - */ - public GraphQueryPropertiesUpdateParameters withDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the query property: KQL query that will be graph. - * - * @return the query value. - */ - public String query() { - return this.query; - } - - /** - * Set the query property: KQL query that will be graph. - * - * @param query the query value to set. - * @return the GraphQueryPropertiesUpdateParameters object itself. - */ - public GraphQueryPropertiesUpdateParameters withQuery(String query) { - this.query = query; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeStringField("query", this.query); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GraphQueryPropertiesUpdateParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GraphQueryPropertiesUpdateParameters if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the GraphQueryPropertiesUpdateParameters. - */ - public static GraphQueryPropertiesUpdateParameters fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GraphQueryPropertiesUpdateParameters deserializedGraphQueryPropertiesUpdateParameters - = new GraphQueryPropertiesUpdateParameters(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("description".equals(fieldName)) { - deserializedGraphQueryPropertiesUpdateParameters.description = reader.getString(); - } else if ("query".equals(fieldName)) { - deserializedGraphQueryPropertiesUpdateParameters.query = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedGraphQueryPropertiesUpdateParameters; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryResourceInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryResourceInner.java deleted file mode 100644 index b888868637e1..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/GraphQueryResourceInner.java +++ /dev/null @@ -1,261 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.resourcegraph.models.ResultKind; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Graph Query entity definition. - */ -@Fluent -public final class GraphQueryResourceInner extends Resource { - /* - * Metadata describing a graph query for an Azure resource. - */ - private GraphQueryProperties innerProperties; - - /* - * This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing - * resource without checking conflict. - */ - private String etag; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of GraphQueryResourceInner class. - */ - public GraphQueryResourceInner() { - } - - /** - * Get the innerProperties property: Metadata describing a graph query for an Azure resource. - * - * @return the innerProperties value. - */ - private GraphQueryProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the etag property: This will be used to handle Optimistic Concurrency. If not present, it will always - * overwrite the existing resource without checking conflict. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: This will be used to handle Optimistic Concurrency. If not present, it will always - * overwrite the existing resource without checking conflict. - * - * @param etag the etag value to set. - * @return the GraphQueryResourceInner object itself. - */ - public GraphQueryResourceInner withEtag(String etag) { - this.etag = etag; - return this; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public GraphQueryResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public GraphQueryResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the timeModified property: Date and time in UTC of the last modification that was made to this graph query - * definition. - * - * @return the timeModified value. - */ - public OffsetDateTime timeModified() { - return this.innerProperties() == null ? null : this.innerProperties().timeModified(); - } - - /** - * Get the description property: The description of a graph query. - * - * @return the description value. - */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); - } - - /** - * Set the description property: The description of a graph query. - * - * @param description the description value to set. - * @return the GraphQueryResourceInner object itself. - */ - public GraphQueryResourceInner withDescription(String description) { - if (this.innerProperties() == null) { - this.innerProperties = new GraphQueryProperties(); - } - this.innerProperties().withDescription(description); - return this; - } - - /** - * Get the query property: KQL query that will be graph. - * - * @return the query value. - */ - public String query() { - return this.innerProperties() == null ? null : this.innerProperties().query(); - } - - /** - * Set the query property: KQL query that will be graph. - * - * @param query the query value to set. - * @return the GraphQueryResourceInner object itself. - */ - public GraphQueryResourceInner withQuery(String query) { - if (this.innerProperties() == null) { - this.innerProperties = new GraphQueryProperties(); - } - this.innerProperties().withQuery(query); - return this; - } - - /** - * Get the resultKind property: Enum indicating a type of graph query. - * - * @return the resultKind value. - */ - public ResultKind resultKind() { - return this.innerProperties() == null ? null : this.innerProperties().resultKind(); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeStringField("etag", this.etag); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GraphQueryResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GraphQueryResourceInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GraphQueryResourceInner. - */ - public static GraphQueryResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GraphQueryResourceInner deserializedGraphQueryResourceInner = new GraphQueryResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedGraphQueryResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedGraphQueryResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedGraphQueryResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedGraphQueryResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedGraphQueryResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedGraphQueryResourceInner.innerProperties = GraphQueryProperties.fromJson(reader); - } else if ("etag".equals(fieldName)) { - deserializedGraphQueryResourceInner.etag = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedGraphQueryResourceInner; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/OperationInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/OperationInner.java deleted file mode 100644 index a23f6dff7c9a..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/OperationInner.java +++ /dev/null @@ -1,153 +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.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.resourcegraph.models.OperationDisplay; -import java.io.IOException; - -/** - * Resource Graph REST API operation definition. - */ -@Fluent -public final class OperationInner implements JsonSerializable { - /* - * Operation name: {provider}/{resource}/{operation} - */ - private String name; - - /* - * Display metadata associated with the operation. - */ - private OperationDisplay display; - - /* - * The origin of operations. - */ - private String origin; - - /** - * Creates an instance of OperationInner class. - */ - public OperationInner() { - } - - /** - * Get the name property: Operation name: {provider}/{resource}/{operation}. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: Operation name: {provider}/{resource}/{operation}. - * - * @param name the name value to set. - * @return the OperationInner object itself. - */ - public OperationInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the display property: Display metadata associated with the operation. - * - * @return the display value. - */ - public OperationDisplay display() { - return this.display; - } - - /** - * Set the display property: Display metadata associated with the operation. - * - * @param display the display value to set. - * @return the OperationInner object itself. - */ - public OperationInner withDisplay(OperationDisplay display) { - this.display = display; - return this; - } - - /** - * Get the origin property: The origin of operations. - * - * @return the origin value. - */ - public String origin() { - return this.origin; - } - - /** - * Set the origin property: The origin of operations. - * - * @param origin the origin value to set. - * @return the OperationInner object itself. - */ - public OperationInner withOrigin(String origin) { - this.origin = origin; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (display() != null) { - display().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("display", this.display); - jsonWriter.writeStringField("origin", this.origin); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationInner. - */ - public static OperationInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationInner deserializedOperationInner = new OperationInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOperationInner.name = reader.getString(); - } else if ("display".equals(fieldName)) { - deserializedOperationInner.display = OperationDisplay.fromJson(reader); - } else if ("origin".equals(fieldName)) { - deserializedOperationInner.origin = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationInner; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryResponseInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryResponseInner.java index baf23be309b0..b3411de4735b 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryResponseInner.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryResponseInner.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,7 +17,7 @@ /** * Query result. */ -@Fluent +@Immutable public final class QueryResponseInner implements JsonSerializable { /* * Number of total records matching the query. @@ -55,7 +54,7 @@ public final class QueryResponseInner implements JsonSerializable facets() { return this.facets; } - /** - * Set the facets property: Query facets. - * - * @param facets the facets value to set. - * @return the QueryResponseInner object itself. - */ - public QueryResponseInner withFacets(List facets) { - this.facets = facets; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (resultTruncated() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property resultTruncated in model QueryResponseInner")); - } - if (data() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property data in model QueryResponseInner")); - } - if (facets() != null) { - facets().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(QueryResponseInner.class); - /** * {@inheritDoc} */ 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..da3a3206a176 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import 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 java.io.IOException; +import java.util.List; + +/** + * Data on a specific change, represented by a pair of before and after resource snapshots. + */ +@Immutable +public final class ResourceChangeDataInner implements JsonSerializable { + /* + * The resource for a change. + */ + private String resourceId; + + /* + * The change ID. Valid and unique within the specified resource only. + */ + private String changeId; + + /* + * The snapshot before the change. + */ + private ResourceChangeDataBeforeSnapshot beforeSnapshot; + + /* + * The snapshot after the change. + */ + private ResourceChangeDataAfterSnapshot afterSnapshot; + + /* + * The change type for snapshot. PropertyChanges will be provided in case of Update change type + */ + private ChangeType changeType; + + /* + * An array of resource property change + */ + private List propertyChanges; + + /** + * Creates an instance of ResourceChangeDataInner class. + */ + private ResourceChangeDataInner() { + } + + /** + * Get the resourceId property: The resource for a change. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * 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; + } + + /** + * Get the beforeSnapshot property: The snapshot before the change. + * + * @return the beforeSnapshot value. + */ + public ResourceChangeDataBeforeSnapshot beforeSnapshot() { + return this.beforeSnapshot; + } + + /** + * Get the afterSnapshot property: The snapshot after the change. + * + * @return the afterSnapshot value. + */ + public ResourceChangeDataAfterSnapshot afterSnapshot() { + return this.afterSnapshot; + } + + /** + * 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; + } + + /** + * Get the propertyChanges property: An array of resource property change. + * + * @return the propertyChanges value. + */ + public List propertyChanges() { + return this.propertyChanges; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("changeId", this.changeId); + jsonWriter.writeJsonField("beforeSnapshot", this.beforeSnapshot); + jsonWriter.writeJsonField("afterSnapshot", this.afterSnapshot); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("changeType", this.changeType == null ? null : this.changeType.toString()); + jsonWriter.writeArrayField("propertyChanges", this.propertyChanges, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangeDataInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangeDataInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceChangeDataInner. + */ + public static ResourceChangeDataInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangeDataInner deserializedResourceChangeDataInner = new ResourceChangeDataInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("changeId".equals(fieldName)) { + deserializedResourceChangeDataInner.changeId = reader.getString(); + } else if ("beforeSnapshot".equals(fieldName)) { + deserializedResourceChangeDataInner.beforeSnapshot + = ResourceChangeDataBeforeSnapshot.fromJson(reader); + } else if ("afterSnapshot".equals(fieldName)) { + deserializedResourceChangeDataInner.afterSnapshot + = ResourceChangeDataAfterSnapshot.fromJson(reader); + } else if ("resourceId".equals(fieldName)) { + deserializedResourceChangeDataInner.resourceId = reader.getString(); + } else if ("changeType".equals(fieldName)) { + deserializedResourceChangeDataInner.changeType = ChangeType.fromString(reader.getString()); + } else if ("propertyChanges".equals(fieldName)) { + List propertyChanges + = reader.readArray(reader1 -> ResourcePropertyChange.fromJson(reader1)); + deserializedResourceChangeDataInner.propertyChanges = propertyChanges; + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangeDataInner; + }); + } +} 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..1349b67fb6fb --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of changes associated with a resource over a specific time interval. + */ +@Immutable +public final class ResourceChangeListInner implements JsonSerializable { + /* + * 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. + */ + private List changes; + + /* + * Skip token that encodes the skip information while executing the current request + */ + private Object skipToken; + + /** + * Creates an instance of ResourceChangeListInner class. + */ + private 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; + } + + /** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("changes", this.changes, (writer, element) -> writer.writeJson(element)); + if (this.skipToken != null) { + jsonWriter.writeUntypedField("$skipToken", this.skipToken); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangeListInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangeListInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceChangeListInner. + */ + public static ResourceChangeListInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangeListInner deserializedResourceChangeListInner = new ResourceChangeListInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("changes".equals(fieldName)) { + List changes + = reader.readArray(reader1 -> ResourceChangeDataInner.fromJson(reader1)); + deserializedResourceChangeListInner.changes = changes; + } else if ("$skipToken".equals(fieldName)) { + deserializedResourceChangeListInner.skipToken = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangeListInner; + }); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/package-info.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/package-info.java index cd79b2f9a3ed..a9f2d2aea8c0 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/package-info.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the inner data models for ResourceGraphClient. + * Package containing the inner data models for ResourceGraph. * Azure Resource Graph API Reference. */ package com.azure.resourcemanager.resourcegraph.fluent.models; diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/package-info.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/package-info.java index 02e16e8245bd..66847aedb40b 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/package-info.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the service clients for ResourceGraphClient. + * Package containing the service clients for ResourceGraph. * Azure Resource Graph API Reference. */ package com.azure.resourcemanager.resourcegraph.fluent; diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueriesClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueriesClientImpl.java deleted file mode 100644 index 311b57ebda0f..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueriesClientImpl.java +++ /dev/null @@ -1,1027 +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.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.resourcegraph.fluent.GraphQueriesClient; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryListResult; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryUpdateParameters; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in GraphQueriesClient. - */ -public final class GraphQueriesClientImpl implements GraphQueriesClient { - /** - * The proxy service used to perform REST calls. - */ - private final GraphQueriesService service; - - /** - * The service client containing this operation class. - */ - private final ResourceGraphClientImpl client; - - /** - * Initializes an instance of GraphQueriesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - GraphQueriesClientImpl(ResourceGraphClientImpl client) { - this.service - = RestProxy.create(GraphQueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourceGraphClientGraphQueries to be used by the proxy service to - * perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "ResourceGraphClientG") - public interface GraphQueriesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceGraph/queries") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries/{resourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries/{resourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries/{resourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") GraphQueryResourceInner properties, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceGraph/queries/{resourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("resourceName") String resourceName, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") GraphQueryUpdateParameters body, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @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 all graph queries defined within a specified subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String subscriptionId) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), - accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String subscriptionId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), subscriptionId, this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @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 all graph queries defined within a specified subscription as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String subscriptionId) { - return new PagedFlux<>(() -> listSinglePageAsync(subscriptionId), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String subscriptionId, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(subscriptionId, context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); - } - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @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 all graph queries defined within a specified subscription as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String subscriptionId) { - return new PagedIterable<>(listAsync(subscriptionId)); - } - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String subscriptionId, Context context) { - return new PagedIterable<>(listAsync(subscriptionId, context)); - } - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String subscriptionId, - String resourceGroupName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), subscriptionId, - resourceGroupName, this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String subscriptionId, - String resourceGroupName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), subscriptionId, resourceGroupName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String subscriptionId, - String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(subscriptionId, resourceGroupName), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String subscriptionId, String resourceGroupName, - Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(subscriptionId, resourceGroupName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName) { - return new PagedIterable<>(listByResourceGroupAsync(subscriptionId, resourceGroupName)); - } - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName, - Context context) { - return new PagedIterable<>(listByResourceGroupAsync(subscriptionId, resourceGroupName, context)); - } - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String subscriptionId, - String resourceGroupName, String resourceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), subscriptionId, - resourceGroupName, resourceName, this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String subscriptionId, - String resourceGroupName, String resourceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByResourceGroup(this.client.getEndpoint(), subscriptionId, resourceGroupName, resourceName, - this.client.getApiVersion(), accept, context); - } - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String subscriptionId, String resourceGroupName, - String resourceName) { - return getByResourceGroupWithResponseAsync(subscriptionId, resourceGroupName, resourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String subscriptionId, - String resourceGroupName, String resourceName, Context context) { - return getByResourceGroupWithResponseAsync(subscriptionId, resourceGroupName, resourceName, context).block(); - } - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public GraphQueryResourceInner getByResourceGroup(String subscriptionId, String resourceGroupName, - String resourceName) { - return getByResourceGroupWithResponse(subscriptionId, resourceGroupName, resourceName, Context.NONE).getValue(); - } - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String subscriptionId, String resourceGroupName, - String resourceName) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), subscriptionId, resourceGroupName, - resourceName, this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String subscriptionId, String resourceGroupName, - String resourceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), subscriptionId, resourceGroupName, resourceName, - this.client.getApiVersion(), accept, context); - } - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String subscriptionId, String resourceGroupName, String resourceName) { - return deleteWithResponseAsync(subscriptionId, resourceGroupName, resourceName) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String subscriptionId, String resourceGroupName, String resourceName, - Context context) { - return deleteWithResponseAsync(subscriptionId, resourceGroupName, resourceName, context).block(); - } - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String subscriptionId, String resourceGroupName, String resourceName) { - deleteWithResponse(subscriptionId, resourceGroupName, resourceName, Context.NONE); - } - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String subscriptionId, - String resourceGroupName, String resourceName, GraphQueryResourceInner properties) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (properties == null) { - return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); - } else { - properties.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), subscriptionId, resourceGroupName, - resourceName, this.client.getApiVersion(), properties, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String subscriptionId, - String resourceGroupName, String resourceName, GraphQueryResourceInner properties, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (properties == null) { - return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); - } else { - properties.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), subscriptionId, resourceGroupName, resourceName, - this.client.getApiVersion(), properties, accept, context); - } - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String subscriptionId, String resourceGroupName, - String resourceName, GraphQueryResourceInner properties) { - return createOrUpdateWithResponseAsync(subscriptionId, resourceGroupName, resourceName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, GraphQueryResourceInner properties, Context context) { - return createOrUpdateWithResponseAsync(subscriptionId, resourceGroupName, resourceName, properties, context) - .block(); - } - - /** - * Create a new graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param properties Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public GraphQueryResourceInner createOrUpdate(String subscriptionId, String resourceGroupName, String resourceName, - GraphQueryResourceInner properties) { - return createOrUpdateWithResponse(subscriptionId, resourceGroupName, resourceName, properties, Context.NONE) - .getValue(); - } - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String subscriptionId, - String resourceGroupName, String resourceName, GraphQueryUpdateParameters body) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName 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 accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), subscriptionId, resourceGroupName, - resourceName, this.client.getApiVersion(), body, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String subscriptionId, - String resourceGroupName, String resourceName, GraphQueryUpdateParameters body, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (subscriptionId == null) { - return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), subscriptionId, resourceGroupName, resourceName, - this.client.getApiVersion(), body, accept, context); - } - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String subscriptionId, String resourceGroupName, - String resourceName, GraphQueryUpdateParameters body) { - return updateWithResponseAsync(subscriptionId, resourceGroupName, resourceName, body) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, GraphQueryUpdateParameters body, Context context) { - return updateWithResponseAsync(subscriptionId, resourceGroupName, resourceName, body, context).block(); - } - - /** - * Updates a graph query that has already been added. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param body Properties that need to be specified to create a new graph query. - * @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 graph Query entity definition. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public GraphQueryResourceInner update(String subscriptionId, String resourceGroupName, String resourceName, - GraphQueryUpdateParameters body) { - return updateWithResponse(subscriptionId, resourceGroupName, resourceName, body, Context.NONE).getValue(); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return graph query list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return graph query list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, - Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return graph query list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return graph query list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueriesImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueriesImpl.java deleted file mode 100644 index c21f7cb55b24..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueriesImpl.java +++ /dev/null @@ -1,172 +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.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.resourcegraph.fluent.GraphQueriesClient; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner; -import com.azure.resourcemanager.resourcegraph.models.GraphQueries; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; - -public final class GraphQueriesImpl implements GraphQueries { - private static final ClientLogger LOGGER = new ClientLogger(GraphQueriesImpl.class); - - private final GraphQueriesClient innerClient; - - private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; - - public GraphQueriesImpl(GraphQueriesClient innerClient, - com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list(String subscriptionId) { - PagedIterable inner = this.serviceClient().list(subscriptionId); - return ResourceManagerUtils.mapPage(inner, inner1 -> new GraphQueryResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(String subscriptionId, Context context) { - PagedIterable inner = this.serviceClient().list(subscriptionId, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new GraphQueryResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(subscriptionId, resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new GraphQueryResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName, - Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(subscriptionId, resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new GraphQueryResourceImpl(inner1, this.manager())); - } - - public Response getByResourceGroupWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(subscriptionId, resourceGroupName, resourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new GraphQueryResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public GraphQueryResource getByResourceGroup(String subscriptionId, String resourceGroupName, String resourceName) { - GraphQueryResourceInner inner - = this.serviceClient().getByResourceGroup(subscriptionId, resourceGroupName, resourceName); - if (inner != null) { - return new GraphQueryResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteWithResponse(String subscriptionId, String resourceGroupName, String resourceName, - Context context) { - return this.serviceClient().deleteWithResponse(subscriptionId, resourceGroupName, resourceName, context); - } - - public void delete(String subscriptionId, String resourceGroupName, String resourceName) { - this.serviceClient().delete(subscriptionId, resourceGroupName, resourceName); - } - - public GraphQueryResource getById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = ResourceManagerUtils.getValueFromIdByName(id, "queries"); - if (resourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'queries'.", id))); - } - return this.getByResourceGroupWithResponse(subscriptionId, resourceGroupName, resourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = ResourceManagerUtils.getValueFromIdByName(id, "queries"); - if (resourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'queries'.", id))); - } - return this.getByResourceGroupWithResponse(subscriptionId, resourceGroupName, resourceName, context); - } - - public void deleteById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = ResourceManagerUtils.getValueFromIdByName(id, "queries"); - if (resourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'queries'.", id))); - } - this.deleteWithResponse(subscriptionId, resourceGroupName, resourceName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = ResourceManagerUtils.getValueFromIdByName(id, "queries"); - if (resourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'queries'.", id))); - } - return this.deleteWithResponse(subscriptionId, resourceGroupName, resourceName, context); - } - - private GraphQueriesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { - return this.serviceManager; - } - - public GraphQueryResourceImpl define(String name) { - return new GraphQueryResourceImpl(name, this.manager()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueryResourceImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueryResourceImpl.java deleted file mode 100644 index 734597d256fc..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/GraphQueryResourceImpl.java +++ /dev/null @@ -1,224 +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.implementation; - -import com.azure.core.management.Region; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryUpdateParameters; -import com.azure.resourcemanager.resourcegraph.models.ResultKind; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.Map; - -public final class GraphQueryResourceImpl - implements GraphQueryResource, GraphQueryResource.Definition, GraphQueryResource.Update { - private GraphQueryResourceInner innerObject; - - private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public String etag() { - return this.innerModel().etag(); - } - - public OffsetDateTime timeModified() { - return this.innerModel().timeModified(); - } - - public String description() { - return this.innerModel().description(); - } - - public String query() { - return this.innerModel().query(); - } - - public ResultKind resultKind() { - return this.innerModel().resultKind(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public GraphQueryResourceInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { - return this.serviceManager; - } - - private String subscriptionId; - - private String resourceGroupName; - - private String resourceName; - - private GraphQueryUpdateParameters updateBody; - - public GraphQueryResourceImpl withExistingResourceGroup(String subscriptionId, String resourceGroupName) { - this.subscriptionId = subscriptionId; - this.resourceGroupName = resourceGroupName; - return this; - } - - public GraphQueryResource create() { - this.innerObject = serviceManager.serviceClient() - .getGraphQueries() - .createOrUpdateWithResponse(subscriptionId, resourceGroupName, resourceName, this.innerModel(), - Context.NONE) - .getValue(); - return this; - } - - public GraphQueryResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getGraphQueries() - .createOrUpdateWithResponse(subscriptionId, resourceGroupName, resourceName, this.innerModel(), context) - .getValue(); - return this; - } - - GraphQueryResourceImpl(String name, com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { - this.innerObject = new GraphQueryResourceInner(); - this.serviceManager = serviceManager; - this.resourceName = name; - } - - public GraphQueryResourceImpl update() { - this.updateBody = new GraphQueryUpdateParameters(); - return this; - } - - public GraphQueryResource apply() { - this.innerObject = serviceManager.serviceClient() - .getGraphQueries() - .updateWithResponse(subscriptionId, resourceGroupName, resourceName, updateBody, Context.NONE) - .getValue(); - return this; - } - - public GraphQueryResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getGraphQueries() - .updateWithResponse(subscriptionId, resourceGroupName, resourceName, updateBody, context) - .getValue(); - return this; - } - - GraphQueryResourceImpl(GraphQueryResourceInner innerObject, - com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.resourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "queries"); - } - - public GraphQueryResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getGraphQueries() - .getByResourceGroupWithResponse(subscriptionId, resourceGroupName, resourceName, Context.NONE) - .getValue(); - return this; - } - - public GraphQueryResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getGraphQueries() - .getByResourceGroupWithResponse(subscriptionId, resourceGroupName, resourceName, context) - .getValue(); - return this; - } - - public GraphQueryResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public GraphQueryResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public GraphQueryResourceImpl withTags(Map tags) { - if (isInCreateMode()) { - this.innerModel().withTags(tags); - return this; - } else { - this.updateBody.withTags(tags); - return this; - } - } - - public GraphQueryResourceImpl withEtag(String etag) { - if (isInCreateMode()) { - this.innerModel().withEtag(etag); - return this; - } else { - this.updateBody.withEtag(etag); - return this; - } - } - - public GraphQueryResourceImpl withDescription(String description) { - if (isInCreateMode()) { - this.innerModel().withDescription(description); - return this; - } else { - this.updateBody.withDescription(description); - return this; - } - } - - public GraphQueryResourceImpl withQuery(String query) { - if (isInCreateMode()) { - this.innerModel().withQuery(query); - return this; - } else { - this.updateBody.withQuery(query); - return this; - } - } - - private boolean isInCreateMode() { - return this.innerModel().id() == null; - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationImpl.java deleted file mode 100644 index 783da83e2ba9..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationImpl.java +++ /dev/null @@ -1,41 +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.implementation; - -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import com.azure.resourcemanager.resourcegraph.models.Operation; -import com.azure.resourcemanager.resourcegraph.models.OperationDisplay; - -public final class OperationImpl implements Operation { - private OperationInner innerObject; - - private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; - - OperationImpl(OperationInner innerObject, - com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public OperationDisplay display() { - return this.innerModel().display(); - } - - public String origin() { - return this.innerModel().origin(); - } - - public OperationInner 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/OperationsClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java deleted file mode 100644 index ee2ba3c0301a..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java +++ /dev/null @@ -1,169 +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.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.resourcemanager.resourcegraph.fluent.OperationsClient; -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import com.azure.resourcemanager.resourcegraph.models.OperationListResult; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public final class OperationsClientImpl implements OperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final OperationsService service; - - /** - * The service client containing this operation class. - */ - private final ResourceGraphClientImpl client; - - /** - * Initializes an instance of OperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationsClientImpl(ResourceGraphClientImpl client) { - this.service - = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourceGraphClientOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "ResourceGraphClientO") - public interface OperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/providers/Microsoft.ResourceGraph/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - } - - /** - * Lists all of the available REST API operations. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), null, null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Lists all of the available REST API operations. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), null, null)); - } - - /** - * Lists all of the available REST API operations. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync()); - } - - /** - * Lists all of the available REST API operations. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context)); - } - - /** - * Lists all of the available REST API operations. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(listAsync()); - } - - /** - * Lists all of the available REST API operations. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java deleted file mode 100644 index fc1039a6c567..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java +++ /dev/null @@ -1,45 +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.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.resourcegraph.fluent.OperationsClient; -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import com.azure.resourcemanager.resourcegraph.models.Operation; -import com.azure.resourcemanager.resourcegraph.models.Operations; - -public final class OperationsImpl implements Operations { - private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); - - private final OperationsClient innerClient; - - private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; - - public OperationsImpl(OperationsClient innerClient, - com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - private OperationsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryResponseImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryResponseImpl.java index 930e195922e7..6cf14d37f546 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryResponseImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryResponseImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.implementation; 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..1217c1f156e5 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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..1b7c8ae4c399 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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/ResourceGraphManagementClientBuilder.java similarity index 65% rename from sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java rename to sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphManagementClientBuilder.java index aef155658b76..9d464fbbca4e 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/ResourceGraphManagementClientBuilder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.implementation; @@ -15,22 +15,22 @@ import java.time.Duration; /** - * A builder for creating a new instance of the ResourceGraphClientImpl type. + * A builder for creating a new instance of the ResourceGraphManagementClientImpl type. */ -@ServiceClientBuilder(serviceClients = { ResourceGraphClientImpl.class }) -public final class ResourceGraphClientBuilder { +@ServiceClientBuilder(serviceClients = { ResourceGraphManagementClientImpl.class }) +public final class ResourceGraphManagementClientBuilder { /* - * server parameter + * Service host */ private String endpoint; /** - * Sets server parameter. + * Sets Service host. * * @param endpoint the endpoint value. - * @return the ResourceGraphClientBuilder. + * @return the ResourceGraphManagementClientBuilder. */ - public ResourceGraphClientBuilder endpoint(String endpoint) { + public ResourceGraphManagementClientBuilder endpoint(String endpoint) { this.endpoint = endpoint; return this; } @@ -44,9 +44,9 @@ public ResourceGraphClientBuilder endpoint(String endpoint) { * Sets The environment to connect to. * * @param environment the environment value. - * @return the ResourceGraphClientBuilder. + * @return the ResourceGraphManagementClientBuilder. */ - public ResourceGraphClientBuilder environment(AzureEnvironment environment) { + public ResourceGraphManagementClientBuilder environment(AzureEnvironment environment) { this.environment = environment; return this; } @@ -60,9 +60,9 @@ public ResourceGraphClientBuilder environment(AzureEnvironment environment) { * Sets The HTTP pipeline to send requests through. * * @param pipeline the pipeline value. - * @return the ResourceGraphClientBuilder. + * @return the ResourceGraphManagementClientBuilder. */ - public ResourceGraphClientBuilder pipeline(HttpPipeline pipeline) { + public ResourceGraphManagementClientBuilder pipeline(HttpPipeline pipeline) { this.pipeline = pipeline; return this; } @@ -76,9 +76,9 @@ public ResourceGraphClientBuilder pipeline(HttpPipeline pipeline) { * Sets The default poll interval for long-running operation. * * @param defaultPollInterval the defaultPollInterval value. - * @return the ResourceGraphClientBuilder. + * @return the ResourceGraphManagementClientBuilder. */ - public ResourceGraphClientBuilder defaultPollInterval(Duration defaultPollInterval) { + public ResourceGraphManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { this.defaultPollInterval = defaultPollInterval; return this; } @@ -92,19 +92,19 @@ public ResourceGraphClientBuilder defaultPollInterval(Duration defaultPollInterv * Sets The serializer to serialize an object into a string. * * @param serializerAdapter the serializerAdapter value. - * @return the ResourceGraphClientBuilder. + * @return the ResourceGraphManagementClientBuilder. */ - public ResourceGraphClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + public ResourceGraphManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { this.serializerAdapter = serializerAdapter; return this; } /** - * Builds an instance of ResourceGraphClientImpl with the provided parameters. + * Builds an instance of ResourceGraphManagementClientImpl with the provided parameters. * - * @return an instance of ResourceGraphClientImpl. + * @return an instance of ResourceGraphManagementClientImpl. */ - public ResourceGraphClientImpl buildClient() { + public ResourceGraphManagementClientImpl buildClient() { String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = (pipeline != null) @@ -115,8 +115,8 @@ public ResourceGraphClientImpl buildClient() { SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); - ResourceGraphClientImpl client = new ResourceGraphClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint); + ResourceGraphManagementClientImpl client = new ResourceGraphManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, 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/ResourceGraphManagementClientImpl.java similarity index 83% rename from sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java rename to sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphManagementClientImpl.java index 4986720bdc0f..8c66c4afdaa5 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/ResourceGraphManagementClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.implementation; @@ -15,17 +15,18 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.resourcegraph.fluent.GraphQueriesClient; -import com.azure.resourcemanager.resourcegraph.fluent.OperationsClient; -import com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphClient; +import com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphManagementClient; import com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient; import java.io.IOException; import java.lang.reflect.Type; @@ -37,17 +38,17 @@ import reactor.core.publisher.Mono; /** - * Initializes a new instance of the ResourceGraphClientImpl type. + * Initializes a new instance of the ResourceGraphManagementClientImpl type. */ -@ServiceClient(builder = ResourceGraphClientBuilder.class) -public final class ResourceGraphClientImpl implements ResourceGraphClient { +@ServiceClient(builder = ResourceGraphManagementClientBuilder.class) +public final class ResourceGraphManagementClientImpl implements ResourceGraphManagementClient { /** - * server parameter. + * Service host. */ private final String endpoint; /** - * Gets server parameter. + * Gets Service host. * * @return the endpoint value. */ @@ -55,20 +56,6 @@ public String getEndpoint() { return this.endpoint; } - /** - * Api Version. - */ - private final String apiVersion; - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - /** * The HTTP pipeline to send requests through. */ @@ -126,52 +113,21 @@ public ResourceProvidersClient getResourceProviders() { } /** - * The OperationsClient object to access its operations. - */ - private final OperationsClient operations; - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - public OperationsClient getOperations() { - return this.operations; - } - - /** - * The GraphQueriesClient object to access its operations. - */ - private final GraphQueriesClient graphQueries; - - /** - * Gets the GraphQueriesClient object to access its operations. - * - * @return the GraphQueriesClient object. - */ - public GraphQueriesClient getGraphQueries() { - return this.graphQueries; - } - - /** - * Initializes an instance of ResourceGraphClient client. + * Initializes an instance of ResourceGraphManagementClient client. * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. - * @param endpoint server parameter. + * @param endpoint Service host. */ - ResourceGraphClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + ResourceGraphManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; - this.apiVersion = "2021-03-01"; this.resourceProviders = new ResourceProvidersClientImpl(this); - this.operations = new OperationsClientImpl(this); - this.graphQueries = new GraphQueriesClientImpl(this); } /** @@ -211,6 +167,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * @@ -300,5 +273,5 @@ public Mono getBodyAsString(Charset charset) { } } - private static final ClientLogger LOGGER = new ClientLogger(ResourceGraphClientImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ResourceGraphManagementClientImpl.class); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceManagerUtils.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceManagerUtils.java index a39eb03b722a..1ae22f5315da 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceManagerUtils.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceManagerUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.implementation; 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 202e4405d2f4..6a5190da0754 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 @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec 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; @@ -23,7 +22,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; /** @@ -38,92 +44,253 @@ public final class ResourceProvidersClientImpl implements ResourceProvidersClien /** * The service client containing this operation class. */ - private final ResourceGraphClientImpl client; + private final ResourceGraphManagementClientImpl client; /** * Initializes an instance of ResourceProvidersClientImpl. * * @param client the instance of the service client containing this operation class. */ - ResourceProvidersClientImpl(ResourceGraphClientImpl client) { + ResourceProvidersClientImpl(ResourceGraphManagementClientImpl client) { this.service = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for ResourceGraphClientResourceProviders to be used by the proxy service - * to perform REST calls. + * The interface defining all the services for ResourceGraphManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "ResourceGraphClientR") + @Host("{endpoint}") + @ServiceInterface(name = "ResourceGraphManagementClientResourceProviders") public interface ResourceProvidersService { - @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.ResourceGraph/resourceChanges") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resourceChanges(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") ResourceChangesRequestParameters parameters, Context context); + + @Post("/providers/Microsoft.ResourceGraph/resourceChanges") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resourceChangesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") ResourceChangesRequestParameters parameters, Context context); + + @Post("/providers/Microsoft.ResourceGraph/resourceChangeDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resourceChangeDetails(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") ResourceChangeDetailsRequestParameters parameters, Context context); + + @Post("/providers/Microsoft.ResourceGraph/resourceChangeDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> resourceChangeDetailsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") ResourceChangeDetailsRequestParameters parameters, Context context); + @Post("/providers/Microsoft.ResourceGraph/resources") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> resources(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @BodyParam("application/json") QueryRequest query, - @HeaderParam("Accept") String accept, Context context); + Mono> resources(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") QueryRequest query, Context context); + + @Post("/providers/Microsoft.ResourceGraph/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resourcesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") QueryRequest query, Context context); + + @Post("/providers/Microsoft.ResourceGraph/resourcesHistory") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resourcesHistory(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ResourcesHistoryRequest request, + Context context); + + @Post("/providers/Microsoft.ResourceGraph/resourcesHistory") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> resourcesHistorySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ResourcesHistoryRequest request, + Context context); } /** - * Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * List changes to a resource for a given time interval. * - * @param query Request specifying query and its options. + * @param parameters The request body. * @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 result along with {@link Response} on successful completion of {@link Mono}. + * @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> resourcesWithResponseAsync(QueryRequest query) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (query == null) { - return Mono.error(new IllegalArgumentException("Parameter query is required and cannot be null.")); - } else { - query.validate(); - } + private Mono> + resourceChangesWithResponseAsync(ResourceChangesRequestParameters parameters) { + final String apiVersion = "2020-09-01-preview"; + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, - accept, context)) + .withContext(context -> service.resourceChanges(this.client.getEndpoint(), apiVersion, contentType, accept, + parameters, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * List changes to a resource for a given time interval. + * + * @param parameters The request body. + * @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 request body. + * @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) { + final String apiVersion = "2020-09-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.resourceChangesSync(this.client.getEndpoint(), apiVersion, contentType, accept, parameters, + context); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters The request body. + * @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 request body. + * @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) { + final String apiVersion = "2020-09-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.resourceChangeDetails(this.client.getEndpoint(), apiVersion, contentType, + accept, parameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get resource change details. + * + * @param parameters The request body. + * @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 query Request specifying query and its options. + * @param parameters The request body. * @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) { + final String apiVersion = "2020-09-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.resourceChangeDetailsSync(this.client.getEndpoint(), apiVersion, contentType, accept, parameters, + context); + } + + /** + * Get resource change details. + * + * @param parameters The request body. + * @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(); + } + + /** + * Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @param query The request body. + * @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 result along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> resourcesWithResponseAsync(QueryRequest query, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (query == null) { - return Mono.error(new IllegalArgumentException("Parameter query is required and cannot be null.")); - } else { - query.validate(); - } + private Mono> resourcesWithResponseAsync(QueryRequest query) { + final String apiVersion = "2024-04-01"; + final String contentType = "application/json"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context); + return FluxUtil.withContext( + context -> service.resources(this.client.getEndpoint(), apiVersion, contentType, accept, query, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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. @@ -137,7 +304,7 @@ private Mono resourcesAsync(QueryRequest query) { /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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. @@ -146,13 +313,16 @@ private Mono resourcesAsync(QueryRequest query) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response resourcesWithResponse(QueryRequest query, Context context) { - return resourcesWithResponseAsync(query, context).block(); + final String apiVersion = "2024-04-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.resourcesSync(this.client.getEndpoint(), apiVersion, contentType, accept, query, context); } /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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. @@ -162,4 +332,72 @@ 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 The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourcesHistoryWithResponseAsync(ResourcesHistoryRequest request) { + final String apiVersion = "2021-06-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.resourcesHistory(this.client.getEndpoint(), apiVersion, contentType, accept, + request, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body 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 The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> resourcesHistoryWithResponse(ResourcesHistoryRequest request, + Context context) { + final String apiVersion = "2021-06-01-preview"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.resourcesHistorySync(this.client.getEndpoint(), apiVersion, contentType, accept, request, + context); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Map resourcesHistory(ResourcesHistoryRequest request) { + return resourcesHistoryWithResponse(request, 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 2a8af4d2e80b..b959aba774a0 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.implementation; @@ -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); @@ -27,16 +38,50 @@ public ResourceProvidersImpl(ResourceProvidersClient innerClient, this.serviceManager = serviceManager; } - public Response resourcesWithResponse(QueryRequest query, Context context) { - Response inner = this.serviceClient().resourcesWithResponse(query, context); + public Response resourceChangesWithResponse(ResourceChangesRequestParameters parameters, + Context context) { + Response inner = this.serviceClient().resourceChangesWithResponse(parameters, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResourceChangeListImpl(inner.getValue(), this.manager())); + } + + public ResourceChangeList resourceChanges(ResourceChangesRequestParameters parameters) { + ResourceChangeListInner inner = this.serviceClient().resourceChanges(parameters); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new QueryResponseImpl(inner.getValue(), this.manager())); + return new ResourceChangeListImpl(inner, this.manager()); } else { return null; } } + public Response> + resourceChangeDetailsWithResponse(ResourceChangeDetailsRequestParameters parameters, Context context) { + Response> inner + = this.serviceClient().resourceChangeDetailsWithResponse(parameters, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + inner.getValue() + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } + + 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(); + } + } + + public Response resourcesWithResponse(QueryRequest query, Context context) { + Response inner = this.serviceClient().resourcesWithResponse(query, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new QueryResponseImpl(inner.getValue(), this.manager())); + } + public QueryResponse resources(QueryRequest query) { QueryResponseInner inner = this.serviceClient().resources(query); if (inner != null) { @@ -46,6 +91,20 @@ 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(); + } + } + private ResourceProvidersClient serviceClient() { return this.innerClient; } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/package-info.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/package-info.java index 8cb673cdf7c5..1c3eaa38973e 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/package-info.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for ResourceGraphClient. + * Package containing the implementations for ResourceGraph. * Azure Resource Graph API Reference. */ package com.azure.resourcemanager.resourcegraph.implementation; 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..bf585ec8b916 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +/** + * Defines what level of authorization resources should be returned based on the which subscriptions and management + * groups are passed as scopes. + */ +public enum AuthorizationScopeFilter { + /** + * AtScopeAndBelow. + */ + AT_SCOPE_AND_BELOW("AtScopeAndBelow"), + + /** + * AtScopeAndAbove. + */ + AT_SCOPE_AND_ABOVE("AtScopeAndAbove"), + + /** + * AtScopeExact. + */ + AT_SCOPE_EXACT("AtScopeExact"), + + /** + * 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. + */ + 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} + */ + @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..197b1ba50a99 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +/** + * The change category. + */ +public enum ChangeCategory { + /** + * User. + */ + USER("User"), + + /** + * 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. + */ + 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} + */ + @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..f4b09a7cc3c2 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +/** + * The change type for snapshot. PropertyChanges will be provided in case of Update change type. + */ +public enum ChangeType { + /** + * Create. + */ + CREATE("Create"), + + /** + * Update. + */ + UPDATE("Update"), + + /** + * 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. + */ + 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} + */ + @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..2c34f4394581 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. `[start, end)`. + */ +@Fluent +public class DateTimeInterval implements JsonSerializable { + /* + * 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. + */ + 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. + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("start", + this.start == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.start)); + jsonWriter.writeStringField("end", + this.end == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.end)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DateTimeInterval from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DateTimeInterval if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DateTimeInterval. + */ + public static DateTimeInterval fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DateTimeInterval deserializedDateTimeInterval = new DateTimeInterval(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("start".equals(fieldName)) { + deserializedDateTimeInterval.start = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("end".equals(fieldName)) { + deserializedDateTimeInterval.end = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDateTimeInterval; + }); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java index 11dfaf32ce43..2c8b2a6170ae 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,7 +16,7 @@ /** * Error details. */ -@Fluent +@Immutable public final class ErrorDetails implements JsonSerializable { /* * Error code identifying the specific error. @@ -37,7 +36,7 @@ public final class ErrorDetails implements JsonSerializable { /** * Creates an instance of ErrorDetails class. */ - public ErrorDetails() { + private ErrorDetails() { } /** @@ -49,17 +48,6 @@ public String code() { return this.code; } - /** - * Set the code property: Error code identifying the specific error. - * - * @param code the code value to set. - * @return the ErrorDetails object itself. - */ - public ErrorDetails withCode(String code) { - this.code = code; - return this; - } - /** * Get the message property: A human readable error message. * @@ -69,17 +57,6 @@ public String message() { return this.message; } - /** - * Set the message property: A human readable error message. - * - * @param message the message value to set. - * @return the ErrorDetails object itself. - */ - public ErrorDetails withMessage(String message) { - this.message = message; - return this; - } - /** * Get the additionalProperties property: Error details. * @@ -89,35 +66,6 @@ public Map additionalProperties() { return this.additionalProperties; } - /** - * Set the additionalProperties property: Error details. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ErrorDetails object itself. - */ - public ErrorDetails withAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (code() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property code in model ErrorDetails")); - } - if (message() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property message in model ErrorDetails")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ErrorDetails.class); - /** * {@inheritDoc} */ diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Facet.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Facet.java index 3e8ec7075be6..ca260529c572 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Facet.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Facet.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +14,7 @@ /** * A facet containing additional statistics on the response of a query. Can be either FacetResult or FacetError. */ -@Fluent +@Immutable public class Facet implements JsonSerializable { /* * Result type @@ -30,7 +29,7 @@ public class Facet implements JsonSerializable { /** * Creates an instance of Facet class. */ - public Facet() { + protected Facet() { } /** @@ -57,25 +56,11 @@ public String expression() { * @param expression the expression value to set. * @return the Facet object itself. */ - public Facet withExpression(String expression) { + Facet withExpression(String expression) { this.expression = expression; return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (expression() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property expression in model Facet")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(Facet.class); - /** * {@inheritDoc} */ diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetError.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetError.java index bdffbfcc0c50..36f2b4bad78b 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetError.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetError.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -15,7 +14,7 @@ /** * A facet whose execution resulted in an error. */ -@Fluent +@Immutable public final class FacetError extends Facet { /* * Result type @@ -30,7 +29,7 @@ public final class FacetError extends Facet { /** * Creates an instance of FacetError class. */ - public FacetError() { + private FacetError() { } /** @@ -52,47 +51,6 @@ public List errors() { return this.errors; } - /** - * Set the errors property: An array containing detected facet errors with details. - * - * @param errors the errors value to set. - * @return the FacetError object itself. - */ - public FacetError withErrors(List errors) { - this.errors = errors; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FacetError withExpression(String expression) { - super.withExpression(expression); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (errors() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property errors in model FacetError")); - } else { - errors().forEach(e -> e.validate()); - } - if (expression() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property expression in model FacetError")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FacetError.class); - /** * {@inheritDoc} */ diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequest.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequest.java index d81e7b99cebf..ca2f44f9fd00 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequest.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequest.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -73,23 +72,6 @@ public FacetRequest withOptions(FacetRequestOptions options) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (expression() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property expression in model FacetRequest")); - } - if (options() != null) { - options().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FacetRequest.class); - /** * {@inheritDoc} */ diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequestOptions.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequestOptions.java index f85057026b24..2a32520ffc52 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequestOptions.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequestOptions.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; @@ -125,14 +125,6 @@ public FacetRequestOptions withTop(Integer top) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetResult.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetResult.java index 5acc1cd77919..c7bcbe7940c4 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetResult.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetResult.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; @@ -14,7 +13,7 @@ /** * Successfully executed facet containing additional statistics on the response of a query. */ -@Fluent +@Immutable public final class FacetResult extends Facet { /* * Result type @@ -39,7 +38,7 @@ public final class FacetResult extends Facet { /** * Creates an instance of FacetResult class. */ - public FacetResult() { + private FacetResult() { } /** @@ -61,17 +60,6 @@ public long totalRecords() { return this.totalRecords; } - /** - * Set the totalRecords property: Number of total records in the facet results. - * - * @param totalRecords the totalRecords value to set. - * @return the FacetResult object itself. - */ - public FacetResult withTotalRecords(long totalRecords) { - this.totalRecords = totalRecords; - return this; - } - /** * Get the count property: Number of records returned in the facet response. * @@ -81,17 +69,6 @@ public int count() { return this.count; } - /** - * Set the count property: Number of records returned in the facet response. - * - * @param count the count value to set. - * @return the FacetResult object itself. - */ - public FacetResult withCount(int count) { - this.count = count; - return this; - } - /** * Get the data property: A JObject array or Table containing the desired facets. Only present if the facet is * valid. @@ -102,46 +79,6 @@ public Object data() { return this.data; } - /** - * Set the data property: A JObject array or Table containing the desired facets. Only present if the facet is - * valid. - * - * @param data the data value to set. - * @return the FacetResult object itself. - */ - public FacetResult withData(Object data) { - this.data = data; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public FacetResult withExpression(String expression) { - super.withExpression(expression); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (data() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property data in model FacetResult")); - } - if (expression() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property expression in model FacetResult")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FacetResult.class); - /** * {@inheritDoc} */ diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetSortOrder.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetSortOrder.java index 8397edce7a5c..30a8ffe4cb87 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetSortOrder.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetSortOrder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; @@ -9,12 +9,12 @@ */ public enum FacetSortOrder { /** - * Enum value asc. + * asc. */ ASC("asc"), /** - * Enum value desc. + * desc. */ DESC("desc"); diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueries.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueries.java deleted file mode 100644 index c5faab74a116..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueries.java +++ /dev/null @@ -1,175 +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.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of GraphQueries. - */ -public interface GraphQueries { - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(String subscriptionId); - - /** - * Get all graph queries defined within a specified subscription. - * - * @param subscriptionId The Azure subscription Id. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all graph queries defined within a specified subscription as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(String subscriptionId, Context context); - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName); - - /** - * Get all graph queries defined within a specified subscription and resource group. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @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 all graph queries defined within a specified subscription and resource group as paginated response with - * {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String subscriptionId, String resourceGroupName, - Context context); - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String subscriptionId, String resourceGroupName, - String resourceName, Context context); - - /** - * Get a single graph query by its resourceName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName. - */ - GraphQueryResource getByResourceGroup(String subscriptionId, String resourceGroupName, String resourceName); - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteWithResponse(String subscriptionId, String resourceGroupName, String resourceName, - Context context); - - /** - * Delete a graph query. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @param resourceName The name of the Graph Query resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String subscriptionId, String resourceGroupName, String resourceName); - - /** - * Get a single graph query by its resourceName. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response}. - */ - GraphQueryResource getById(String id); - - /** - * Get a single graph query by its resourceName. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a single graph query by its resourceName along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a graph query. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a graph query. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new GraphQueryResource resource. - * - * @param name resource name. - * @return the first stage of the new GraphQueryResource definition. - */ - GraphQueryResource.DefinitionStages.Blank define(String name); -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryListResult.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryListResult.java deleted file mode 100644 index fd0a8a895dc0..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryListResult.java +++ /dev/null @@ -1,116 +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.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner; -import java.io.IOException; -import java.util.List; - -/** - * Graph query list result. - */ -@Fluent -public final class GraphQueryListResult implements JsonSerializable { - /* - * URL to fetch the next set of queries. - */ - private String nextLink; - - /* - * An array of graph queries. - */ - private List value; - - /** - * Creates an instance of GraphQueryListResult class. - */ - public GraphQueryListResult() { - } - - /** - * Get the nextLink property: URL to fetch the next set of queries. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: URL to fetch the next set of queries. - * - * @param nextLink the nextLink value to set. - * @return the GraphQueryListResult object itself. - */ - public GraphQueryListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Get the value property: An array of graph queries. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GraphQueryListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GraphQueryListResult if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the GraphQueryListResult. - */ - public static GraphQueryListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GraphQueryListResult deserializedGraphQueryListResult = new GraphQueryListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("nextLink".equals(fieldName)) { - deserializedGraphQueryListResult.nextLink = reader.getString(); - } else if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> GraphQueryResourceInner.fromJson(reader1)); - deserializedGraphQueryListResult.value = value; - } else { - reader.skipChildren(); - } - } - - return deserializedGraphQueryListResult; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryResource.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryResource.java deleted file mode 100644 index a3987c6b4b20..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryResource.java +++ /dev/null @@ -1,347 +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.models; - -import com.azure.core.management.Region; -import com.azure.core.util.Context; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * An immutable client-side representation of GraphQueryResource. - */ -public interface GraphQueryResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the etag property: This will be used to handle Optimistic Concurrency. If not present, it will always - * overwrite the existing resource without checking conflict. - * - * @return the etag value. - */ - String etag(); - - /** - * Gets the timeModified property: Date and time in UTC of the last modification that was made to this graph query - * definition. - * - * @return the timeModified value. - */ - OffsetDateTime timeModified(); - - /** - * Gets the description property: The description of a graph query. - * - * @return the description value. - */ - String description(); - - /** - * Gets the query property: KQL query that will be graph. - * - * @return the query value. - */ - String query(); - - /** - * Gets the resultKind property: Enum indicating a type of graph query. - * - * @return the resultKind value. - */ - ResultKind resultKind(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryResourceInner object. - * - * @return the inner object. - */ - GraphQueryResourceInner innerModel(); - - /** - * The entirety of the GraphQueryResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The GraphQueryResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the GraphQueryResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the GraphQueryResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the GraphQueryResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies subscriptionId, resourceGroupName. - * - * @param subscriptionId The Azure subscription Id. - * @param resourceGroupName The name of the resource group. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String subscriptionId, String resourceGroupName); - } - - /** - * The stage of the GraphQueryResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithEtag, - DefinitionStages.WithDescription, DefinitionStages.WithQuery { - /** - * Executes the create request. - * - * @return the created resource. - */ - GraphQueryResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - GraphQueryResource create(Context context); - } - - /** - * The stage of the GraphQueryResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the GraphQueryResource definition allowing to specify etag. - */ - interface WithEtag { - /** - * Specifies the etag property: This will be used to handle Optimistic Concurrency. If not present, it will - * always overwrite the existing resource without checking conflict.. - * - * @param etag This will be used to handle Optimistic Concurrency. If not present, it will always overwrite - * the existing resource without checking conflict. - * @return the next definition stage. - */ - WithCreate withEtag(String etag); - } - - /** - * The stage of the GraphQueryResource definition allowing to specify description. - */ - interface WithDescription { - /** - * Specifies the description property: The description of a graph query.. - * - * @param description The description of a graph query. - * @return the next definition stage. - */ - WithCreate withDescription(String description); - } - - /** - * The stage of the GraphQueryResource definition allowing to specify query. - */ - interface WithQuery { - /** - * Specifies the query property: KQL query that will be graph.. - * - * @param query KQL query that will be graph. - * @return the next definition stage. - */ - WithCreate withQuery(String query); - } - } - - /** - * Begins update for the GraphQueryResource resource. - * - * @return the stage of resource update. - */ - GraphQueryResource.Update update(); - - /** - * The template for GraphQueryResource update. - */ - interface Update - extends UpdateStages.WithTags, UpdateStages.WithEtag, UpdateStages.WithDescription, UpdateStages.WithQuery { - /** - * Executes the update request. - * - * @return the updated resource. - */ - GraphQueryResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - GraphQueryResource apply(Context context); - } - - /** - * The GraphQueryResource update stages. - */ - interface UpdateStages { - /** - * The stage of the GraphQueryResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the GraphQueryResource update allowing to specify etag. - */ - interface WithEtag { - /** - * Specifies the etag property: This will be used to handle Optimistic Concurrency. If not present, it will - * always overwrite the existing resource without checking conflict.. - * - * @param etag This will be used to handle Optimistic Concurrency. If not present, it will always overwrite - * the existing resource without checking conflict. - * @return the next definition stage. - */ - Update withEtag(String etag); - } - - /** - * The stage of the GraphQueryResource update allowing to specify description. - */ - interface WithDescription { - /** - * Specifies the description property: The description of a graph query.. - * - * @param description The description of a graph query. - * @return the next definition stage. - */ - Update withDescription(String description); - } - - /** - * The stage of the GraphQueryResource update allowing to specify query. - */ - interface WithQuery { - /** - * Specifies the query property: KQL query that will be graph.. - * - * @param query KQL query that will be graph. - * @return the next definition stage. - */ - Update withQuery(String query); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - GraphQueryResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - GraphQueryResource refresh(Context context); -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryUpdateParameters.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryUpdateParameters.java deleted file mode 100644 index 6259308b05e0..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/GraphQueryUpdateParameters.java +++ /dev/null @@ -1,194 +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.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.resourcegraph.fluent.models.GraphQueryPropertiesUpdateParameters; -import java.io.IOException; -import java.util.Map; - -/** - * The parameters that can be provided when updating workbook properties properties. - */ -@Fluent -public final class GraphQueryUpdateParameters implements JsonSerializable { - /* - * Resource tags - */ - private Map tags; - - /* - * This will be used to handle Optimistic Concurrency. If not present, it will always overwrite the existing - * resource without checking conflict. - */ - private String etag; - - /* - * Metadata describing a graph query for an Azure resource. - */ - private GraphQueryPropertiesUpdateParameters innerProperties; - - /** - * Creates an instance of GraphQueryUpdateParameters class. - */ - public GraphQueryUpdateParameters() { - } - - /** - * Get the tags property: Resource tags. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Resource tags. - * - * @param tags the tags value to set. - * @return the GraphQueryUpdateParameters object itself. - */ - public GraphQueryUpdateParameters withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * Get the etag property: This will be used to handle Optimistic Concurrency. If not present, it will always - * overwrite the existing resource without checking conflict. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: This will be used to handle Optimistic Concurrency. If not present, it will always - * overwrite the existing resource without checking conflict. - * - * @param etag the etag value to set. - * @return the GraphQueryUpdateParameters object itself. - */ - public GraphQueryUpdateParameters withEtag(String etag) { - this.etag = etag; - return this; - } - - /** - * Get the innerProperties property: Metadata describing a graph query for an Azure resource. - * - * @return the innerProperties value. - */ - private GraphQueryPropertiesUpdateParameters innerProperties() { - return this.innerProperties; - } - - /** - * Get the description property: The description of a graph query. - * - * @return the description value. - */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); - } - - /** - * Set the description property: The description of a graph query. - * - * @param description the description value to set. - * @return the GraphQueryUpdateParameters object itself. - */ - public GraphQueryUpdateParameters withDescription(String description) { - if (this.innerProperties() == null) { - this.innerProperties = new GraphQueryPropertiesUpdateParameters(); - } - this.innerProperties().withDescription(description); - return this; - } - - /** - * Get the query property: KQL query that will be graph. - * - * @return the query value. - */ - public String query() { - return this.innerProperties() == null ? null : this.innerProperties().query(); - } - - /** - * Set the query property: KQL query that will be graph. - * - * @param query the query value to set. - * @return the GraphQueryUpdateParameters object itself. - */ - public GraphQueryUpdateParameters withQuery(String query) { - if (this.innerProperties() == null) { - this.innerProperties = new GraphQueryPropertiesUpdateParameters(); - } - this.innerProperties().withQuery(query); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - jsonWriter.writeStringField("etag", this.etag); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GraphQueryUpdateParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GraphQueryUpdateParameters if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the GraphQueryUpdateParameters. - */ - public static GraphQueryUpdateParameters fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GraphQueryUpdateParameters deserializedGraphQueryUpdateParameters = new GraphQueryUpdateParameters(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedGraphQueryUpdateParameters.tags = tags; - } else if ("etag".equals(fieldName)) { - deserializedGraphQueryUpdateParameters.etag = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedGraphQueryUpdateParameters.innerProperties - = GraphQueryPropertiesUpdateParameters.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedGraphQueryUpdateParameters; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operation.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operation.java deleted file mode 100644 index 586190f911d1..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operation.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.models; - -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; - -/** - * An immutable client-side representation of Operation. - */ -public interface Operation { - /** - * Gets the name property: Operation name: {provider}/{resource}/{operation}. - * - * @return the name value. - */ - String name(); - - /** - * Gets the display property: Display metadata associated with the operation. - * - * @return the display value. - */ - OperationDisplay display(); - - /** - * Gets the origin property: The origin of operations. - * - * @return the origin value. - */ - String origin(); - - /** - * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner object. - * - * @return the inner object. - */ - OperationInner innerModel(); -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/OperationDisplay.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/OperationDisplay.java deleted file mode 100644 index 96e975333d27..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/OperationDisplay.java +++ /dev/null @@ -1,177 +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.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Display metadata associated with the operation. - */ -@Fluent -public final class OperationDisplay implements JsonSerializable { - /* - * Service provider: Microsoft Resource Graph. - */ - private String provider; - - /* - * Resource on which the operation is performed etc. - */ - private String resource; - - /* - * Type of operation: get, read, delete, etc. - */ - private String operation; - - /* - * Description for the operation. - */ - private String description; - - /** - * Creates an instance of OperationDisplay class. - */ - public OperationDisplay() { - } - - /** - * Get the provider property: Service provider: Microsoft Resource Graph. - * - * @return the provider value. - */ - public String provider() { - return this.provider; - } - - /** - * Set the provider property: Service provider: Microsoft Resource Graph. - * - * @param provider the provider value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withProvider(String provider) { - this.provider = provider; - return this; - } - - /** - * Get the resource property: Resource on which the operation is performed etc. - * - * @return the resource value. - */ - public String resource() { - return this.resource; - } - - /** - * Set the resource property: Resource on which the operation is performed etc. - * - * @param resource the resource value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withResource(String resource) { - this.resource = resource; - return this; - } - - /** - * Get the operation property: Type of operation: get, read, delete, etc. - * - * @return the operation value. - */ - public String operation() { - return this.operation; - } - - /** - * Set the operation property: Type of operation: get, read, delete, etc. - * - * @param operation the operation value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withOperation(String operation) { - this.operation = operation; - return this; - } - - /** - * Get the description property: Description for the operation. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: Description for the operation. - * - * @param description the description value to set. - * @return the OperationDisplay object itself. - */ - public OperationDisplay withDescription(String description) { - this.description = description; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("provider", this.provider); - jsonWriter.writeStringField("resource", this.resource); - jsonWriter.writeStringField("operation", this.operation); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationDisplay from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationDisplay. - */ - public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationDisplay deserializedOperationDisplay = new OperationDisplay(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provider".equals(fieldName)) { - deserializedOperationDisplay.provider = reader.getString(); - } else if ("resource".equals(fieldName)) { - deserializedOperationDisplay.resource = reader.getString(); - } else if ("operation".equals(fieldName)) { - deserializedOperationDisplay.operation = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedOperationDisplay.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationDisplay; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/OperationListResult.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/OperationListResult.java deleted file mode 100644 index 43ee6ad4802a..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/OperationListResult.java +++ /dev/null @@ -1,100 +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.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import java.io.IOException; -import java.util.List; - -/** - * Result of the request to list Resource Graph operations. It contains a list of operations and a URL link to get the - * next set of results. - */ -@Fluent -public final class OperationListResult implements JsonSerializable { - /* - * List of Resource Graph operations supported by the Resource Graph resource provider. - */ - private List value; - - /** - * Creates an instance of OperationListResult class. - */ - public OperationListResult() { - } - - /** - * Get the value property: List of Resource Graph operations supported by the Resource Graph resource provider. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: List of Resource Graph operations supported by the Resource Graph resource provider. - * - * @param value the value value to set. - * @return the OperationListResult object itself. - */ - public OperationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationListResult. - */ - public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationListResult deserializedOperationListResult = new OperationListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); - deserializedOperationListResult.value = value; - } else { - reader.skipChildren(); - } - } - - return deserializedOperationListResult; - }); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operations.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operations.java deleted file mode 100644 index 635bcce9d6b2..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operations.java +++ /dev/null @@ -1,33 +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.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * Resource collection API of Operations. - */ -public interface Operations { - /** - * Lists all of the available REST API operations. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * Lists all of the available REST API operations. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. - */ - PagedIterable list(Context context); -} 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..cc4e90b22a3c --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +/** + * The property change Type. + */ +public enum PropertyChangeType { + /** + * Insert. + */ + INSERT("Insert"), + + /** + * Update. + */ + UPDATE("Update"), + + /** + * 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. + */ + 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} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java index 4b3a5b5575c2..2a34ce41f956 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java @@ -1,11 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -151,26 +150,6 @@ public QueryRequest withFacets(List facets) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (query() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property query in model QueryRequest")); - } - if (options() != null) { - options().validate(); - } - if (facets() != null) { - facets().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(QueryRequest.class); - /** * {@inheritDoc} */ 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 a0f6b35ff74e..f0796e89c176 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; @@ -44,6 +44,12 @@ public final class QueryRequestOptions implements JsonSerializable 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..820bbca052f0 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The snapshot after the change. + */ +@Immutable +public final class ResourceChangeDataAfterSnapshot extends ResourceSnapshotData { + /* + * The resource snapshot content (in resourceChangeDetails response only). + */ + private Object content; + + /* + * 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. + */ + private OffsetDateTime timestamp; + + /* + * The ID of the snapshot. + */ + private String snapshotId; + + /** + * Creates an instance of ResourceChangeDataAfterSnapshot class. + */ + private ResourceChangeDataAfterSnapshot() { + } + + /** + * Get the content property: The resource snapshot content (in resourceChangeDetails response only). + * + * @return the content value. + */ + @Override + public Object content() { + return this.content; + } + + /** + * 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. + */ + @Override + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the snapshotId property: The ID of the snapshot. + * + * @return the snapshotId value. + */ + @Override + public String snapshotId() { + return this.snapshotId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timestamp", + timestamp() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(timestamp())); + jsonWriter.writeStringField("snapshotId", snapshotId()); + if (content() != null) { + jsonWriter.writeUntypedField("content", content()); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangeDataAfterSnapshot from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangeDataAfterSnapshot if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceChangeDataAfterSnapshot. + */ + public static ResourceChangeDataAfterSnapshot fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangeDataAfterSnapshot deserializedResourceChangeDataAfterSnapshot + = new ResourceChangeDataAfterSnapshot(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timestamp".equals(fieldName)) { + deserializedResourceChangeDataAfterSnapshot.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("snapshotId".equals(fieldName)) { + deserializedResourceChangeDataAfterSnapshot.snapshotId = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedResourceChangeDataAfterSnapshot.content = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangeDataAfterSnapshot; + }); + } +} 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..0a71201f9a11 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The snapshot before the change. + */ +@Immutable +public final class ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData { + /* + * The resource snapshot content (in resourceChangeDetails response only). + */ + private Object content; + + /* + * 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. + */ + private OffsetDateTime timestamp; + + /* + * The ID of the snapshot. + */ + private String snapshotId; + + /** + * Creates an instance of ResourceChangeDataBeforeSnapshot class. + */ + private ResourceChangeDataBeforeSnapshot() { + } + + /** + * Get the content property: The resource snapshot content (in resourceChangeDetails response only). + * + * @return the content value. + */ + @Override + public Object content() { + return this.content; + } + + /** + * 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. + */ + @Override + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the snapshotId property: The ID of the snapshot. + * + * @return the snapshotId value. + */ + @Override + public String snapshotId() { + return this.snapshotId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timestamp", + timestamp() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(timestamp())); + jsonWriter.writeStringField("snapshotId", snapshotId()); + if (content() != null) { + jsonWriter.writeUntypedField("content", content()); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangeDataBeforeSnapshot from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangeDataBeforeSnapshot if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceChangeDataBeforeSnapshot. + */ + public static ResourceChangeDataBeforeSnapshot fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangeDataBeforeSnapshot deserializedResourceChangeDataBeforeSnapshot + = new ResourceChangeDataBeforeSnapshot(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timestamp".equals(fieldName)) { + deserializedResourceChangeDataBeforeSnapshot.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("snapshotId".equals(fieldName)) { + deserializedResourceChangeDataBeforeSnapshot.snapshotId = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedResourceChangeDataBeforeSnapshot.content = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangeDataBeforeSnapshot; + }); + } +} 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..728dd979d34f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The parameters for a specific change details request. + */ +@Fluent +public final class ResourceChangeDetailsRequestParameters + implements JsonSerializable { + /* + * Specifies the list of resources for a change details request. + */ + private List resourceIds; + + /* + * Specifies the list of change IDs for a change details request. + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceIds", this.resourceIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("changeIds", this.changeIds, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangeDetailsRequestParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangeDetailsRequestParameters if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceChangeDetailsRequestParameters. + */ + public static ResourceChangeDetailsRequestParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangeDetailsRequestParameters deserializedResourceChangeDetailsRequestParameters + = new ResourceChangeDetailsRequestParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceIds".equals(fieldName)) { + List resourceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedResourceChangeDetailsRequestParameters.resourceIds = resourceIds; + } else if ("changeIds".equals(fieldName)) { + List changeIds = reader.readArray(reader1 -> reader1.getString()); + deserializedResourceChangeDetailsRequestParameters.changeIds = changeIds; + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangeDetailsRequestParameters; + }); + } +} 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..a6df41fbf957 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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..1b49428ead6c --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The parameters for a specific changes request. + */ +@Fluent +public final class ResourceChangesRequestParameters implements JsonSerializable { + /* + * Specifies the list of resources for a changes request. + */ + private List resourceIds; + + /* + * The subscription id of resources to query the changes from. + */ + private String subscriptionId; + + /* + * Specifies the date and time interval for a changes request. + */ + private ResourceChangesRequestParametersInterval interval; + + /* + * Acts as the continuation token for paged responses. + */ + private String skipToken; + + /* + * The maximum number of changes the client can accept in a paged response. + */ + private Integer top; + + /* + * The table name to query resources from. + */ + private String table; + + /* + * The flag if set to true will fetch property changes + */ + private Boolean fetchPropertyChanges; + + /* + * The flag if set to true will fetch change snapshots + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("interval", this.interval); + jsonWriter.writeArrayField("resourceIds", this.resourceIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("$skipToken", this.skipToken); + jsonWriter.writeNumberField("$top", this.top); + jsonWriter.writeStringField("table", this.table); + jsonWriter.writeBooleanField("fetchPropertyChanges", this.fetchPropertyChanges); + jsonWriter.writeBooleanField("fetchSnapshots", this.fetchSnapshots); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangesRequestParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangesRequestParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceChangesRequestParameters. + */ + public static ResourceChangesRequestParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangesRequestParameters deserializedResourceChangesRequestParameters + = new ResourceChangesRequestParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("interval".equals(fieldName)) { + deserializedResourceChangesRequestParameters.interval + = ResourceChangesRequestParametersInterval.fromJson(reader); + } else if ("resourceIds".equals(fieldName)) { + List resourceIds = reader.readArray(reader1 -> reader1.getString()); + deserializedResourceChangesRequestParameters.resourceIds = resourceIds; + } else if ("subscriptionId".equals(fieldName)) { + deserializedResourceChangesRequestParameters.subscriptionId = reader.getString(); + } else if ("$skipToken".equals(fieldName)) { + deserializedResourceChangesRequestParameters.skipToken = reader.getString(); + } else if ("$top".equals(fieldName)) { + deserializedResourceChangesRequestParameters.top = reader.getNullable(JsonReader::getInt); + } else if ("table".equals(fieldName)) { + deserializedResourceChangesRequestParameters.table = reader.getString(); + } else if ("fetchPropertyChanges".equals(fieldName)) { + deserializedResourceChangesRequestParameters.fetchPropertyChanges + = reader.getNullable(JsonReader::getBoolean); + } else if ("fetchSnapshots".equals(fieldName)) { + deserializedResourceChangesRequestParameters.fetchSnapshots + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangesRequestParameters; + }); + } +} 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..a3ca3de10920 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("start", + start() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(start())); + jsonWriter.writeStringField("end", end() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(end())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceChangesRequestParametersInterval from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceChangesRequestParametersInterval if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceChangesRequestParametersInterval. + */ + public static ResourceChangesRequestParametersInterval fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceChangesRequestParametersInterval deserializedResourceChangesRequestParametersInterval + = new ResourceChangesRequestParametersInterval(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("start".equals(fieldName)) { + deserializedResourceChangesRequestParametersInterval.withStart(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else if ("end".equals(fieldName)) { + deserializedResourceChangesRequestParametersInterval.withEnd(reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()))); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceChangesRequestParametersInterval; + }); + } +} 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..fb3e7df52954 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The resource property change. + */ +@Immutable +public final class ResourcePropertyChange implements JsonSerializable { + /* + * The property name + */ + private String propertyName; + + /* + * The property value in before snapshot + */ + private String beforeValue; + + /* + * The property value in after snapshot + */ + private String afterValue; + + /* + * The change category. + */ + private ChangeCategory changeCategory; + + /* + * The property change Type + */ + private PropertyChangeType propertyChangeType; + + /** + * Creates an instance of ResourcePropertyChange class. + */ + private ResourcePropertyChange() { + } + + /** + * Get the propertyName property: The property name. + * + * @return the propertyName value. + */ + public String propertyName() { + return this.propertyName; + } + + /** + * Get the beforeValue property: The property value in before snapshot. + * + * @return the beforeValue value. + */ + public String beforeValue() { + return this.beforeValue; + } + + /** + * Get the afterValue property: The property value in after snapshot. + * + * @return the afterValue value. + */ + public String afterValue() { + return this.afterValue; + } + + /** + * Get the changeCategory property: The change category. + * + * @return the changeCategory value. + */ + public ChangeCategory changeCategory() { + return this.changeCategory; + } + + /** + * Get the propertyChangeType property: The property change Type. + * + * @return the propertyChangeType value. + */ + public PropertyChangeType propertyChangeType() { + return this.propertyChangeType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyName", this.propertyName); + jsonWriter.writeStringField("changeCategory", + this.changeCategory == null ? null : this.changeCategory.toString()); + jsonWriter.writeStringField("propertyChangeType", + this.propertyChangeType == null ? null : this.propertyChangeType.toString()); + jsonWriter.writeStringField("beforeValue", this.beforeValue); + jsonWriter.writeStringField("afterValue", this.afterValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourcePropertyChange from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourcePropertyChange if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourcePropertyChange. + */ + public static ResourcePropertyChange fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourcePropertyChange deserializedResourcePropertyChange = new ResourcePropertyChange(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyName".equals(fieldName)) { + deserializedResourcePropertyChange.propertyName = reader.getString(); + } else if ("changeCategory".equals(fieldName)) { + deserializedResourcePropertyChange.changeCategory = ChangeCategory.fromString(reader.getString()); + } else if ("propertyChangeType".equals(fieldName)) { + deserializedResourcePropertyChange.propertyChangeType + = PropertyChangeType.fromString(reader.getString()); + } else if ("beforeValue".equals(fieldName)) { + deserializedResourcePropertyChange.beforeValue = reader.getString(); + } else if ("afterValue".equals(fieldName)) { + deserializedResourcePropertyChange.afterValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourcePropertyChange; + }); + } +} 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 5663e03a7397..5281dd924f53 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 @@ -1,20 +1,70 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; 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 { + /** + * List changes to a resource for a given time interval. + * + * @param parameters The request body. + * @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 request body. + * @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 request body. + * @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 request body. + * @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); + /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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. @@ -26,11 +76,34 @@ public interface ResourceProviders { /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * - * @param query Request specifying query and its options. + * @param query The request body. * @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 result. */ QueryResponse resources(QueryRequest query); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + Response> resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Map resourcesHistory(ResourcesHistoryRequest request); } 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..b9e3d7e44dfc --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Data on a specific resource snapshot. + */ +@Immutable +public class ResourceSnapshotData implements JsonSerializable { + /* + * The ID of the snapshot. + */ + 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. + */ + private OffsetDateTime timestamp; + + /* + * The resource snapshot content (in resourceChangeDetails response only). + */ + private Object content; + + /** + * Creates an instance of ResourceSnapshotData class. + */ + protected 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. + */ + 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. + */ + 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. + */ + ResourceSnapshotData withContent(Object content) { + this.content = content; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timestamp", + this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp)); + jsonWriter.writeStringField("snapshotId", this.snapshotId); + if (this.content != null) { + jsonWriter.writeUntypedField("content", this.content); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceSnapshotData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceSnapshotData if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceSnapshotData. + */ + public static ResourceSnapshotData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceSnapshotData deserializedResourceSnapshotData = new ResourceSnapshotData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timestamp".equals(fieldName)) { + deserializedResourceSnapshotData.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("snapshotId".equals(fieldName)) { + deserializedResourceSnapshotData.snapshotId = reader.getString(); + } else if ("content".equals(fieldName)) { + deserializedResourceSnapshotData.content = reader.readUntyped(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceSnapshotData; + }); + } +} 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..0cd705d9915e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes a history request to be executed. + */ +@Fluent +public final class ResourcesHistoryRequest implements JsonSerializable { + /* + * Azure subscriptions against which to execute the query. + */ + private List subscriptions; + + /* + * The resources query. + */ + private String query; + + /* + * The history request evaluation options + */ + private ResourcesHistoryRequestOptions options; + + /* + * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("subscriptions", this.subscriptions, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("query", this.query); + jsonWriter.writeJsonField("options", this.options); + jsonWriter.writeArrayField("managementGroups", this.managementGroups, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourcesHistoryRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourcesHistoryRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourcesHistoryRequest. + */ + public static ResourcesHistoryRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourcesHistoryRequest deserializedResourcesHistoryRequest = new ResourcesHistoryRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptions".equals(fieldName)) { + List subscriptions = reader.readArray(reader1 -> reader1.getString()); + deserializedResourcesHistoryRequest.subscriptions = subscriptions; + } else if ("query".equals(fieldName)) { + deserializedResourcesHistoryRequest.query = reader.getString(); + } else if ("options".equals(fieldName)) { + deserializedResourcesHistoryRequest.options = ResourcesHistoryRequestOptions.fromJson(reader); + } else if ("managementGroups".equals(fieldName)) { + List managementGroups = reader.readArray(reader1 -> reader1.getString()); + deserializedResourcesHistoryRequest.managementGroups = managementGroups; + } else { + reader.skipChildren(); + } + } + + return deserializedResourcesHistoryRequest; + }); + } +} 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..caeecfda6380 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The options for history request evaluation. + */ +@Fluent +public final class ResourcesHistoryRequestOptions implements JsonSerializable { + /* + * The time interval used to fetch history. + */ + private DateTimeInterval interval; + + /* + * The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property + * is present. + */ + 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. + */ + private Integer skip; + + /* + * Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. + */ + private String skipToken; + + /* + * Defines in which format query result returned. + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("interval", this.interval); + jsonWriter.writeNumberField("$top", this.top); + jsonWriter.writeNumberField("$skip", this.skip); + jsonWriter.writeStringField("$skipToken", this.skipToken); + jsonWriter.writeStringField("resultFormat", this.resultFormat == null ? null : this.resultFormat.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourcesHistoryRequestOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourcesHistoryRequestOptions if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourcesHistoryRequestOptions. + */ + public static ResourcesHistoryRequestOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourcesHistoryRequestOptions deserializedResourcesHistoryRequestOptions + = new ResourcesHistoryRequestOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("interval".equals(fieldName)) { + deserializedResourcesHistoryRequestOptions.interval = DateTimeInterval.fromJson(reader); + } else if ("$top".equals(fieldName)) { + deserializedResourcesHistoryRequestOptions.top = reader.getNullable(JsonReader::getInt); + } else if ("$skip".equals(fieldName)) { + deserializedResourcesHistoryRequestOptions.skip = reader.getNullable(JsonReader::getInt); + } else if ("$skipToken".equals(fieldName)) { + deserializedResourcesHistoryRequestOptions.skipToken = reader.getString(); + } else if ("resultFormat".equals(fieldName)) { + deserializedResourcesHistoryRequestOptions.resultFormat + = ResultFormat.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedResourcesHistoryRequestOptions; + }); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java index 5c70b2d150b1..dd8201cc5b30 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; @@ -9,12 +9,12 @@ */ public enum ResultFormat { /** - * Enum value table. + * table. */ TABLE("table"), /** - * Enum value objectArray. + * objectArray. */ OBJECT_ARRAY("objectArray"); diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultKind.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultKind.java deleted file mode 100644 index 6dcbbea8f6e7..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultKind.java +++ /dev/null @@ -1,46 +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.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Enum indicating a type of graph query. - */ -public final class ResultKind extends ExpandableStringEnum { - /** - * Static value basic for ResultKind. - */ - public static final ResultKind BASIC = fromString("basic"); - - /** - * Creates a new instance of ResultKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ResultKind() { - } - - /** - * Creates or finds a ResultKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding ResultKind. - */ - public static ResultKind fromString(String name) { - return fromString(name, ResultKind.class); - } - - /** - * Gets known ResultKind values. - * - * @return known ResultKind values. - */ - public static Collection values() { - return values(ResultKind.class); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultTruncated.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultTruncated.java index 5e9c3465288a..1f93cfb8c48c 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultTruncated.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultTruncated.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.models; @@ -9,12 +9,12 @@ */ public enum ResultTruncated { /** - * Enum value true. + * true. */ TRUE("true"), /** - * Enum value false. + * false. */ FALSE("false"); diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/package-info.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/package-info.java index d7ff6b962386..1cc7611d297c 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/package-info.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for ResourceGraphClient. + * Package containing the data models for ResourceGraph. * Azure Resource Graph API Reference. */ package com.azure.resourcemanager.resourcegraph.models; diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/package-info.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/package-info.java index 0d5bd4dec747..346ec986f023 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/package-info.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the classes for ResourceGraphClient. + * Package containing the classes for ResourceGraph. * Azure Resource Graph API Reference. */ package com.azure.resourcemanager.resourcegraph; diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/module-info.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/module-info.java index 1aa7cfee955a..d04852862927 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/module-info.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/module-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. module com.azure.resourcemanager.resourcegraph { requires transitive com.azure.core.management; diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/azure-resourcemanager-resourcegraph_metadata.json b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/azure-resourcemanager-resourcegraph_metadata.json new file mode 100644 index 000000000000..54fee3feec88 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/azure-resourcemanager-resourcegraph_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"ResourceChanges":"2020-09-01-preview","ResourceGraphApi":"2024-04-01","ResourceHistory":"2021-06-01-preview","GraphQueryApi":"2024-04-01"},"crossLanguageDefinitions":{"com.azure.resourcemanager.resourcegraph.fluent.ResourceGraphManagementClient":"Microsoft.ResourceGraph","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient":"Microsoft.ResourceGraph","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourceChangeDetails":"ResourceChanges.resourceChangeDetails","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourceChangeDetailsWithResponse":"ResourceChanges.resourceChangeDetails","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourceChanges":"ResourceChanges.resourceChanges","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourceChangesWithResponse":"ResourceChanges.resourceChanges","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resources":"ResourceGraphApi.resources","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourcesHistory":"ResourceHistory.resourcesHistory","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourcesHistoryWithResponse":"ResourceHistory.resourcesHistory","com.azure.resourcemanager.resourcegraph.fluent.ResourceProvidersClient.resourcesWithResponse":"ResourceGraphApi.resources","com.azure.resourcemanager.resourcegraph.fluent.models.QueryResponseInner":"ResourceGraphApi.QueryResponse","com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner":"ResourceChanges.ResourceChangeData","com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner":"ResourceChanges.ResourceChangeList","com.azure.resourcemanager.resourcegraph.implementation.ResourceGraphManagementClientBuilder":"Microsoft.ResourceGraph","com.azure.resourcemanager.resourcegraph.models.AuthorizationScopeFilter":"ResourceGraphApi.AuthorizationScopeFilter","com.azure.resourcemanager.resourcegraph.models.ChangeCategory":"ResourceChanges.ChangeCategory","com.azure.resourcemanager.resourcegraph.models.ChangeType":"ResourceChanges.ChangeType","com.azure.resourcemanager.resourcegraph.models.DateTimeInterval":"ResourceGraphCommon.DateTimeInterval","com.azure.resourcemanager.resourcegraph.models.ErrorDetails":"ResourceGraphCommon.ErrorDetails","com.azure.resourcemanager.resourcegraph.models.Facet":"ResourceGraphApi.Facet","com.azure.resourcemanager.resourcegraph.models.FacetError":"ResourceGraphApi.FacetError","com.azure.resourcemanager.resourcegraph.models.FacetRequest":"ResourceGraphApi.FacetRequest","com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions":"ResourceGraphApi.FacetRequestOptions","com.azure.resourcemanager.resourcegraph.models.FacetResult":"ResourceGraphApi.FacetResult","com.azure.resourcemanager.resourcegraph.models.FacetSortOrder":"ResourceGraphApi.FacetSortOrder","com.azure.resourcemanager.resourcegraph.models.PropertyChangeType":"ResourceChanges.PropertyChangeType","com.azure.resourcemanager.resourcegraph.models.QueryRequest":"ResourceGraphApi.QueryRequest","com.azure.resourcemanager.resourcegraph.models.QueryRequestOptions":"ResourceGraphApi.QueryRequestOptions","com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataAfterSnapshot":"ResourceChanges.ResourceChangeDataAfterSnapshot","com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataBeforeSnapshot":"ResourceChanges.ResourceChangeDataBeforeSnapshot","com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters":"ResourceChanges.ResourceChangeDetailsRequestParameters","com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters":"ResourceChanges.ResourceChangesRequestParameters","com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParametersInterval":"ResourceChanges.ResourceChangesRequestParametersInterval","com.azure.resourcemanager.resourcegraph.models.ResourcePropertyChange":"ResourceChanges.ResourcePropertyChange","com.azure.resourcemanager.resourcegraph.models.ResourceSnapshotData":"ResourceChanges.ResourceSnapshotData","com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest":"ResourceHistory.ResourcesHistoryRequest","com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequestOptions":"ResourceHistory.ResourcesHistoryRequestOptions","com.azure.resourcemanager.resourcegraph.models.ResultFormat":"ResourceGraphCommon.ResultFormat","com.azure.resourcemanager.resourcegraph.models.ResultTruncated":"ResourceGraphApi.ResultTruncated"},"generatedFiles":["src/main/java/com/azure/resourcemanager/resourcegraph/ResourceGraphManager.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphManagementClient.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/QueryResponseInner.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/resourcegraph/fluent/package-info.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/QueryResponseImpl.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphManagementClientImpl.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java","src/main/java/com/azure/resourcemanager/resourcegraph/implementation/package-info.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/Facet.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetError.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequest.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetRequestOptions.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetResult.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/FacetSortOrder.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryResponse.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultTruncated.java","src/main/java/com/azure/resourcemanager/resourcegraph/models/package-info.java","src/main/java/com/azure/resourcemanager/resourcegraph/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcegraph/proxy-config.json b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcegraph/proxy-config.json index a85765291865..209a157f2347 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcegraph/proxy-config.json +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resourcegraph/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.resourcegraph.implementation.GraphQueriesClientImpl$GraphQueriesService"],["com.azure.resourcemanager.resourcegraph.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.resourcegraph.implementation.ResourceProvidersClientImpl$ResourceProvidersService"]] \ No newline at end of file +[["com.azure.resourcemanager.resourcegraph.implementation.ResourceProvidersClientImpl$ResourceProvidersService"]] \ No newline at end of file diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/azure-resourcemanager-resourcegraph.properties b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/azure-resourcemanager-resourcegraph.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/resources/azure-resourcemanager-resourcegraph.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryCreateOrUpdateSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryCreateOrUpdateSamples.java deleted file mode 100644 index dc1338c0fe84..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryCreateOrUpdateSamples.java +++ /dev/null @@ -1,46 +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 java.util.HashMap; -import java.util.Map; - -/** - * Samples for GraphQuery CreateOrUpdate. - */ -public final class GraphQueryCreateOrUpdateSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryAdd. - * json - */ - /** - * Sample code: Create Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void createGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .define("MyDockerVMs") - .withRegion((String) null) - .withExistingResourceGroup("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group") - .withTags(mapOf()) - .withDescription("Docker VMs in PROD") - .withQuery("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'") - .create(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryDeleteSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryDeleteSamples.java deleted file mode 100644 index 026c6e7d028d..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryDeleteSamples.java +++ /dev/null @@ -1,26 +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; - -/** - * Samples for GraphQuery Delete. - */ -public final class GraphQueryDeleteSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryDelete. - * json - */ - /** - * Sample code: Delete Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void deleteGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .deleteWithResponse("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", "MyDockerVM", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryGetByResourceGroupSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryGetByResourceGroupSamples.java deleted file mode 100644 index e4ab7cf52d79..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryGetByResourceGroupSamples.java +++ /dev/null @@ -1,26 +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; - -/** - * Samples for GraphQuery GetByResourceGroup. - */ -public final class GraphQueryGetByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryGet. - * json - */ - /** - * Sample code: Get Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void getGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .getByResourceGroupWithResponse("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", "MyDockerVMs", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListByResourceGroupSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListByResourceGroupSamples.java deleted file mode 100644 index 918c6a042961..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListByResourceGroupSamples.java +++ /dev/null @@ -1,26 +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; - -/** - * Samples for GraphQuery ListByResourceGroup. - */ -public final class GraphQueryListByResourceGroupSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryList. - * json - */ - /** - * Sample code: Get a list of Graph Queries. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void getAListOfGraphQueries(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries() - .listByResourceGroup("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListSamples.java deleted file mode 100644 index 451fc8882ef4..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListSamples.java +++ /dev/null @@ -1,24 +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; - -/** - * Samples for GraphQuery List. - */ -public final class GraphQueryListSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryList. - * json - */ - /** - * Sample code: Get a list of Graph Queries. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void getAListOfGraphQueries(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.graphQueries().list("024e2271-06fa-46b6-9079-f1ed3c7b070e", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryUpdateSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryUpdateSamples.java deleted file mode 100644 index ecb9bcfa7062..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryUpdateSamples.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.resourcemanager.resourcegraph.models.GraphQueryResource; - -/** - * Samples for GraphQuery Update. - */ -public final class GraphQueryUpdateSamples { - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/GraphQueryUpdate. - * json - */ - /** - * Sample code: Update Graph Query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void updateGraphQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - GraphQueryResource resource = manager.graphQueries() - .getByResourceGroupWithResponse("024e2271-06fa-46b6-9079-f1ed3c7b070e", "my-resource-group", "MyDockerVMs", - com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withEtag("b0809832-ca62-4133-8f13-0c46580f9db1") - .withDescription("Modified description") - .withQuery("where isnotnull(tags['Prod']) and properties.extensions[0].Name == 'docker'") - .apply(); - } -} 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 deleted file mode 100644 index df3c66b93617..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java +++ /dev/null @@ -1,24 +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; - -/** - * 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 - */ - /** - * Sample code: OperationsList. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void operationsList(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - 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/ResourceProviderResourceChangeDetailsSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangeDetailsSamples.java new file mode 100644 index 000000000000..b6652de962f4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangeDetailsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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: 2020-09-01-preview/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..cbb9779e49a5 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangesSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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: 2020-09-01-preview/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: 2020-09-01-preview/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: 2020-09-01-preview/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..9812c5cb170e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesHistorySamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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: 2021-06-01-preview/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: 2021-06-01-preview/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 deleted file mode 100644 index 3f1dc08629ee..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java +++ /dev/null @@ -1,237 +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.resourcemanager.resourcegraph.models.FacetRequest; -import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; -import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; -import com.azure.resourcemanager.resourcegraph.models.QueryRequest; -import com.azure.resourcemanager.resourcegraph.models.QueryRequestOptions; -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 - */ - /** - * Sample code: Basic management group query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void basicManagementGroupQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest() - .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")) - .withQuery("Resources | project id, name, type, location, tags | limit 3"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesBasicQuery.json - */ - /** - * Sample code: Basic query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery("Resources | project id, name, type, location, tags | limit 3"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesFacetQuery.json - */ - /** - * Sample code: Query with a facet request. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void queryWithAFacetRequest(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5") - .withFacets(Arrays.asList( - new FacetRequest().withExpression("location") - .withOptions(new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), - new FacetRequest().withExpression("properties.storageProfile.osDisk.osType") - .withOptions(new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), - new FacetRequest().withExpression("nonExistingColumn") - .withOptions(new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), - new FacetRequest().withExpression("resourceGroup") - .withOptions(new FacetRequestOptions().withSortBy("tolower(resourceGroup)") - .withSortOrder(FacetSortOrder.ASC) - .withTop(3)), - new FacetRequest().withExpression("resourceGroup") - .withOptions( - new FacetRequestOptions().withFilter("resourceGroup contains 'test'").withTop(3)))), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesFilterQuery.json - */ - /** - * Sample code: Filter resources. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void filterResources(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesSummarizeQuery.json - */ - /** - * Sample code: Summarize resources by location. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void - summarizeResourcesByLocation(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery("Resources | project id, name, type, location | summarize by location"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesPropertiesQuery.json - */ - /** - * Sample code: Access a properties field. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void accessAPropertiesField(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesComplexQuery.json - */ - /** - * Sample code: Complex query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void complexQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse(new QueryRequest() - .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) - .withQuery( - "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesNextPageQuery.json - */ - /** - * Sample code: Next page query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - 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("fakeTokenPlaceholder")), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesFirstPageQuery.json - */ - /** - * Sample code: First page query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().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)), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesTenantBasicQuery.json - */ - /** - * Sample code: Basic tenant query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void basicTenantQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().withQuery("Resources | project id, name, type, location, tags | limit 3"), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: - * specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ - * ResourcesRandomPageQuery.json - */ - /** - * Sample code: Random page query. - * - * @param manager Entry point to ResourceGraphManager. - */ - public static void randomPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { - manager.resourceProviders() - .resourcesWithResponse( - new QueryRequest().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)), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/DateTimeIntervalTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/DateTimeIntervalTests.java new file mode 100644 index 000000000000..5668161f29a7 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/DateTimeIntervalTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.DateTimeInterval; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class DateTimeIntervalTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DateTimeInterval model + = BinaryData.fromString("{\"start\":\"2021-01-05T22:43:58Z\",\"end\":\"2021-03-11T09:58:27Z\"}") + .toObject(DateTimeInterval.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-05T22:43:58Z"), model.start()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-11T09:58:27Z"), model.end()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DateTimeInterval model = new DateTimeInterval().withStart(OffsetDateTime.parse("2021-01-05T22:43:58Z")) + .withEnd(OffsetDateTime.parse("2021-03-11T09:58:27Z")); + model = BinaryData.fromObject(model).toObject(DateTimeInterval.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-05T22:43:58Z"), model.start()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-11T09:58:27Z"), model.end()); + } +} 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 index 11f9e944852f..4b2902b09cc3 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.generated; @@ -13,24 +13,25 @@ public final class FacetRequestOptionsTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FacetRequestOptions model = BinaryData - .fromString("{\"sortBy\":\"ufo\",\"sortOrder\":\"asc\",\"filter\":\"wifsq\",\"$top\":1701108276}") + .fromString( + "{\"sortBy\":\"tqxhocdgeab\",\"sortOrder\":\"asc\",\"filter\":\"uticndvkaozwyif\",\"$top\":655079148}") .toObject(FacetRequestOptions.class); - Assertions.assertEquals("ufo", model.sortBy()); + Assertions.assertEquals("tqxhocdgeab", model.sortBy()); Assertions.assertEquals(FacetSortOrder.ASC, model.sortOrder()); - Assertions.assertEquals("wifsq", model.filter()); - Assertions.assertEquals(1701108276, model.top()); + Assertions.assertEquals("uticndvkaozwyif", model.filter()); + Assertions.assertEquals(655079148, model.top()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FacetRequestOptions model = new FacetRequestOptions().withSortBy("ufo") + FacetRequestOptions model = new FacetRequestOptions().withSortBy("tqxhocdgeab") .withSortOrder(FacetSortOrder.ASC) - .withFilter("wifsq") - .withTop(1701108276); + .withFilter("uticndvkaozwyif") + .withTop(655079148); model = BinaryData.fromObject(model).toObject(FacetRequestOptions.class); - Assertions.assertEquals("ufo", model.sortBy()); + Assertions.assertEquals("tqxhocdgeab", model.sortBy()); Assertions.assertEquals(FacetSortOrder.ASC, model.sortOrder()); - Assertions.assertEquals("wifsq", model.filter()); - Assertions.assertEquals(1701108276, model.top()); + Assertions.assertEquals("uticndvkaozwyif", model.filter()); + Assertions.assertEquals(655079148, 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 index a24eddf9b430..18e0aa59cfde 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.generated; @@ -14,27 +14,27 @@ public final class FacetRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FacetRequest model = BinaryData.fromString( - "{\"expression\":\"soqijg\",\"options\":{\"sortBy\":\"bpazlobcufpdzn\",\"sortOrder\":\"asc\",\"filter\":\"qqjnqgl\",\"$top\":2127527772}}") + "{\"expression\":\"zevndhkrwpdappds\",\"options\":{\"sortBy\":\"vwrwj\",\"sortOrder\":\"asc\",\"filter\":\"nhutjeltmrldhugj\",\"$top\":1346954674}}") .toObject(FacetRequest.class); - Assertions.assertEquals("soqijg", model.expression()); - Assertions.assertEquals("bpazlobcufpdzn", model.options().sortBy()); + Assertions.assertEquals("zevndhkrwpdappds", model.expression()); + Assertions.assertEquals("vwrwj", model.options().sortBy()); Assertions.assertEquals(FacetSortOrder.ASC, model.options().sortOrder()); - Assertions.assertEquals("qqjnqgl", model.options().filter()); - Assertions.assertEquals(2127527772, model.options().top()); + Assertions.assertEquals("nhutjeltmrldhugj", model.options().filter()); + Assertions.assertEquals(1346954674, model.options().top()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - FacetRequest model = new FacetRequest().withExpression("soqijg") - .withOptions(new FacetRequestOptions().withSortBy("bpazlobcufpdzn") + FacetRequest model = new FacetRequest().withExpression("zevndhkrwpdappds") + .withOptions(new FacetRequestOptions().withSortBy("vwrwj") .withSortOrder(FacetSortOrder.ASC) - .withFilter("qqjnqgl") - .withTop(2127527772)); + .withFilter("nhutjeltmrldhugj") + .withTop(1346954674)); model = BinaryData.fromObject(model).toObject(FacetRequest.class); - Assertions.assertEquals("soqijg", model.expression()); - Assertions.assertEquals("bpazlobcufpdzn", model.options().sortBy()); + Assertions.assertEquals("zevndhkrwpdappds", model.expression()); + Assertions.assertEquals("vwrwj", model.options().sortBy()); Assertions.assertEquals(FacetSortOrder.ASC, model.options().sortOrder()); - Assertions.assertEquals("qqjnqgl", model.options().filter()); - Assertions.assertEquals(2127527772, model.options().top()); + Assertions.assertEquals("nhutjeltmrldhugj", model.options().filter()); + Assertions.assertEquals(1346954674, 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 index dfe62ab06a03..eb6889afb9e6 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.generated; @@ -12,22 +12,10 @@ public final class FacetResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { FacetResult model = BinaryData.fromString( - "{\"resultType\":\"FacetResult\",\"totalRecords\":6646325726173395137,\"count\":194894857,\"data\":\"datawzjeiach\",\"expression\":\"oosflnr\"}") + "{\"resultType\":\"FacetResult\",\"totalRecords\":6522292179184062414,\"count\":2108755788,\"data\":\"\\\"datalwckbasyypnddhs\\\"\",\"expression\":\"cbacphejkotynqg\"}") .toObject(FacetResult.class); - Assertions.assertEquals("oosflnr", model.expression()); - Assertions.assertEquals(6646325726173395137L, model.totalRecords()); - Assertions.assertEquals(194894857, model.count()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FacetResult model = new FacetResult().withExpression("oosflnr") - .withTotalRecords(6646325726173395137L) - .withCount(194894857) - .withData("datawzjeiach"); - model = BinaryData.fromObject(model).toObject(FacetResult.class); - Assertions.assertEquals("oosflnr", model.expression()); - Assertions.assertEquals(6646325726173395137L, model.totalRecords()); - Assertions.assertEquals(194894857, model.count()); + Assertions.assertEquals("cbacphejkotynqg", model.expression()); + Assertions.assertEquals(6522292179184062414L, model.totalRecords()); + Assertions.assertEquals(2108755788, 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 index 74e522653943..ec4d5f7196ae 100644 --- 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 @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.resourcegraph.generated; @@ -11,14 +11,8 @@ public final class FacetTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - Facet model = BinaryData.fromString("{\"resultType\":\"Facet\",\"expression\":\"j\"}").toObject(Facet.class); - Assertions.assertEquals("j", model.expression()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Facet model = new Facet().withExpression("j"); - model = BinaryData.fromObject(model).toObject(Facet.class); - Assertions.assertEquals("j", model.expression()); + Facet model = BinaryData.fromString("{\"resultType\":\"Facet\",\"expression\":\"wcukjfkgiawxk\"}") + .toObject(Facet.class); + Assertions.assertEquals("wcukjfkgiawxk", model.expression()); } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesCreateOrUpdateWithResponseMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 074f7be3999f..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,63 +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.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class GraphQueriesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"timeModified\":\"2020-12-23T07:48:17Z\",\"description\":\"e\",\"query\":\"kh\",\"resultKind\":\"basic\"},\"etag\":\"vfyexfw\",\"location\":\"ybcibvyvdcsit\",\"tags\":{\"hfiqscjeypvhe\":\"aamdect\",\"gm\":\"rkgqhcjrefo\"},\"id\":\"qsl\",\"name\":\"yyvxyqjpkcattpn\",\"type\":\"jcrcczsqpjhvmda\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ResourceGraphManager manager = ResourceGraphManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - GraphQueryResource response = manager.graphQueries() - .define("njeaseipheofloke") - .withRegion("zvdudgwdslfhotwm") - .withExistingResourceGroup("mpmngnzscxaqwoo", "hcbonqvpkvlr") - .withTags(mapOf("cftadeh", "pwlbjnpg", "dejbavo", "nltyfsoppusuesnz", "vudwx", "xzdmohctb")) - .withEtag("jj") - .withDescription("jbdlwtgrhpdjpju") - .withQuery("asxazjpqyegualhb") - .create(); - - Assertions.assertEquals("ybcibvyvdcsit", response.location()); - Assertions.assertEquals("aamdect", response.tags().get("hfiqscjeypvhe")); - Assertions.assertEquals("vfyexfw", response.etag()); - Assertions.assertEquals("e", response.description()); - Assertions.assertEquals("kh", response.query()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesDeleteWithResponseMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesDeleteWithResponseMockTests.java deleted file mode 100644 index af9adeebf9b5..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesDeleteWithResponseMockTests.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.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class GraphQueriesDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ResourceGraphManager manager = ResourceGraphManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.graphQueries() - .deleteWithResponse("onlebxetqgtzxdpn", "bqqwxrj", "eallnwsubisnj", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesGetByResourceGroupWithResponseMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesGetByResourceGroupWithResponseMockTests.java deleted file mode 100644 index 6d82899a4e9d..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesGetByResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,43 +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.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class GraphQueriesGetByResourceGroupWithResponseMockTests { - @Test - public void testGetByResourceGroupWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"timeModified\":\"2021-05-13T11:12:13Z\",\"description\":\"cuiywgqyw\",\"query\":\"ndrvynhzg\",\"resultKind\":\"basic\"},\"etag\":\"cgyncocpecf\",\"location\":\"m\",\"tags\":{\"zevgb\":\"ofsx\"},\"id\":\"qjqabcypmivkwl\",\"name\":\"uvcc\",\"type\":\"wnfnbacf\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - ResourceGraphManager manager = ResourceGraphManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - GraphQueryResource response = manager.graphQueries() - .getByResourceGroupWithResponse("tthzrvqd", "abhjybi", "ehoqfbowskan", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("m", response.location()); - Assertions.assertEquals("ofsx", response.tags().get("zevgb")); - Assertions.assertEquals("cgyncocpecf", response.etag()); - Assertions.assertEquals("cuiywgqyw", response.description()); - Assertions.assertEquals("ndrvynhzg", response.query()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesListByResourceGroupMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesListByResourceGroupMockTests.java deleted file mode 100644 index 598b784790be..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesListByResourceGroupMockTests.java +++ /dev/null @@ -1,43 +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.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class GraphQueriesListByResourceGroupMockTests { - @Test - public void testListByResourceGroup() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"timeModified\":\"2021-01-16T07:23:11Z\",\"description\":\"hix\",\"query\":\"igdtopbob\",\"resultKind\":\"basic\"},\"etag\":\"m\",\"location\":\"w\",\"tags\":{\"hrzayvvtpgvdf\":\"a\"},\"id\":\"iotkftutqxl\",\"name\":\"gxlefgugnxkrxd\",\"type\":\"mi\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - 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.graphQueries().listByResourceGroup("jthjqkwpyei", "xmqci", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("w", response.iterator().next().location()); - Assertions.assertEquals("a", response.iterator().next().tags().get("hrzayvvtpgvdf")); - Assertions.assertEquals("m", response.iterator().next().etag()); - Assertions.assertEquals("hix", response.iterator().next().description()); - Assertions.assertEquals("igdtopbob", response.iterator().next().query()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesListMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesListMockTests.java deleted file mode 100644 index ac0ce8c5c0a5..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueriesListMockTests.java +++ /dev/null @@ -1,43 +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.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import com.azure.resourcemanager.resourcegraph.models.GraphQueryResource; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class GraphQueriesListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"timeModified\":\"2021-11-18T07:05:01Z\",\"description\":\"erhhbcsglumm\",\"query\":\"jtjaodxobnbdxkq\",\"resultKind\":\"basic\"},\"etag\":\"ajionpimexgstxg\",\"location\":\"po\",\"tags\":{\"djwzrlov\":\"aajrm\",\"qsqsy\":\"clwhijcoejctbz\",\"ppofmxaxcfjpgdd\":\"bkbfkgukdkex\",\"zxibqeoj\":\"ocjjxhvpmouexh\"},\"id\":\"xqbzvddntwnd\",\"name\":\"icbtwnpzao\",\"type\":\"vuhrhcffcyddgl\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - 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.graphQueries().list("locx", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("po", response.iterator().next().location()); - Assertions.assertEquals("aajrm", response.iterator().next().tags().get("djwzrlov")); - Assertions.assertEquals("ajionpimexgstxg", response.iterator().next().etag()); - Assertions.assertEquals("erhhbcsglumm", response.iterator().next().description()); - Assertions.assertEquals("jtjaodxobnbdxkq", response.iterator().next().query()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListResultTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListResultTests.java deleted file mode 100644 index 30c680d2cd71..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryListResultTests.java +++ /dev/null @@ -1,26 +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.GraphQueryListResult; -import org.junit.jupiter.api.Assertions; - -public final class GraphQueryListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GraphQueryListResult model = BinaryData.fromString( - "{\"nextLink\":\"pmqnja\",\"value\":[{\"properties\":{\"timeModified\":\"2021-08-22T00:38:37Z\",\"description\":\"r\",\"query\":\"zvcputegjvwmfda\",\"resultKind\":\"basic\"},\"etag\":\"dvpjhulsuuvmk\",\"location\":\"ozkrwfndiodjpslw\",\"tags\":{\"azakl\":\"pvwryoqpsoacc\",\"fdosyg\":\"lahbcryff\",\"hcrzevd\":\"xpaojakhmsbz\",\"qjbpfzfsin\":\"hlxaolthqtr\"},\"id\":\"gvfcj\",\"name\":\"wzo\",\"type\":\"xjtfelluwfzit\"},{\"properties\":{\"timeModified\":\"2021-06-22T14:15:07Z\",\"description\":\"fpjkjlxofp\",\"query\":\"vhpfxxypininmay\",\"resultKind\":\"basic\"},\"etag\":\"bkpodepooginuv\",\"location\":\"mihe\",\"tags\":{\"si\":\"arxzxtheot\",\"iqihn\":\"yevc\",\"bwjzr\":\"un\",\"fublj\":\"fygxgispemvtzfk\"},\"id\":\"fxqeof\",\"name\":\"aeqjhqjbasvms\",\"type\":\"jqul\"},{\"properties\":{\"timeModified\":\"2021-11-20T09:27:06Z\",\"description\":\"nbybkzgcwrwcl\",\"query\":\"xwrljdouskcqvkoc\",\"resultKind\":\"basic\"},\"etag\":\"kwt\",\"location\":\"hxbnjbiksqrg\",\"tags\":{\"pee\":\"ainqpjwnzlljfm\",\"yqduujit\":\"vmgxsab\",\"rwpdappdsbdkvwrw\":\"jczdzevndh\"},\"id\":\"feusnhut\",\"name\":\"eltmrldhugjzzdat\",\"type\":\"xhocdgeablgphuti\"},{\"properties\":{\"timeModified\":\"2021-11-02T18:15:21Z\",\"description\":\"aozwyiftyhxhu\",\"query\":\"okftyxolniwpwcuk\",\"resultKind\":\"basic\"},\"etag\":\"iawxklry\",\"location\":\"lwckbasyypnddhs\",\"tags\":{\"qgoulznd\":\"acphejkoty\",\"wyqkgfgibm\":\"i\",\"qsrxybzqqed\":\"dgak\"},\"id\":\"ytb\",\"name\":\"iqfouflmmnkz\",\"type\":\"modmglougpb\"}]}") - .toObject(GraphQueryListResult.class); - Assertions.assertEquals("pmqnja", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GraphQueryListResult model = new GraphQueryListResult().withNextLink("pmqnja"); - model = BinaryData.fromObject(model).toObject(GraphQueryListResult.class); - Assertions.assertEquals("pmqnja", model.nextLink()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryPropertiesTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryPropertiesTests.java deleted file mode 100644 index 7bbea3a9b074..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryPropertiesTests.java +++ /dev/null @@ -1,28 +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.GraphQueryProperties; -import org.junit.jupiter.api.Assertions; - -public final class GraphQueryPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GraphQueryProperties model = BinaryData.fromString( - "{\"timeModified\":\"2021-08-27T05:18:38Z\",\"description\":\"rbnwbxgjvtbvpy\",\"query\":\"szdnr\",\"resultKind\":\"basic\"}") - .toObject(GraphQueryProperties.class); - Assertions.assertEquals("rbnwbxgjvtbvpy", model.description()); - Assertions.assertEquals("szdnr", model.query()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GraphQueryProperties model = new GraphQueryProperties().withDescription("rbnwbxgjvtbvpy").withQuery("szdnr"); - model = BinaryData.fromObject(model).toObject(GraphQueryProperties.class); - Assertions.assertEquals("rbnwbxgjvtbvpy", model.description()); - Assertions.assertEquals("szdnr", model.query()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryPropertiesUpdateParametersTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryPropertiesUpdateParametersTests.java deleted file mode 100644 index 6bc6614e3889..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryPropertiesUpdateParametersTests.java +++ /dev/null @@ -1,29 +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.GraphQueryPropertiesUpdateParameters; -import org.junit.jupiter.api.Assertions; - -public final class GraphQueryPropertiesUpdateParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GraphQueryPropertiesUpdateParameters model - = BinaryData.fromString("{\"description\":\"ymzidn\",\"query\":\"zcxtbzsgfyccsn\"}") - .toObject(GraphQueryPropertiesUpdateParameters.class); - Assertions.assertEquals("ymzidn", model.description()); - Assertions.assertEquals("zcxtbzsgfyccsn", model.query()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GraphQueryPropertiesUpdateParameters model - = new GraphQueryPropertiesUpdateParameters().withDescription("ymzidn").withQuery("zcxtbzsgfyccsn"); - model = BinaryData.fromObject(model).toObject(GraphQueryPropertiesUpdateParameters.class); - Assertions.assertEquals("ymzidn", model.description()); - Assertions.assertEquals("zcxtbzsgfyccsn", model.query()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryResourceInnerTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryResourceInnerTests.java deleted file mode 100644 index 2d953897cd0f..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryResourceInnerTests.java +++ /dev/null @@ -1,52 +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.GraphQueryResourceInner; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class GraphQueryResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GraphQueryResourceInner model = BinaryData.fromString( - "{\"properties\":{\"timeModified\":\"2021-09-06T16:19:25Z\",\"description\":\"tduqktapspwgcuer\",\"query\":\"umkdosvqwhbmd\",\"resultKind\":\"basic\"},\"etag\":\"f\",\"location\":\"dgmb\",\"tags\":{\"fpfpsalgbquxigj\":\"xppbhtqqro\"},\"id\":\"jgzjaoyfhrtx\",\"name\":\"lnerkujysvleju\",\"type\":\"fqawrlyxw\"}") - .toObject(GraphQueryResourceInner.class); - Assertions.assertEquals("dgmb", model.location()); - Assertions.assertEquals("xppbhtqqro", model.tags().get("fpfpsalgbquxigj")); - Assertions.assertEquals("f", model.etag()); - Assertions.assertEquals("tduqktapspwgcuer", model.description()); - Assertions.assertEquals("umkdosvqwhbmd", model.query()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GraphQueryResourceInner model = new GraphQueryResourceInner().withLocation("dgmb") - .withTags(mapOf("fpfpsalgbquxigj", "xppbhtqqro")) - .withEtag("f") - .withDescription("tduqktapspwgcuer") - .withQuery("umkdosvqwhbmd"); - model = BinaryData.fromObject(model).toObject(GraphQueryResourceInner.class); - Assertions.assertEquals("dgmb", model.location()); - Assertions.assertEquals("xppbhtqqro", model.tags().get("fpfpsalgbquxigj")); - Assertions.assertEquals("f", model.etag()); - Assertions.assertEquals("tduqktapspwgcuer", model.description()); - Assertions.assertEquals("umkdosvqwhbmd", model.query()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryUpdateParametersTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryUpdateParametersTests.java deleted file mode 100644 index 885831a0eec4..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/GraphQueryUpdateParametersTests.java +++ /dev/null @@ -1,50 +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.GraphQueryUpdateParameters; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class GraphQueryUpdateParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - GraphQueryUpdateParameters model = BinaryData.fromString( - "{\"tags\":{\"uitnwuiz\":\"hmuouqfprwzwbn\",\"x\":\"a\",\"hr\":\"fizuckyf\",\"zwdzuh\":\"idf\"},\"etag\":\"mwisdkfthwxmnt\",\"properties\":{\"description\":\"aop\",\"query\":\"mijcmmxdcufufs\"}}") - .toObject(GraphQueryUpdateParameters.class); - Assertions.assertEquals("hmuouqfprwzwbn", model.tags().get("uitnwuiz")); - Assertions.assertEquals("mwisdkfthwxmnt", model.etag()); - Assertions.assertEquals("aop", model.description()); - Assertions.assertEquals("mijcmmxdcufufs", model.query()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - GraphQueryUpdateParameters model = new GraphQueryUpdateParameters() - .withTags(mapOf("uitnwuiz", "hmuouqfprwzwbn", "x", "a", "hr", "fizuckyf", "zwdzuh", "idf")) - .withEtag("mwisdkfthwxmnt") - .withDescription("aop") - .withQuery("mijcmmxdcufufs"); - model = BinaryData.fromObject(model).toObject(GraphQueryUpdateParameters.class); - Assertions.assertEquals("hmuouqfprwzwbn", model.tags().get("uitnwuiz")); - Assertions.assertEquals("mwisdkfthwxmnt", model.etag()); - Assertions.assertEquals("aop", model.description()); - Assertions.assertEquals("mijcmmxdcufufs", model.query()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/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 a0de1514ec6c..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationDisplayTests.java +++ /dev/null @@ -1,36 +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; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - 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()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - 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 6121384eadab..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationInnerTests.java +++ /dev/null @@ -1,42 +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; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - 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()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - 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 a56a9746140e..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationListResultTests.java +++ /dev/null @@ -1,63 +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; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - 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()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - 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 5654177322d6..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListMockTests.java +++ /dev/null @@ -1,43 +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.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; -import com.azure.resourcemanager.resourcegraph.models.Operation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"fblj\",\"display\":{\"provider\":\"btoqcjmkljavbqid\",\"resource\":\"ajzyul\",\"operation\":\"u\",\"description\":\"krlkhbzhfepg\"},\"origin\":\"qex\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - 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(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fblj", response.iterator().next().name()); - Assertions.assertEquals("btoqcjmkljavbqid", response.iterator().next().display().provider()); - Assertions.assertEquals("ajzyul", response.iterator().next().display().resource()); - Assertions.assertEquals("u", response.iterator().next().display().operation()); - Assertions.assertEquals("krlkhbzhfepg", response.iterator().next().display().description()); - Assertions.assertEquals("qex", response.iterator().next().origin()); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataAfterSnapshotTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataAfterSnapshotTests.java new file mode 100644 index 000000000000..76308588b2bc --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataAfterSnapshotTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataAfterSnapshot; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ResourceChangeDataAfterSnapshotTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceChangeDataAfterSnapshot model = BinaryData + .fromString( + "{\"snapshotId\":\"hpf\",\"timestamp\":\"2021-10-07T09:36:49Z\",\"content\":\"\\\"datapini\\\"\"}") + .toObject(ResourceChangeDataAfterSnapshot.class); + Assertions.assertEquals("hpf", model.snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-07T09:36:49Z"), model.timestamp()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataBeforeSnapshotTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataBeforeSnapshotTests.java new file mode 100644 index 000000000000..c58b498a2c7e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataBeforeSnapshotTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataBeforeSnapshot; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ResourceChangeDataBeforeSnapshotTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceChangeDataBeforeSnapshot model = BinaryData + .fromString( + "{\"snapshotId\":\"wzo\",\"timestamp\":\"2021-08-01T19:04:33Z\",\"content\":\"\\\"datatfell\\\"\"}") + .toObject(ResourceChangeDataBeforeSnapshot.class); + Assertions.assertEquals("wzo", model.snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-01T19:04:33Z"), model.timestamp()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataInnerTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataInnerTests.java new file mode 100644 index 000000000000..ab476355c57d --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDataInnerTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.models.ChangeCategory; +import com.azure.resourcemanager.resourcegraph.models.ChangeType; +import com.azure.resourcemanager.resourcegraph.models.PropertyChangeType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ResourceChangeDataInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceChangeDataInner model = BinaryData.fromString( + "{\"resourceId\":\"cmdv\",\"changeId\":\"jhulsuuvmkjo\",\"beforeSnapshot\":{\"snapshotId\":\"rwfndiod\",\"timestamp\":\"2021-09-01T06:44:17Z\",\"content\":\"\\\"datalwejdpv\\\"\"},\"afterSnapshot\":{\"snapshotId\":\"yoqpsoaccta\",\"timestamp\":\"2021-11-14T07:17:25Z\",\"content\":\"\\\"dataljlahbcryf\\\"\"},\"changeType\":\"Update\",\"propertyChanges\":[{\"propertyName\":\"sy\",\"beforeValue\":\"xpaojakhmsbz\",\"afterValue\":\"crzevdphlx\",\"changeCategory\":\"System\",\"propertyChangeType\":\"Remove\"},{\"propertyName\":\"thqt\",\"beforeValue\":\"qjbpfzfsin\",\"afterValue\":\"v\",\"changeCategory\":\"System\",\"propertyChangeType\":\"Insert\"}]}") + .toObject(ResourceChangeDataInner.class); + Assertions.assertEquals("cmdv", model.resourceId()); + Assertions.assertEquals("jhulsuuvmkjo", model.changeId()); + Assertions.assertEquals("rwfndiod", model.beforeSnapshot().snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-01T06:44:17Z"), model.beforeSnapshot().timestamp()); + Assertions.assertEquals("yoqpsoaccta", model.afterSnapshot().snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-14T07:17:25Z"), model.afterSnapshot().timestamp()); + Assertions.assertEquals(ChangeType.UPDATE, model.changeType()); + Assertions.assertEquals("sy", model.propertyChanges().get(0).propertyName()); + Assertions.assertEquals("xpaojakhmsbz", model.propertyChanges().get(0).beforeValue()); + Assertions.assertEquals("crzevdphlx", model.propertyChanges().get(0).afterValue()); + Assertions.assertEquals(ChangeCategory.SYSTEM, model.propertyChanges().get(0).changeCategory()); + Assertions.assertEquals(PropertyChangeType.REMOVE, model.propertyChanges().get(0).propertyChangeType()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDetailsRequestParametersTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDetailsRequestParametersTests.java new file mode 100644 index 000000000000..3df1950e0b3a --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangeDetailsRequestParametersTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ResourceChangeDetailsRequestParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceChangeDetailsRequestParameters model = BinaryData.fromString( + "{\"resourceIds\":[\"ngbwjz\"],\"changeIds\":[\"fygxgispemvtzfk\",\"fublj\",\"fxqeof\",\"aeqjhqjbasvms\"]}") + .toObject(ResourceChangeDetailsRequestParameters.class); + Assertions.assertEquals("ngbwjz", model.resourceIds().get(0)); + Assertions.assertEquals("fygxgispemvtzfk", model.changeIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResourceChangeDetailsRequestParameters model + = new ResourceChangeDetailsRequestParameters().withResourceIds(Arrays.asList("ngbwjz")) + .withChangeIds(Arrays.asList("fygxgispemvtzfk", "fublj", "fxqeof", "aeqjhqjbasvms")); + model = BinaryData.fromObject(model).toObject(ResourceChangeDetailsRequestParameters.class); + Assertions.assertEquals("ngbwjz", model.resourceIds().get(0)); + Assertions.assertEquals("fygxgispemvtzfk", model.changeIds().get(0)); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangesRequestParametersIntervalTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangesRequestParametersIntervalTests.java new file mode 100644 index 000000000000..8be30e2d5209 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceChangesRequestParametersIntervalTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParametersInterval; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ResourceChangesRequestParametersIntervalTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceChangesRequestParametersInterval model + = BinaryData.fromString("{\"start\":\"2021-03-23T13:19:49Z\",\"end\":\"2021-09-10T01:37:09Z\"}") + .toObject(ResourceChangesRequestParametersInterval.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-23T13:19:49Z"), model.start()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T01:37:09Z"), model.end()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResourceChangesRequestParametersInterval model + = new ResourceChangesRequestParametersInterval().withStart(OffsetDateTime.parse("2021-03-23T13:19:49Z")) + .withEnd(OffsetDateTime.parse("2021-09-10T01:37:09Z")); + model = BinaryData.fromObject(model).toObject(ResourceChangesRequestParametersInterval.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-23T13:19:49Z"), model.start()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T01:37:09Z"), model.end()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourcePropertyChangeTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourcePropertyChangeTests.java new file mode 100644 index 000000000000..ff4cc4a7188d --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourcePropertyChangeTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.ChangeCategory; +import com.azure.resourcemanager.resourcegraph.models.PropertyChangeType; +import com.azure.resourcemanager.resourcegraph.models.ResourcePropertyChange; +import org.junit.jupiter.api.Assertions; + +public final class ResourcePropertyChangeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourcePropertyChange model = BinaryData.fromString( + "{\"propertyName\":\"mayhuybbkpodepoo\",\"beforeValue\":\"nuvamiheogna\",\"afterValue\":\"zxtheotusivyevcc\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Insert\"}") + .toObject(ResourcePropertyChange.class); + Assertions.assertEquals("mayhuybbkpodepoo", model.propertyName()); + Assertions.assertEquals("nuvamiheogna", model.beforeValue()); + Assertions.assertEquals("zxtheotusivyevcc", model.afterValue()); + Assertions.assertEquals(ChangeCategory.USER, model.changeCategory()); + Assertions.assertEquals(PropertyChangeType.INSERT, model.propertyChangeType()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProvidersResourceChangeDetailsWithResponseMockTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProvidersResourceChangeDetailsWithResponseMockTests.java new file mode 100644 index 000000000000..f4a5a8b1530e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProvidersResourceChangeDetailsWithResponseMockTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.resourcegraph.ResourceGraphManager; +import com.azure.resourcemanager.resourcegraph.models.ChangeCategory; +import com.azure.resourcemanager.resourcegraph.models.ChangeType; +import com.azure.resourcemanager.resourcegraph.models.PropertyChangeType; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ResourceProvidersResourceChangeDetailsWithResponseMockTests { + @Test + public void testResourceChangeDetailsWithResponse() throws Exception { + String responseStr + = "[{\"resourceId\":\"zuckyfi\",\"changeId\":\"rfidfvzwdz\",\"beforeSnapshot\":{\"snapshotId\":\"tymw\",\"timestamp\":\"2021-06-04T23:46:10Z\",\"content\":\"\\\"datakfthwxmntei\\\"\"},\"afterSnapshot\":{\"snapshotId\":\"opvkmijcm\",\"timestamp\":\"2021-11-05T05:35:16Z\",\"content\":\"\\\"datacufufsrpymz\\\"\"},\"changeType\":\"Update\",\"propertyChanges\":[{\"propertyName\":\"zcxtbzsgfyccsn\",\"beforeValue\":\"mdwzjeiachboo\",\"afterValue\":\"lnrosfqp\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Remove\"},{\"propertyName\":\"hzzvypyq\",\"beforeValue\":\"mzinpvswjdk\",\"afterValue\":\"soodqxhcrmnoh\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Update\"},{\"propertyName\":\"kwh\",\"beforeValue\":\"oifiyipjxsqwpgr\",\"afterValue\":\"znorcj\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Insert\"},{\"propertyName\":\"nb\",\"beforeValue\":\"qabnmoc\",\"afterValue\":\"ysh\",\"changeCategory\":\"System\",\"propertyChangeType\":\"Update\"}]},{\"resourceId\":\"fblj\",\"changeId\":\"gpbtoqcjmklj\",\"beforeSnapshot\":{\"snapshotId\":\"bqidtqaj\",\"timestamp\":\"2021-08-03T08:21:01Z\",\"content\":\"\\\"datal\\\"\"},\"afterSnapshot\":{\"snapshotId\":\"u\",\"timestamp\":\"2021-11-19T04:41:57Z\",\"content\":\"\\\"datarlkhbzhfepgzgq\\\"\"},\"changeType\":\"Update\",\"propertyChanges\":[{\"propertyName\":\"c\",\"beforeValue\":\"c\",\"afterValue\":\"ierhhbcsglummaj\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Update\"},{\"propertyName\":\"odxobnbdxkqpxok\",\"beforeValue\":\"ionpimexg\",\"afterValue\":\"xgcp\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Update\"},{\"propertyName\":\"maajrmvdjwzrlo\",\"beforeValue\":\"clwhijcoejctbz\",\"afterValue\":\"s\",\"changeCategory\":\"User\",\"propertyChangeType\":\"Insert\"},{\"propertyName\":\"cbkbfkg\",\"beforeValue\":\"dkexxppofm\",\"afterValue\":\"x\",\"changeCategory\":\"System\",\"propertyChangeType\":\"Remove\"}]}]"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ResourceGraphManager manager = ResourceGraphManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + List response = manager.resourceProviders() + .resourceChangeDetailsWithResponse( + new ResourceChangeDetailsRequestParameters().withResourceIds(Arrays.asList("rujqg")) + .withChangeIds(Arrays.asList("muouqfp", "wzwbnguitn", "uizga", "x")), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("zuckyfi", response.get(0).resourceId()); + Assertions.assertEquals("rfidfvzwdz", response.get(0).changeId()); + Assertions.assertEquals("tymw", response.get(0).beforeSnapshot().snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T23:46:10Z"), + response.get(0).beforeSnapshot().timestamp()); + Assertions.assertEquals("opvkmijcm", response.get(0).afterSnapshot().snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-05T05:35:16Z"), + response.get(0).afterSnapshot().timestamp()); + Assertions.assertEquals(ChangeType.UPDATE, response.get(0).changeType()); + Assertions.assertEquals("zcxtbzsgfyccsn", response.get(0).propertyChanges().get(0).propertyName()); + Assertions.assertEquals("mdwzjeiachboo", response.get(0).propertyChanges().get(0).beforeValue()); + Assertions.assertEquals("lnrosfqp", response.get(0).propertyChanges().get(0).afterValue()); + Assertions.assertEquals(ChangeCategory.USER, response.get(0).propertyChanges().get(0).changeCategory()); + Assertions.assertEquals(PropertyChangeType.REMOVE, + response.get(0).propertyChanges().get(0).propertyChangeType()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceSnapshotDataTests.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceSnapshotDataTests.java new file mode 100644 index 000000000000..1bcc1db2f76e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/test/java/com/azure/resourcemanager/resourcegraph/generated/ResourceSnapshotDataTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcegraph.models.ResourceSnapshotData; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ResourceSnapshotDataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceSnapshotData model = BinaryData.fromString( + "{\"snapshotId\":\"fziton\",\"timestamp\":\"2021-06-22T14:15:07Z\",\"content\":\"\\\"datafpjkjlxofp\\\"\"}") + .toObject(ResourceSnapshotData.class); + Assertions.assertEquals("fziton", model.snapshotId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-22T14:15:07Z"), model.timestamp()); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/tsp-location.yaml b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/tsp-location.yaml new file mode 100644 index 000000000000..f997e7ce9ad4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/ResourceGraph +commit: 61ef1085014acf8197d8b44e9dec699ef635a750 +repo: Azure/azure-rest-api-specs +additionalDirectories: