public static SphereClientConfigBuilder ofKeyIdSecret(final String projectKey, final String clientId, final String clientSecret) { final SphereClientConfigBuilder builder = new SphereClientConfigBuilder(); builder.clientId = clientId; builder.clientSecret = clientSecret; builder.projectKey = projectKey; builder.correlationIdGenerator = CorrelationIdGenerator.of(projectKey); return builder; }
static SphereApiConfig of(final String projectKey, final String apiUrl) { return new SphereApiConfigImpl(projectKey, apiUrl, CorrelationIdGenerator.of(projectKey)); } }
public static SphereClientConfig of(final String projectKey, final String clientId, final String clientSecret, final String authUrl, final String apiUrl) { return new SphereClientConfig(projectKey, clientId, clientSecret, authUrl, apiUrl, ClientPackage.DEFAULT_SCOPES, CorrelationIdGenerator.of(projectKey)); }
/** * Raw client creation. * See also SphereClientFactory. * * @param config platform project and location * @param httpClient client to execute requests * @param tokenSupplier delivery of access tokens * @return sphere client */ static SphereClient of(final SphereApiConfig config, final HttpClient httpClient, final SphereAccessTokenSupplier tokenSupplier) { return SphereClientImpl.of(config, httpClient, tokenSupplier, CorrelationIdGenerator.of(config.getProjectKey())); }
/** * Raw client creation. * See also SphereClientFactory. * * @param config platform project and location * @param httpClient client to execute requests * @param tokenSupplier delivery of access tokens * @return sphere client */ static SphereClient of(final SphereApiConfig config, final HttpClient httpClient, final SphereAccessTokenSupplier tokenSupplier) { return SphereClientImpl.of(config, httpClient, tokenSupplier, CorrelationIdGenerator.of(config.getProjectKey())); }
public static SphereClient of(final SphereApiConfig config, final HttpClient httpClient, final SphereAccessTokenSupplier tokenSupplier) { return new SphereClientImpl(config, tokenSupplier, httpClient, CorrelationIdGenerator.of(config.getProjectKey())); }
public static SphereClient of(final SphereApiConfig config, final HttpClient httpClient, final SphereAccessTokenSupplier tokenSupplier) { return new SphereClientImpl(config, tokenSupplier, httpClient, CorrelationIdGenerator.of(config.getProjectKey())); }
@Test public void createCorrelationId() { final String projectKey = "my-project"; final CorrelationIdGenerator correlationIdGenerator = CorrelationIdGenerator.of(projectKey); final String correlationId = correlationIdGenerator.get(); final List<String> correlationIdParts = Arrays.asList(correlationId.split("/")); assertThat(correlationIdParts).hasSize(2); assertThat(correlationIdParts.get(0)).isEqualTo(projectKey); final UUID uuid = UUID.fromString(correlationIdParts.get(1)); assertThat(uuid).isNotNull(); } }