diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md index 98c9dc1a4a82..ec270b437911 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.1 (2022-10-18) + +- 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-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md index c7e4150e722d..38a363b23381 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md @@ -2,7 +2,7 @@ Azure Resource Manager ResourceGraph client library for Java. -This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-2021-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-2022-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-resourcegraph - 1.0.0-beta.3 + 1.0.0-beta.4 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md index e1910609c0d8..83ace4750878 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md @@ -7,7 +7,10 @@ ## ResourceProvider +- [ResourceChangeDetails](#resourceprovider_resourcechangedetails) +- [ResourceChanges](#resourceprovider_resourcechanges) - [Resources](#resourceprovider_resources) +- [ResourcesHistory](#resourceprovider_resourceshistory) ### Operations_List ```java @@ -16,7 +19,7 @@ import com.azure.core.util.Context; /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/OperationsList.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/OperationsList.json */ /** * Sample code: OperationsList. @@ -29,6 +32,126 @@ public final class OperationsListSamples { } ``` +### ResourceProvider_ResourceChangeDetails + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChangeDetails. */ +public final class ResourceProviderResourceChangeDetailsSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangeDetails.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangeDetailsWithResponse( + new ResourceChangeDetailsRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withChangeIds(Arrays.asList("53dc0515-b86b-4bc2-979b-e4694ab4a556")), + Context.NONE); + } +} +``` + +### ResourceProvider_ResourceChanges + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParametersInterval; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChanges. */ +public final class ResourceProviderResourceChangesSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChanges.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesNextPage.json + */ + /** + * Sample code: Next page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withSkipToken("ew0KICAiJGlkIjogIjEiLA0KICAiRW5kVGltZSI6ICJcL0RhdGUoMTU1MDc0NT") + .withTop(2), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesFirstPage.json + */ + /** + * Sample code: First page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withTop(2), + Context.NONE); + } +} +``` + ### ResourceProvider_Resources ```java @@ -43,7 +166,7 @@ import java.util.Arrays; /** Samples for ResourceProvider Resources. */ public final class ResourceProviderResourcesSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesMgBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesMgBasicQuery.json */ /** * Sample code: Basic management group query. @@ -61,7 +184,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesBasicQuery.json */ /** * Sample code: Basic query. @@ -79,7 +202,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFacetQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesFacetQuery.json */ /** * Sample code: Query with a facet request. @@ -127,7 +250,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFilterQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesFilterQuery.json */ /** * Sample code: Filter resources. @@ -147,7 +270,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesSummarizeQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesSummarizeQuery.json */ /** * Sample code: Summarize resources by location. @@ -166,7 +289,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesPropertiesQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesPropertiesQuery.json */ /** * Sample code: Access a properties field. @@ -186,7 +309,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesComplexQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesComplexQuery.json */ /** * Sample code: Complex query. @@ -206,7 +329,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesNextPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesNextPageQuery.json */ /** * Sample code: Next page query. @@ -227,7 +350,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFirstPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesFirstPageQuery.json */ /** * Sample code: First page query. @@ -246,7 +369,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesTenantBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesTenantBasicQuery.json */ /** * Sample code: Basic tenant query. @@ -262,7 +385,7 @@ public final class ResourceProviderResourcesSamples { } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesRandomPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesRandomPageQuery.json */ /** * Sample code: Random page query. @@ -282,3 +405,66 @@ public final class ResourceProviderResourcesSamples { } ``` +### ResourceProvider_ResourcesHistory + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.models.DateTimeInterval; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequestOptions; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourcesHistory. */ +public final class ResourceProviderResourcesHistorySamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ + /** + * Sample code: Resource History Management Group scope Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryManagementGroupScopeQuery( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))) + .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ + /** + * Sample code: Resource History Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withSubscriptions(Arrays.asList("a7f33fdb-e646-4f15-89aa-3a360210861e")) + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))), + Context.NONE); + } +} +``` + diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml index 62da0247ae9e..c8c9d78143ee 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for ResourceGraph Management - This package contains Microsoft Azure SDK for ResourceGraph Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Resource Graph API Reference. Package tag package-2021-03. + This package contains Microsoft Azure SDK for ResourceGraph Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Resource Graph API Reference. Package tag package-2022-10. https://github.com/Azure/azure-sdk-for-java 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 dbc13510472b..4f537783beaf 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 @@ -206,7 +206,7 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.resourcegraph") .append("/") - .append("1.0.0-beta.3"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -263,7 +263,11 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil } } - /** @return Resource collection API of ResourceProviders. */ + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ public ResourceProviders resourceProviders() { if (this.resourceProviders == null) { this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); @@ -271,7 +275,11 @@ public ResourceProviders resourceProviders() { return resourceProviders; } - /** @return Resource collection API of Operations. */ + /** + * 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); diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java index 16412a3b5883..e2cc897677fd 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java @@ -16,13 +16,6 @@ public interface ResourceGraphClient { */ String getEndpoint(); - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - /** * Gets The HTTP pipeline to send requests through. * 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 e78b538a4bfc..980570dcfb0a 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceProvidersClient.java @@ -9,7 +9,13 @@ 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; /** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ public interface ResourceProvidersClient { @@ -17,24 +23,101 @@ 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 context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result. + * @return query result along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - QueryResponseInner resources(QueryRequest query); + Response resourcesWithResponse(QueryRequest query, Context context); /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * * @param query Request specifying query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryResponseInner resources(QueryRequest query); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result along with {@link Response}. + * @return any object along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response resourcesWithResponse(QueryRequest query, Context context); + Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Object resourcesHistory(ResourcesHistoryRequest request); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceChangeListInner resourceChanges(ResourceChangesRequestParameters parameters); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/OperationInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/OperationInner.java index 3807d8330214..283fbd362e7e 100644 --- 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 @@ -29,6 +29,10 @@ public final class OperationInner { @JsonProperty(value = "origin") private String origin; + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + /** * Get the name property: Operation name: {provider}/{resource}/{operation}. * 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 499340d6c1f3..9d693eed3168 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 @@ -21,8 +21,8 @@ public final class QueryResponseInner { private long totalRecords; /* - * Number of records returned in the current response. In the case of - * paging, this is the number of records in the current page. + * Number of records returned in the current response. In the case of paging, this is the number of records in the + * current page. */ @JsonProperty(value = "count", required = true) private long count; @@ -34,9 +34,8 @@ public final class QueryResponseInner { private ResultTruncated resultTruncated; /* - * When present, the value can be passed to a subsequent query call - * (together with the same query and scopes used in the current request) to - * retrieve the next page of data. + * When present, the value can be passed to a subsequent query call (together with the same query and scopes used + * in the current request) to retrieve the next page of data. */ @JsonProperty(value = "$skipToken") private String skipToken; @@ -53,6 +52,10 @@ public final class QueryResponseInner { @JsonProperty(value = "facets") private List facets; + /** Creates an instance of QueryResponseInner class. */ + public QueryResponseInner() { + } + /** * Get the totalRecords property: Number of total records matching the query. * diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java new file mode 100644 index 000000000000..a4fca875be8f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcegraph.models.ChangeType; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataAfterSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataBeforeSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourcePropertyChange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Data on a specific change, represented by a pair of before and after resource snapshots. */ +@Fluent +public final class ResourceChangeDataInner { + /* + * The resource for a change. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The change ID. Valid and unique within the specified resource only. + */ + @JsonProperty(value = "changeId", required = true) + private String changeId; + + /* + * The snapshot before the change. + */ + @JsonProperty(value = "beforeSnapshot", required = true) + private ResourceChangeDataBeforeSnapshot beforeSnapshot; + + /* + * The snapshot after the change. + */ + @JsonProperty(value = "afterSnapshot", required = true) + private ResourceChangeDataAfterSnapshot afterSnapshot; + + /* + * The change type for snapshot. PropertyChanges will be provided in case of Update change type + */ + @JsonProperty(value = "changeType") + private ChangeType changeType; + + /* + * An array of resource property change + */ + @JsonProperty(value = "propertyChanges") + private List propertyChanges; + + /** Creates an instance of ResourceChangeDataInner class. */ + public ResourceChangeDataInner() { + } + + /** + * Get the resourceId property: The resource for a change. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource for a change. + * + * @param resourceId the resourceId value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the changeId property: The change ID. Valid and unique within the specified resource only. + * + * @return the changeId value. + */ + public String changeId() { + return this.changeId; + } + + /** + * Set the changeId property: The change ID. Valid and unique within the specified resource only. + * + * @param changeId the changeId value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withChangeId(String changeId) { + this.changeId = changeId; + return this; + } + + /** + * Get the beforeSnapshot property: The snapshot before the change. + * + * @return the beforeSnapshot value. + */ + public ResourceChangeDataBeforeSnapshot beforeSnapshot() { + return this.beforeSnapshot; + } + + /** + * Set the beforeSnapshot property: The snapshot before the change. + * + * @param beforeSnapshot the beforeSnapshot value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withBeforeSnapshot(ResourceChangeDataBeforeSnapshot beforeSnapshot) { + this.beforeSnapshot = beforeSnapshot; + return this; + } + + /** + * Get the afterSnapshot property: The snapshot after the change. + * + * @return the afterSnapshot value. + */ + public ResourceChangeDataAfterSnapshot afterSnapshot() { + return this.afterSnapshot; + } + + /** + * Set the afterSnapshot property: The snapshot after the change. + * + * @param afterSnapshot the afterSnapshot value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withAfterSnapshot(ResourceChangeDataAfterSnapshot afterSnapshot) { + this.afterSnapshot = afterSnapshot; + return this; + } + + /** + * Get the changeType property: The change type for snapshot. PropertyChanges will be provided in case of Update + * change type. + * + * @return the changeType value. + */ + public ChangeType changeType() { + return this.changeType; + } + + /** + * Set the changeType property: The change type for snapshot. PropertyChanges will be provided in case of Update + * change type. + * + * @param changeType the changeType value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withChangeType(ChangeType changeType) { + this.changeType = changeType; + return this; + } + + /** + * Get the propertyChanges property: An array of resource property change. + * + * @return the propertyChanges value. + */ + public List propertyChanges() { + return this.propertyChanges; + } + + /** + * Set the propertyChanges property: An array of resource property change. + * + * @param propertyChanges the propertyChanges value to set. + * @return the ResourceChangeDataInner object itself. + */ + public ResourceChangeDataInner withPropertyChanges(List propertyChanges) { + this.propertyChanges = propertyChanges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (changeId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property changeId in model ResourceChangeDataInner")); + } + if (beforeSnapshot() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property beforeSnapshot in model ResourceChangeDataInner")); + } else { + beforeSnapshot().validate(); + } + if (afterSnapshot() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property afterSnapshot in model ResourceChangeDataInner")); + } else { + afterSnapshot().validate(); + } + if (propertyChanges() != null) { + propertyChanges().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceChangeDataInner.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java new file mode 100644 index 000000000000..b3fa17d80639 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of changes associated with a resource over a specific time interval. */ +@Fluent +public final class ResourceChangeListInner { + /* + * The pageable value returned by the operation, i.e. a list of changes to the resource. + * + * - The list is ordered from the most recent changes to the least recent changes. + * - This list will be empty if there were no changes during the requested interval. + * - The `Before` snapshot timestamp value of the oldest change can be outside of the specified time interval. + */ + @JsonProperty(value = "changes") + private List changes; + + /* + * Skip token that encodes the skip information while executing the current request + */ + @JsonProperty(value = "$skipToken") + private Object skipToken; + + /** Creates an instance of ResourceChangeListInner class. */ + public ResourceChangeListInner() { + } + + /** + * Get the changes property: The pageable value returned by the operation, i.e. a list of changes to the resource. + * + *

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

