Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-resourcegraph</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -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
Expand Down
348 changes: 348 additions & 0 deletions sdk/resourcegraph/azure-resourcemanager-resourcegraph/SAMPLE.md
Original file line number Diff line number Diff line change
@@ -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);
}
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for ResourceGraph Management</name>
<description>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.</description>
<description>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.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down
Loading