Skip to content

Commit d503e34

Browse files
authored
chore: Add BetaApi Annotation to public classes and methods (#2067)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-storage/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> ☕️ If you write sample code, please follow the [samples format]( https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
1 parent 437385d commit d503e34

File tree

10 files changed

+102
-0
lines changed

10 files changed

+102
-0
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/DownloadJob.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.google.api.core.ApiFuture;
2222
import com.google.api.core.ApiFutures;
23+
import com.google.api.core.BetaApi;
2324
import com.google.api.gax.rpc.ApiExceptions;
2425
import com.google.common.base.MoreObjects;
2526
import com.google.common.collect.ImmutableList;
@@ -28,6 +29,7 @@
2829
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
2930
import org.checkerframework.checker.nullness.qual.NonNull;
3031

32+
@BetaApi
3133
public final class DownloadJob {
3234

3335
@NonNull private final List<ApiFuture<DownloadResult>> downloadResults;
@@ -41,10 +43,12 @@ private DownloadJob(
4143
this.parallelDownloadConfig = parallelDownloadConfig;
4244
}
4345

46+
@BetaApi
4447
public @NonNull List<DownloadResult> getDownloadResults() {
4548
return ApiExceptions.callAndTranslateApiException(ApiFutures.allAsList(downloadResults));
4649
}
4750

51+
@BetaApi
4852
public @NonNull ParallelDownloadConfig getParallelDownloadConfig() {
4953
return parallelDownloadConfig;
5054
}
@@ -75,10 +79,12 @@ public String toString() {
7579
.toString();
7680
}
7781

82+
@BetaApi
7883
public static Builder newBuilder() {
7984
return new Builder();
8085
}
8186

87+
@BetaApi
8288
public static final class Builder {
8389

8490
private @NonNull List<ApiFuture<DownloadResult>> downloadResults;
@@ -88,17 +94,20 @@ private Builder() {
8894
this.downloadResults = ImmutableList.of();
8995
}
9096

97+
@BetaApi
9198
public Builder setDownloadResults(@NonNull List<ApiFuture<DownloadResult>> downloadResults) {
9299
this.downloadResults = ImmutableList.copyOf(downloadResults);
93100
return this;
94101
}
95102

103+
@BetaApi
96104
public Builder setParallelDownloadConfig(
97105
@NonNull ParallelDownloadConfig parallelDownloadConfig) {
98106
this.parallelDownloadConfig = parallelDownloadConfig;
99107
return this;
100108
}
101109

110+
@BetaApi
102111
public DownloadJob build() {
103112
checkNotNull(downloadResults);
104113
checkNotNull(parallelDownloadConfig);

google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/DownloadResult.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static com.google.common.base.Preconditions.checkNotNull;
2020
import static com.google.common.base.Preconditions.checkState;
2121

22+
import com.google.api.core.BetaApi;
2223
import com.google.cloud.storage.BlobInfo;
2324
import com.google.common.base.MoreObjects;
2425
import java.nio.file.Path;
@@ -27,6 +28,7 @@
2728
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
2829
import org.checkerframework.checker.nullness.qual.NonNull;
2930

31+
@BetaApi
3032
public final class DownloadResult {
3133
static final Comparator<DownloadResult> COMPARATOR =
3234
Comparator.comparingInt(dr -> dr.getStatus().ordinal());
@@ -47,10 +49,12 @@ private DownloadResult(
4749
this.exception = exception;
4850
}
4951

52+
@BetaApi
5053
public @NonNull BlobInfo getInput() {
5154
return input;
5255
}
5356

57+
@BetaApi
5458
public @NonNull Path getOutputDestination() {
5559
checkState(
5660
status == TransferStatus.SUCCESS,
@@ -59,10 +63,12 @@ private DownloadResult(
5963
return outputDestination;
6064
}
6165

66+
@BetaApi
6267
public @NonNull TransferStatus getStatus() {
6368
return status;
6469
}
6570

71+
@BetaApi
6672
public @NonNull Exception getException() {
6773
checkState(
6874
status == TransferStatus.FAILED_TO_FINISH || status == TransferStatus.FAILED_TO_START,
@@ -101,10 +107,12 @@ public String toString() {
101107
.toString();
102108
}
103109

110+
@BetaApi
104111
public static Builder newBuilder(@NonNull BlobInfo blobInfo, @NonNull TransferStatus status) {
105112
return new Builder(blobInfo, status);
106113
}
107114

115+
@BetaApi
108116
public static final class Builder {
109117

110118
private @NonNull BlobInfo input;
@@ -117,26 +125,31 @@ private Builder(@NonNull BlobInfo input, @NonNull TransferStatus status) {
117125
this.status = status;
118126
}
119127

128+
@BetaApi
120129
public Builder setInput(@NonNull BlobInfo input) {
121130
this.input = input;
122131
return this;
123132
}
124133

134+
@BetaApi
125135
public Builder setOutputDestination(@NonNull Path outputDestination) {
126136
this.outputDestination = outputDestination;
127137
return this;
128138
}
129139

140+
@BetaApi
130141
public Builder setStatus(@NonNull TransferStatus status) {
131142
this.status = status;
132143
return this;
133144
}
134145

146+
@BetaApi
135147
public Builder setException(@NonNull Exception exception) {
136148
this.exception = exception;
137149
return this;
138150
}
139151

152+
@BetaApi
140153
public DownloadResult build() {
141154
checkNotNull(input);
142155
checkNotNull(status);

google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/ParallelDownloadConfig.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

21+
import com.google.api.core.BetaApi;
2122
import com.google.cloud.storage.Storage.BlobSourceOption;
2223
import com.google.common.base.MoreObjects;
2324
import com.google.common.collect.ImmutableList;
@@ -27,6 +28,7 @@
2728
import java.util.Objects;
2829
import org.checkerframework.checker.nullness.qual.NonNull;
2930

31+
@BetaApi
3032
public final class ParallelDownloadConfig {
3133

3234
@NonNull private final String stripPrefix;
@@ -48,21 +50,25 @@ private ParallelDownloadConfig(
4850
/**
4951
* A common prefix that is removed from downloaded object's name before written to the filesystem
5052
*/
53+
@BetaApi
5154
public @NonNull String getStripPrefix() {
5255
return stripPrefix;
5356
}
5457

5558
/** The base directory in which all objects will be placed when downloaded. */
59+
@BetaApi
5660
public @NonNull Path getDownloadDirectory() {
5761
return downloadDirectory;
5862
}
5963

6064
/** The bucket objects are being downloaded from */
65+
@BetaApi
6166
public @NonNull String getBucketName() {
6267
return bucketName;
6368
}
6469

6570
/** A list of common BlobSourceOptions that are used for each download request */
71+
@BetaApi
6672
public @NonNull List<BlobSourceOption> getOptionsPerRequest() {
6773
return optionsPerRequest;
6874
}
@@ -97,10 +103,12 @@ public String toString() {
97103
.toString();
98104
}
99105

106+
@BetaApi
100107
public static Builder newBuilder() {
101108
return new Builder();
102109
}
103110

111+
@BetaApi
104112
public static final class Builder {
105113

106114
@NonNull private String stripPrefix;
@@ -115,26 +123,31 @@ private Builder() {
115123
this.optionsPerRequest = ImmutableList.of();
116124
}
117125

126+
@BetaApi
118127
public Builder setStripPrefix(String stripPrefix) {
119128
this.stripPrefix = stripPrefix;
120129
return this;
121130
}
122131

132+
@BetaApi
123133
public Builder setDownloadDirectory(Path downloadDirectory) {
124134
this.downloadDirectory = downloadDirectory;
125135
return this;
126136
}
127137

138+
@BetaApi
128139
public Builder setBucketName(String bucketName) {
129140
this.bucketName = bucketName;
130141
return this;
131142
}
132143

144+
@BetaApi
133145
public Builder setOptionsPerRequest(List<BlobSourceOption> optionsPerRequest) {
134146
this.optionsPerRequest = ImmutableList.copyOf(optionsPerRequest);
135147
return this;
136148
}
137149

150+
@BetaApi
138151
public ParallelDownloadConfig build() {
139152
checkNotNull(bucketName);
140153
checkNotNull(stripPrefix);

google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/ParallelUploadConfig.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

21+
import com.google.api.core.BetaApi;
2122
import com.google.cloud.storage.Storage.BlobTargetOption;
2223
import com.google.cloud.storage.Storage.BlobWriteOption;
2324
import com.google.common.base.MoreObjects;
@@ -26,6 +27,7 @@
2627
import java.util.Objects;
2728
import org.checkerframework.checker.nullness.qual.NonNull;
2829

30+
@BetaApi
2931
public final class ParallelUploadConfig {
3032

3133
private final boolean skipIfExists;
@@ -49,26 +51,31 @@ private ParallelUploadConfig(
4951
}
5052

5153
/** If a corresponding object already exists skip uploading the object */
54+
@BetaApi
5255
public boolean isSkipIfExists() {
5356
return skipIfExists;
5457
}
5558

5659
/** A common prefix that will be applied to all object paths in the destination bucket */
60+
@BetaApi
5761
public @NonNull String getPrefix() {
5862
return prefix;
5963
}
6064

6165
/** The bucket objects are being uploaded from */
66+
@BetaApi
6267
public @NonNull String getBucketName() {
6368
return bucketName;
6469
}
6570

6671
/** A list of common BlobTargetOptions that are used for each upload request */
72+
@BetaApi
6773
public @NonNull List<BlobTargetOption> getTargetOptsPerRequest() {
6874
return targetOptsPerRequest;
6975
}
7076

7177
/** A list of common BlobWriteOptions that are used for each upload request */
78+
@BetaApi
7279
public @NonNull List<BlobWriteOption> getWriteOptsPerRequest() {
7380
return writeOptsPerRequest;
7481
}
@@ -103,10 +110,12 @@ public String toString() {
103110
.toString();
104111
}
105112

113+
@BetaApi
106114
public static Builder newBuilder() {
107115
return new Builder();
108116
}
109117

118+
@BetaApi
110119
public static final class Builder {
111120

112121
private boolean skipIfExists;
@@ -123,31 +132,37 @@ private Builder() {
123132
this.writeOptsPerRequest = ImmutableList.of();
124133
}
125134

135+
@BetaApi
126136
public Builder setSkipIfExists(boolean skipIfExists) {
127137
this.skipIfExists = skipIfExists;
128138
return this;
129139
}
130140

141+
@BetaApi
131142
public Builder setPrefix(@NonNull String prefix) {
132143
this.prefix = prefix;
133144
return this;
134145
}
135146

147+
@BetaApi
136148
public Builder setBucketName(@NonNull String bucketName) {
137149
this.bucketName = bucketName;
138150
return this;
139151
}
140152

153+
@BetaApi
141154
public Builder setOptionsPerRequest(@NonNull List<BlobTargetOption> optionsPerRequest) {
142155
this.optionsPerRequest = ImmutableList.copyOf(optionsPerRequest);
143156
return this;
144157
}
145158

159+
@BetaApi
146160
public Builder setWriteOptsPerRequest(@NonNull List<BlobWriteOption> writeOptsPerRequest) {
147161
this.writeOptsPerRequest = writeOptsPerRequest;
148162
return this;
149163
}
150164

165+
@BetaApi
151166
public ParallelUploadConfig build() {
152167
checkNotNull(prefix);
153168
checkNotNull(bucketName);

google-cloud-storage/src/main/java/com/google/cloud/storage/transfermanager/TransferManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@
1616

1717
package com.google.cloud.storage.transfermanager;
1818

19+
import com.google.api.core.BetaApi;
1920
import com.google.cloud.storage.BlobInfo;
2021
import java.io.IOException;
2122
import java.nio.file.Path;
2223
import java.util.List;
2324
import org.checkerframework.checker.nullness.qual.NonNull;
2425

26+
@BetaApi
2527
public interface TransferManager extends AutoCloseable {
2628

29+
@BetaApi
2730
@NonNull
2831
UploadJob uploadFiles(List<Path> files, ParallelUploadConfig opts) throws IOException;
2932

33+
@BetaApi
3034
@NonNull
3135
DownloadJob downloadBlobs(List<BlobInfo> blobs, ParallelDownloadConfig opts);
3236
}

0 commit comments

Comments
 (0)