- The list is ordered from the most recent changes to the least recent changes. - This list will be empty if + * there were no changes during the requested interval. - The `Before` snapshot timestamp value of the oldest change + * can be outside of the specified time interval. + * + * @param changes the changes value to set. + * @return the ResourceChangeListInner object itself. + */ + public ResourceChangeListInner withChanges(List changes) { + this.changes = changes; + return this; + } + + /** + * Get the skipToken property: Skip token that encodes the skip information while executing the current request. + * + * @return the skipToken value. + */ + public Object skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: Skip token that encodes the skip information while executing the current request. + * + * @param skipToken the skipToken value to set. + * @return the ResourceChangeListInner object itself. + */ + public ResourceChangeListInner withSkipToken(Object skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (changes() != null) { + changes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java index 92e4e6c050be..1d0169fd672f 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsClientImpl.java @@ -82,10 +82,10 @@ private Mono> listSinglePageAsync() { new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2022-10-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .>map( res -> new PagedResponseBase<>( @@ -111,10 +111,11 @@ private Mono> listSinglePageAsync(Context context) new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2022-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .list(this.client.getEndpoint(), apiVersion, accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java new file mode 100644 index 000000000000..56cd4365f0f3 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.implementation; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.models.ChangeType; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataAfterSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDataBeforeSnapshot; +import com.azure.resourcemanager.resourcegraph.models.ResourcePropertyChange; +import java.util.Collections; +import java.util.List; + +public final class ResourceChangeDataImpl implements ResourceChangeData { + private ResourceChangeDataInner innerObject; + + private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; + + ResourceChangeDataImpl( + ResourceChangeDataInner innerObject, + com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String changeId() { + return this.innerModel().changeId(); + } + + public ResourceChangeDataBeforeSnapshot beforeSnapshot() { + return this.innerModel().beforeSnapshot(); + } + + public ResourceChangeDataAfterSnapshot afterSnapshot() { + return this.innerModel().afterSnapshot(); + } + + public ChangeType changeType() { + return this.innerModel().changeType(); + } + + public List propertyChanges() { + List inner = this.innerModel().propertyChanges(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceChangeDataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java new file mode 100644 index 000000000000..e0e7c8dca71a --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.implementation; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeData; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ResourceChangeListImpl implements ResourceChangeList { + private ResourceChangeListInner innerObject; + + private final com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager; + + ResourceChangeListImpl( + ResourceChangeListInner innerObject, + com.azure.resourcemanager.resourcegraph.ResourceGraphManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List changes() { + List inner = this.innerModel().changes(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Object skipToken() { + return this.innerModel().skipToken(); + } + + public ResourceChangeListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java index 8712af38576c..5620f7fc0065 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientBuilder.java @@ -103,26 +103,21 @@ public ResourceGraphClientBuilder serializerAdapter(SerializerAdapter serializer * @return an instance of ResourceGraphClientImpl. */ public ResourceGraphClientImpl buildClient() { - if (pipeline == null) { - this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - } - if (endpoint == null) { - this.endpoint = "https://management.azure.com"; - } - if (environment == null) { - this.environment = AzureEnvironment.AZURE; - } - if (pipeline == null) { - this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - } - if (defaultPollInterval == null) { - this.defaultPollInterval = Duration.ofSeconds(30); - } - if (serializerAdapter == null) { - this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); - } + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); ResourceGraphClientImpl client = - new ResourceGraphClientImpl(pipeline, serializerAdapter, defaultPollInterval, environment, endpoint); + new ResourceGraphClientImpl( + 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/ResourceGraphClientImpl.java index 334dc3c6d7a4..37f9ee5f7964 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java @@ -15,6 +15,7 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -30,7 +31,6 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.time.Duration; -import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -49,18 +49,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. */ private final HttpPipeline httpPipeline; @@ -140,7 +128,6 @@ public OperationsClient getOperations() { this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; - this.apiVersion = "2021-03-01"; this.resourceProviders = new ResourceProvidersClientImpl(this); this.operations = new OperationsClientImpl(this); } @@ -161,10 +148,7 @@ public Context getContext() { * @return the merged context. */ public Context mergeContext(Context context) { - for (Map.Entry entry : this.getContext().getValues().entrySet()) { - context = context.addData(entry.getKey(), entry.getValue()); - } - return context; + return CoreUtils.mergeContexts(this.getContext(), context); } /** 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 173159447bea..96f286522445 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersClientImpl.java @@ -23,7 +23,13 @@ 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 reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ @@ -62,6 +68,39 @@ Mono> resources( @BodyParam("application/json") QueryRequest query, @HeaderParam("Accept") String accept, Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/resourcesHistory") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resourcesHistory( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourcesHistoryRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/resourceChanges") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resourceChanges( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceChangesRequestParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceGraph/resourceChangeDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resourceChangeDetails( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceChangeDetailsRequestParameters parameters, + @HeaderParam("Accept") String accept, + Context context); } /** @@ -86,11 +125,10 @@ private Mono> resourcesWithResponseAsync(QueryReque } else { query.validate(); } + final String apiVersion = "2022-10-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> - service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context)) + .withContext(context -> service.resources(this.client.getEndpoint(), apiVersion, query, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -117,9 +155,10 @@ private Mono> resourcesWithResponseAsync(QueryReque } else { query.validate(); } + final String apiVersion = "2022-10-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context); + return service.resources(this.client.getEndpoint(), apiVersion, query, accept, context); } /** @@ -133,43 +172,352 @@ private Mono> resourcesWithResponseAsync(QueryReque */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono resourcesAsync(QueryRequest query) { - return resourcesWithResponseAsync(query) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return resourcesWithResponseAsync(query).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * * @param query Request specifying query and its options. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result. + * @return query result along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public QueryResponseInner resources(QueryRequest query) { - return resourcesAsync(query).block(); + public Response resourcesWithResponse(QueryRequest query, Context context) { + return resourcesWithResponseAsync(query, context).block(); } /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * * @param query Request specifying query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryResponseInner resources(QueryRequest query) { + return resourcesWithResponse(query, Context.NONE).getValue(); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourcesHistoryWithResponseAsync(ResourcesHistoryRequest request) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String apiVersion = "2021-06-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.resourcesHistory(this.client.getEndpoint(), apiVersion, request, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result along with {@link Response}. + * @return any object along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response resourcesWithResponse(QueryRequest query, Context context) { - return resourcesWithResponseAsync(query, context).block(); + private Mono> resourcesHistoryWithResponseAsync(ResourcesHistoryRequest request, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String apiVersion = "2021-06-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resourcesHistory(this.client.getEndpoint(), apiVersion, request, accept, context); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resourcesHistoryAsync(ResourcesHistoryRequest request) { + return resourcesHistoryWithResponseAsync(request).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context) { + return resourcesHistoryWithResponseAsync(request, context).block(); + } + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Object resourcesHistory(ResourcesHistoryRequest request) { + return resourcesHistoryWithResponse(request, Context.NONE).getValue(); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourceChangesWithResponseAsync( + ResourceChangesRequestParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.resourceChanges(this.client.getEndpoint(), apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourceChangesWithResponseAsync( + ResourceChangesRequestParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resourceChanges(this.client.getEndpoint(), apiVersion, parameters, accept, context); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resourceChangesAsync(ResourceChangesRequestParameters parameters) { + return resourceChangesWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context) { + return resourceChangesWithResponseAsync(parameters, context).block(); + } + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceChangeListInner resourceChanges(ResourceChangesRequestParameters parameters) { + return resourceChangesWithResponse(parameters, Context.NONE).getValue(); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourceChangeDetailsWithResponseAsync( + ResourceChangeDetailsRequestParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.resourceChangeDetails(this.client.getEndpoint(), apiVersion, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resourceChangeDetailsWithResponseAsync( + ResourceChangeDetailsRequestParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.resourceChangeDetails(this.client.getEndpoint(), apiVersion, parameters, accept, context); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> resourceChangeDetailsAsync( + ResourceChangeDetailsRequestParameters parameters) { + return resourceChangeDetailsWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context) { + return resourceChangeDetailsWithResponseAsync(parameters, context).block(); + } + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters) { + return resourceChangeDetailsWithResponse(parameters, Context.NONE).getValue(); } } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java index e0a6ae542ea0..30bad434dfaf 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceProvidersImpl.java @@ -10,9 +10,19 @@ 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.stream.Collectors; public final class ResourceProvidersImpl implements ResourceProviders { private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); @@ -28,6 +38,19 @@ public ResourceProvidersImpl( this.serviceManager = serviceManager; } + public Response resourcesWithResponse(QueryRequest query, Context context) { + Response inner = this.serviceClient().resourcesWithResponse(query, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + public QueryResponse resources(QueryRequest query) { QueryResponseInner inner = this.serviceClient().resources(query); if (inner != null) { @@ -37,19 +60,70 @@ public QueryResponse resources(QueryRequest query) { } } - public Response resourcesWithResponse(QueryRequest query, Context context) { - Response inner = this.serviceClient().resourcesWithResponse(query, context); + public Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context) { + return this.serviceClient().resourcesHistoryWithResponse(request, context); + } + + public Object resourcesHistory(ResourcesHistoryRequest request) { + return this.serviceClient().resourcesHistory(request); + } + + public Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context) { + Response inner = this.serviceClient().resourceChangesWithResponse(parameters, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new QueryResponseImpl(inner.getValue(), this.manager())); + new ResourceChangeListImpl(inner.getValue(), this.manager())); } else { return null; } } + public ResourceChangeList resourceChanges(ResourceChangesRequestParameters parameters) { + ResourceChangeListInner inner = this.serviceClient().resourceChanges(parameters); + if (inner != null) { + return new ResourceChangeListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context) { + Response> inner = + this.serviceClient().resourceChangeDetailsWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters) { + List inner = this.serviceClient().resourceChangeDetails(parameters); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + private ResourceProvidersClient serviceClient() { return this.innerClient; } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java new file mode 100644 index 000000000000..ab6c050484ce --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines what level of authorization resources should be returned based on the which subscriptions and management + * groups are passed as scopes. + */ +public enum AuthorizationScopeFilter { + /** Enum value AtScopeAndBelow. */ + AT_SCOPE_AND_BELOW("AtScopeAndBelow"), + + /** Enum value AtScopeAndAbove. */ + AT_SCOPE_AND_ABOVE("AtScopeAndAbove"), + + /** Enum value AtScopeExact. */ + AT_SCOPE_EXACT("AtScopeExact"), + + /** Enum value AtScopeAboveAndBelow. */ + AT_SCOPE_ABOVE_AND_BELOW("AtScopeAboveAndBelow"); + + /** The actual serialized value for a AuthorizationScopeFilter instance. */ + private final String value; + + AuthorizationScopeFilter(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AuthorizationScopeFilter instance. + * + * @param value the serialized value to parse. + * @return the parsed AuthorizationScopeFilter object, or null if unable to parse. + */ + @JsonCreator + public static AuthorizationScopeFilter fromString(String value) { + if (value == null) { + return null; + } + AuthorizationScopeFilter[] items = AuthorizationScopeFilter.values(); + for (AuthorizationScopeFilter item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java new file mode 100644 index 000000000000..5b52538b3fae --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The change category. */ +public enum ChangeCategory { + /** Enum value User. */ + USER("User"), + + /** Enum value System. */ + SYSTEM("System"); + + /** The actual serialized value for a ChangeCategory instance. */ + private final String value; + + ChangeCategory(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeCategory instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeCategory object, or null if unable to parse. + */ + @JsonCreator + public static ChangeCategory fromString(String value) { + if (value == null) { + return null; + } + ChangeCategory[] items = ChangeCategory.values(); + for (ChangeCategory item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java new file mode 100644 index 000000000000..a90022c91624 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The change type for snapshot. PropertyChanges will be provided in case of Update change type. */ +public enum ChangeType { + /** Enum value Create. */ + CREATE("Create"), + + /** Enum value Update. */ + UPDATE("Update"), + + /** Enum value Delete. */ + DELETE("Delete"); + + /** The actual serialized value for a ChangeType instance. */ + private final String value; + + ChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeType object, or null if unable to parse. + */ + @JsonCreator + public static ChangeType fromString(String value) { + if (value == null) { + return null; + } + ChangeType[] items = ChangeType.values(); + for (ChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java new file mode 100644 index 000000000000..aafb62317826 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/DateTimeInterval.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. `[start, end)`. */ +@Fluent +public class DateTimeInterval { + /* + * A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, end)`. Specifying a + * `start` that occurs chronologically after `end` will result in an error. + */ + @JsonProperty(value = "start", required = true) + private OffsetDateTime start; + + /* + * A datetime indicating the exclusive/open end of the time interval, i.e. `[start, `**`end`**`)`. Specifying an + * `end` that occurs chronologically before `start` will result in an error. + */ + @JsonProperty(value = "end", required = true) + private OffsetDateTime end; + + /** Creates an instance of DateTimeInterval class. */ + public DateTimeInterval() { + } + + /** + * Get the start property: A datetime indicating the inclusive/closed start of the time interval, i.e. + * `[`**`start`**`, end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. + * + * @return the start value. + */ + public OffsetDateTime start() { + return this.start; + } + + /** + * Set the start property: A datetime indicating the inclusive/closed start of the time interval, i.e. + * `[`**`start`**`, end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. + * + * @param start the start value to set. + * @return the DateTimeInterval object itself. + */ + public DateTimeInterval withStart(OffsetDateTime start) { + this.start = start; + return this; + } + + /** + * Get the end property: A datetime indicating the exclusive/open end of the time interval, i.e. `[start, + * `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in an error. + * + * @return the end value. + */ + public OffsetDateTime end() { + return this.end; + } + + /** + * Set the end property: A datetime indicating the exclusive/open end of the time interval, i.e. `[start, + * `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in an error. + * + * @param end the end value to set. + * @return the DateTimeInterval object itself. + */ + public DateTimeInterval withEnd(OffsetDateTime end) { + this.end = end; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (start() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property start in model DateTimeInterval")); + } + if (end() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property end in model DateTimeInterval")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DateTimeInterval.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ErrorDetails.java index 4737e577634e..501869d84d30 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 @@ -33,6 +33,10 @@ public final class ErrorDetails { */ @JsonIgnore private Map additionalProperties; + /** Creates an instance of ErrorDetails class. */ + public ErrorDetails() { + } + /** * Get the code property: Error code identifying the specific error. * 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 86e4778394e2..d3c773d058c1 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 @@ -30,6 +30,10 @@ public class Facet { @JsonProperty(value = "expression", required = true) private String expression; + /** Creates an instance of Facet class. */ + public Facet() { + } + /** * Get the expression property: Facet expression, same as in the corresponding facet request. * 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 d74851ac29af..e13948879087 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 @@ -22,6 +22,10 @@ public final class FacetError extends Facet { @JsonProperty(value = "errors", required = true) private List errors; + /** Creates an instance of FacetError class. */ + public FacetError() { + } + /** * Get the errors property: An array containing detected facet errors with details. * 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 0e24a6a14f1d..b1a29ec231c6 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 @@ -23,6 +23,10 @@ public final class FacetRequest { @JsonProperty(value = "options") private FacetRequestOptions options; + /** Creates an instance of FacetRequest class. */ + public FacetRequest() { + } + /** * Get the expression property: The column or list of columns to summarize by. * 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 d8c9e77c0790..a5da137822ec 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 @@ -11,8 +11,7 @@ @Fluent public final class FacetRequestOptions { /* - * The column name or query expression to sort on. Defaults to count if not - * present. + * The column name or query expression to sort on. Defaults to count if not present. */ @JsonProperty(value = "sortBy") private String sortBy; @@ -24,8 +23,8 @@ public final class FacetRequestOptions { private FacetSortOrder sortOrder; /* - * Specifies the filter condition for the 'where' clause which will be run - * on main query's result, just before the actual faceting. + * Specifies the filter condition for the 'where' clause which will be run on main query's result, just before the + * actual faceting. */ @JsonProperty(value = "filter") private String filter; @@ -36,6 +35,10 @@ public final class FacetRequestOptions { @JsonProperty(value = "$top") private Integer top; + /** Creates an instance of FacetRequestOptions class. */ + public FacetRequestOptions() { + } + /** * Get the sortBy property: The column name or query expression to sort on. Defaults to count if not present. * 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 257e12a4207f..5e5bdc9d860e 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 @@ -28,12 +28,15 @@ public final class FacetResult extends Facet { private int count; /* - * A JObject array or Table containing the desired facets. Only present if - * the facet is valid. + * A JObject array or Table containing the desired facets. Only present if the facet is valid. */ @JsonProperty(value = "data", required = true) private Object data; + /** Creates an instance of FacetResult class. */ + public FacetResult() { + } + /** * Get the totalRecords property: Number of total records in the facet results. * 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 03d27b3b22b8..c50fbe86827a 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 @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for FacetSortOrder. */ +/** The sorting order by the selected column (count by default). */ public enum FacetSortOrder { /** Enum value asc. */ ASC("asc"), @@ -30,6 +30,9 @@ public enum FacetSortOrder { */ @JsonCreator public static FacetSortOrder fromString(String value) { + if (value == null) { + return null; + } FacetSortOrder[] items = FacetSortOrder.values(); for (FacetSortOrder item : items) { if (item.toString().equalsIgnoreCase(value)) { @@ -39,6 +42,7 @@ public static FacetSortOrder fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { 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 index 6ae26220ffce..27a233a48443 100644 --- 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 @@ -34,6 +34,10 @@ public final class OperationDisplay { @JsonProperty(value = "description") private String description; + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + /** * Get the provider property: Service provider: Microsoft Resource Graph. * 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 index 918f1093b5cd..e352f47df2b3 100644 --- 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 @@ -16,12 +16,15 @@ @Fluent public final class OperationListResult { /* - * List of Resource Graph operations supported by the Resource Graph - * resource provider. + * List of Resource Graph operations supported by the Resource Graph resource provider. */ @JsonProperty(value = "value") 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. * diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java new file mode 100644 index 000000000000..0dc462cff3a4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The property change Type. */ +public enum PropertyChangeType { + /** Enum value Insert. */ + INSERT("Insert"), + + /** Enum value Update. */ + UPDATE("Update"), + + /** Enum value Remove. */ + REMOVE("Remove"); + + /** The actual serialized value for a PropertyChangeType instance. */ + private final String value; + + PropertyChangeType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PropertyChangeType instance. + * + * @param value the serialized value to parse. + * @return the parsed PropertyChangeType object, or null if unable to parse. + */ + @JsonCreator + public static PropertyChangeType fromString(String value) { + if (value == null) { + return null; + } + PropertyChangeType[] items = PropertyChangeType.values(); + for (PropertyChangeType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequest.java index 8fd1ab1c7347..19506a00ca5d 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 @@ -19,8 +19,7 @@ public final class QueryRequest { private List subscriptions; /* - * Azure management groups against which to execute the query. Example: [ - * 'mg1', 'mg2' ] + * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] */ @JsonProperty(value = "managementGroups") private List managementGroups; @@ -43,6 +42,10 @@ public final class QueryRequest { @JsonProperty(value = "facets") private List facets; + /** Creates an instance of QueryRequest class. */ + public QueryRequest() { + } + /** * Get the subscriptions property: Azure subscriptions against which to execute the query. * 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 fd367a645844..b0a1b7e5c4f1 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/QueryRequestOptions.java @@ -11,22 +11,21 @@ @Fluent public final class QueryRequestOptions { /* - * Continuation token for pagination, capturing the next page size and - * offset, as well as the context of the query. + * Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. */ @JsonProperty(value = "$skipToken") private String skipToken; /* - * The maximum number of rows that the query should return. Overrides the - * page size when ```$skipToken``` property is present. + * The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property + * is present. */ @JsonProperty(value = "$top") private Integer top; /* - * The number of rows to skip from the beginning of the results. Overrides - * the next page offset when ```$skipToken``` property is present. + * The number of rows to skip from the beginning of the results. Overrides the next page offset when + * ```$skipToken``` property is present. */ @JsonProperty(value = "$skip") private Integer skip; @@ -38,13 +37,23 @@ public final class QueryRequestOptions { private ResultFormat resultFormat; /* - * Only applicable for tenant and management group level queries to decide - * whether to allow partial scopes for result in case the number of - * subscriptions exceed allowed limits. + * Only applicable for tenant and management group level queries to decide whether to allow partial scopes for + * result in case the number of subscriptions exceed allowed limits. */ @JsonProperty(value = "allowPartialScopes") private Boolean allowPartialScopes; + /* + * Defines what level of authorization resources should be returned based on the which subscriptions and management + * groups are passed as scopes. + */ + @JsonProperty(value = "authorizationScopeFilter") + private AuthorizationScopeFilter authorizationScopeFilter; + + /** Creates an instance of QueryRequestOptions class. */ + public QueryRequestOptions() { + } + /** * Get the skipToken property: Continuation token for pagination, capturing the next page size and offset, as well * as the context of the query. @@ -153,6 +162,28 @@ public QueryRequestOptions withAllowPartialScopes(Boolean allowPartialScopes) { return this; } + /** + * Get the authorizationScopeFilter property: Defines what level of authorization resources should be returned based + * on the which subscriptions and management groups are passed as scopes. + * + * @return the authorizationScopeFilter value. + */ + public AuthorizationScopeFilter authorizationScopeFilter() { + return this.authorizationScopeFilter; + } + + /** + * Set the authorizationScopeFilter property: Defines what level of authorization resources should be returned based + * on the which subscriptions and management groups are passed as scopes. + * + * @param authorizationScopeFilter the authorizationScopeFilter value to set. + * @return the QueryRequestOptions object itself. + */ + public QueryRequestOptions withAuthorizationScopeFilter(AuthorizationScopeFilter authorizationScopeFilter) { + this.authorizationScopeFilter = authorizationScopeFilter; + return this; + } + /** * Validates the instance. * diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java new file mode 100644 index 000000000000..9787266e2cc0 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner; +import java.util.List; + +/** An immutable client-side representation of ResourceChangeData. */ +public interface ResourceChangeData { + /** + * Gets the resourceId property: The resource for a change. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the changeId property: The change ID. Valid and unique within the specified resource only. + * + * @return the changeId value. + */ + String changeId(); + + /** + * Gets the beforeSnapshot property: The snapshot before the change. + * + * @return the beforeSnapshot value. + */ + ResourceChangeDataBeforeSnapshot beforeSnapshot(); + + /** + * Gets the afterSnapshot property: The snapshot after the change. + * + * @return the afterSnapshot value. + */ + ResourceChangeDataAfterSnapshot afterSnapshot(); + + /** + * Gets the changeType property: The change type for snapshot. PropertyChanges will be provided in case of Update + * change type. + * + * @return the changeType value. + */ + ChangeType changeType(); + + /** + * Gets the propertyChanges property: An array of resource property change. + * + * @return the propertyChanges value. + */ + List propertyChanges(); + + /** + * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeDataInner object. + * + * @return the inner object. + */ + ResourceChangeDataInner innerModel(); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java new file mode 100644 index 000000000000..78abecca0c57 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import java.time.OffsetDateTime; + +/** The snapshot after the change. */ +@Fluent +public final class ResourceChangeDataAfterSnapshot extends ResourceSnapshotData { + /** Creates an instance of ResourceChangeDataAfterSnapshot class. */ + public ResourceChangeDataAfterSnapshot() { + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataAfterSnapshot withSnapshotId(String snapshotId) { + super.withSnapshotId(snapshotId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataAfterSnapshot withTimestamp(OffsetDateTime timestamp) { + super.withTimestamp(timestamp); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataAfterSnapshot withContent(Object content) { + super.withContent(content); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java new file mode 100644 index 000000000000..3c79a4420067 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import java.time.OffsetDateTime; + +/** The snapshot before the change. */ +@Fluent +public final class ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData { + /** Creates an instance of ResourceChangeDataBeforeSnapshot class. */ + public ResourceChangeDataBeforeSnapshot() { + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataBeforeSnapshot withSnapshotId(String snapshotId) { + super.withSnapshotId(snapshotId); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataBeforeSnapshot withTimestamp(OffsetDateTime timestamp) { + super.withTimestamp(timestamp); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangeDataBeforeSnapshot withContent(Object content) { + super.withContent(content); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java new file mode 100644 index 000000000000..0de22aa35e89 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The parameters for a specific change details request. */ +@Fluent +public final class ResourceChangeDetailsRequestParameters { + /* + * Specifies the list of resources for a change details request. + */ + @JsonProperty(value = "resourceIds", required = true) + private List resourceIds; + + /* + * Specifies the list of change IDs for a change details request. + */ + @JsonProperty(value = "changeIds", required = true) + private List changeIds; + + /** Creates an instance of ResourceChangeDetailsRequestParameters class. */ + public ResourceChangeDetailsRequestParameters() { + } + + /** + * Get the resourceIds property: Specifies the list of resources for a change details request. + * + * @return the resourceIds value. + */ + public List resourceIds() { + return this.resourceIds; + } + + /** + * Set the resourceIds property: Specifies the list of resources for a change details request. + * + * @param resourceIds the resourceIds value to set. + * @return the ResourceChangeDetailsRequestParameters object itself. + */ + public ResourceChangeDetailsRequestParameters withResourceIds(List resourceIds) { + this.resourceIds = resourceIds; + return this; + } + + /** + * Get the changeIds property: Specifies the list of change IDs for a change details request. + * + * @return the changeIds value. + */ + public List changeIds() { + return this.changeIds; + } + + /** + * Set the changeIds property: Specifies the list of change IDs for a change details request. + * + * @param changeIds the changeIds value to set. + * @return the ResourceChangeDetailsRequestParameters object itself. + */ + public ResourceChangeDetailsRequestParameters withChangeIds(List changeIds) { + this.changeIds = changeIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceIds() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resourceIds in model ResourceChangeDetailsRequestParameters")); + } + if (changeIds() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property changeIds in model ResourceChangeDetailsRequestParameters")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceChangeDetailsRequestParameters.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java new file mode 100644 index 000000000000..b9fbc2f1986f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner; +import java.util.List; + +/** An immutable client-side representation of ResourceChangeList. */ +public interface ResourceChangeList { + /** + * Gets the changes property: The pageable value returned by the operation, i.e. a list of changes to the resource. + * + *

- The list is ordered from the most recent changes to the least recent changes. - This list will be empty if + * there were no changes during the requested interval. - The `Before` snapshot timestamp value of the oldest change + * can be outside of the specified time interval. + * + * @return the changes value. + */ + List changes(); + + /** + * Gets the skipToken property: Skip token that encodes the skip information while executing the current request. + * + * @return the skipToken value. + */ + Object skipToken(); + + /** + * Gets the inner com.azure.resourcemanager.resourcegraph.fluent.models.ResourceChangeListInner object. + * + * @return the inner object. + */ + ResourceChangeListInner innerModel(); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java new file mode 100644 index 000000000000..5db2ec4b608f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The parameters for a specific changes request. */ +@Fluent +public final class ResourceChangesRequestParameters { + /* + * Specifies the list of resources for a changes request. + */ + @JsonProperty(value = "resourceIds") + private List resourceIds; + + /* + * The subscription id of resources to query the changes from. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Specifies the date and time interval for a changes request. + */ + @JsonProperty(value = "interval", required = true) + private ResourceChangesRequestParametersInterval interval; + + /* + * Acts as the continuation token for paged responses. + */ + @JsonProperty(value = "$skipToken") + private String skipToken; + + /* + * The maximum number of changes the client can accept in a paged response. + */ + @JsonProperty(value = "$top") + private Integer top; + + /* + * The table name to query resources from. + */ + @JsonProperty(value = "table") + private String table; + + /* + * The flag if set to true will fetch property changes + */ + @JsonProperty(value = "fetchPropertyChanges") + private Boolean fetchPropertyChanges; + + /* + * The flag if set to true will fetch change snapshots + */ + @JsonProperty(value = "fetchSnapshots") + private Boolean fetchSnapshots; + + /** Creates an instance of ResourceChangesRequestParameters class. */ + public ResourceChangesRequestParameters() { + } + + /** + * Get the resourceIds property: Specifies the list of resources for a changes request. + * + * @return the resourceIds value. + */ + public List resourceIds() { + return this.resourceIds; + } + + /** + * Set the resourceIds property: Specifies the list of resources for a changes request. + * + * @param resourceIds the resourceIds value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withResourceIds(List resourceIds) { + this.resourceIds = resourceIds; + return this; + } + + /** + * Get the subscriptionId property: The subscription id of resources to query the changes from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The subscription id of resources to query the changes from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the interval property: Specifies the date and time interval for a changes request. + * + * @return the interval value. + */ + public ResourceChangesRequestParametersInterval interval() { + return this.interval; + } + + /** + * Set the interval property: Specifies the date and time interval for a changes request. + * + * @param interval the interval value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withInterval(ResourceChangesRequestParametersInterval interval) { + this.interval = interval; + return this; + } + + /** + * Get the skipToken property: Acts as the continuation token for paged responses. + * + * @return the skipToken value. + */ + public String skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: Acts as the continuation token for paged responses. + * + * @param skipToken the skipToken value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withSkipToken(String skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Get the top property: The maximum number of changes the client can accept in a paged response. + * + * @return the top value. + */ + public Integer top() { + return this.top; + } + + /** + * Set the top property: The maximum number of changes the client can accept in a paged response. + * + * @param top the top value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get the table property: The table name to query resources from. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: The table name to query resources from. + * + * @param table the table value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the fetchPropertyChanges property: The flag if set to true will fetch property changes. + * + * @return the fetchPropertyChanges value. + */ + public Boolean fetchPropertyChanges() { + return this.fetchPropertyChanges; + } + + /** + * Set the fetchPropertyChanges property: The flag if set to true will fetch property changes. + * + * @param fetchPropertyChanges the fetchPropertyChanges value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withFetchPropertyChanges(Boolean fetchPropertyChanges) { + this.fetchPropertyChanges = fetchPropertyChanges; + return this; + } + + /** + * Get the fetchSnapshots property: The flag if set to true will fetch change snapshots. + * + * @return the fetchSnapshots value. + */ + public Boolean fetchSnapshots() { + return this.fetchSnapshots; + } + + /** + * Set the fetchSnapshots property: The flag if set to true will fetch change snapshots. + * + * @param fetchSnapshots the fetchSnapshots value to set. + * @return the ResourceChangesRequestParameters object itself. + */ + public ResourceChangesRequestParameters withFetchSnapshots(Boolean fetchSnapshots) { + this.fetchSnapshots = fetchSnapshots; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (interval() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property interval in model ResourceChangesRequestParameters")); + } else { + interval().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceChangesRequestParameters.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java new file mode 100644 index 000000000000..e6dd4a4bd24e --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import java.time.OffsetDateTime; + +/** Specifies the date and time interval for a changes request. */ +@Fluent +public final class ResourceChangesRequestParametersInterval extends DateTimeInterval { + /** Creates an instance of ResourceChangesRequestParametersInterval class. */ + public ResourceChangesRequestParametersInterval() { + } + + /** {@inheritDoc} */ + @Override + public ResourceChangesRequestParametersInterval withStart(OffsetDateTime start) { + super.withStart(start); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceChangesRequestParametersInterval withEnd(OffsetDateTime end) { + super.withEnd(end); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java new file mode 100644 index 000000000000..776686cf803f --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource property change. */ +@Fluent +public final class ResourcePropertyChange { + /* + * The property name + */ + @JsonProperty(value = "propertyName", required = true) + private String propertyName; + + /* + * The property value in before snapshot + */ + @JsonProperty(value = "beforeValue") + private String beforeValue; + + /* + * The property value in after snapshot + */ + @JsonProperty(value = "afterValue") + private String afterValue; + + /* + * The change category. + */ + @JsonProperty(value = "changeCategory", required = true) + private ChangeCategory changeCategory; + + /* + * The property change Type + */ + @JsonProperty(value = "propertyChangeType", required = true) + private PropertyChangeType propertyChangeType; + + /** Creates an instance of ResourcePropertyChange class. */ + public ResourcePropertyChange() { + } + + /** + * Get the propertyName property: The property name. + * + * @return the propertyName value. + */ + public String propertyName() { + return this.propertyName; + } + + /** + * Set the propertyName property: The property name. + * + * @param propertyName the propertyName value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withPropertyName(String propertyName) { + this.propertyName = propertyName; + return this; + } + + /** + * Get the beforeValue property: The property value in before snapshot. + * + * @return the beforeValue value. + */ + public String beforeValue() { + return this.beforeValue; + } + + /** + * Set the beforeValue property: The property value in before snapshot. + * + * @param beforeValue the beforeValue value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withBeforeValue(String beforeValue) { + this.beforeValue = beforeValue; + return this; + } + + /** + * Get the afterValue property: The property value in after snapshot. + * + * @return the afterValue value. + */ + public String afterValue() { + return this.afterValue; + } + + /** + * Set the afterValue property: The property value in after snapshot. + * + * @param afterValue the afterValue value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withAfterValue(String afterValue) { + this.afterValue = afterValue; + return this; + } + + /** + * Get the changeCategory property: The change category. + * + * @return the changeCategory value. + */ + public ChangeCategory changeCategory() { + return this.changeCategory; + } + + /** + * Set the changeCategory property: The change category. + * + * @param changeCategory the changeCategory value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withChangeCategory(ChangeCategory changeCategory) { + this.changeCategory = changeCategory; + return this; + } + + /** + * Get the propertyChangeType property: The property change Type. + * + * @return the propertyChangeType value. + */ + public PropertyChangeType propertyChangeType() { + return this.propertyChangeType; + } + + /** + * Set the propertyChangeType property: The property change Type. + * + * @param propertyChangeType the propertyChangeType value to set. + * @return the ResourcePropertyChange object itself. + */ + public ResourcePropertyChange withPropertyChangeType(PropertyChangeType propertyChangeType) { + this.propertyChangeType = propertyChangeType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (propertyName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property propertyName in model ResourcePropertyChange")); + } + if (changeCategory() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property changeCategory in model ResourcePropertyChange")); + } + if (propertyChangeType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property propertyChangeType in model ResourcePropertyChange")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourcePropertyChange.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java index fe99a66d5c8d..5aec42a03c51 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceProviders.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import java.util.List; /** Resource collection API of ResourceProviders. */ public interface ResourceProviders { @@ -13,22 +14,93 @@ 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 context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result. + * @return query result along with {@link Response}. */ - QueryResponse resources(QueryRequest query); + Response resourcesWithResponse(QueryRequest query, Context context); /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * * @param query Request specifying query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query result. + */ + QueryResponse resources(QueryRequest query); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result along with {@link Response}. + * @return any object along with {@link Response}. */ - Response resourcesWithResponse(QueryRequest query, Context context); + Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); + + /** + * List all snapshots of a resource for a given time interval. + * + * @param request Request specifying the query and its options. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return any object. + */ + Object resourcesHistory(ResourcesHistoryRequest request); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval along with {@link Response}. + */ + Response resourceChangesWithResponse( + ResourceChangesRequestParameters parameters, Context context); + + /** + * List changes to a resource for a given time interval. + * + * @param parameters the parameters for this request for changes. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of changes associated with a resource over a specific time interval. + */ + ResourceChangeList resourceChanges(ResourceChangesRequestParameters parameters); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details along with {@link Response}. + */ + Response> resourceChangeDetailsWithResponse( + ResourceChangeDetailsRequestParameters parameters, Context context); + + /** + * Get resource change details. + * + * @param parameters The parameters for this request for resource change details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return resource change details. + */ + List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java new file mode 100644 index 000000000000..e291edfc8618 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Data on a specific resource snapshot. */ +@Fluent +public class ResourceSnapshotData { + /* + * The ID of the snapshot. + */ + @JsonProperty(value = "snapshotId") + private String snapshotId; + + /* + * The time when the snapshot was created. + * The snapshot timestamp provides an approximation as to when a modification to a resource was detected. There + * can be a difference between the actual modification time and the detection time. This is due to differences in + * how operations that modify a resource are processed, versus how operation that record resource snapshots are + * processed. + */ + @JsonProperty(value = "timestamp", required = true) + private OffsetDateTime timestamp; + + /* + * The resource snapshot content (in resourceChangeDetails response only). + */ + @JsonProperty(value = "content") + private Object content; + + /** Creates an instance of ResourceSnapshotData class. */ + public ResourceSnapshotData() { + } + + /** + * Get the snapshotId property: The ID of the snapshot. + * + * @return the snapshotId value. + */ + public String snapshotId() { + return this.snapshotId; + } + + /** + * Set the snapshotId property: The ID of the snapshot. + * + * @param snapshotId the snapshotId value to set. + * @return the ResourceSnapshotData object itself. + */ + public ResourceSnapshotData withSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + return this; + } + + /** + * Get the timestamp property: The time when the snapshot was created. The snapshot timestamp provides an + * approximation as to when a modification to a resource was detected. There can be a difference between the actual + * modification time and the detection time. This is due to differences in how operations that modify a resource are + * processed, versus how operation that record resource snapshots are processed. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The time when the snapshot was created. The snapshot timestamp provides an + * approximation as to when a modification to a resource was detected. There can be a difference between the actual + * modification time and the detection time. This is due to differences in how operations that modify a resource are + * processed, versus how operation that record resource snapshots are processed. + * + * @param timestamp the timestamp value to set. + * @return the ResourceSnapshotData object itself. + */ + public ResourceSnapshotData withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the content property: The resource snapshot content (in resourceChangeDetails response only). + * + * @return the content value. + */ + public Object content() { + return this.content; + } + + /** + * Set the content property: The resource snapshot content (in resourceChangeDetails response only). + * + * @param content the content value to set. + * @return the ResourceSnapshotData object itself. + */ + public ResourceSnapshotData withContent(Object content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timestamp() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timestamp in model ResourceSnapshotData")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceSnapshotData.class); +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java new file mode 100644 index 000000000000..b3a8e26f67ee --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequest.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a history request to be executed. */ +@Fluent +public final class ResourcesHistoryRequest { + /* + * Azure subscriptions against which to execute the query. + */ + @JsonProperty(value = "subscriptions") + private List subscriptions; + + /* + * The resources query. + */ + @JsonProperty(value = "query") + private String query; + + /* + * The history request evaluation options + */ + @JsonProperty(value = "options") + private ResourcesHistoryRequestOptions options; + + /* + * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] + */ + @JsonProperty(value = "managementGroups") + private List managementGroups; + + /** Creates an instance of ResourcesHistoryRequest class. */ + public ResourcesHistoryRequest() { + } + + /** + * Get the subscriptions property: Azure subscriptions against which to execute the query. + * + * @return the subscriptions value. + */ + public List subscriptions() { + return this.subscriptions; + } + + /** + * Set the subscriptions property: Azure subscriptions against which to execute the query. + * + * @param subscriptions the subscriptions value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + return this; + } + + /** + * Get the query property: The resources query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: The resources query. + * + * @param query the query value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the options property: The history request evaluation options. + * + * @return the options value. + */ + public ResourcesHistoryRequestOptions options() { + return this.options; + } + + /** + * Set the options property: The history request evaluation options. + * + * @param options the options value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withOptions(ResourcesHistoryRequestOptions options) { + this.options = options; + return this; + } + + /** + * Get the managementGroups property: Azure management groups against which to execute the query. Example: [ 'mg1', + * 'mg2' ]. + * + * @return the managementGroups value. + */ + public List managementGroups() { + return this.managementGroups; + } + + /** + * Set the managementGroups property: Azure management groups against which to execute the query. Example: [ 'mg1', + * 'mg2' ]. + * + * @param managementGroups the managementGroups value to set. + * @return the ResourcesHistoryRequest object itself. + */ + public ResourcesHistoryRequest withManagementGroups(List managementGroups) { + this.managementGroups = managementGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (options() != null) { + options().validate(); + } + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java new file mode 100644 index 000000000000..578cd6ef7a74 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptions.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The options for history request evaluation. */ +@Fluent +public final class ResourcesHistoryRequestOptions { + /* + * The time interval used to fetch history. + */ + @JsonProperty(value = "interval") + private DateTimeInterval interval; + + /* + * The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property + * is present. + */ + @JsonProperty(value = "$top") + private Integer top; + + /* + * The number of rows to skip from the beginning of the results. Overrides the next page offset when + * ```$skipToken``` property is present. + */ + @JsonProperty(value = "$skip") + private Integer skip; + + /* + * Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. + */ + @JsonProperty(value = "$skipToken") + private String skipToken; + + /* + * Defines in which format query result returned. + */ + @JsonProperty(value = "resultFormat") + private ResultFormat resultFormat; + + /** Creates an instance of ResourcesHistoryRequestOptions class. */ + public ResourcesHistoryRequestOptions() { + } + + /** + * Get the interval property: The time interval used to fetch history. + * + * @return the interval value. + */ + public DateTimeInterval interval() { + return this.interval; + } + + /** + * Set the interval property: The time interval used to fetch history. + * + * @param interval the interval value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withInterval(DateTimeInterval interval) { + this.interval = interval; + return this; + } + + /** + * Get the top property: The maximum number of rows that the query should return. Overrides the page size when + * ```$skipToken``` property is present. + * + * @return the top value. + */ + public Integer top() { + return this.top; + } + + /** + * Set the top property: The maximum number of rows that the query should return. Overrides the page size when + * ```$skipToken``` property is present. + * + * @param top the top value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withTop(Integer top) { + this.top = top; + return this; + } + + /** + * Get the skip property: The number of rows to skip from the beginning of the results. Overrides the next page + * offset when ```$skipToken``` property is present. + * + * @return the skip value. + */ + public Integer skip() { + return this.skip; + } + + /** + * Set the skip property: The number of rows to skip from the beginning of the results. Overrides the next page + * offset when ```$skipToken``` property is present. + * + * @param skip the skip value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withSkip(Integer skip) { + this.skip = skip; + return this; + } + + /** + * Get the skipToken property: Continuation token for pagination, capturing the next page size and offset, as well + * as the context of the query. + * + * @return the skipToken value. + */ + public String skipToken() { + return this.skipToken; + } + + /** + * Set the skipToken property: Continuation token for pagination, capturing the next page size and offset, as well + * as the context of the query. + * + * @param skipToken the skipToken value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withSkipToken(String skipToken) { + this.skipToken = skipToken; + return this; + } + + /** + * Get the resultFormat property: Defines in which format query result returned. + * + * @return the resultFormat value. + */ + public ResultFormat resultFormat() { + return this.resultFormat; + } + + /** + * Set the resultFormat property: Defines in which format query result returned. + * + * @param resultFormat the resultFormat value to set. + * @return the ResourcesHistoryRequestOptions object itself. + */ + public ResourcesHistoryRequestOptions withResultFormat(ResultFormat resultFormat) { + this.resultFormat = resultFormat; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (interval() != null) { + interval().validate(); + } + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResultFormat.java index 1c4046e89b81..bcf741091869 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 @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for ResultFormat. */ +/** Defines in which format query result returned. */ public enum ResultFormat { /** Enum value table. */ TABLE("table"), @@ -30,6 +30,9 @@ public enum ResultFormat { */ @JsonCreator public static ResultFormat fromString(String value) { + if (value == null) { + return null; + } ResultFormat[] items = ResultFormat.values(); for (ResultFormat item : items) { if (item.toString().equalsIgnoreCase(value)) { @@ -39,6 +42,7 @@ public static ResultFormat fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { 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 ff78599437fc..cb12b8de9de1 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 @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for ResultTruncated. */ +/** Indicates whether the query results are truncated. */ public enum ResultTruncated { /** Enum value true. */ TRUE("true"), @@ -30,6 +30,9 @@ public enum ResultTruncated { */ @JsonCreator public static ResultTruncated fromString(String value) { + if (value == null) { + return null; + } ResultTruncated[] items = ResultTruncated.values(); for (ResultTruncated item : items) { if (item.toString().equalsIgnoreCase(value)) { @@ -39,6 +42,7 @@ public static ResultTruncated fromString(String value) { return null; } + /** {@inheritDoc} */ @JsonValue @Override public String toString() { diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java index 49bfe7fbb5f1..093f3a55ac59 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java @@ -9,7 +9,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/OperationsList.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/OperationsList.json */ /** * Sample code: OperationsList. 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..46ff4f497c0a --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangeDetailsSamples.java @@ -0,0 +1,33 @@ +// 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.Context; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangeDetailsRequestParameters; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChangeDetails. */ +public final class ResourceProviderResourceChangeDetailsSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangeDetails.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangeDetailsWithResponse( + new ResourceChangeDetailsRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withChangeIds(Arrays.asList("53dc0515-b86b-4bc2-979b-e4694ab4a556")), + 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..a46103d42a71 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourceChangesSamples.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParameters; +import com.azure.resourcemanager.resourcegraph.models.ResourceChangesRequestParametersInterval; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourceChanges. */ +public final class ResourceProviderResourceChangesSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChanges.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesNextPage.json + */ + /** + * Sample code: Next page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withSkipToken("ew0KICAiJGlkIjogIjEiLA0KICAiRW5kVGltZSI6ICJcL0RhdGUoMTU1MDc0NT") + .withTop(2), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2020-09-01-preview/examples/ResourceChangesFirstPage.json + */ + /** + * Sample code: First page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourceChangesWithResponse( + new ResourceChangesRequestParameters() + .withResourceIds( + Arrays + .asList( + "/subscriptions/4d962866-1e3f-47f2-bd18-450c08f914c1/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount")) + .withInterval( + new ResourceChangesRequestParametersInterval() + .withStart(OffsetDateTime.parse("2018-10-30T12:09:03.141Z")) + .withEnd(OffsetDateTime.parse("2018-10-31T12:09:03.141Z"))) + .withTop(2), + 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..909affd6d3f8 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesHistorySamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcegraph.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.models.DateTimeInterval; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequest; +import com.azure.resourcemanager.resourcegraph.models.ResourcesHistoryRequestOptions; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** Samples for ResourceProvider ResourcesHistory. */ +public final class ResourceProviderResourcesHistorySamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ + /** + * Sample code: Resource History Management Group scope Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryManagementGroupScopeQuery( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))) + .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ + /** + * Sample code: Resource History Query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void resourceHistoryQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesHistoryWithResponse( + new ResourcesHistoryRequest() + .withSubscriptions(Arrays.asList("a7f33fdb-e646-4f15-89aa-3a360210861e")) + .withQuery("where name =~ 'cpu-utilization' | project id, name, properties") + .withOptions( + new ResourcesHistoryRequestOptions() + .withInterval( + new DateTimeInterval() + .withStart(OffsetDateTime.parse("2020-11-12T01:00:00.0000000Z")) + .withEnd(OffsetDateTime.parse("2020-11-12T01:25:00.0000000Z")))), + Context.NONE); + } +} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java index 73c1478468d1..1fe175eebdfb 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java @@ -15,7 +15,7 @@ /** Samples for ResourceProvider Resources. */ public final class ResourceProviderResourcesSamples { /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesMgBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesMgBasicQuery.json */ /** * Sample code: Basic management group query. @@ -33,7 +33,7 @@ public static void basicManagementGroupQuery(com.azure.resourcemanager.resourceg } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesBasicQuery.json */ /** * Sample code: Basic query. @@ -51,7 +51,7 @@ public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGr } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFacetQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesFacetQuery.json */ /** * Sample code: Query with a facet request. @@ -99,7 +99,7 @@ public static void queryWithAFacetRequest(com.azure.resourcemanager.resourcegrap } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFilterQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesFilterQuery.json */ /** * Sample code: Filter resources. @@ -119,7 +119,7 @@ public static void filterResources(com.azure.resourcemanager.resourcegraph.Resou } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesSummarizeQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesSummarizeQuery.json */ /** * Sample code: Summarize resources by location. @@ -138,7 +138,7 @@ public static void summarizeResourcesByLocation( } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesPropertiesQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesPropertiesQuery.json */ /** * Sample code: Access a properties field. @@ -158,7 +158,7 @@ public static void accessAPropertiesField(com.azure.resourcemanager.resourcegrap } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesComplexQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesComplexQuery.json */ /** * Sample code: Complex query. @@ -178,7 +178,7 @@ public static void complexQuery(com.azure.resourcemanager.resourcegraph.Resource } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesNextPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesNextPageQuery.json */ /** * Sample code: Next page query. @@ -199,7 +199,7 @@ public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.Resourc } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesFirstPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesFirstPageQuery.json */ /** * Sample code: First page query. @@ -218,7 +218,7 @@ public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.Resour } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesTenantBasicQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesTenantBasicQuery.json */ /** * Sample code: Basic tenant query. @@ -234,7 +234,7 @@ public static void basicTenantQuery(com.azure.resourcemanager.resourcegraph.Reso } /* - * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2021-03-01/examples/ResourcesRandomPageQuery.json + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/stable/2022-10-01/examples/ResourcesRandomPageQuery.json */ /** * Sample code: Random page query.