com.azure.communication.networktraversal.CommunicationRelayClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-communication-networktraversal Show documentation
Show all versions of azure-communication-networktraversal Show documentation
Please note, this package has been deprecated and will no longer be maintained after 03/31/2024.
Refer to our deprecation policy (https://aka.ms/azsdk/support-policies) for more details.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.communication.networktraversal;
import com.azure.communication.networktraversal.models.CommunicationRelayConfiguration;
import com.azure.communication.networktraversal.models.GetRelayConfigurationOptions;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
/**
* Synchronous client interface for Communication Service NetworkTraversal operations
*
* Instantiating a synchronous CommunicationRelayClient
*
*
*
* // You can find your endpoint and access key from your resource in the Azure Portal
* String endpoint = "https://<RESOURCE_NAME>.communication.azure.com";
* AzureKeyCredential keyCredential = new AzureKeyCredential("<access-key>");
*
* CommunicationRelayClient communicationRelayClient = new CommunicationRelayClientBuilder()
* .endpoint(endpoint)
* .credential(keyCredential)
* .buildClient();
*
*
* View {@link CommunicationRelayClientBuilder this} for additional ways to construct the client.
*
* @see CommunicationRelayClientBuilder
*/
@ServiceClient(builder = CommunicationRelayClientBuilder.class, isAsync = false)
public final class CommunicationRelayClient {
private final CommunicationRelayAsyncClient client;
private final ClientLogger logger = new ClientLogger(CommunicationRelayClient.class);
CommunicationRelayClient(CommunicationRelayAsyncClient communicationNetworkingClient) {
client = communicationNetworkingClient;
}
/**
* Gets a Relay Configuration.
*
* @return The obtained Communication Relay Configuration
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CommunicationRelayConfiguration getRelayConfiguration() {
return client.getRelayConfiguration().block();
}
/**
* Gets a Relay Configuration for a CommunicationUserIdentifier.
*
* @param options of the GetRelayConfigurationOptions request
* @return The obtained Communication Relay Configuration
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CommunicationRelayConfiguration getRelayConfiguration(GetRelayConfigurationOptions options) {
return client.getRelayConfiguration(options).block();
}
/**
* Gets a Relay Configuration with response.
*
* @param options of the GetRelayConfigurationOptions request
* @param context A {@link Context} representing the request context.
* @return The obtained Communication Relay Configuration
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getRelayConfigurationWithResponse(GetRelayConfigurationOptions options, Context context) {
Response response =
client.getRelayConfigurationWithResponse(options, context).block();
return response;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy