Skip to content

Commit

Permalink
CodeGen from PR 23424 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
merging billing fix to public repo (Azure#23424)

Co-authored-by: Gaurav Bang <gauravbang@microsoft.com>
  • Loading branch information
SDKAuto and Gaurav Bang committed Apr 7, 2023
1 parent bb30d8d commit 6e94ee4
Show file tree
Hide file tree
Showing 70 changed files with 164 additions and 3,532 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2023-04-07)

- Azure Resource Manager NewRelicObservability client library for Java. This package contains Microsoft Azure SDK for NewRelicObservability Management SDK. Package tag package-2022-07-01-preview. 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-newrelicobservability</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest;
import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest;
import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest;
import com.azure.resourcemanager.newrelicobservability.models.MonitorsSwitchBillingResponse;
import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate;
import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest;

Expand Down Expand Up @@ -358,10 +359,10 @@ PagedIterable<AppServiceInfoInner> listAppServices(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
* @return a Monitor Resource by NewRelic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<Void> switchBillingWithResponse(
MonitorsSwitchBillingResponse switchBillingWithResponse(
String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context);

/**
Expand All @@ -373,9 +374,11 @@ Response<Void> switchBillingWithResponse(
* @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 Monitor Resource by NewRelic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request);
NewRelicMonitorResourceInner switchBilling(
String resourceGroupName, String monitorName, SwitchBillingRequest request);

/**
* List the compute vm resources currently being monitored by the NewRelic resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest;
import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest;
import com.azure.resourcemanager.newrelicobservability.models.MonitoredResourceListResponse;
import com.azure.resourcemanager.newrelicobservability.models.MonitorsSwitchBillingResponse;
import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceListResult;
import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate;
import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest;
Expand Down Expand Up @@ -211,9 +212,9 @@ Mono<Response<AppServicesListResponse>> listAppServices(
@Headers({"Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/switchBilling")
@ExpectedResponses({204})
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Void>> switchBilling(
Mono<MonitorsSwitchBillingResponse> switchBilling(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Expand Down Expand Up @@ -1988,10 +1989,10 @@ public PagedIterable<AppServiceInfoInner> listAppServices(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
* @return a Monitor Resource by NewRelic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> switchBillingWithResponseAsync(
private Mono<MonitorsSwitchBillingResponse> switchBillingWithResponseAsync(
String resourceGroupName, String monitorName, SwitchBillingRequest request) {
if (this.client.getEndpoint() == null) {
return Mono
Expand Down Expand Up @@ -2044,10 +2045,10 @@ private Mono<Response<Void>> switchBillingWithResponseAsync(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
* @return a Monitor Resource by NewRelic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> switchBillingWithResponseAsync(
private Mono<MonitorsSwitchBillingResponse> switchBillingWithResponseAsync(
String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
Expand Down Expand Up @@ -2096,11 +2097,13 @@ private Mono<Response<Void>> switchBillingWithResponseAsync(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
* @return a Monitor Resource by NewRelic on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> switchBillingAsync(String resourceGroupName, String monitorName, SwitchBillingRequest request) {
return switchBillingWithResponseAsync(resourceGroupName, monitorName, request).flatMap(ignored -> Mono.empty());
private Mono<NewRelicMonitorResourceInner> switchBillingAsync(
String resourceGroupName, String monitorName, SwitchBillingRequest request) {
return switchBillingWithResponseAsync(resourceGroupName, monitorName, request)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
Expand All @@ -2113,10 +2116,10 @@ private Mono<Void> switchBillingAsync(String resourceGroupName, String monitorNa
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
* @return a Monitor Resource by NewRelic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> switchBillingWithResponse(
public MonitorsSwitchBillingResponse switchBillingWithResponse(
String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) {
return switchBillingWithResponseAsync(resourceGroupName, monitorName, request, context).block();
}
Expand All @@ -2130,10 +2133,12 @@ public Response<Void> switchBillingWithResponse(
* @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 Monitor Resource by NewRelic.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request) {
switchBillingWithResponse(resourceGroupName, monitorName, request, Context.NONE);
public NewRelicMonitorResourceInner switchBilling(
String resourceGroupName, String monitorName, SwitchBillingRequest request) {
return switchBillingWithResponse(resourceGroupName, monitorName, request, Context.NONE).getValue();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusResponse;
import com.azure.resourcemanager.newrelicobservability.models.MonitoredResource;
import com.azure.resourcemanager.newrelicobservability.models.Monitors;
import com.azure.resourcemanager.newrelicobservability.models.MonitorsSwitchBillingResponse;
import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource;
import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest;
import com.azure.resourcemanager.newrelicobservability.models.VMExtensionPayload;
Expand Down Expand Up @@ -162,13 +163,30 @@ public PagedIterable<AppServiceInfo> listAppServices(
return Utils.mapPage(inner, inner1 -> new AppServiceInfoImpl(inner1, this.manager()));
}

public Response<Void> switchBillingWithResponse(
public Response<NewRelicMonitorResource> switchBillingWithResponse(
String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) {
return this.serviceClient().switchBillingWithResponse(resourceGroupName, monitorName, request, context);
MonitorsSwitchBillingResponse inner =
this.serviceClient().switchBillingWithResponse(resourceGroupName, monitorName, request, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new NewRelicMonitorResourceImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}

public void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request) {
this.serviceClient().switchBilling(resourceGroupName, monitorName, request);
public NewRelicMonitorResource switchBilling(
String resourceGroupName, String monitorName, SwitchBillingRequest request) {
NewRelicMonitorResourceInner inner =
this.serviceClient().switchBilling(resourceGroupName, monitorName, request);
if (inner != null) {
return new NewRelicMonitorResourceImpl(inner, this.manager());
} else {
return null;
}
}

public PagedIterable<VMInfo> listHosts(String resourceGroupName, String monitorName, HostsGetRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ public PagedIterable<AppServiceInfo> listAppServices(AppServicesGetRequest reque
return serviceManager.monitors().listAppServices(resourceGroupName, monitorName, request, context);
}

public Response<Void> switchBillingWithResponse(SwitchBillingRequest request, Context context) {
public Response<NewRelicMonitorResource> switchBillingWithResponse(SwitchBillingRequest request, Context context) {
return serviceManager.monitors().switchBillingWithResponse(resourceGroupName, monitorName, request, context);
}

public void switchBilling(SwitchBillingRequest request) {
serviceManager.monitors().switchBilling(resourceGroupName, monitorName, request);
public NewRelicMonitorResource switchBilling(SwitchBillingRequest request) {
return serviceManager.monitors().switchBilling(resourceGroupName, monitorName, request);
}

public PagedIterable<VMInfo> listHosts(HostsGetRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ PagedIterable<AppServiceInfo> listAppServices(
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
* @return a Monitor Resource by NewRelic.
*/
Response<Void> switchBillingWithResponse(
Response<NewRelicMonitorResource> switchBillingWithResponse(
String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context);

/**
Expand All @@ -217,8 +217,9 @@ Response<Void> switchBillingWithResponse(
* @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 Monitor Resource by NewRelic.
*/
void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request);
NewRelicMonitorResource switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request);

/**
* List the compute vm resources currently being monitored by the NewRelic resource.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.newrelicobservability.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.http.HttpHeaderName;
import com.azure.core.http.HttpHeaders;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The MonitorsSwitchBillingHeaders model. */
@Fluent
public final class MonitorsSwitchBillingHeaders {
/*
* The Retry-After property.
*/
@JsonProperty(value = "Retry-After")
private Integer retryAfter;

// HttpHeaders containing the raw property values.
/**
* Creates an instance of MonitorsSwitchBillingHeaders class.
*
* @param rawHeaders The raw HttpHeaders that will be used to create the property values.
*/
public MonitorsSwitchBillingHeaders(HttpHeaders rawHeaders) {
String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER);
if (retryAfter != null) {
this.retryAfter = Integer.parseInt(retryAfter);
}
}

/**
* Get the retryAfter property: The Retry-After property.
*
* @return the retryAfter value.
*/
public Integer retryAfter() {
return this.retryAfter;
}

/**
* Set the retryAfter property: The Retry-After property.
*
* @param retryAfter the retryAfter value to set.
* @return the MonitorsSwitchBillingHeaders object itself.
*/
public MonitorsSwitchBillingHeaders withRetryAfter(Integer retryAfter) {
this.retryAfter = retryAfter;
return this;
}

/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.newrelicobservability.models;

import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpRequest;
import com.azure.core.http.rest.ResponseBase;
import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner;

/** Contains all response data for the switchBilling operation. */
public final class MonitorsSwitchBillingResponse
extends ResponseBase<MonitorsSwitchBillingHeaders, NewRelicMonitorResourceInner> {
/**
* Creates an instance of MonitorsSwitchBillingResponse.
*
* @param request the request which resulted in this MonitorsSwitchBillingResponse.
* @param statusCode the status code of the HTTP response.
* @param rawHeaders the raw headers of the HTTP response.
* @param value the deserialized value of the HTTP response.
* @param headers the deserialized headers of the HTTP response.
*/
public MonitorsSwitchBillingResponse(
HttpRequest request,
int statusCode,
HttpHeaders rawHeaders,
NewRelicMonitorResourceInner value,
MonitorsSwitchBillingHeaders headers) {
super(request, statusCode, rawHeaders, value, headers);
}

/**
* Gets the deserialized response body.
*
* @return the deserialized response body.
*/
@Override
public NewRelicMonitorResourceInner getValue() {
return super.getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ interface WithAccountCreationSource {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
* @return a Monitor Resource by NewRelic.
*/
Response<Void> switchBillingWithResponse(SwitchBillingRequest request, Context context);
Response<NewRelicMonitorResource> switchBillingWithResponse(SwitchBillingRequest request, Context context);

/**
* Switches the billing for NewRelic monitor resource.
Expand All @@ -513,8 +513,9 @@ interface WithAccountCreationSource {
* @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 Monitor Resource by NewRelic.
*/
void switchBilling(SwitchBillingRequest request);
NewRelicMonitorResource switchBilling(SwitchBillingRequest request);

/**
* List the compute vm resources currently being monitored by the NewRelic resource.
Expand Down
Loading

0 comments on commit 6e94ee4

Please sign in to comment.