Skip to content

Commit

Permalink
Rename EventRoute to DigitalTwinsEventRoute (#16824)
Browse files Browse the repository at this point in the history
  • Loading branch information
azabbasi authored Oct 26, 2020
1 parent 19e3106 commit 1e1b2d9
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,9 @@ <T> Mono<PagedResponse<T>> queryNextPage(String nextLink, Class<T> clazz, QueryO
* @return An empty mono.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> createOrReplaceEventRoute(String eventRouteId, EventRoute eventRoute)
public Mono<Void> createOrReplaceEventRoute(String eventRouteId, DigitalTwinsEventRoute eventRoute)
{
return createEventRouteWithResponse(eventRouteId, eventRoute, null)
return createOrReplaceEventRouteWithResponse(eventRouteId, eventRoute, null)
.flatMap(voidResponse -> Mono.empty());
}

Expand All @@ -1269,12 +1269,12 @@ public Mono<Void> createOrReplaceEventRoute(String eventRouteId, EventRoute even
* @return A {@link Response} containing an empty mono.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> createEventRouteWithResponse(String eventRouteId, EventRoute eventRoute, CreateEventRouteOptions options)
public Mono<Response<Void>> createOrReplaceEventRouteWithResponse(String eventRouteId, DigitalTwinsEventRoute eventRoute, CreateEventRouteOptions options)
{
return withContext(context -> createEventRouteWithResponse(eventRouteId, eventRoute, options, context));
return withContext(context -> createOrReplaceEventRouteWithResponse(eventRouteId, eventRoute, options, context));
}

Mono<Response<Void>> createEventRouteWithResponse(String eventRouteId, EventRoute eventRoute, CreateEventRouteOptions options, Context context)
Mono<Response<Void>> createOrReplaceEventRouteWithResponse(String eventRouteId, DigitalTwinsEventRoute eventRoute, CreateEventRouteOptions options, Context context)
{
return this.protocolLayer.getEventRoutes().addWithResponseAsync(eventRouteId, EventRouteConverter.map(eventRoute), OptionsConverter.toProtocolLayerOptions(options), context);
}
Expand All @@ -1290,7 +1290,7 @@ Mono<Response<Void>> createEventRouteWithResponse(String eventRouteId, EventRout
* @return The retrieved event route.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<EventRoute> getEventRoute(String eventRouteId)
public Mono<DigitalTwinsEventRoute> getEventRoute(String eventRouteId)
{
return getEventRouteWithResponse(eventRouteId, null)
.map(Response::getValue);
Expand All @@ -1308,12 +1308,12 @@ public Mono<EventRoute> getEventRoute(String eventRouteId)
* @return A {@link Response} containing the retrieved event route.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<EventRoute>> getEventRouteWithResponse(String eventRouteId, GetEventRouteOptions options)
public Mono<Response<DigitalTwinsEventRoute>> getEventRouteWithResponse(String eventRouteId, GetDigitalTwinsEventRouteOptions options)
{
return withContext(context -> getEventRouteWithResponse(eventRouteId, options, context));
}

Mono<Response<EventRoute>> getEventRouteWithResponse(String eventRouteId, GetEventRouteOptions options, Context context)
Mono<Response<DigitalTwinsEventRoute>> getEventRouteWithResponse(String eventRouteId, GetDigitalTwinsEventRouteOptions options, Context context)
{
return this.protocolLayer.getEventRoutes().getByIdWithResponseAsync(eventRouteId, OptionsConverter.toProtocolLayerOptions(options), context)
.map(eventRouteResponse -> new SimpleResponse<>(
Expand Down Expand Up @@ -1373,7 +1373,7 @@ Mono<Response<Void>> deleteEventRouteWithResponse(String eventRouteId, DeleteEve
* This PagedFlux may take multiple service requests to iterate over all event routes.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<EventRoute> listEventRoutes()
public PagedFlux<DigitalTwinsEventRoute> listEventRoutes()
{
return listEventRoutes(null);
}
Expand All @@ -1385,42 +1385,42 @@ public PagedFlux<EventRoute> listEventRoutes()
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.listEventRoutes#Options}
*
* @param options The optional parameters to use when listing event routes. See {@link ListEventRoutesOptions} for more details
* @param options The optional parameters to use when listing event routes. See {@link ListDigitalTwinsEventRoutesOptions} for more details
* on what optional parameters can be set.
* @return A {@link PagedFlux} that contains all the event routes that exist in your digital twins instance.
* This PagedFlux may take multiple service requests to iterate over all event routes.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<EventRoute> listEventRoutes(ListEventRoutesOptions options)
public PagedFlux<DigitalTwinsEventRoute> listEventRoutes(ListDigitalTwinsEventRoutesOptions options)
{
return new PagedFlux<>(
() -> withContext(context -> listEventRoutesFirstPage(options, context)),
nextLink -> withContext(context -> listEventRoutesNextPage(nextLink, options, context)));
}

PagedFlux<EventRoute> listEventRoutes(ListEventRoutesOptions options, Context context)
PagedFlux<DigitalTwinsEventRoute> listEventRoutes(ListDigitalTwinsEventRoutesOptions options, Context context)
{
return new PagedFlux<>(
() -> listEventRoutesFirstPage(options, context),
nextLink -> listEventRoutesNextPage(nextLink, options, context));
}

Mono<PagedResponse<EventRoute>> listEventRoutesFirstPage(ListEventRoutesOptions options, Context context) {
Mono<PagedResponse<DigitalTwinsEventRoute>> listEventRoutesFirstPage(ListDigitalTwinsEventRoutesOptions options, Context context) {
return protocolLayer
.getEventRoutes()
.listSinglePageAsync(OptionsConverter.toProtocolLayerOptions(options), context)
.map(pagedEventRouteMappingFunction);
}

Mono<PagedResponse<EventRoute>> listEventRoutesNextPage(String nextLink, ListEventRoutesOptions options, Context context) {
Mono<PagedResponse<DigitalTwinsEventRoute>> listEventRoutesNextPage(String nextLink, ListDigitalTwinsEventRoutesOptions options, Context context) {
return protocolLayer
.getEventRoutes()
.listNextSinglePageAsync(nextLink, OptionsConverter.toProtocolLayerOptions(options), context)
.map(pagedEventRouteMappingFunction);
}

private Function<PagedResponse<com.azure.digitaltwins.core.implementation.models.EventRoute>, PagedResponse<EventRoute>> pagedEventRouteMappingFunction = (pagedEventRouteResponse) -> {
List<EventRoute> convertedList = pagedEventRouteResponse.getValue().stream()
private Function<PagedResponse<com.azure.digitaltwins.core.implementation.models.EventRoute>, PagedResponse<DigitalTwinsEventRoute>> pagedEventRouteMappingFunction = (pagedEventRouteResponse) -> {
List<DigitalTwinsEventRoute> convertedList = pagedEventRouteResponse.getValue().stream()
.map(EventRouteConverter::map)
.filter(Objects::nonNull)
.collect(Collectors.toList());
Expand Down Expand Up @@ -1451,7 +1451,7 @@ Mono<PagedResponse<EventRoute>> listEventRoutesNextPage(String nextLink, ListEve
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.publishTelemetry#String-String-Object#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param messageId A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. Defaults to a random UUID if argument is null.
Expand All @@ -1477,7 +1477,7 @@ public Mono<Void> publishTelemetry(String digitalTwinId, String messageId, Objec
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.publishTelemetryWithResponse#String-String-Object-Options#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param messageId A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. Defaults to a random UUID if argument is null.
Expand Down Expand Up @@ -1528,7 +1528,7 @@ Mono<Response<Void>> publishTelemetryWithResponse(String digitalTwinId, String m
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.publishComponentTelemetry#String-String-String-Object#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param componentName The name of the DTDL component.
Expand All @@ -1555,7 +1555,7 @@ public Mono<Void> publishComponentTelemetry(String digitalTwinId, String compone
*
* {@codesnippet com.azure.digitaltwins.core.asyncClient.publishComponentTelemetryWithResponse#String-String-String-Object-Options#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param componentName The name of the DTDL component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public <T> PagedIterable<T> query(String query, Class<T> clazz, QueryOptions opt
* @param eventRoute The event route to create.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void createOrReplaceEventRoute(String eventRouteId, EventRoute eventRoute) {
public void createOrReplaceEventRoute(String eventRouteId, DigitalTwinsEventRoute eventRoute) {
createOrReplaceEventRouteWithResponse(eventRouteId, eventRoute, null, Context.NONE);
}

Expand All @@ -833,8 +833,8 @@ public void createOrReplaceEventRoute(String eventRouteId, EventRoute eventRoute
* @return A {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> createOrReplaceEventRouteWithResponse(String eventRouteId, EventRoute eventRoute, CreateEventRouteOptions options, Context context) {
return this.digitalTwinsAsyncClient.createEventRouteWithResponse(eventRouteId, eventRoute, options, context).block();
public Response<Void> createOrReplaceEventRouteWithResponse(String eventRouteId, DigitalTwinsEventRoute eventRoute, CreateEventRouteOptions options, Context context) {
return this.digitalTwinsAsyncClient.createOrReplaceEventRouteWithResponse(eventRouteId, eventRoute, options, context).block();
}

/**
Expand All @@ -848,7 +848,7 @@ public Response<Void> createOrReplaceEventRouteWithResponse(String eventRouteId,
* @return The retrieved event route.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public EventRoute getEventRoute(String eventRouteId) {
public DigitalTwinsEventRoute getEventRoute(String eventRouteId) {
return getEventRouteWithResponse(eventRouteId, null, Context.NONE).getValue();
}

Expand All @@ -865,7 +865,7 @@ public EventRoute getEventRoute(String eventRouteId) {
* @return A {@link Response} containing the retrieved event route.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<EventRoute> getEventRouteWithResponse(String eventRouteId, GetEventRouteOptions options, Context context) {
public Response<DigitalTwinsEventRoute> getEventRouteWithResponse(String eventRouteId, GetDigitalTwinsEventRouteOptions options, Context context) {
return this.digitalTwinsAsyncClient.getEventRouteWithResponse(eventRouteId, options, context).block();
}

Expand Down Expand Up @@ -913,7 +913,7 @@ public Response<Void> deleteEventRouteWithResponse(String eventRouteId, DeleteEv
* This PagedIterable may take multiple service requests to iterate over all event routes.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<EventRoute> listEventRoutes() {
public PagedIterable<DigitalTwinsEventRoute> listEventRoutes() {
return listEventRoutes(null, Context.NONE);
}

Expand All @@ -930,7 +930,7 @@ public PagedIterable<EventRoute> listEventRoutes() {
* This PagedIterable may take multiple service requests to iterate over all event routes.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<EventRoute> listEventRoutes(ListEventRoutesOptions options, Context context) {
public PagedIterable<DigitalTwinsEventRoute> listEventRoutes(ListDigitalTwinsEventRoutesOptions options, Context context) {
return new PagedIterable<>(this.digitalTwinsAsyncClient.listEventRoutes(options, context));
}

Expand All @@ -951,7 +951,7 @@ public PagedIterable<EventRoute> listEventRoutes(ListEventRoutesOptions options,
*
* {@codesnippet com.azure.digitaltwins.core.syncClient.publishTelemetry#String-String-Object#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param messageId A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. Defaults to a random UUID if argument is null.
Expand All @@ -975,7 +975,7 @@ public void publishTelemetry(String digitalTwinId, String messageId, Object payl
*
* {@codesnippet com.azure.digitaltwins.core.syncClient.publishTelemetryWithResponse#String-String-Object-Options-Context#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param messageId A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. Defaults to a random UUID if argument is null.
Expand All @@ -1002,7 +1002,7 @@ public Response<Void> publishTelemetryWithResponse(String digitalTwinId, String
*
* {@codesnippet com.azure.digitaltwins.core.syncClient.publishComponentTelemetry#String-String-String-Object#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param componentName The name of the DTDL component.
Expand All @@ -1027,7 +1027,7 @@ public void publishComponentTelemetry(String digitalTwinId, String componentName
*
* {@codesnippet com.azure.digitaltwins.core.syncClient.publishComponentTelemetryWithResponse#String-String-String-Object-Options-Context#String}
*
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link EventRoute}
* The result is then consumed by one or many destination endpoints (subscribers) defined under {@link DigitalTwinsEventRoute}
* These event routes need to be set before publishing a telemetry message, in order for the telemetry message to be consumed.
* @param digitalTwinId The Id of the digital twin.
* @param componentName The name of the DTDL component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@

package com.azure.digitaltwins.core.implementation.converters;

import com.azure.digitaltwins.core.models.EventRoute;
import com.azure.digitaltwins.core.models.DigitalTwinsEventRoute;

/**
* A converter between {@link com.azure.digitaltwins.core.implementation.models.EventRoute} and
* {@link com.azure.digitaltwins.core.models.EventRoute}.
* {@link DigitalTwinsEventRoute}.
*/
public final class EventRouteConverter {

/**
* Maps from {@link com.azure.digitaltwins.core.implementation.models.EventRoute} to
* {@link com.azure.digitaltwins.core.models.EventRoute}. If the input is null, then the output will be null as well.
* {@link DigitalTwinsEventRoute}. If the input is null, then the output will be null as well.
*/
public static com.azure.digitaltwins.core.models.EventRoute map(com.azure.digitaltwins.core.implementation.models.EventRoute input) {
public static DigitalTwinsEventRoute map(com.azure.digitaltwins.core.implementation.models.EventRoute input) {
if (input == null) {
return null;
}

EventRoute mappedEventRoute = new EventRoute(input.getEndpointName());
DigitalTwinsEventRoute mappedEventRoute = new DigitalTwinsEventRoute(input.getEndpointName());
mappedEventRoute.setFilter(input.getFilter());
mappedEventRoute.setEventRouteId(input.getId());
return mappedEventRoute;
}

/**
* Maps from {@link com.azure.digitaltwins.core.models.EventRoute} to
* Maps from {@link DigitalTwinsEventRoute} to
* {@link com.azure.digitaltwins.core.implementation.models.EventRoute}. If the input is null, then the output will be null as well.
*/
public static com.azure.digitaltwins.core.implementation.models.EventRoute map(com.azure.digitaltwins.core.models.EventRoute input) {
public static com.azure.digitaltwins.core.implementation.models.EventRoute map(DigitalTwinsEventRoute input) {
if (input == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static EventRoutesAddOptions toProtocolLayerOptions(CreateEventRouteOptio
return new EventRoutesAddOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static EventRoutesListOptions toProtocolLayerOptions(ListEventRoutesOptions options) {
public static EventRoutesListOptions toProtocolLayerOptions(ListDigitalTwinsEventRoutesOptions options) {
if (options == null) {
return null;
}
Expand All @@ -95,7 +95,7 @@ public static EventRoutesListOptions toProtocolLayerOptions(ListEventRoutesOptio
.setMaxItemsPerPage(options.getMaxItemsPerPage());
}

public static EventRoutesGetByIdOptions toProtocolLayerOptions(GetEventRouteOptions options) {
public static EventRoutesGetByIdOptions toProtocolLayerOptions(GetDigitalTwinsEventRouteOptions options) {
if (options == null) {
return null;
}
Expand Down
Loading

0 comments on commit 1e1b2d9

Please sign in to comment.