diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md index 064cb4bbc722..a9db3a4b24ae 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.3 (Unreleased) +## 1.0.0-beta.1 (2022-03-15) +- Azure Resource Manager ResourceGraph client library for Java. This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-preview-2021-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0-beta.2 (2021-05-24) diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/README.md index 372b2213f310..31af4f51ab71 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-preview-2021-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for ResourceGraph Management SDK. Azure Resource Graph API Reference. Package tag package-preview-2021-06. 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.2 + 1.0.0-beta.3 ``` [//]: # ({x-version-update-end}) @@ -88,6 +88,7 @@ queryRequest.withOptions(new QueryRequestOptions().withResultFormat(ResultFormat response = manager.resourceProviders().resources(queryRequest); ``` +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md) ## Troubleshooting diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md new file mode 100644 index 000000000000..e2b72adcb7b4 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md @@ -0,0 +1,348 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## ResourceProvider + +- [Resources](#resourceprovider_resources) +- [ResourcesHistory](#resourceprovider_resourceshistory) +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void operationsList(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### ResourceProvider_Resources + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcegraph.models.FacetRequest; +import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; +import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; +import com.azure.resourcemanager.resourcegraph.models.QueryRequest; +import com.azure.resourcemanager.resourcegraph.models.QueryRequestOptions; +import java.util.Arrays; + +/** Samples for ResourceProvider Resources. */ +public final class ResourceProviderResourcesSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json + */ + /** + * Sample code: Basic management group query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicManagementGroupQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")) + .withQuery("Resources | project id, name, type, location, tags | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | project id, name, type, location, tags | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json + */ + /** + * Sample code: Query with a facet request. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void queryWithAFacetRequest(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location," + + " resourceGroup, properties.storageProfile.osDisk.osType | limit 5") + .withFacets( + Arrays + .asList( + new FacetRequest() + .withExpression("location") + .withOptions( + new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), + new FacetRequest() + .withExpression("properties.storageProfile.osDisk.osType") + .withOptions( + new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), + new FacetRequest() + .withExpression("nonExistingColumn") + .withOptions( + new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), + new FacetRequest() + .withExpression("resourceGroup") + .withOptions( + new FacetRequestOptions() + .withSortBy("tolower(resourceGroup)") + .withSortOrder(FacetSortOrder.ASC) + .withTop(3)), + new FacetRequest() + .withExpression("resourceGroup") + .withOptions( + new FacetRequestOptions() + .withFilter("resourceGroup contains 'test'") + .withTop(3)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json + */ + /** + * Sample code: Filter resources. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void filterResources(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | project id, name, type, location | where type =~" + + " 'Microsoft.Compute/virtualMachines' | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json + */ + /** + * Sample code: Summarize resources by location. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void summarizeResourcesByLocation( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | project id, name, type, location | summarize by location"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json + */ + /** + * Sample code: Access a properties field. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void accessAPropertiesField(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by" + + " tostring(properties.storageProfile.osDisk.osType)"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json + */ + /** + * Sample code: Complex query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void complexQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | project id, name, type, location | where type =~" + + " 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json + */ + /** + * Sample code: Next page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | where name contains 'test' | project id, name, type, location") + .withOptions( + new QueryRequestOptions() + .withSkipToken("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json + */ + /** + * Sample code: First page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | where name contains 'test' | project id, name, type, location") + .withOptions(new QueryRequestOptions().withTop(3).withSkip(0)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json + */ + /** + * Sample code: Basic tenant query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicTenantQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest().withQuery("Resources | project id, name, type, location, tags | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json + */ + /** + * Sample code: Random page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void randomPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | where name contains 'test' | project id, name, type, location") + .withOptions(new QueryRequestOptions().withTop(2).withSkip(10)), + Context.NONE); + } +} +``` + +### 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 804ed87d6c35..de85c4e29ad8 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-preview-2021-03. + This package contains Microsoft Azure SDK for ResourceGraph Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Resource Graph API Reference. Package tag package-preview-2021-06. 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 a201b9e74296..82a27413baf9 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 @@ -8,8 +8,8 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -31,6 +32,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** Entry point to ResourceGraphManager. Azure Resource Graph API Reference. */ public final class ResourceGraphManager { @@ -75,11 +77,12 @@ public static Configurable configure() { /** The Configurable allowing configurations to be set. */ public static final class Configurable { - private final ClientLogger logger = new ClientLogger(Configurable.class); + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -119,6 +122,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -137,9 +151,11 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); } return this; } @@ -161,7 +177,7 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.resourcegraph") .append("/") - .append("1.0.0-beta.2"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -175,20 +191,33 @@ public ResourceGraphManager authenticate(TokenCredential credential, AzureProfil userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); - policies.addAll(this.policies); + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java index 3d46ac606fcb..049b3590d5b0 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/OperationsClient.java @@ -17,7 +17,7 @@ public interface OperationsClient { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -29,7 +29,7 @@ public interface OperationsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/ResourceGraphClient.java index e2cc897677fd..16412a3b5883 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,6 +16,13 @@ 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 186cff92a7f3..c19d49ea4bf4 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,68 +9,11 @@ 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 { - /** - * 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); - - /** - * 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response resourceChangesWithResponse( - ResourceChangesRequestParameters 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); - - /** - * 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response> resourceChangeDetailsWithResponse( - ResourceChangeDetailsRequestParameters parameters, Context context); - /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * @@ -91,7 +34,7 @@ Response> resourceChangeDetailsWithResponse( * @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) Response resourcesWithResponse(QueryRequest query, Context context); @@ -99,7 +42,7 @@ Response> resourceChangeDetailsWithResponse( /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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. @@ -111,12 +54,12 @@ Response> resourceChangeDetailsWithResponse( /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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 any object. + * @return any object along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); 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 b7b050ec7e8d..3807d8330214 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 @@ -5,16 +5,12 @@ 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.OperationDisplay; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Resource Graph REST API operation definition. */ @Fluent public final class OperationInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); - /* * 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 41f7027b0ee1..499340d6c1f3 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 @@ -8,15 +8,12 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resourcegraph.models.Facet; import com.azure.resourcemanager.resourcegraph.models.ResultTruncated; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Query result. */ @Fluent public final class QueryResponseInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryResponseInner.class); - /* * Number of total records matching the query. */ @@ -187,13 +184,13 @@ public QueryResponseInner withFacets(List facets) { */ public void validate() { if (resultTruncated() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( "Missing required property resultTruncated in model QueryResponseInner")); } if (data() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property data in model QueryResponseInner")); } @@ -201,4 +198,6 @@ public void validate() { facets().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(QueryResponseInner.class); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java deleted file mode 100644 index ccc5ea574794..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeDataInner.java +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.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.JsonIgnore; -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 { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangeDataInner.class); - - /* - * 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; - - /** - * 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()); - } - } -} 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 deleted file mode 100644 index 51a35d029c48..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/fluent/models/ResourceChangeListInner.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -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 { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangeListInner.class); - - /* - * 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; - - /** - * 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 12c12f2070fe..92e4e6c050be 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 @@ -24,7 +24,6 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resourcegraph.fluent.OperationsClient; import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; import com.azure.resourcemanager.resourcegraph.models.OperationListResult; @@ -32,8 +31,6 @@ /** An instance of this class provides access to all the operations defined in OperationsClient. */ public final class OperationsClientImpl implements OperationsClient { - private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); - /** The proxy service used to perform REST calls. */ private final OperationsService service; @@ -74,7 +71,8 @@ Mono> list( * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -84,10 +82,10 @@ private Mono> listSinglePageAsync() { new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2021-03-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) .>map( res -> new PagedResponseBase<>( @@ -102,7 +100,8 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -112,11 +111,10 @@ private Mono> listSinglePageAsync(Context context) new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } - final String apiVersion = "2021-03-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list(this.client.getEndpoint(), apiVersion, accept, context) + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( @@ -128,7 +126,7 @@ private Mono> listSinglePageAsync(Context context) * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -142,7 +140,7 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -154,7 +152,7 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -168,7 +166,7 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java index a242d89136e9..31f3c85a921e 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/OperationsImpl.java @@ -11,10 +11,9 @@ import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; import com.azure.resourcemanager.resourcegraph.models.Operation; import com.azure.resourcemanager.resourcegraph.models.Operations; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class OperationsImpl implements Operations { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); private final OperationsClient innerClient; 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 deleted file mode 100644 index 56cd4365f0f3..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeDataImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.implementation; - -import com.azure.resourcemanager.resourcegraph.fluent.models.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 deleted file mode 100644 index e0e7c8dca71a..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceChangeListImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.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/ResourceGraphClientImpl.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/implementation/ResourceGraphClientImpl.java index 607a0acd0bbb..5029148e9c90 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 @@ -37,8 +37,6 @@ /** Initializes a new instance of the ResourceGraphClientImpl type. */ @ServiceClient(builder = ResourceGraphClientBuilder.class) public final class ResourceGraphClientImpl implements ResourceGraphClient { - private final ClientLogger logger = new ClientLogger(ResourceGraphClientImpl.class); - /** server parameter. */ private final String endpoint; @@ -51,6 +49,18 @@ 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; @@ -130,6 +140,7 @@ public OperationsClient getOperations() { this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; + this.apiVersion = "2021-06-01-preview"; this.resourceProviders = new ResourceProvidersClientImpl(this); this.operations = new OperationsClientImpl(this); } @@ -217,7 +228,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, managementError = null; } } catch (IOException | RuntimeException ioe) { - logger.logThrowableAsWarning(ioe); + LOGGER.logThrowableAsWarning(ioe); } } } else { @@ -276,4 +287,6 @@ public Mono getBodyAsString(Charset charset) { return Mono.just(new String(responseBody, charset)); } } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceGraphClientImpl.class); } 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 5c82e03a81fa..39576f2de847 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 @@ -21,22 +21,14 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -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.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. */ public final class ResourceProvidersClientImpl implements ResourceProvidersClient { - private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); - /** The proxy service used to perform REST calls. */ private final ResourceProvidersService service; @@ -61,28 +53,6 @@ public final class ResourceProvidersClientImpl implements ResourceProvidersClien @Host("{$host}") @ServiceInterface(name = "ResourceGraphClientR") private interface ResourceProvidersService { - @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); - @Headers({"Content-Type: application/json"}) @Post("/providers/Microsoft.ResourceGraph/resources") @ExpectedResponses({200}) @@ -106,234 +76,6 @@ Mono> resourcesHistory( 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 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) - 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. - */ - @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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono resourceChangesAsync(ResourceChangesRequestParameters parameters) { - return resourceChangesWithResponseAsync(parameters) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * 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 resourceChangesAsync(parameters).block(); - } - - /** - * 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response resourceChangesWithResponse( - ResourceChangesRequestParameters parameters, Context context) { - return resourceChangesWithResponseAsync(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) - 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. - */ - @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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> resourceChangeDetailsAsync( - ResourceChangeDetailsRequestParameters parameters) { - return resourceChangeDetailsWithResponseAsync(parameters) - .flatMap( - (Response> res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * 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 resourceChangeDetailsAsync(parameters).block(); - } - - /** - * 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response> resourceChangeDetailsWithResponse( - ResourceChangeDetailsRequestParameters parameters, Context context) { - return resourceChangeDetailsWithResponseAsync(parameters, context).block(); - } - /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * @@ -341,7 +83,7 @@ public Response> resourceChangeDetailsWithResponse * @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} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> resourcesWithResponseAsync(QueryRequest query) { @@ -356,10 +98,11 @@ private Mono> resourcesWithResponseAsync(QueryReque } else { query.validate(); } - final String apiVersion = "2021-03-01"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.resources(this.client.getEndpoint(), apiVersion, query, accept, context)) + .withContext( + context -> + service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -371,7 +114,7 @@ private Mono> resourcesWithResponseAsync(QueryReque * @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} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> resourcesWithResponseAsync(QueryRequest query, Context context) { @@ -386,10 +129,9 @@ private Mono> resourcesWithResponseAsync(QueryReque } else { query.validate(); } - final String apiVersion = "2021-03-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.resources(this.client.getEndpoint(), apiVersion, query, accept, context); + return service.resources(this.client.getEndpoint(), this.client.getApiVersion(), query, accept, context); } /** @@ -399,7 +141,7 @@ private Mono> resourcesWithResponseAsync(QueryReque * @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 on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono resourcesAsync(QueryRequest query) { @@ -436,7 +178,7 @@ public QueryResponseInner resources(QueryRequest query) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return query result. + * @return query result along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response resourcesWithResponse(QueryRequest query, Context context) { @@ -446,11 +188,11 @@ public Response resourcesWithResponse(QueryRequest query, Co /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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. + * @return any object along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> resourcesHistoryWithResponseAsync(ResourcesHistoryRequest request) { @@ -465,23 +207,25 @@ private Mono> resourcesHistoryWithResponseAsync(ResourcesHistor } else { request.validate(); } - final String apiVersion = "2020-04-01-preview"; final String accept = "application/json"; return FluxUtil .withContext( - context -> service.resourcesHistory(this.client.getEndpoint(), apiVersion, request, accept, context)) + context -> + service + .resourcesHistory( + this.client.getEndpoint(), this.client.getApiVersion(), 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 The request parameter. + * @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. + * @return any object along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> resourcesHistoryWithResponseAsync(ResourcesHistoryRequest request, Context context) { @@ -496,20 +240,20 @@ private Mono> resourcesHistoryWithResponseAsync(ResourcesHistor } else { request.validate(); } - final String apiVersion = "2020-04-01-preview"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.resourcesHistory(this.client.getEndpoint(), apiVersion, request, accept, context); + return service + .resourcesHistory(this.client.getEndpoint(), this.client.getApiVersion(), request, accept, context); } /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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. + * @return any object on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono resourcesHistoryAsync(ResourcesHistoryRequest request) { @@ -527,7 +271,7 @@ private Mono resourcesHistoryAsync(ResourcesHistoryRequest request) { /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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. @@ -541,12 +285,12 @@ public Object resourcesHistory(ResourcesHistoryRequest request) { /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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. + * @return any object along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context) { 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 3afc8539c967..a49c14c38d1d 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,23 +10,13 @@ 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 com.fasterxml.jackson.annotation.JsonIgnore; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; public final class ResourceProvidersImpl implements ResourceProviders { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); private final ResourceProvidersClient innerClient; @@ -39,62 +29,6 @@ public ResourceProvidersImpl( this.serviceManager = serviceManager; } - 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 resourceChangesWithResponse( - ResourceChangesRequestParameters parameters, Context context) { - Response inner = this.serviceClient().resourceChangesWithResponse(parameters, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new ResourceChangeListImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public List resourceChangeDetails(ResourceChangeDetailsRequestParameters parameters) { - List inner = this.serviceClient().resourceChangeDetails(parameters); - if (inner != null) { - return Collections - .unmodifiableList( - inner - .stream() - .map(inner1 -> new ResourceChangeDataImpl(inner1, this.manager())) - .collect(Collectors.toList())); - } else { - return Collections.emptyList(); - } - } - - public Response> 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 QueryResponse resources(QueryRequest query) { QueryResponseInner inner = this.serviceClient().resources(query); if (inner != null) { 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..1b30b0ad9c96 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/AuthorizationScopeFilter.java @@ -0,0 +1,53 @@ +// 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 values for AuthorizationScopeFilter. */ +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) { + AuthorizationScopeFilter[] items = AuthorizationScopeFilter.values(); + for (AuthorizationScopeFilter item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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 deleted file mode 100644 index 443f99c8a8c1..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeCategory.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for ChangeCategory. */ -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) { - ChangeCategory[] items = ChangeCategory.values(); - for (ChangeCategory item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @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 deleted file mode 100644 index 84de98f11dd6..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ChangeType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for ChangeType. */ -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) { - ChangeType[] items = ChangeType.values(); - for (ChangeType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Column.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Column.java deleted file mode 100644 index ba445a7f0bf9..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Column.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Query result column descriptor. */ -@Fluent -public final class Column { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Column.class); - - /* - * Column name. - */ - @JsonProperty(value = "name", required = true) - private String name; - - /* - * Column data type. - */ - @JsonProperty(value = "type", required = true) - private ColumnDataType type; - - /** - * Get the name property: Column name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: Column name. - * - * @param name the name value to set. - * @return the Column object itself. - */ - public Column withName(String name) { - this.name = name; - return this; - } - - /** - * Get the type property: Column data type. - * - * @return the type value. - */ - public ColumnDataType type() { - return this.type; - } - - /** - * Set the type property: Column data type. - * - * @param type the type value to set. - * @return the Column object itself. - */ - public Column withType(ColumnDataType type) { - this.type = type; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw logger - .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Column")); - } - if (type() == null) { - throw logger - .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Column")); - } - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ColumnDataType.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ColumnDataType.java deleted file mode 100644 index d68af9d296ae..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ColumnDataType.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for ColumnDataType. */ -public enum ColumnDataType { - /** Enum value string. */ - STRING("string"), - - /** Enum value integer. */ - INTEGER("integer"), - - /** Enum value number. */ - NUMBER("number"), - - /** Enum value boolean. */ - BOOLEAN("boolean"), - - /** Enum value object. */ - OBJECT("object"); - - /** The actual serialized value for a ColumnDataType instance. */ - private final String value; - - ColumnDataType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ColumnDataType instance. - * - * @param value the serialized value to parse. - * @return the parsed ColumnDataType object, or null if unable to parse. - */ - @JsonCreator - public static ColumnDataType fromString(String value) { - ColumnDataType[] items = ColumnDataType.values(); - for (ColumnDataType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @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 index 564c3d43d400..af38d1645816 100644 --- 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 @@ -6,15 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; 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 { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DateTimeInterval.class); - +public final class DateTimeInterval { /* * A datetime indicating the inclusive/closed start of the time interval, * i.e. `[`**`start`**`, end)`. Specifying a `start` that occurs @@ -82,14 +79,16 @@ public DateTimeInterval withEnd(OffsetDateTime end) { */ public void validate() { if (start() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property start in model DateTimeInterval")); } if (end() == null) { - throw logger + 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 ab08800b6675..4737e577634e 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 @@ -16,8 +16,6 @@ /** Error details. */ @Fluent public final class ErrorDetails { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorDetails.class); - /* * Error code identifying the specific error. */ @@ -111,14 +109,16 @@ void withAdditionalProperties(String key, Object value) { */ public void validate() { if (code() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property code in model ErrorDetails")); } if (message() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property message in model ErrorDetails")); } } + + private static final ClientLogger LOGGER = new ClientLogger(ErrorDetails.class); } 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 4be60198dd4f..86e4778394e2 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 @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -25,8 +24,6 @@ }) @Fluent public class Facet { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Facet.class); - /* * Facet expression, same as in the corresponding facet request. */ @@ -60,9 +57,11 @@ public Facet withExpression(String expression) { */ public void validate() { if (expression() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property expression in model Facet")); } } + + private static final ClientLogger LOGGER = new ClientLogger(Facet.class); } 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 69db15ab9ea0..d74851ac29af 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 @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -17,8 +16,6 @@ @JsonTypeName("FacetError") @Fluent public final class FacetError extends Facet { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FacetError.class); - /* * An array containing detected facet errors with details. */ @@ -61,11 +58,13 @@ public FacetError withExpression(String expression) { public void validate() { super.validate(); if (errors() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property errors in model FacetError")); } else { errors().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(FacetError.class); } 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 00717c1ff399..0e24a6a14f1d 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 @@ -6,14 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** A request to compute additional statistics (facets) over the query results. */ @Fluent public final class FacetRequest { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FacetRequest.class); - /* * The column or list of columns to summarize by */ @@ -73,7 +70,7 @@ public FacetRequest withOptions(FacetRequestOptions options) { */ public void validate() { if (expression() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property expression in model FacetRequest")); } @@ -81,4 +78,6 @@ public void validate() { options().validate(); } } + + private static final ClientLogger LOGGER = new ClientLogger(FacetRequest.class); } 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 fc06c6474c25..d8c9e77c0790 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 @@ -5,15 +5,11 @@ package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** The options for facet evaluation. */ @Fluent public final class FacetRequestOptions { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FacetRequestOptions.class); - /* * 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 419eb3d1538d..257e12a4207f 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 @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -16,8 +15,6 @@ @JsonTypeName("FacetResult") @Fluent public final class FacetResult extends Facet { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FacetResult.class); - /* * Number of total records in the facet results. */ @@ -115,9 +112,11 @@ public FacetResult withExpression(String expression) { public void validate() { super.validate(); if (data() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property data in model FacetResult")); } } + + private static final ClientLogger LOGGER = new ClientLogger(FacetResult.class); } 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 97c40587d302..6ae26220ffce 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 @@ -5,15 +5,11 @@ package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Display metadata associated with the operation. */ @Fluent public final class OperationDisplay { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); - /* * 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 3ba05ce5a7de..918f1093b5cd 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 @@ -5,9 +5,7 @@ package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.resourcegraph.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -17,8 +15,6 @@ */ @Fluent public final class OperationListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); - /* * 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/Operations.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operations.java index fd7775dca3aa..df9ab0decce2 100644 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operations.java +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/Operations.java @@ -14,7 +14,7 @@ public interface Operations { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -25,7 +25,7 @@ public interface Operations { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return result of the request to list Resource Graph operations. + * @return result of the request to list Resource Graph operations as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java deleted file mode 100644 index 2de713f05faf..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/PropertyChangeType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for PropertyChangeType. */ -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) { - PropertyChangeType[] items = PropertyChangeType.values(); - for (PropertyChangeType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @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 64c18ea283fc..8fd1ab1c7347 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 @@ -6,15 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** Describes a query to be executed. */ @Fluent public final class QueryRequest { - @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryRequest.class); - /* * Azure subscriptions against which to execute the query. */ @@ -155,7 +152,7 @@ public QueryRequest withFacets(List facets) { */ public void validate() { if (query() == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException("Missing required property query in model QueryRequest")); } @@ -166,4 +163,6 @@ public void validate() { facets().forEach(e -> e.validate()); } } + + private static final ClientLogger LOGGER = new ClientLogger(QueryRequest.class); } 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 79e644a05d3a..fdcaeca6785c 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 @@ -5,15 +5,11 @@ package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** The options for query evaluation. */ @Fluent public final class QueryRequestOptions { - @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryRequestOptions.class); - /* * Continuation token for pagination, capturing the next page size and * offset, as well as the context of the query. @@ -49,6 +45,13 @@ public final class QueryRequestOptions { @JsonProperty(value = "allowPartialScopes") private Boolean allowPartialScopes; + /* + * Defines what level of authorization resources should be returned based + * on the which subscriptions and management groups are passed as scopes. + */ + @JsonProperty(value = "authorizationScopeFilter") + private AuthorizationScopeFilter authorizationScopeFilter; + /** * Get the skipToken property: Continuation token for pagination, capturing the next page size and offset, as well * as the context of the query. @@ -157,6 +160,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 deleted file mode 100644 index 9787266e2cc0..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeData.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.resourcemanager.resourcegraph.fluent.models.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 deleted file mode 100644 index 099349c2edae..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataAfterSnapshot.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import java.time.OffsetDateTime; - -/** The snapshot after the change. */ -@Immutable -public final class ResourceChangeDataAfterSnapshot extends ResourceSnapshotData { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangeDataAfterSnapshot.class); - - /** {@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 deleted file mode 100644 index db49067bbf37..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDataBeforeSnapshot.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import java.time.OffsetDateTime; - -/** The snapshot before the change. */ -@Immutable -public final class ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangeDataBeforeSnapshot.class); - - /** {@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 deleted file mode 100644 index 3816f70b8228..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeDetailsRequestParameters.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The parameters for a specific change details request. */ -@Fluent -public final class ResourceChangeDetailsRequestParameters { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangeDetailsRequestParameters.class); - - /* - * 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; - - /** - * 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")); - } - } -} 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 deleted file mode 100644 index b9fbc2f1986f..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangeList.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.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 deleted file mode 100644 index 4f8e159bb9fa..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParameters.java +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** The parameters for a specific changes request. */ -@Fluent -public final class ResourceChangesRequestParameters { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangesRequestParameters.class); - - /* - * 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; - - /** - * 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(); - } - } -} 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 deleted file mode 100644 index fd93e3a6b14a..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceChangesRequestParametersInterval.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import java.time.OffsetDateTime; - -/** Specifies the date and time interval for a changes request. */ -@Immutable -public final class ResourceChangesRequestParametersInterval extends DateTimeInterval { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangesRequestParametersInterval.class); - - /** {@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 deleted file mode 100644 index 1f56ba56ae71..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcePropertyChange.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The resource property change. */ -@Fluent -public final class ResourcePropertyChange { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourcePropertyChange.class); - - /* - * 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; - - /** - * 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")); - } - } -} 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 7e9eadea0735..7720658ff45c 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,58 +6,9 @@ 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 { - /** - * 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); - - /** - * 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. - */ - Response resourceChangesWithResponse( - ResourceChangesRequestParameters 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); - - /** - * 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. - */ - Response> resourceChangeDetailsWithResponse( - ResourceChangeDetailsRequestParameters parameters, Context context); - /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * @@ -77,14 +28,14 @@ Response> resourceChangeDetailsWithResponse( * @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}. */ Response resourcesWithResponse(QueryRequest query, Context context); /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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. @@ -95,12 +46,12 @@ Response> resourceChangeDetailsWithResponse( /** * List all snapshots of a resource for a given time interval. * - * @param request The request parameter. + * @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 any object. + * @return any object along with {@link Response}. */ Response resourcesHistoryWithResponse(ResourcesHistoryRequest request, Context context); } 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 deleted file mode 100644 index d87221d13f2f..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourceSnapshotData.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Data on a specific resource snapshot. */ -@Fluent -public class ResourceSnapshotData { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceSnapshotData.class); - - /* - * 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; - - /** - * 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")); - } - } -} 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 index a1257e83af50..2ed80d6bb6cb 100644 --- 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 @@ -5,42 +5,39 @@ package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The ResourcesHistoryRequest model. */ +/** Describes a history request to be executed. */ @Fluent public final class ResourcesHistoryRequest { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourcesHistoryRequest.class); - /* - * The subscriptions property. + * Azure subscriptions against which to execute the query. */ @JsonProperty(value = "subscriptions") private List subscriptions; /* - * The query property. + * The resources query. */ @JsonProperty(value = "query") private String query; /* - * The options property. + * The history request evaluation options */ @JsonProperty(value = "options") private ResourcesHistoryRequestOptions options; /* - * The managementGroupId property. + * Azure management groups against which to execute the query. Example: [ + * 'mg1', 'mg2' ] */ - @JsonProperty(value = "managementGroupId") - private String managementGroupId; + @JsonProperty(value = "managementGroups") + private List managementGroups; /** - * Get the subscriptions property: The subscriptions property. + * Get the subscriptions property: Azure subscriptions against which to execute the query. * * @return the subscriptions value. */ @@ -49,7 +46,7 @@ public List subscriptions() { } /** - * Set the subscriptions property: The subscriptions property. + * Set the subscriptions property: Azure subscriptions against which to execute the query. * * @param subscriptions the subscriptions value to set. * @return the ResourcesHistoryRequest object itself. @@ -60,7 +57,7 @@ public ResourcesHistoryRequest withSubscriptions(List subscriptions) { } /** - * Get the query property: The query property. + * Get the query property: The resources query. * * @return the query value. */ @@ -69,7 +66,7 @@ public String query() { } /** - * Set the query property: The query property. + * Set the query property: The resources query. * * @param query the query value to set. * @return the ResourcesHistoryRequest object itself. @@ -80,7 +77,7 @@ public ResourcesHistoryRequest withQuery(String query) { } /** - * Get the options property: The options property. + * Get the options property: The history request evaluation options. * * @return the options value. */ @@ -89,7 +86,7 @@ public ResourcesHistoryRequestOptions options() { } /** - * Set the options property: The options property. + * Set the options property: The history request evaluation options. * * @param options the options value to set. * @return the ResourcesHistoryRequest object itself. @@ -100,22 +97,24 @@ public ResourcesHistoryRequest withOptions(ResourcesHistoryRequestOptions option } /** - * Get the managementGroupId property: The managementGroupId property. + * Get the managementGroups property: Azure management groups against which to execute the query. Example: [ 'mg1', + * 'mg2' ]. * - * @return the managementGroupId value. + * @return the managementGroups value. */ - public String managementGroupId() { - return this.managementGroupId; + public List managementGroups() { + return this.managementGroups; } /** - * Set the managementGroupId property: The managementGroupId property. + * Set the managementGroups property: Azure management groups against which to execute the query. Example: [ 'mg1', + * 'mg2' ]. * - * @param managementGroupId the managementGroupId value to set. + * @param managementGroups the managementGroups value to set. * @return the ResourcesHistoryRequest object itself. */ - public ResourcesHistoryRequest withManagementGroupId(String managementGroupId) { - this.managementGroupId = managementGroupId; + public ResourcesHistoryRequest withManagementGroups(List managementGroups) { + this.managementGroups = managementGroups; return this; } 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 index afec50d51109..737f9f1da1e3 100644 --- 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 @@ -5,49 +5,46 @@ package com.azure.resourcemanager.resourcegraph.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -/** The ResourcesHistoryRequestOptions model. */ +/** The options for history request evaluation. */ @Fluent public final class ResourcesHistoryRequestOptions { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourcesHistoryRequestOptions.class); - /* - * An interval in time specifying the date and time for the inclusive start - * and exclusive end, i.e. `[start, end)`. + * The time interval used to fetch history. */ @JsonProperty(value = "interval") private DateTimeInterval interval; /* - * The $top property. + * 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 $skip property. + * 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; /* - * The $skipToken property. + * 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 resultFormat property. + * Defines in which format query result returned. */ @JsonProperty(value = "resultFormat") - private ResourcesHistoryRequestOptionsResultFormat resultFormat; + private ResultFormat resultFormat; /** - * Get the interval property: An interval in time specifying the date and time for the inclusive start and exclusive - * end, i.e. `[start, end)`. + * Get the interval property: The time interval used to fetch history. * * @return the interval value. */ @@ -56,8 +53,7 @@ public DateTimeInterval interval() { } /** - * Set the interval property: An interval in time specifying the date and time for the inclusive start and exclusive - * end, i.e. `[start, end)`. + * Set the interval property: The time interval used to fetch history. * * @param interval the interval value to set. * @return the ResourcesHistoryRequestOptions object itself. @@ -68,7 +64,8 @@ public ResourcesHistoryRequestOptions withInterval(DateTimeInterval interval) { } /** - * Get the top property: The $top property. + * 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. */ @@ -77,7 +74,8 @@ public Integer top() { } /** - * Set the top property: The $top property. + * 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. @@ -88,7 +86,8 @@ public ResourcesHistoryRequestOptions withTop(Integer top) { } /** - * Get the skip property: The $skip property. + * 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. */ @@ -97,7 +96,8 @@ public Integer skip() { } /** - * Set the skip property: The $skip property. + * 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. @@ -108,7 +108,8 @@ public ResourcesHistoryRequestOptions withSkip(Integer skip) { } /** - * Get the skipToken property: The $skipToken property. + * 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. */ @@ -117,7 +118,8 @@ public String skipToken() { } /** - * Set the skipToken property: The $skipToken property. + * 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. @@ -128,21 +130,21 @@ public ResourcesHistoryRequestOptions withSkipToken(String skipToken) { } /** - * Get the resultFormat property: The resultFormat property. + * Get the resultFormat property: Defines in which format query result returned. * * @return the resultFormat value. */ - public ResourcesHistoryRequestOptionsResultFormat resultFormat() { + public ResultFormat resultFormat() { return this.resultFormat; } /** - * Set the resultFormat property: The resultFormat property. + * 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(ResourcesHistoryRequestOptionsResultFormat resultFormat) { + public ResourcesHistoryRequestOptions withResultFormat(ResultFormat resultFormat) { this.resultFormat = resultFormat; return this; } diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptionsResultFormat.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptionsResultFormat.java deleted file mode 100644 index f5c653d0c01d..000000000000 --- a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/main/java/com/azure/resourcemanager/resourcegraph/models/ResourcesHistoryRequestOptionsResultFormat.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.resourcegraph.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ResourcesHistoryRequestOptionsResultFormat. */ -public final class ResourcesHistoryRequestOptionsResultFormat - extends ExpandableStringEnum { - /** Static value table for ResourcesHistoryRequestOptionsResultFormat. */ - public static final ResourcesHistoryRequestOptionsResultFormat TABLE = fromString("table"); - - /** Static value objectArray for ResourcesHistoryRequestOptionsResultFormat. */ - public static final ResourcesHistoryRequestOptionsResultFormat OBJECT_ARRAY = fromString("objectArray"); - - /** - * Creates or finds a ResourcesHistoryRequestOptionsResultFormat from its string representation. - * - * @param name a name to look for. - * @return the corresponding ResourcesHistoryRequestOptionsResultFormat. - */ - @JsonCreator - public static ResourcesHistoryRequestOptionsResultFormat fromString(String name) { - return fromString(name, ResourcesHistoryRequestOptionsResultFormat.class); - } - - /** @return known ResourcesHistoryRequestOptionsResultFormat values. */ - public static Collection values() { - return values(ResourcesHistoryRequestOptionsResultFormat.class); - } -} diff --git a/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java new file mode 100644 index 000000000000..1432417fc194 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// 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; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json + */ + /** + * Sample code: OperationsList. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void operationsList(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager.operations().list(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 new file mode 100644 index 000000000000..634650c2c2c0 --- /dev/null +++ b/sdk/resourcegraph/azure-resourcemanager-resourcegraph/src/samples/java/com/azure/resourcemanager/resourcegraph/generated/ResourceProviderResourcesSamples.java @@ -0,0 +1,254 @@ +// 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.FacetRequest; +import com.azure.resourcemanager.resourcegraph.models.FacetRequestOptions; +import com.azure.resourcemanager.resourcegraph.models.FacetSortOrder; +import com.azure.resourcemanager.resourcegraph.models.QueryRequest; +import com.azure.resourcemanager.resourcegraph.models.QueryRequestOptions; +import java.util.Arrays; + +/** Samples for ResourceProvider Resources. */ +public final class ResourceProviderResourcesSamples { + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json + */ + /** + * Sample code: Basic management group query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicManagementGroupQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withManagementGroups(Arrays.asList("e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG")) + .withQuery("Resources | project id, name, type, location, tags | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json + */ + /** + * Sample code: Basic query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | project id, name, type, location, tags | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json + */ + /** + * Sample code: Query with a facet request. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void queryWithAFacetRequest(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location," + + " resourceGroup, properties.storageProfile.osDisk.osType | limit 5") + .withFacets( + Arrays + .asList( + new FacetRequest() + .withExpression("location") + .withOptions( + new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), + new FacetRequest() + .withExpression("properties.storageProfile.osDisk.osType") + .withOptions( + new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), + new FacetRequest() + .withExpression("nonExistingColumn") + .withOptions( + new FacetRequestOptions().withSortOrder(FacetSortOrder.DESC).withTop(3)), + new FacetRequest() + .withExpression("resourceGroup") + .withOptions( + new FacetRequestOptions() + .withSortBy("tolower(resourceGroup)") + .withSortOrder(FacetSortOrder.ASC) + .withTop(3)), + new FacetRequest() + .withExpression("resourceGroup") + .withOptions( + new FacetRequestOptions() + .withFilter("resourceGroup contains 'test'") + .withTop(3)))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json + */ + /** + * Sample code: Filter resources. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void filterResources(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | project id, name, type, location | where type =~" + + " 'Microsoft.Compute/virtualMachines' | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json + */ + /** + * Sample code: Summarize resources by location. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void summarizeResourcesByLocation( + com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | project id, name, type, location | summarize by location"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json + */ + /** + * Sample code: Access a properties field. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void accessAPropertiesField(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by" + + " tostring(properties.storageProfile.osDisk.osType)"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json + */ + /** + * Sample code: Complex query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void complexQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery( + "Resources | project id, name, type, location | where type =~" + + " 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json + */ + /** + * Sample code: Next page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void nextPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | where name contains 'test' | project id, name, type, location") + .withOptions( + new QueryRequestOptions() + .withSkipToken("eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json + */ + /** + * Sample code: First page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void firstPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | where name contains 'test' | project id, name, type, location") + .withOptions(new QueryRequestOptions().withTop(3).withSkip(0)), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json + */ + /** + * Sample code: Basic tenant query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void basicTenantQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest().withQuery("Resources | project id, name, type, location, tags | limit 3"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json + */ + /** + * Sample code: Random page query. + * + * @param manager Entry point to ResourceGraphManager. + */ + public static void randomPageQuery(com.azure.resourcemanager.resourcegraph.ResourceGraphManager manager) { + manager + .resourceProviders() + .resourcesWithResponse( + new QueryRequest() + .withSubscriptions(Arrays.asList("cfbbd179-59d2-4052-aa06-9270a38aa9d6")) + .withQuery("Resources | where name contains 'test' | project id, name, type, location") + .withOptions(new QueryRequestOptions().withTop(2).withSkip(10)), + Context.NONE); + } +}