Skip to content

Commit

Permalink
DMR: Prepare to release preview SDK (#20258)
Browse files Browse the repository at this point in the history
  • Loading branch information
azabbasi authored Mar 30, 2021
1 parent 7725644 commit 59d2b25
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 1.0.0-beta.1 (Unreleased)
## 1.0.0-beta.1 (2021-03-30)

### New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public final class ModelsRepositoryAsyncClient {
private final ModelsRepositoryServiceVersion serviceVersion;
private final RepositoryHandler repositoryHandler;
private final ModelDependencyResolution defaultDependencyResolutionOption;
private final URI repositoryUri;
private final URI repositoryEndpoint;

ModelsRepositoryAsyncClient(
URI repositoryUri,
URI repositoryEndpoint,
HttpPipeline pipeline,
ModelsRepositoryServiceVersion serviceVersion,
ModelDependencyResolution dependencyResolutionOption) {
Expand All @@ -44,24 +44,24 @@ public final class ModelsRepositoryAsyncClient {
this.serviceVersion = serviceVersion;

this.defaultDependencyResolutionOption = dependencyResolutionOption;
this.repositoryUri = repositoryUri;
this.repositoryEndpoint = repositoryEndpoint;

ModelsRepositoryAPIImpl protocolLayer = new ModelsRepositoryAPIImplBuilder()
.apiVersion(this.serviceVersion.toString())
.host(repositoryUri.toString())
.host(repositoryEndpoint.toString())
.pipeline(pipeline)
.serializerAdapter(jacksonAdapter)
.buildClient();

this.repositoryHandler = new RepositoryHandler(repositoryUri, protocolLayer);
this.repositoryHandler = new RepositoryHandler(repositoryEndpoint, protocolLayer);
}

/**
* Gets the repository uri that the client has been initialized with.
* @return The target repository uri.
* Gets the repository endpoint that the client has been initialized with.
* @return The target repository endpoint.
*/
public String getRepositoryUri() {
return this.repositoryUri.toString();
public String getRepositoryEndpoint() {
return this.repositoryEndpoint.toString();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public final class ModelsRepositoryClient {
}

/**
* Gets the repository uri that the client has been initialized with.
* @return The target repository uri.
* Gets the repository endpoint that the client has been initialized with.
* @return The target repository endpoint.
*/
public String getRepositoryUri() {
return this.modelsRepositoryAsyncClient.getRepositoryUri();
public String getRepositoryEndpoint() {
return this.modelsRepositoryAsyncClient.getRepositoryEndpoint();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* The service API versions of Azure Models Repository that are supported by this client.
*/
public enum ModelsRepositoryServiceVersion implements ServiceVersion {
V2021_03_18("2021_03_18");
V2021_02_11("2021_02_11");

private final String version;

Expand All @@ -31,6 +31,6 @@ public String getVersion() {
* @return The latest service API version of Azure Models Repository that is supported by this client.
*/
public static ModelsRepositoryServiceVersion getLatest() {
return V2021_03_18;
return V2021_02_11;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.azure.core.util.Configuration;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.core.util.serializer.SerializerAdapter;
import com.azure.iot.modelsrepository.ModelsRepositoryServiceVersion;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -191,7 +192,7 @@ public ModelsRepositoryAPIImplBuilder addPolicy(HttpPipelinePolicy customPolicy)
*/
public ModelsRepositoryAPIImpl buildClient() {
if (apiVersion == null) {
this.apiVersion = "2021-03-18";
this.apiVersion = ModelsRepositoryServiceVersion.getLatest().toString();
}
if (host == null) {
this.host = ModelsRepositoryConstants.DEFAULT_MODELS_REPOSITORY_ENDPOINT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ The samples project demonstrates the following:
```java
// When no URI is provided for instantiation, the Azure IoT Models Repository global endpoint
// https://devicemodels.azure.com/ is used and the model dependency resolution
// configuration is set to TryFromExpanded.
// configuration is set to TRY_FROM_EXPANDED.
ModelsRepositoryAsyncClient asyncClient = new ModelsRepositoryClientBuilder()
.buildAsyncClient();

ModelsRepositoryClient syncClient = new ModelsRepositoryClientBuilder()
.buildClient();

System.out.println("Initialized the async client pointing to the global endpoint" + asyncClient.getRepositoryUri());
System.out.println("Initialized the sync client pointing to the global endpoint" + syncClient.getRepositoryUri());
System.out.println("Initialized the async client pointing to the global endpoint" + asyncClient.getRepositoryEndpoint());
System.out.println("Initialized the sync client pointing to the global endpoint" + syncClient.getRepositoryEndpoint());
```

```java
Expand All @@ -40,8 +40,8 @@ ModelsRepositoryClient syncClient = new ModelsRepositoryClientBuilder()
.repositoryEndpoint("https://contoso.com/models")
.buildClient();

System.out.println("Initialized the async client pointing to the custom endpoint" + asyncClient.getRepositoryUri());
System.out.println("Initialized the sync client pointing to the custom endpoint" + syncClient.getRepositoryUri());
System.out.println("Initialized the async client pointing to the custom endpoint" + asyncClient.getRepositoryEndpoint);
System.out.println("Initialized the sync client pointing to the custom endpoint" + syncClient.getRepositoryEndpoint);
```

```java
Expand All @@ -57,8 +57,8 @@ ModelsRepositoryClient syncClient = new ModelsRepositoryClientBuilder()
.modelDependencyResolution(ModelDependencyResolution.DISABLED)
.buildClient();

System.out.println("Initialized the async client pointing to the local file-system: " + asyncClient.getRepositoryUri());
System.out.println("Initialized the sync client pointing to the local file-system: " + syncClient.getRepositoryUri());
System.out.println("Initialized the async client pointing to the local file-system: " + asyncClient.getRepositoryEndpoint);
System.out.println("Initialized the sync client pointing to the local file-system: " + syncClient.getRepositoryEndpoint);
```

## Sync vs Async clients
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public static void clientInitializationSamples() {
ModelsRepositoryClient syncClient = new ModelsRepositoryClientBuilder()
.buildClient();

System.out.println("Initialized the async client pointing to the global endpoint" + asyncClient.getRepositoryUri());
System.out.println("Initialized the sync client pointing to the global endpoint" + syncClient.getRepositoryUri());
System.out.println("Initialized the async client pointing to the global endpoint" + asyncClient.getRepositoryEndpoint());
System.out.println("Initialized the sync client pointing to the global endpoint" + syncClient.getRepositoryEndpoint());

// This form shows specifying a custom URI for the models repository with default client options.
// The default client options will enable model dependency resolution.
Expand All @@ -41,8 +41,8 @@ public static void clientInitializationSamples() {
.repositoryEndpoint("https://contoso.com/models")
.buildClient();

System.out.println("Initialized the async client pointing to the custom endpoint" + asyncClient.getRepositoryUri().toString());
System.out.println("Initialized the sync client pointing to the custom endpoint" + syncClient.getRepositoryUri().toString());
System.out.println("Initialized the async client pointing to the custom endpoint" + asyncClient.getRepositoryEndpoint().toString());
System.out.println("Initialized the sync client pointing to the custom endpoint" + syncClient.getRepositoryEndpoint().toString());

// The client will also work with a local file-system URI. This example shows initialization
// with a local URI and disabling model dependency resolution.
Expand All @@ -56,8 +56,8 @@ public static void clientInitializationSamples() {
.modelDependencyResolution(ModelDependencyResolution.DISABLED)
.buildClient();

System.out.println("Initialized the async client pointing to the local file-system: " + asyncClient.getRepositoryUri());
System.out.println("Initialized the sync client pointing to the local file-system: " + syncClient.getRepositoryUri());
System.out.println("Initialized the async client pointing to the local file-system: " + asyncClient.getRepositoryEndpoint());
System.out.println("Initialized the sync client pointing to the local file-system: " + syncClient.getRepositoryEndpoint());
}

/**
Expand Down

0 comments on commit 59d2b25

Please sign in to comment.