20
20
import com .google .api .core .ApiFutures ;
21
21
import com .google .api .core .BetaApi ;
22
22
import com .google .api .gax .core .BackgroundResource ;
23
+ import com .google .api .gax .httpjson .longrunning .OperationsClient ;
23
24
import com .google .api .gax .longrunning .OperationFuture ;
24
25
import com .google .api .gax .paging .AbstractFixedSizeCollection ;
25
26
import com .google .api .gax .paging .AbstractPage ;
36
37
import com .google .iam .v1 .TestIamPermissionsRequest ;
37
38
import com .google .iam .v1 .TestIamPermissionsResponse ;
38
39
import com .google .longrunning .Operation ;
39
- import com .google .longrunning .OperationsClient ;
40
40
import com .google .protobuf .Empty ;
41
41
import com .google .protobuf .FieldMask ;
42
42
import java .io .IOException ;
125
125
* ArtifactRegistryClient.create(artifactRegistrySettings);
126
126
* }</pre>
127
127
*
128
+ * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
129
+ * the wire:
130
+ *
131
+ * <pre>{@code
132
+ * // This snippet has been automatically generated for illustrative purposes only.
133
+ * // It may require modifications to work in your environment.
134
+ * ArtifactRegistrySettings artifactRegistrySettings =
135
+ * ArtifactRegistrySettings.newBuilder()
136
+ * .setTransportChannelProvider(
137
+ * ArtifactRegistrySettings.defaultHttpJsonTransportProviderBuilder().build())
138
+ * .build();
139
+ * ArtifactRegistryClient artifactRegistryClient =
140
+ * ArtifactRegistryClient.create(artifactRegistrySettings);
141
+ * }</pre>
142
+ *
128
143
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
129
144
*/
130
145
@ Generated ("by gapic-generator-java" )
131
146
public class ArtifactRegistryClient implements BackgroundResource {
132
147
private final ArtifactRegistrySettings settings ;
133
148
private final ArtifactRegistryStub stub ;
134
- private final OperationsClient operationsClient ;
149
+ private final OperationsClient httpJsonOperationsClient ;
150
+ private final com .google .longrunning .OperationsClient operationsClient ;
135
151
136
152
/** Constructs an instance of ArtifactRegistryClient with default settings. */
137
153
public static final ArtifactRegistryClient create () throws IOException {
@@ -151,7 +167,6 @@ public static final ArtifactRegistryClient create(ArtifactRegistrySettings setti
151
167
* Constructs an instance of ArtifactRegistryClient, using the given stub for making calls. This
152
168
* is for advanced usage - prefer using create(ArtifactRegistrySettings).
153
169
*/
154
- @ BetaApi ("A restructuring of stub classes is planned, so this may break in the future" )
155
170
public static final ArtifactRegistryClient create (ArtifactRegistryStub stub ) {
156
171
return new ArtifactRegistryClient (stub );
157
172
}
@@ -164,21 +179,23 @@ public static final ArtifactRegistryClient create(ArtifactRegistryStub stub) {
164
179
protected ArtifactRegistryClient (ArtifactRegistrySettings settings ) throws IOException {
165
180
this .settings = settings ;
166
181
this .stub = ((ArtifactRegistryStubSettings ) settings .getStubSettings ()).createStub ();
167
- this .operationsClient = OperationsClient .create (this .stub .getOperationsStub ());
182
+ this .operationsClient =
183
+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
184
+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
168
185
}
169
186
170
- @ BetaApi ("A restructuring of stub classes is planned, so this may break in the future" )
171
187
protected ArtifactRegistryClient (ArtifactRegistryStub stub ) {
172
188
this .settings = null ;
173
189
this .stub = stub ;
174
- this .operationsClient = OperationsClient .create (this .stub .getOperationsStub ());
190
+ this .operationsClient =
191
+ com .google .longrunning .OperationsClient .create (this .stub .getOperationsStub ());
192
+ this .httpJsonOperationsClient = OperationsClient .create (this .stub .getHttpJsonOperationsStub ());
175
193
}
176
194
177
195
public final ArtifactRegistrySettings getSettings () {
178
196
return settings ;
179
197
}
180
198
181
- @ BetaApi ("A restructuring of stub classes is planned, so this may break in the future" )
182
199
public ArtifactRegistryStub getStub () {
183
200
return stub ;
184
201
}
@@ -187,10 +204,19 @@ public ArtifactRegistryStub getStub() {
187
204
* Returns the OperationsClient that can be used to query the status of a long-running operation
188
205
* returned by another API method call.
189
206
*/
190
- public final OperationsClient getOperationsClient () {
207
+ public final com . google . longrunning . OperationsClient getOperationsClient () {
191
208
return operationsClient ;
192
209
}
193
210
211
+ /**
212
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
213
+ * returned by another API method call.
214
+ */
215
+ @ BetaApi
216
+ public final OperationsClient getHttpJsonOperationsClient () {
217
+ return httpJsonOperationsClient ;
218
+ }
219
+
194
220
// AUTO-GENERATED DOCUMENTATION AND METHOD.
195
221
/**
196
222
* Lists docker images.
@@ -295,7 +321,7 @@ public final ListDockerImagesPagedResponse listDockerImages(ListDockerImagesRequ
295
321
* while (true) {
296
322
* ListDockerImagesResponse response =
297
323
* artifactRegistryClient.listDockerImagesCallable().call(request);
298
- * for (DockerImage element : response.getResponsesList ()) {
324
+ * for (DockerImage element : response.getDockerImagesList ()) {
299
325
* // doThingsWith(element);
300
326
* }
301
327
* String nextPageToken = response.getNextPageToken();
@@ -707,7 +733,7 @@ public final ListRepositoriesPagedResponse listRepositories(ListRepositoriesRequ
707
733
* while (true) {
708
734
* ListRepositoriesResponse response =
709
735
* artifactRegistryClient.listRepositoriesCallable().call(request);
710
- * for (Repository element : response.getResponsesList ()) {
736
+ * for (Repository element : response.getRepositoriesList ()) {
711
737
* // doThingsWith(element);
712
738
* }
713
739
* String nextPageToken = response.getNextPageToken();
@@ -1297,7 +1323,7 @@ public final ListPackagesPagedResponse listPackages(ListPackagesRequest request)
1297
1323
* .build();
1298
1324
* while (true) {
1299
1325
* ListPackagesResponse response = artifactRegistryClient.listPackagesCallable().call(request);
1300
- * for (Package element : response.getResponsesList ()) {
1326
+ * for (Package element : response.getPackagesList ()) {
1301
1327
* // doThingsWith(element);
1302
1328
* }
1303
1329
* String nextPageToken = response.getNextPageToken();
@@ -1586,7 +1612,7 @@ public final ListVersionsPagedResponse listVersions(ListVersionsRequest request)
1586
1612
* .build();
1587
1613
* while (true) {
1588
1614
* ListVersionsResponse response = artifactRegistryClient.listVersionsCallable().call(request);
1589
- * for (Version element : response.getResponsesList ()) {
1615
+ * for (Version element : response.getVersionsList ()) {
1590
1616
* // doThingsWith(element);
1591
1617
* }
1592
1618
* String nextPageToken = response.getNextPageToken();
@@ -1882,7 +1908,7 @@ public final UnaryCallable<ListFilesRequest, ListFilesPagedResponse> listFilesPa
1882
1908
* .build();
1883
1909
* while (true) {
1884
1910
* ListFilesResponse response = artifactRegistryClient.listFilesCallable().call(request);
1885
- * for (File element : response.getResponsesList ()) {
1911
+ * for (File element : response.getFilesList ()) {
1886
1912
* // doThingsWith(element);
1887
1913
* }
1888
1914
* String nextPageToken = response.getNextPageToken();
@@ -2068,7 +2094,7 @@ public final UnaryCallable<ListTagsRequest, ListTagsPagedResponse> listTagsPaged
2068
2094
* .build();
2069
2095
* while (true) {
2070
2096
* ListTagsResponse response = artifactRegistryClient.listTagsCallable().call(request);
2071
- * for (Tag element : response.getResponsesList ()) {
2097
+ * for (Tag element : response.getTagsList ()) {
2072
2098
* // doThingsWith(element);
2073
2099
* }
2074
2100
* String nextPageToken = response.getNextPageToken();
@@ -2388,9 +2414,7 @@ public final UnaryCallable<DeleteTagRequest, Empty> deleteTagCallable() {
2388
2414
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
2389
2415
* SetIamPolicyRequest request =
2390
2416
* SetIamPolicyRequest.newBuilder()
2391
- * .setResource(
2392
- * DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
2393
- * .toString())
2417
+ * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
2394
2418
* .setPolicy(Policy.newBuilder().build())
2395
2419
* .setUpdateMask(FieldMask.newBuilder().build())
2396
2420
* .build();
@@ -2417,9 +2441,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
2417
2441
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
2418
2442
* SetIamPolicyRequest request =
2419
2443
* SetIamPolicyRequest.newBuilder()
2420
- * .setResource(
2421
- * DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
2422
- * .toString())
2444
+ * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
2423
2445
* .setPolicy(Policy.newBuilder().build())
2424
2446
* .setUpdateMask(FieldMask.newBuilder().build())
2425
2447
* .build();
@@ -2445,9 +2467,7 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
2445
2467
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
2446
2468
* GetIamPolicyRequest request =
2447
2469
* GetIamPolicyRequest.newBuilder()
2448
- * .setResource(
2449
- * DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
2450
- * .toString())
2470
+ * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
2451
2471
* .setOptions(GetPolicyOptions.newBuilder().build())
2452
2472
* .build();
2453
2473
* Policy response = artifactRegistryClient.getIamPolicy(request);
@@ -2473,9 +2493,7 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
2473
2493
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
2474
2494
* GetIamPolicyRequest request =
2475
2495
* GetIamPolicyRequest.newBuilder()
2476
- * .setResource(
2477
- * DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
2478
- * .toString())
2496
+ * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
2479
2497
* .setOptions(GetPolicyOptions.newBuilder().build())
2480
2498
* .build();
2481
2499
* ApiFuture<Policy> future = artifactRegistryClient.getIamPolicyCallable().futureCall(request);
@@ -2500,9 +2518,7 @@ public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
2500
2518
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
2501
2519
* TestIamPermissionsRequest request =
2502
2520
* TestIamPermissionsRequest.newBuilder()
2503
- * .setResource(
2504
- * DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
2505
- * .toString())
2521
+ * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
2506
2522
* .addAllPermissions(new ArrayList<String>())
2507
2523
* .build();
2508
2524
* TestIamPermissionsResponse response = artifactRegistryClient.testIamPermissions(request);
@@ -2528,9 +2544,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
2528
2544
* try (ArtifactRegistryClient artifactRegistryClient = ArtifactRegistryClient.create()) {
2529
2545
* TestIamPermissionsRequest request =
2530
2546
* TestIamPermissionsRequest.newBuilder()
2531
- * .setResource(
2532
- * DockerImageName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]", "[DOCKER_IMAGE]")
2533
- * .toString())
2547
+ * .setResource(RepositoryName.of("[PROJECT]", "[LOCATION]", "[REPOSITORY]").toString())
2534
2548
* .addAllPermissions(new ArrayList<String>())
2535
2549
* .build();
2536
2550
* ApiFuture<TestIamPermissionsResponse> future =
0 commit comments