
com.azure.resourcemanager.orbital.implementation.ContactsClientImpl Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.orbital.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.orbital.fluent.ContactsClient;
import com.azure.resourcemanager.orbital.fluent.models.ContactInner;
import com.azure.resourcemanager.orbital.models.ContactListResult;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in ContactsClient.
*/
public final class ContactsClientImpl implements ContactsClient {
/**
* The proxy service used to perform REST calls.
*/
private final ContactsService service;
/**
* The service client containing this operation class.
*/
private final AzureOrbitalImpl client;
/**
* Initializes an instance of ContactsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
ContactsClientImpl(AzureOrbitalImpl client) {
this.service = RestProxy.create(ContactsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for AzureOrbitalContacts to be used by the proxy service to perform REST
* calls.
*/
@Host("{$host}")
@ServiceInterface(name = "AzureOrbitalContacts")
public interface ContactsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@PathParam("spacecraftName") String spacecraftName, @QueryParam("$skiptoken") String skiptoken,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@PathParam("spacecraftName") String spacecraftName, @PathParam("contactName") String contactName,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> create(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@PathParam("spacecraftName") String spacecraftName, @PathParam("contactName") String contactName,
@BodyParam("application/json") ContactInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Orbital/spacecrafts/{spacecraftName}/contacts/{contactName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@PathParam("spacecraftName") String spacecraftName, @PathParam("contactName") String contactName,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context);
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param skiptoken An opaque string that the resource provider uses to skip over previously-returned results. This
* is used when a previous list operation call returned a partial result. If a previous response contains a nextLink
* element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to
* use for subsequent calls.
* @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 response for the ListContacts API service call along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String spacecraftName,
String skiptoken) {
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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.list(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, skiptoken, accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param skiptoken An opaque string that the resource provider uses to skip over previously-returned results. This
* is used when a previous list operation call returned a partial result. If a previous response contains a nextLink
* element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to
* use for subsequent calls.
* @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 response for the ListContacts API service call along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName, String spacecraftName,
String skiptoken, 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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, skiptoken, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param skiptoken An opaque string that the resource provider uses to skip over previously-returned results. This
* is used when a previous list operation call returned a partial result. If a previous response contains a nextLink
* element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to
* use for subsequent calls.
* @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 response for the ListContacts API service call as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String spacecraftName, String skiptoken) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, spacecraftName, skiptoken),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @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 response for the ListContacts API service call as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String spacecraftName) {
final String skiptoken = null;
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, spacecraftName, skiptoken),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param skiptoken An opaque string that the resource provider uses to skip over previously-returned results. This
* is used when a previous list operation call returned a partial result. If a previous response contains a nextLink
* element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to
* use for subsequent calls.
* @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 response for the ListContacts API service call as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName, String spacecraftName, String skiptoken,
Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, spacecraftName, skiptoken, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @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 response for the ListContacts API service call as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String spacecraftName) {
final String skiptoken = null;
return new PagedIterable<>(listAsync(resourceGroupName, spacecraftName, skiptoken));
}
/**
* Returns list of contacts by spacecraftName.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param skiptoken An opaque string that the resource provider uses to skip over previously-returned results. This
* is used when a previous list operation call returned a partial result. If a previous response contains a nextLink
* element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to
* use for subsequent calls.
* @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 response for the ListContacts API service call as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName, String spacecraftName, String skiptoken,
Context context) {
return new PagedIterable<>(listAsync(resourceGroupName, spacecraftName, skiptoken, context));
}
/**
* Gets the specified contact in a specified resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 specified contact in a specified resource group along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String spacecraftName,
String contactName) {
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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
if (contactName == null) {
return Mono.error(new IllegalArgumentException("Parameter contactName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.get(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, contactName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the specified contact in a specified resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 the specified contact in a specified resource group along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String spacecraftName,
String contactName, 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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
if (contactName == null) {
return Mono.error(new IllegalArgumentException("Parameter contactName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, contactName, accept, context);
}
/**
* Gets the specified contact in a specified resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 specified contact in a specified resource group on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceGroupName, String spacecraftName, String contactName) {
return getWithResponseAsync(resourceGroupName, spacecraftName, contactName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the specified contact in a specified resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 the specified contact in a specified resource group along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String spacecraftName, String contactName,
Context context) {
return getWithResponseAsync(resourceGroupName, spacecraftName, contactName, context).block();
}
/**
* Gets the specified contact in a specified resource group.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 specified contact in a specified resource group.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ContactInner get(String resourceGroupName, String spacecraftName, String contactName) {
return getWithResponse(resourceGroupName, spacecraftName, contactName, Context.NONE).getValue();
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 customer creates a contact resource for a spacecraft resource along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createWithResponseAsync(String resourceGroupName, String spacecraftName,
String contactName, ContactInner parameters) {
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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
if (contactName == null) {
return Mono.error(new IllegalArgumentException("Parameter contactName 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 accept = "application/json";
return FluxUtil
.withContext(
context -> service.create(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, contactName, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 customer creates a contact resource for a spacecraft resource along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createWithResponseAsync(String resourceGroupName, String spacecraftName,
String contactName, ContactInner parameters, 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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
if (contactName == null) {
return Mono.error(new IllegalArgumentException("Parameter contactName 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 accept = "application/json";
context = this.client.mergeContext(context);
return service.create(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, contactName, parameters, accept, context);
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 PollerFlux} for polling of customer creates a contact resource for a spacecraft resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ContactInner> beginCreateAsync(String resourceGroupName,
String spacecraftName, String contactName, ContactInner parameters) {
Mono>> mono
= createWithResponseAsync(resourceGroupName, spacecraftName, contactName, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
ContactInner.class, ContactInner.class, this.client.getContext());
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 the {@link PollerFlux} for polling of customer creates a contact resource for a spacecraft resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, ContactInner> beginCreateAsync(String resourceGroupName,
String spacecraftName, String contactName, ContactInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createWithResponseAsync(resourceGroupName, spacecraftName, contactName, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
ContactInner.class, ContactInner.class, context);
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 SyncPoller} for polling of customer creates a contact resource for a spacecraft resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ContactInner> beginCreate(String resourceGroupName,
String spacecraftName, String contactName, ContactInner parameters) {
return this.beginCreateAsync(resourceGroupName, spacecraftName, contactName, parameters).getSyncPoller();
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 the {@link SyncPoller} for polling of customer creates a contact resource for a spacecraft resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, ContactInner> beginCreate(String resourceGroupName,
String spacecraftName, String contactName, ContactInner parameters, Context context) {
return this.beginCreateAsync(resourceGroupName, spacecraftName, contactName, parameters, context)
.getSyncPoller();
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 customer creates a contact resource for a spacecraft resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(String resourceGroupName, String spacecraftName, String contactName,
ContactInner parameters) {
return beginCreateAsync(resourceGroupName, spacecraftName, contactName, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 customer creates a contact resource for a spacecraft resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createAsync(String resourceGroupName, String spacecraftName, String contactName,
ContactInner parameters, Context context) {
return beginCreateAsync(resourceGroupName, spacecraftName, contactName, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 customer creates a contact resource for a spacecraft resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ContactInner create(String resourceGroupName, String spacecraftName, String contactName,
ContactInner parameters) {
return createAsync(resourceGroupName, spacecraftName, contactName, parameters).block();
}
/**
* Creates a contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @param parameters The parameters to provide for the created contact.
* @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 customer creates a contact resource for a spacecraft resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ContactInner create(String resourceGroupName, String spacecraftName, String contactName,
ContactInner parameters, Context context) {
return createAsync(resourceGroupName, spacecraftName, contactName, parameters, context).block();
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String spacecraftName,
String contactName) {
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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
if (contactName == null) {
return Mono.error(new IllegalArgumentException("Parameter contactName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.delete(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, contactName, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String spacecraftName,
String contactName, 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 (spacecraftName == null) {
return Mono.error(new IllegalArgumentException("Parameter spacecraftName is required and cannot be null."));
}
if (contactName == null) {
return Mono.error(new IllegalArgumentException("Parameter contactName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), resourceGroupName, this.client.getSubscriptionId(),
this.client.getApiVersion(), spacecraftName, contactName, accept, context);
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String spacecraftName,
String contactName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, spacecraftName, contactName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String spacecraftName,
String contactName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, spacecraftName, contactName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String spacecraftName,
String contactName) {
return this.beginDeleteAsync(resourceGroupName, spacecraftName, contactName).getSyncPoller();
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String spacecraftName,
String contactName, Context context) {
return this.beginDeleteAsync(resourceGroupName, spacecraftName, contactName, context).getSyncPoller();
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String spacecraftName, String contactName) {
return beginDeleteAsync(resourceGroupName, spacecraftName, contactName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String spacecraftName, String contactName,
Context context) {
return beginDeleteAsync(resourceGroupName, spacecraftName, contactName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String spacecraftName, String contactName) {
deleteAsync(resourceGroupName, spacecraftName, contactName).block();
}
/**
* Deletes a specified contact.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param spacecraftName Spacecraft ID.
* @param contactName Contact name.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String spacecraftName, String contactName, Context context) {
deleteAsync(resourceGroupName, spacecraftName, contactName, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @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 response for the ListContacts API service call along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @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 response for the ListContacts API service call along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy