Skip to content

Commit

Permalink
Update digital twins code as per Azure SDK board feedback (Azure#16646)
Browse files Browse the repository at this point in the history
-Rename Tracestate and Traceparent to TraceState and TraceParent
-Rename UpdateModelOptions to DecomissionModelOptions
-Rename some setters and getters to be more descriptive
  • Loading branch information
timtay-microsoft authored Oct 22, 2020
1 parent 5788f10 commit 281d7e5
Show file tree
Hide file tree
Showing 50 changed files with 244 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,8 @@ Mono<PagedResponse<DigitalTwinsModelData>> listModelsNextSinglePageAsync(String
if (options != null) {
protocolLayerOptions = new com.azure.digitaltwins.core.implementation.models.DigitalTwinModelsListOptions()
.setMaxItemsPerPage(options.getMaxItemsPerPage())
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate());
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState());
}

return protocolLayer.getDigitalTwinModels().listNextSinglePageAsync(
Expand Down Expand Up @@ -998,11 +998,11 @@ public Mono<Void> decommissionModel(String modelId) {
* @return A {@link Response} with no parsed payload object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> decommissionModelWithResponse(String modelId, UpdateModelOptions options) {
public Mono<Response<Void>> decommissionModelWithResponse(String modelId, DecommissionModelOptions options) {
return withContext(context -> decommissionModelWithResponse(modelId, options, context));
}

Mono<Response<Void>> decommissionModelWithResponse(String modelId, UpdateModelOptions options, Context context) {
Mono<Response<Void>> decommissionModelWithResponse(String modelId, DecommissionModelOptions options, Context context) {
List<Object> updateOperation = new UpdateOperationUtility()
.appendReplaceOperation("/decommissioned", true)
.getUpdateOperations();
Expand Down Expand Up @@ -1494,8 +1494,8 @@ Mono<Response<Void>> publishTelemetryWithResponse(String digitalTwinId, String m
}
else {
protocolLayerOptions = new com.azure.digitaltwins.core.implementation.models.DigitalTwinsSendTelemetryOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate());
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState());
}

return protocolLayer.getDigitalTwins().sendTelemetryWithResponseAsync(
Expand Down Expand Up @@ -1573,8 +1573,8 @@ Mono<Response<Void>> publishComponentTelemetryWithResponse(String digitalTwinId,
}
else {
protocolLayerOptions = new com.azure.digitaltwins.core.implementation.models.DigitalTwinsSendComponentTelemetryOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate());
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState());
}

return protocolLayer.getDigitalTwins().sendComponentTelemetryWithResponseAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ public void decommissionModel(String modelId) {
* @return A {@link Response} with no parsed payload object.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> decommissionModelWithResponse(String modelId, UpdateModelOptions options, Context context) {
public Response<Void> decommissionModelWithResponse(String modelId, DecommissionModelOptions options, Context context) {
return digitalTwinsAsyncClient.decommissionModelWithResponse(modelId, options, context).block();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public static DigitalTwinsModelData map(com.azure.digitaltwins.core.implementati
}

return new DigitalTwinsModelData()
.setId(input.getId())
.setModelId(input.getId())
.setUploadTime(input.getUploadTime())
.setDisplayName(input.getDisplayName())
.setDescription(input.getDescription())
.setDisplayNameLanguageMap(input.getDisplayName())
.setDescriptionLanguageMap(input.getDescription())
.setDecommissioned(input.isDecommissioned())
.setModel(modelStringValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static com.azure.digitaltwins.core.models.EventRoute map(com.azure.digita

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ public static DigitalTwinsAddOptions toProtocolLayerOptions(CreateDigitalTwinOpt
return null;
}

return new DigitalTwinsAddOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsAddOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsAddRelationshipOptions toProtocolLayerOptions(CreateRelationshipOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinsAddRelationshipOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsAddRelationshipOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinModelsAddOptions toProtocolLayerOptions(CreateModelsOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinModelsAddOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinModelsAddOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinModelsUpdateOptions toProtocolLayerOptions(UpdateModelOptions options) {
public static DigitalTwinModelsUpdateOptions toProtocolLayerOptions(DecommissionModelOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinModelsUpdateOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinModelsUpdateOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinModelsListOptions toProtocolLayerOptions(ListModelsOptions options) {
Expand All @@ -49,8 +49,8 @@ public static DigitalTwinModelsListOptions toProtocolLayerOptions(ListModelsOpti
}

return new DigitalTwinModelsListOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setMaxItemsPerPage(options.getMaxItemsPerPage());
}

Expand All @@ -59,23 +59,23 @@ public static DigitalTwinModelsGetByIdOptions toProtocolLayerOptions(GetModelOpt
return null;
}

return new DigitalTwinModelsGetByIdOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinModelsGetByIdOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinModelsDeleteOptions toProtocolLayerOptions(DeleteModelOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinModelsDeleteOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinModelsDeleteOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static EventRoutesAddOptions toProtocolLayerOptions(CreateEventRouteOptions options) {
if (options == null) {
return null;
}

return new EventRoutesAddOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new EventRoutesAddOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static EventRoutesListOptions toProtocolLayerOptions(ListEventRoutesOptions options) {
Expand All @@ -84,8 +84,8 @@ public static EventRoutesListOptions toProtocolLayerOptions(ListEventRoutesOptio
}

return new EventRoutesListOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setMaxItemsPerPage(options.getMaxItemsPerPage());
}

Expand All @@ -94,23 +94,23 @@ public static EventRoutesGetByIdOptions toProtocolLayerOptions(GetEventRouteOpti
return null;
}

return new EventRoutesGetByIdOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new EventRoutesGetByIdOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static EventRoutesDeleteOptions toProtocolLayerOptions(DeleteEventRouteOptions options) {
if (options == null) {
return null;
}

return new EventRoutesDeleteOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new EventRoutesDeleteOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsGetByIdOptions toProtocolLayerOptions(GetDigitalTwinOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinsGetByIdOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsGetByIdOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsDeleteOptions toProtocolLayerOptions(DeleteDigitalTwinOptions options) {
Expand All @@ -119,8 +119,8 @@ public static DigitalTwinsDeleteOptions toProtocolLayerOptions(DeleteDigitalTwin
}

return new DigitalTwinsDeleteOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setIfMatch(options.getIfMatch());
}

Expand All @@ -130,8 +130,8 @@ public static DigitalTwinsUpdateOptions toProtocolLayerOptions(UpdateDigitalTwin
}

return new DigitalTwinsUpdateOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setIfMatch(options.getIfMatch());
}

Expand All @@ -140,7 +140,7 @@ public static DigitalTwinsGetRelationshipByIdOptions toProtocolLayerOptions(GetR
return null;
}

return new DigitalTwinsGetRelationshipByIdOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsGetRelationshipByIdOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsUpdateRelationshipOptions toProtocolLayerOptions(UpdateRelationshipOptions options) {
Expand All @@ -149,8 +149,8 @@ public static DigitalTwinsUpdateRelationshipOptions toProtocolLayerOptions(Updat
}

return new DigitalTwinsUpdateRelationshipOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setIfMatch(options.getIfMatch());
}

Expand All @@ -160,8 +160,8 @@ public static DigitalTwinsDeleteRelationshipOptions toProtocolLayerOptions(Delet
}

return new DigitalTwinsDeleteRelationshipOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setIfMatch(options.getIfMatch());
}

Expand All @@ -170,23 +170,23 @@ public static DigitalTwinsListRelationshipsOptions toProtocolLayerOptions(ListRe
return null;
}

return new DigitalTwinsListRelationshipsOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsListRelationshipsOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsListIncomingRelationshipsOptions toProtocolLayerOptions(ListIncomingRelationshipsOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinsListIncomingRelationshipsOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsListIncomingRelationshipsOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsGetComponentOptions toProtocolLayerOptions(GetComponentOptions options) {
if (options == null) {
return null;
}

return new DigitalTwinsGetComponentOptions().setTraceparent(options.getTraceparent()).setTracestate(options.getTracestate());
return new DigitalTwinsGetComponentOptions().setTraceparent(options.getTraceParent()).setTracestate(options.getTraceState());
}

public static DigitalTwinsUpdateComponentOptions toProtocolLayerOptions(UpdateComponentOptions options) {
Expand All @@ -195,8 +195,8 @@ public static DigitalTwinsUpdateComponentOptions toProtocolLayerOptions(UpdateCo
}

return new DigitalTwinsUpdateComponentOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setIfMatch(options.getIfMatch());
}

Expand All @@ -206,8 +206,8 @@ public static QueryTwinsOptions toProtocolLayerOptions(QueryOptions options) {
}

return new QueryTwinsOptions()
.setTraceparent(options.getTraceparent())
.setTracestate(options.getTracestate())
.setTraceparent(options.getTraceParent())
.setTracestate(options.getTraceState())
.setMaxItemsPerPage(options.getMaxItemsPerPage());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public String getId() {
* Gets a string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.
* @return A string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.
*/
public String getTwinETag() {
public String getDigitalTwinEtag() {
return twinETag;
}

Expand All @@ -64,7 +64,7 @@ public String getTwinETag() {
* @param twinETag A string representing a weak ETag for the entity that this request performs an operation against, as per RFC7232.
* @return The BasicDigitalTwin object itself.
*/
public BasicDigitalTwin setTwinETag(String twinETag) {
public BasicDigitalTwin setDigitalTwinEtag(String twinETag) {
this.twinETag = twinETag;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,31 @@ private BasicRelationship() {
* Gets the unique Id of the relationship. This field is present on every relationship.
* @return The unique Id of the relationship. This field is present on every relationship.
*/
public String getId() {
public String getRelationshipId() {
return id;
}

/**
* Gets the unique Id of the source digital twin. This field is present on every relationship.
* @return The unique Id of the source digital twin. This field is present on every relationship.
*/
public String getSourceId() {
public String getSourceDigitalTwinId() {
return sourceId;
}

/**
* Gets the unique Id of the target digital twin. This field is present on every relationship.
* @return The unique Id of the target digital twin. This field is present on every relationship.
*/
public String getTargetId() {
public String getTargetDigitalTwinId() {
return targetId;
}

/**
* Gets the name of the relationship, which defines the type of link (e.g. Contains). This field is present on every relationship.
* @return The name of the relationship, which defines the type of link (e.g. Contains). This field is present on every relationship.
*/
public String getName() {
public String getRelationshipName() {
return name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class CreateDigitalTwinOptions {
*
* @return the traceparent value.
*/
public String getTraceparent() {
public String getTraceParent() {
return this.traceparent;
}

Expand All @@ -54,7 +54,7 @@ public CreateDigitalTwinOptions setTraceparent(String traceparent) {
*
* @return the tracestate value.
*/
public String getTracestate() {
public String getTraceState() {
return this.tracestate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class CreateEventRouteOptions {
*
* @return the traceparent value.
*/
public String getTraceparent() {
public String getTraceParent() {
return this.traceparent;
}

Expand All @@ -54,7 +54,7 @@ public CreateEventRouteOptions setTraceparent(String traceparent) {
*
* @return the tracestate value.
*/
public String getTracestate() {
public String getTraceState() {
return this.tracestate;
}

Expand Down
Loading

0 comments on commit 281d7e5

Please sign in to comment.