File tree

58 files changed

+61869
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searcx below for content that may be hidden.

58 files changed

+61869
-1
lines changed
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.storage.v2;
18+
19+
import com.google.api.core.ApiFunction;
20+
import com.google.api.core.BetaApi;
21+
import com.google.api.gax.core.GoogleCredentialsProvider;
22+
import com.google.api.gax.core.InstantiatingExecutorProvider;
23+
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
24+
import com.google.api.gax.rpc.ApiClientHeaderProvider;
25+
import com.google.api.gax.rpc.ClientContext;
26+
import com.google.api.gax.rpc.ClientSettings;
27+
import com.google.api.gax.rpc.ServerCallSettings;
28+
import com.google.api.gax.rpc.CallSettings;
29+
import com.google.api.gax.rpc.TransportChannelProvider;
30+
import com.google.api.gax.rpc.UnaryCallSettings;
31+
import com.google.storage.v2.stub.StorageStubSettings;
32+
import java.io.IOException;
33+
import java.util.List;
34+
import javax.annotation.Generated;
35+
36+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
37+
/**
38+
* Settings class to configure an instance of {@link StorageClient}.
39+
*
40+
* <p>The default instance has everything set to sensible defaults:
41+
*
42+
* <ul>
43+
* <li>The default service address (storage.googleapis.com) and default port (443) are used.
44+
* <li>Credentials are acquired automatically through Application Default Credentials.
45+
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
46+
* </ul>
47+
*
48+
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
49+
* build() is called, the tree of builders is called to create the complete settings object.
50+
*
51+
* <p>For example, to set the total timeout of startResumableWrite to 30 seconds:
52+
*
53+
* <pre>{@code
54+
* StorageSettings.Builder storageSettingsBuilder = StorageSettings.newBuilder();
55+
* storageSettingsBuilder
56+
* .startResumableWriteSettings()
57+
* .setRetrySettings(
58+
* storageSettingsBuilder
59+
* .startResumableWriteSettings()
60+
* .getRetrySettings()
61+
* .toBuilder()
62+
* .setTotalTimeout(Duration.ofSeconds(30))
63+
* .build());
64+
* StorageSettings storageSettings = storageSettingsBuilder.build();
65+
* }</pre>
66+
*/
67+
@Generated("by gapic-generator-java")
68+
public class StorageSettings extends ClientSettings<StorageSettings> {
69+
70+
/** Returns the object with the settings used for calls to readObject. */
71+
public ServerCallSettings<ReadObjectRequest, ReadObjectResponse> readObjectSettings() {
72+
return ((StorageStubSettings) getStubSettings()).readObjectSettings();
73+
}
74+
75+
/** Returns the object with the settings used for calls to writeObject. */
76+
public CallSettings<WriteObjectRequest, WriteObjectResponse> writeObjectSettings() {
77+
return ((StorageStubSettings) getStubSettings()).writeObjectSettings();
78+
}
79+
80+
/** Returns the object with the settings used for calls to startResumableWrite. */
81+
public UnaryCallSettings<StartResumableWriteRequest, StartResumableWriteResponse>
82+
startResumableWriteSettings() {
83+
return ((StorageStubSettings) getStubSettings()).startResumableWriteSettings();
84+
}
85+
86+
/** Returns the object with the settings used for calls to queryWriteStatus. */
87+
public UnaryCallSettings<QueryWriteStatusRequest, QueryWriteStatusResponse>
88+
queryWriteStatusSettings() {
89+
return ((StorageStubSettings) getStubSettings()).queryWriteStatusSettings();
90+
}
91+
92+
public static final StorageSettings create(StorageStubSettings stub) throws IOException {
93+
return new StorageSettings.Builder(stub.toBuilder()).build();
94+
}
95+
96+
/** Returns a builder for the default ExecutorProvider for this service. */
97+
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
98+
return StorageStubSettings.defaultExecutorProviderBuilder();
99+
}
100+
101+
/** Returns the default service endpoint. */
102+
public static String getDefaultEndpoint() {
103+
return StorageStubSettings.getDefaultEndpoint();
104+
}
105+
106+
/** Returns the default service scopes. */
107+
public static List<String> getDefaultServiceScopes() {
108+
return StorageStubSettings.getDefaultServiceScopes();
109+
}
110+
111+
/** Returns a builder for the default credentials for this service. */
112+
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
113+
return StorageStubSettings.defaultCredentialsProviderBuilder();
114+
}
115+
116+
/** Returns a builder for the default ChannelProvider for this service. */
117+
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
118+
return StorageStubSettings.defaultGrpcTransportProviderBuilder();
119+
}
120+
121+
public static TransportChannelProvider defaultTransportChannelProvider() {
122+
return StorageStubSettings.defaultTransportChannelProvider();
123+
}
124+
125+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
126+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
127+
return StorageStubSettings.defaultApiClientHeaderProviderBuilder();
128+
}
129+
130+
/** Returns a new builder for this class. */
131+
public static Builder newBuilder() {
132+
return Builder.createDefault();
133+
}
134+
135+
/** Returns a new builder for this class. */
136+
public static Builder newBuilder(ClientContext clientContext) {
137+
return new Builder(clientContext);
138+
}
139+
140+
/** Returns a builder containing all the values of this settings class. */
141+
public Builder toBuilder() {
142+
return new Builder(this);
143+
}
144+
145+
protected StorageSettings(Builder settingsBuilder) throws IOException {
146+
super(settingsBuilder);
147+
}
148+
149+
/** Builder for StorageSettings. */
150+
public static class Builder extends ClientSettings.Builder<StorageSettings, Builder> {
151+
152+
protected Builder() throws IOException {
153+
this(((ClientContext) null));
154+
}
155+
156+
protected Builder(ClientContext clientContext) {
157+
super(StorageStubSettings.newBuilder(clientContext));
158+
}
159+
160+
protected Builder(StorageSettings settings) {
161+
super(settings.getStubSettings().toBuilder());
162+
}
163+
164+
protected Builder(StorageStubSettings.Builder stubSettings) {
165+
super(stubSettings);
166+
}
167+
168+
private static Builder createDefault() {
169+
return new Builder(StorageStubSettings.newBuilder());
170+
}
171+
172+
public StorageStubSettings.Builder getStubSettingsBuilder() {
173+
return ((StorageStubSettings.Builder) getStubSettings());
174+
}
175+
176+
/**
177+
* Applies the given settings updater function to all of the unary API methods in this service.
178+
*
179+
* <p>Note: This method does not support applying settings to methods.
180+
*/
181+
public Builder applyToAllUnaryMethods(
182+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
183+
super.applyToAllUnaryMethods(
184+
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
185+
return this;
186+
}
187+
188+
/** Returns the builder for the settings used for calls to readObject. */
189+
public ServerCallSettings.Builder<ReadObjectRequest, ReadObjectResponse>
190+
readObjectSettings() {
191+
return getStubSettingsBuilder().readObjectSettings();
192+
}
193+
194+
/** Returns the builder for the settings used for calls to writeObject. */
195+
public CallSettings.Builder<WriteObjectRequest, WriteObjectResponse>
196+
writeObjectSettings() {
197+
return getStubSettingsBuilder().writeObjectSettings();
198+
}
199+
200+
/** Returns the builder for the settings used for calls to startResumableWrite. */
201+
public UnaryCallSettings.Builder<StartResumableWriteRequest, StartResumableWriteResponse>
202+
startResumableWriteSettings() {
203+
return getStubSettingsBuilder().startResumableWriteSettings();
204+
}
205+
206+
/** Returns the builder for the settings used for calls to queryWriteStatus. */
207+
public UnaryCallSettings.Builder<QueryWriteStatusRequest, QueryWriteStatusResponse>
208+
queryWriteStatusSettings() {
209+
return getStubSettingsBuilder().queryWriteStatusSettings();
210+
}
211+
212+
@Override
213+
public StorageSettings build() throws IOException {
214+
return new StorageSettings(this);
215+
}
216+
}
217+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* The interfaces provided are listed below, along with usage samples.
19+
*
20+
* <p>======================= StorageClient =======================
21+
*
22+
* <p>Service Description: Manages Google Cloud Storage resources.
23+
*
24+
* <p>Sample for StorageClient:
25+
*
26+
* <pre>{@code
27+
* try (StorageClient storageClient = StorageClient.create()) {
28+
* StartResumableWriteRequest request =
29+
* StartResumableWriteRequest.newBuilder()
30+
* .setWriteObjectSpec(WriteObjectSpec.newBuilder().build())
31+
* .setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build())
32+
* .setCommonRequestParams(CommonRequestParams.newBuilder().build())
33+
* .build();
34+
* StartResumableWriteResponse response = storageClient.startResumableWrite(request);
35+
* }
36+
* }</pre>
37+
*/
38+
@Generated("by gapic-generator-java")
39+
package com.google.storage.v2;
40+
41+
import javax.annotation.Generated;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.storage.v2.stub;
18+
19+
import com.google.api.gax.grpc.GrpcCallSettings;
20+
import com.google.api.gax.grpc.GrpcCallableFactory;
21+
import com.google.api.gax.grpc.GrpcStubCallableFactory;
22+
import com.google.api.gax.rpc.BatchingCallSettings;
23+
import com.google.api.gax.rpc.BidiCallable;
24+
import com.google.api.gax.rpc.ClientContext;
25+
import com.google.api.gax.rpc.ClientCallable;
26+
import com.google.api.gax.rpc.OperationCallSettings;
27+
import com.google.api.gax.rpc.OperationCallable;
28+
import com.google.api.gax.rpc.PagedCallSettings;
29+
import com.google.api.gax.rpc.ServerCallSettings;
30+
import com.google.api.gax.rpc.ServerCallable;
31+
import com.google.api.gax.rpc.CallSettings;
32+
import com.google.api.gax.rpc.UnaryCallSettings;
33+
import com.google.api.gax.rpc.UnaryCallable;
34+
import com.google.longrunning.Operation;
35+
import com.google.longrunning.stub.OperationsStub;
36+
import javax.annotation.Generated;
37+
38+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
39+
/**
40+
* gRPC callable factory implementation for the Storage service API.
41+
*
42+
* <p>This class is for advanced usage.
43+
*/
44+
@Generated("by gapic-generator-java")
45+
public class GrpcStorageCallableFactory implements GrpcStubCallableFactory {
46+
47+
@Override
48+
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
49+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
50+
UnaryCallSettings<RequestT, ResponseT> callSettings,
51+
ClientContext clientContext) {
52+
return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext);
53+
}
54+
55+
@Override
56+
public <RequestT, ResponseT, PagedListResponseT>
57+
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
58+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
59+
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
60+
ClientContext clientContext) {
61+
return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
62+
}
63+
64+
@Override
65+
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
66+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
67+
BatchingCallSettings<RequestT, ResponseT> callSettings,
68+
ClientContext clientContext) {
69+
return GrpcCallableFactory.createBatchingCallable(
70+
grpcCallSettings, callSettings, clientContext);
71+
}
72+
73+
@Override
74+
public <RequestT, ResponseT, MetadataT>
75+
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
76+
GrpcCallSettings<RequestT, Operation> grpcCallSettings,
77+
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
78+
ClientContext clientContext,
79+
OperationsStub operationsStub) {
80+
return GrpcCallableFactory.createOperationCallable(
81+
grpcCallSettings, callSettings, clientContext, operationsStub);
82+
}
83+
84+
@Override
85+
public <RequestT, ResponseT>
86+
BidiCallable<RequestT, ResponseT> createBidiCallable(
87+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
88+
CallSettings<RequestT, ResponseT> callSettings,
89+
ClientContext clientContext) {
90+
return GrpcCallableFactory.createBidiCallable(
91+
grpcCallSettings, callSettings, clientContext);
92+
}
93+
94+
@Override
95+
public <RequestT, ResponseT>
96+
ServerCallable<RequestT, ResponseT> createServerCallable(
97+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
98+
ServerCallSettings<RequestT, ResponseT> callSettings,
99+
ClientContext clientContext) {
100+
return GrpcCallableFactory.createServerCallable(
101+
grpcCallSettings, callSettings, clientContext);
102+
}
103+
104+
@Override
105+
public <RequestT, ResponseT>
106+
ClientCallable<RequestT, ResponseT> createClientCallable(
107+
GrpcCallSettings<RequestT, ResponseT> grpcCallSettings,
108+
CallSettings<RequestT, ResponseT> callSettings,
109+
ClientContext clientContext) {
110+
return GrpcCallableFactory.createClientCallable(
111+
grpcCallSettings, callSettings, clientContext);
112+
}
113+
}

0 commit comments

Comments
 (0)