Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

feat: re-implement resource name helper classes #59

Merged
merged 7 commits into from Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions google-cloud-bigquerydatatransfer/clirr-ignored-differences.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<!--TODO: To be removed-->
<difference>
<differenceType>7005</differenceType>
<className>com/google/cloud/bigquery/datatransfer/v1/DataTransferServiceClient</className>
<method>* *(com.google.cloud.bigquery.datatransfer.v1.ParentName*)</method>
<to>* *(com.google.cloud.bigquery.datatransfer.v1.ProjectName*)</to>
</difference>
</differences>

Large diffs are not rendered by default.

Expand Up @@ -119,6 +119,12 @@ public UnaryCallSettings<GetTransferConfigRequest, TransferConfig> getTransferCo
return ((DataTransferServiceStubSettings) getStubSettings()).scheduleTransferRunsSettings();
}

/** Returns the object with the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return ((DataTransferServiceStubSettings) getStubSettings()).startManualTransferRunsSettings();
}

/** Returns the object with the settings used for calls to getTransferRun. */
public UnaryCallSettings<GetTransferRunRequest, TransferRun> getTransferRunSettings() {
return ((DataTransferServiceStubSettings) getStubSettings()).getTransferRunSettings();
Expand Down Expand Up @@ -149,12 +155,6 @@ public UnaryCallSettings<DeleteTransferRunRequest, Empty> deleteTransferRunSetti
return ((DataTransferServiceStubSettings) getStubSettings()).checkValidCredsSettings();
}

/** Returns the object with the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return ((DataTransferServiceStubSettings) getStubSettings()).startManualTransferRunsSettings();
}

public static final DataTransferServiceSettings create(DataTransferServiceStubSettings stub)
throws IOException {
return new DataTransferServiceSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -303,6 +303,13 @@ public UnaryCallSettings.Builder<GetDataSourceRequest, DataSource> getDataSource
return getStubSettingsBuilder().scheduleTransferRunsSettings();
}

/** Returns the builder for the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings.Builder<
StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return getStubSettingsBuilder().startManualTransferRunsSettings();
}

/** Returns the builder for the settings used for calls to getTransferRun. */
public UnaryCallSettings.Builder<GetTransferRunRequest, TransferRun> getTransferRunSettings() {
return getStubSettingsBuilder().getTransferRunSettings();
Expand Down Expand Up @@ -333,13 +340,6 @@ public UnaryCallSettings.Builder<DeleteTransferRunRequest, Empty> deleteTransfer
return getStubSettingsBuilder().checkValidCredsSettings();
}

