Skip to content

Commit

Permalink
Integrate Sync Stack in Key Vault Administration package via AutoRest…
Browse files Browse the repository at this point in the history
… Generation (#31830)

* update

* update

* update

* update

* update

* update

Co-authored-by: Vinay Gera <[email protected]>
  • Loading branch information
g2vinay and Vinay Gera authored Nov 9, 2022
1 parent 3ef6d6e commit 5f0f783
Show file tree
Hide file tree
Showing 52 changed files with 3,824 additions and 743 deletions.
2 changes: 2 additions & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ unreleased_com.azure:azure-identity;1.7.0-beta.2
unreleased_com.azure:azure-identity-providers-core;1.0.0-beta.2
unreleased_com.azure:azure-identity-providers-jdbc-mysql;1.0.0-beta.2
unreleased_com.azure:azure-identity-providers-jdbc-postgresql;1.0.0-beta.2
unreleased_com.azure:azure-core;1.35.0-beta.1


# Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current
# version and set the version to the released beta. Released beta dependencies are only valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public U getFinalResult() {
.apply(currentTerminalPollContext);
} else {
PollingContext<T> context = this.pollingContext.copy();
PollingUtil.pollingLoop(pollingContext, null, null, pollOperation, pollInterval);
PollingUtil.pollingLoop(context, null, null, pollOperation, pollInterval);
this.terminalPollContext = context;
return getFinalResult();
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.azure.core.util.HttpClientOptions;
import com.azure.core.util.builder.ClientBuilderUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.ServiceVersion;
import com.azure.security.keyvault.administration.implementation.KeyVaultCredentialPolicy;
import com.azure.security.keyvault.administration.implementation.KeyVaultErrorCodeStrings;

Expand Down Expand Up @@ -123,7 +124,13 @@ public KeyVaultAccessControlClientBuilder() {
* and {@link #retryPolicy(RetryPolicy)} have been set.
*/
public KeyVaultAccessControlClient buildClient() {
return new KeyVaultAccessControlClient(buildAsyncClient());
Configuration buildConfiguration = validateEndpointAndGetConfiguration();
serviceVersion = getServiceVersion();
if (pipeline != null) {
return new KeyVaultAccessControlClient(vaultUrl, pipeline, serviceVersion);
}
HttpPipeline buildPipeline = getPipeline(buildConfiguration, serviceVersion);
return new KeyVaultAccessControlClient(vaultUrl, buildPipeline, serviceVersion);
}

/**
Expand All @@ -141,6 +148,17 @@ public KeyVaultAccessControlClient buildClient() {
* and {@link #retryPolicy(RetryPolicy)} have been set.
*/
public KeyVaultAccessControlAsyncClient buildAsyncClient() {
Configuration buildConfiguration = validateEndpointAndGetConfiguration();
serviceVersion = getServiceVersion();
if (pipeline != null) {
return new KeyVaultAccessControlAsyncClient(vaultUrl, pipeline, serviceVersion);
}
HttpPipeline buildPipeline = getPipeline(buildConfiguration, serviceVersion);
return new KeyVaultAccessControlAsyncClient(vaultUrl, buildPipeline, serviceVersion);
}


private Configuration validateEndpointAndGetConfiguration() {
Configuration buildConfiguration = (configuration == null)
? Configuration.getGlobalConfiguration().clone()
: configuration;
Expand All @@ -152,13 +170,15 @@ public KeyVaultAccessControlAsyncClient buildAsyncClient() {
new IllegalStateException(
KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)));
}
return buildConfiguration;
}

serviceVersion = serviceVersion != null ? serviceVersion : KeyVaultAdministrationServiceVersion.getLatest();
private KeyVaultAdministrationServiceVersion getServiceVersion() {
return serviceVersion != null ? serviceVersion : KeyVaultAdministrationServiceVersion.getLatest();
}

if (pipeline != null) {
return new KeyVaultAccessControlAsyncClient(vaultUrl, pipeline, serviceVersion);
}

private HttpPipeline getPipeline(Configuration buildConfiguration, ServiceVersion serviceVersion) {
// Closest to API goes first, closest to wire goes last.
final List<HttpPipelinePolicy> policies = new ArrayList<>();

Expand Down Expand Up @@ -192,12 +212,10 @@ public KeyVaultAccessControlAsyncClient buildAsyncClient() {
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));

HttpPipeline buildPipeline = new HttpPipelineBuilder()
return new HttpPipelineBuilder()
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.httpClient(httpClient)
.build();

return new KeyVaultAccessControlAsyncClient(vaultUrl, buildPipeline, serviceVersion);
}

/**
Expand Down
Loading

0 comments on commit 5f0f783

Please sign in to comment.