Skip to content
Closed
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,6 +1,8 @@
# Release History

## 1.0.0-beta.4 (Unreleased)
## 1.0.0-beta.1 (2022-07-20)

- Azure Resource Manager LogAnalytics client library for Java. This package contains Microsoft Azure SDK for LogAnalytics Management SDK. Operational Insights Client. Package tag package-2022-02. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

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

- [CreateOrUpdate](#querypacks_createorupdate)
- [CreateOrUpdateWithoutName](#querypacks_createorupdatewithoutname)
- [Delete](#querypacks_delete)
- [GetByResourceGroup](#querypacks_getbyresourcegroup)
- [List](#querypacks_list)
Expand Down Expand Up @@ -1223,6 +1224,61 @@ public final class QueryPacksCreateOrUpdateSamples {
}
```

### QueryPacks_CreateOrUpdateWithoutName

```java
import com.azure.core.util.Context;
import com.azure.resourcemanager.loganalytics.fluent.models.LogAnalyticsQueryPackInner;
import java.util.HashMap;
import java.util.Map;

/** Samples for QueryPacks CreateOrUpdateWithoutName. */
public final class QueryPacksCreateOrUpdateWithoutNameSamples {
/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPacksCreateNoName.json
*/
/**
* Sample code: QueryPackCreateNoName.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void queryPackCreateNoName(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager
.queryPacks()
.createOrUpdateWithoutNameWithResponse(
"my-resource-group", new LogAnalyticsQueryPackInner().withLocation("South Central US"), Context.NONE);
}

/*
* x-ms-original-file: specification/operationalinsights/resource-manager/Microsoft.OperationalInsights/stable/2019-09-01/examples/QueryPackUpdateNoName.json
*/
/**
* Sample code: QueryPackUpdateNoName.
*
* @param manager Entry point to LogAnalyticsManager.
*/
public static void queryPackUpdateNoName(com.azure.resourcemanager.loganalytics.LogAnalyticsManager manager) {
manager
.queryPacks()
.createOrUpdateWithoutNameWithResponse(
"my-resource-group",
new LogAnalyticsQueryPackInner().withLocation("South Central US").withTags(mapOf("Tag1", "Value1")),
Context.NONE);
}

@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
```

### QueryPacks_Delete

```java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public LogAnalyticsManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.loganalytics")
.append("/")
.append("1.0.0-beta.3");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,39 @@ public interface QueryPacksClient {
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<LogAnalyticsQueryPackInner> listByResourceGroup(String resourceGroupName, Context context);

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
LogAnalyticsQueryPackInner createOrUpdateWithoutName(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload);

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<LogAnalyticsQueryPackInner> createOrUpdateWithoutNameWithResponse(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload, Context context);

/**
* Deletes a Log Analytics QueryPack.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ Mono<Response<LogAnalyticsQueryPackListResult>> listByResourceGroup(
@HeaderParam("Accept") String accept,
Context context);

@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights"
+ "/queryPacks")
@ExpectedResponses({201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<LogAnalyticsQueryPackInner>> createOrUpdateWithoutName(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload,
@HeaderParam("Accept") String accept,
Context context);

@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights"
Expand Down Expand Up @@ -477,6 +492,175 @@ public PagedIterable<LogAnalyticsQueryPackInner> listByResourceGroup(String reso
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition along with {@link Response} on successful completion of {@link
* Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<LogAnalyticsQueryPackInner>> createOrUpdateWithoutNameWithResponseAsync(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (logAnalyticsQueryPackPayload == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter logAnalyticsQueryPackPayload is required and cannot be null."));
} else {
logAnalyticsQueryPackPayload.validate();
}
final String apiVersion = "2019-09-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.createOrUpdateWithoutName(
this.client.getEndpoint(),
resourceGroupName,
apiVersion,
this.client.getSubscriptionId(),
logAnalyticsQueryPackPayload,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition along with {@link Response} on successful completion of {@link
* Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<LogAnalyticsQueryPackInner>> createOrUpdateWithoutNameWithResponseAsync(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (logAnalyticsQueryPackPayload == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter logAnalyticsQueryPackPayload is required and cannot be null."));
} else {
logAnalyticsQueryPackPayload.validate();
}
final String apiVersion = "2019-09-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.createOrUpdateWithoutName(
this.client.getEndpoint(),
resourceGroupName,
apiVersion,
this.client.getSubscriptionId(),
logAnalyticsQueryPackPayload,
accept,
context);
}

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<LogAnalyticsQueryPackInner> createOrUpdateWithoutNameAsync(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload) {
return createOrUpdateWithoutNameWithResponseAsync(resourceGroupName, logAnalyticsQueryPackPayload)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public LogAnalyticsQueryPackInner createOrUpdateWithoutName(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload) {
return createOrUpdateWithoutNameAsync(resourceGroupName, logAnalyticsQueryPackPayload).block();
}

/**
* Creates a Log Analytics QueryPack. Note: You cannot specify a different value for InstrumentationKey nor AppId in
* the Put operation.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param logAnalyticsQueryPackPayload Properties that need to be specified to create or update a Log Analytics
* QueryPack.
* @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 an Log Analytics QueryPack definition along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<LogAnalyticsQueryPackInner> createOrUpdateWithoutNameWithResponse(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload, Context context) {
return createOrUpdateWithoutNameWithResponseAsync(resourceGroupName, logAnalyticsQueryPackPayload, context)
.block();
}

/**
* Deletes a Log Analytics QueryPack.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ public PagedIterable<LogAnalyticsQueryPack> listByResourceGroup(String resourceG
return Utils.mapPage(inner, inner1 -> new LogAnalyticsQueryPackImpl(inner1, this.manager()));
}

public LogAnalyticsQueryPack createOrUpdateWithoutName(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload) {
LogAnalyticsQueryPackInner inner =
this.serviceClient().createOrUpdateWithoutName(resourceGroupName, logAnalyticsQueryPackPayload);
if (inner != null) {
return new LogAnalyticsQueryPackImpl(inner, this.manager());
} else {
return null;
}
}

public Response<LogAnalyticsQueryPack> createOrUpdateWithoutNameWithResponse(
String resourceGroupName, LogAnalyticsQueryPackInner logAnalyticsQueryPackPayload, Context context) {
Response<LogAnalyticsQueryPackInner> inner =
this
.serviceClient()
.createOrUpdateWithoutNameWithResponse(resourceGroupName, logAnalyticsQueryPackPayload, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new LogAnalyticsQueryPackImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}

public void deleteByResourceGroup(String resourceGroupName, String queryPackName) {
this.serviceClient().delete(resourceGroupName, queryPackName);
}
Expand Down
Loading