/** Returns the builder for the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings.Builder<
StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return getStubSettingsBuilder().startManualTransferRunsSettings();
}

@Override
public DataTransferServiceSettings build() throws IOException {
return new DataTransferServiceSettings(this);
Expand Down
Expand Up @@ -30,7 +30,7 @@
* <pre>
* <code>
* try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
* DataSourceName name = ProjectDataSourceName.of("[PROJECT]", "[DATA_SOURCE]");
* DataSourceName name = DataSourceName.ofProjectDataSourceName("[PROJECT]", "[DATA_SOURCE]");
* DataSource response = dataTransferServiceClient.getDataSource(name);
* }
* </code>
Expand Down
Expand Up @@ -104,6 +104,11 @@ public UnaryCallable<GetTransferConfigRequest, TransferConfig> getTransferConfig
throw new UnsupportedOperationException("Not implemented: scheduleTransferRunsCallable()");
}

public UnaryCallable<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsCallable() {
throw new UnsupportedOperationException("Not implemented: startManualTransferRunsCallable()");
}

public UnaryCallable<GetTransferRunRequest, TransferRun> getTransferRunCallable() {
throw new UnsupportedOperationException("Not implemented: getTransferRunCallable()");
}
Expand Down Expand Up @@ -136,11 +141,6 @@ public UnaryCallable<CheckValidCredsRequest, CheckValidCredsResponse> checkValid
throw new UnsupportedOperationException("Not implemented: checkValidCredsCallable()");
}

public UnaryCallable<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsCallable() {
throw new UnsupportedOperationException("Not implemented: startManualTransferRunsCallable()");
}

@Override
public abstract void close();
}
Expand Up @@ -132,6 +132,8 @@ public class DataTransferServiceStubSettings extends StubSettings<DataTransferSe
listTransferConfigsSettings;
private final UnaryCallSettings<ScheduleTransferRunsRequest, ScheduleTransferRunsResponse>
scheduleTransferRunsSettings;
private final UnaryCallSettings<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings;
private final UnaryCallSettings<GetTransferRunRequest, TransferRun> getTransferRunSettings;
private final UnaryCallSettings<DeleteTransferRunRequest, Empty> deleteTransferRunSettings;
private final PagedCallSettings<
Expand All @@ -142,8 +144,6 @@ public class DataTransferServiceStubSettings extends StubSettings<DataTransferSe
listTransferLogsSettings;
private final UnaryCallSettings<CheckValidCredsRequest, CheckValidCredsResponse>
checkValidCredsSettings;
private final UnaryCallSettings<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings;

/** Returns the object with the settings used for calls to getDataSource. */
public UnaryCallSettings<GetDataSourceRequest, DataSource> getDataSourceSettings() {
Expand Down Expand Up @@ -192,6 +192,12 @@ public UnaryCallSettings<GetTransferConfigRequest, TransferConfig> getTransferCo
return scheduleTransferRunsSettings;
}

/** Returns the object with the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return startManualTransferRunsSettings;
}

/** Returns the object with the settings used for calls to getTransferRun. */
public UnaryCallSettings<GetTransferRunRequest, TransferRun> getTransferRunSettings() {
return getTransferRunSettings;
Expand Down Expand Up @@ -222,12 +228,6 @@ public UnaryCallSettings<DeleteTransferRunRequest, Empty> deleteTransferRunSetti
return checkValidCredsSettings;
}

/** Returns the object with the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings<StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return startManualTransferRunsSettings;
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public DataTransferServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
Expand Down Expand Up @@ -305,12 +305,12 @@ protected DataTransferServiceStubSettings(Builder settingsBuilder) throws IOExce
getTransferConfigSettings = settingsBuilder.getTransferConfigSettings().build();
listTransferConfigsSettings = settingsBuilder.listTransferConfigsSettings().build();
scheduleTransferRunsSettings = settingsBuilder.scheduleTransferRunsSettings().build();
startManualTransferRunsSettings = settingsBuilder.startManualTransferRunsSettings().build();
getTransferRunSettings = settingsBuilder.getTransferRunSettings().build();
deleteTransferRunSettings = settingsBuilder.deleteTransferRunSettings().build();
listTransferRunsSettings = settingsBuilder.listTransferRunsSettings().build();
listTransferLogsSettings = settingsBuilder.listTransferLogsSettings().build();
checkValidCredsSettings = settingsBuilder.checkValidCredsSettings().build();
startManualTransferRunsSettings = settingsBuilder.startManualTransferRunsSettings().build();
}

private static final PagedListDescriptor<
Expand Down Expand Up @@ -573,6 +573,9 @@ public static class Builder
private final UnaryCallSettings.Builder<
ScheduleTransferRunsRequest, ScheduleTransferRunsResponse>
scheduleTransferRunsSettings;
private final UnaryCallSettings.Builder<
StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings;
private final UnaryCallSettings.Builder<GetTransferRunRequest, TransferRun>
getTransferRunSettings;
private final UnaryCallSettings.Builder<DeleteTransferRunRequest, Empty>
Expand All @@ -585,9 +588,6 @@ public static class Builder
listTransferLogsSettings;
private final UnaryCallSettings.Builder<CheckValidCredsRequest, CheckValidCredsResponse>
checkValidCredsSettings;
private final UnaryCallSettings.Builder<
StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings;

private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;
Expand Down Expand Up @@ -647,6 +647,8 @@ protected Builder(ClientContext clientContext) {

scheduleTransferRunsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

startManualTransferRunsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

getTransferRunSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

deleteTransferRunSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand All @@ -657,8 +659,6 @@ protected Builder(ClientContext clientContext) {

checkValidCredsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

startManualTransferRunsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
getDataSourceSettings,
Expand All @@ -669,12 +669,12 @@ protected Builder(ClientContext clientContext) {
getTransferConfigSettings,
listTransferConfigsSettings,
scheduleTransferRunsSettings,
startManualTransferRunsSettings,
getTransferRunSettings,
deleteTransferRunSettings,
listTransferRunsSettings,
listTransferLogsSettings,
checkValidCredsSettings,
startManualTransferRunsSettings);
checkValidCredsSettings);

initDefaults(this);
}
Expand Down Expand Up @@ -712,7 +712,7 @@ private static Builder initDefaults(Builder builder) {

builder
.deleteTransferConfigSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
stephaniewang526 marked this conversation as resolved.
Show resolved Hide resolved
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
Expand All @@ -730,14 +730,19 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
.startManualTransferRunsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
.getTransferRunSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
.deleteTransferRunSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
Expand All @@ -752,11 +757,6 @@ private static Builder initDefaults(Builder builder) {

builder
.checkValidCredsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

builder
.startManualTransferRunsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));

Expand All @@ -774,12 +774,12 @@ protected Builder(DataTransferServiceStubSettings settings) {
getTransferConfigSettings = settings.getTransferConfigSettings.toBuilder();
listTransferConfigsSettings = settings.listTransferConfigsSettings.toBuilder();
scheduleTransferRunsSettings = settings.scheduleTransferRunsSettings.toBuilder();
startManualTransferRunsSettings = settings.startManualTransferRunsSettings.toBuilder();
getTransferRunSettings = settings.getTransferRunSettings.toBuilder();
deleteTransferRunSettings = settings.deleteTransferRunSettings.toBuilder();
listTransferRunsSettings = settings.listTransferRunsSettings.toBuilder();
listTransferLogsSettings = settings.listTransferLogsSettings.toBuilder();
checkValidCredsSettings = settings.checkValidCredsSettings.toBuilder();
startManualTransferRunsSettings = settings.startManualTransferRunsSettings.toBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
Expand All @@ -791,12 +791,12 @@ protected Builder(DataTransferServiceStubSettings settings) {
getTransferConfigSettings,
listTransferConfigsSettings,
scheduleTransferRunsSettings,
startManualTransferRunsSettings,
getTransferRunSettings,
deleteTransferRunSettings,
listTransferRunsSettings,
listTransferLogsSettings,
checkValidCredsSettings,
startManualTransferRunsSettings);
checkValidCredsSettings);
}

// NEXT_MAJOR_VER: remove 'throws Exception'
Expand Down Expand Up @@ -866,6 +866,13 @@ public UnaryCallSettings.Builder<GetDataSourceRequest, DataSource> getDataSource
return scheduleTransferRunsSettings;
}

/** Returns the builder for the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings.Builder<
StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return startManualTransferRunsSettings;
}

/** Returns the builder for the settings used for calls to getTransferRun. */
public UnaryCallSettings.Builder<GetTransferRunRequest, TransferRun> getTransferRunSettings() {
return getTransferRunSettings;
Expand Down Expand Up @@ -896,13 +903,6 @@ public UnaryCallSettings.Builder<DeleteTransferRunRequest, Empty> deleteTransfer
return checkValidCredsSettings;
}

/** Returns the builder for the settings used for calls to startManualTransferRuns. */
public UnaryCallSettings.Builder<
StartManualTransferRunsRequest, StartManualTransferRunsResponse>
startManualTransferRunsSettings() {
return startManualTransferRunsSettings;
}

@Override
public DataTransferServiceStubSettings build() throws IOException {
return new DataTransferServiceStubSettings(this);
Expand Down