|
27 | 27 | import com.google.cloud.dataproc.v1.stub.AutoscalingPolicyServiceStub; |
28 | 28 | import com.google.cloud.dataproc.v1.stub.AutoscalingPolicyServiceStubSettings; |
29 | 29 | import com.google.common.util.concurrent.MoreExecutors; |
| 30 | +import com.google.iam.v1.GetIamPolicyRequest; |
| 31 | +import com.google.iam.v1.Policy; |
| 32 | +import com.google.iam.v1.SetIamPolicyRequest; |
| 33 | +import com.google.iam.v1.TestIamPermissionsRequest; |
| 34 | +import com.google.iam.v1.TestIamPermissionsResponse; |
30 | 35 | import com.google.protobuf.Empty; |
31 | 36 | import java.io.IOException; |
32 | 37 | import java.util.List; |
@@ -1011,6 +1016,224 @@ public final void deleteAutoscalingPolicy(DeleteAutoscalingPolicyRequest request |
1011 | 1016 | return stub.deleteAutoscalingPolicyCallable(); |
1012 | 1017 | } |
1013 | 1018 |
|
| 1019 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1020 | + /** |
| 1021 | + * Sets the access control policy on the specified resource. Replacesany existing policy. |
| 1022 | + * |
| 1023 | + * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
| 1024 | + * |
| 1025 | + * <p>Sample code: |
| 1026 | + * |
| 1027 | + * <pre>{@code |
| 1028 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1029 | + * // It will require modifications to work: |
| 1030 | + * // - It may require correct/in-range values for request initialization. |
| 1031 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1032 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1033 | + * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = |
| 1034 | + * AutoscalingPolicyServiceClient.create()) { |
| 1035 | + * SetIamPolicyRequest request = |
| 1036 | + * SetIamPolicyRequest.newBuilder() |
| 1037 | + * .setResource( |
| 1038 | + * AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( |
| 1039 | + * "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") |
| 1040 | + * .toString()) |
| 1041 | + * .setPolicy(Policy.newBuilder().build()) |
| 1042 | + * .setUpdateMask(FieldMask.newBuilder().build()) |
| 1043 | + * .build(); |
| 1044 | + * Policy response = autoscalingPolicyServiceClient.setIamPolicy(request); |
| 1045 | + * } |
| 1046 | + * }</pre> |
| 1047 | + * |
| 1048 | + * @param request The request object containing all of the parameters for the API call. |
| 1049 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1050 | + */ |
| 1051 | + public final Policy setIamPolicy(SetIamPolicyRequest request) { |
| 1052 | + return setIamPolicyCallable().call(request); |
| 1053 | + } |
| 1054 | + |
| 1055 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1056 | + /** |
| 1057 | + * Sets the access control policy on the specified resource. Replacesany existing policy. |
| 1058 | + * |
| 1059 | + * <p>Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
| 1060 | + * |
| 1061 | + * <p>Sample code: |
| 1062 | + * |
| 1063 | + * <pre>{@code |
| 1064 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1065 | + * // It will require modifications to work: |
| 1066 | + * // - It may require correct/in-range values for request initialization. |
| 1067 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1068 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1069 | + * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = |
| 1070 | + * AutoscalingPolicyServiceClient.create()) { |
| 1071 | + * SetIamPolicyRequest request = |
| 1072 | + * SetIamPolicyRequest.newBuilder() |
| 1073 | + * .setResource( |
| 1074 | + * AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( |
| 1075 | + * "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") |
| 1076 | + * .toString()) |
| 1077 | + * .setPolicy(Policy.newBuilder().build()) |
| 1078 | + * .setUpdateMask(FieldMask.newBuilder().build()) |
| 1079 | + * .build(); |
| 1080 | + * ApiFuture<Policy> future = |
| 1081 | + * autoscalingPolicyServiceClient.setIamPolicyCallable().futureCall(request); |
| 1082 | + * // Do something. |
| 1083 | + * Policy response = future.get(); |
| 1084 | + * } |
| 1085 | + * }</pre> |
| 1086 | + */ |
| 1087 | + public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() { |
| 1088 | + return stub.setIamPolicyCallable(); |
| 1089 | + } |
| 1090 | + |
| 1091 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1092 | + /** |
| 1093 | + * Gets the access control policy for a resource. Returns an empty policyif the resource exists |
| 1094 | + * and does not have a policy set. |
| 1095 | + * |
| 1096 | + * <p>Sample code: |
| 1097 | + * |
| 1098 | + * <pre>{@code |
| 1099 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1100 | + * // It will require modifications to work: |
| 1101 | + * // - It may require correct/in-range values for request initialization. |
| 1102 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1103 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1104 | + * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = |
| 1105 | + * AutoscalingPolicyServiceClient.create()) { |
| 1106 | + * GetIamPolicyRequest request = |
| 1107 | + * GetIamPolicyRequest.newBuilder() |
| 1108 | + * .setResource( |
| 1109 | + * AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( |
| 1110 | + * "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") |
| 1111 | + * .toString()) |
| 1112 | + * .setOptions(GetPolicyOptions.newBuilder().build()) |
| 1113 | + * .build(); |
| 1114 | + * Policy response = autoscalingPolicyServiceClient.getIamPolicy(request); |
| 1115 | + * } |
| 1116 | + * }</pre> |
| 1117 | + * |
| 1118 | + * @param request The request object containing all of the parameters for the API call. |
| 1119 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1120 | + */ |
| 1121 | + public final Policy getIamPolicy(GetIamPolicyRequest request) { |
| 1122 | + return getIamPolicyCallable().call(request); |
| 1123 | + } |
| 1124 | + |
| 1125 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1126 | + /** |
| 1127 | + * Gets the access control policy for a resource. Returns an empty policyif the resource exists |
| 1128 | + * and does not have a policy set. |
| 1129 | + * |
| 1130 | + * <p>Sample code: |
| 1131 | + * |
| 1132 | + * <pre>{@code |
| 1133 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1134 | + * // It will require modifications to work: |
| 1135 | + * // - It may require correct/in-range values for request initialization. |
| 1136 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1137 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1138 | + * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = |
| 1139 | + * AutoscalingPolicyServiceClient.create()) { |
| 1140 | + * GetIamPolicyRequest request = |
| 1141 | + * GetIamPolicyRequest.newBuilder() |
| 1142 | + * .setResource( |
| 1143 | + * AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( |
| 1144 | + * "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") |
| 1145 | + * .toString()) |
| 1146 | + * .setOptions(GetPolicyOptions.newBuilder().build()) |
| 1147 | + * .build(); |
| 1148 | + * ApiFuture<Policy> future = |
| 1149 | + * autoscalingPolicyServiceClient.getIamPolicyCallable().futureCall(request); |
| 1150 | + * // Do something. |
| 1151 | + * Policy response = future.get(); |
| 1152 | + * } |
| 1153 | + * }</pre> |
| 1154 | + */ |
| 1155 | + public final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() { |
| 1156 | + return stub.getIamPolicyCallable(); |
| 1157 | + } |
| 1158 | + |
| 1159 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1160 | + /** |
| 1161 | + * Returns permissions that a caller has on the specified resource. If theresource does not exist, |
| 1162 | + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. |
| 1163 | + * |
| 1164 | + * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and |
| 1165 | + * command-line tools, not for authorizationchecking. This operation may "fail open" without |
| 1166 | + * warning. |
| 1167 | + * |
| 1168 | + * <p>Sample code: |
| 1169 | + * |
| 1170 | + * <pre>{@code |
| 1171 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1172 | + * // It will require modifications to work: |
| 1173 | + * // - It may require correct/in-range values for request initialization. |
| 1174 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1175 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1176 | + * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = |
| 1177 | + * AutoscalingPolicyServiceClient.create()) { |
| 1178 | + * TestIamPermissionsRequest request = |
| 1179 | + * TestIamPermissionsRequest.newBuilder() |
| 1180 | + * .setResource( |
| 1181 | + * AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( |
| 1182 | + * "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") |
| 1183 | + * .toString()) |
| 1184 | + * .addAllPermissions(new ArrayList<String>()) |
| 1185 | + * .build(); |
| 1186 | + * TestIamPermissionsResponse response = |
| 1187 | + * autoscalingPolicyServiceClient.testIamPermissions(request); |
| 1188 | + * } |
| 1189 | + * }</pre> |
| 1190 | + * |
| 1191 | + * @param request The request object containing all of the parameters for the API call. |
| 1192 | + * @throws com.google.api.gax.rpc.ApiException if the remote call fails |
| 1193 | + */ |
| 1194 | + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { |
| 1195 | + return testIamPermissionsCallable().call(request); |
| 1196 | + } |
| 1197 | + |
| 1198 | + // AUTO-GENERATED DOCUMENTATION AND METHOD. |
| 1199 | + /** |
| 1200 | + * Returns permissions that a caller has on the specified resource. If theresource does not exist, |
| 1201 | + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. |
| 1202 | + * |
| 1203 | + * <p>Note: This operation is designed to be used for buildingpermission-aware UIs and |
| 1204 | + * command-line tools, not for authorizationchecking. This operation may "fail open" without |
| 1205 | + * warning. |
| 1206 | + * |
| 1207 | + * <p>Sample code: |
| 1208 | + * |
| 1209 | + * <pre>{@code |
| 1210 | + * // This snippet has been automatically generated and should be regarded as a code template only. |
| 1211 | + * // It will require modifications to work: |
| 1212 | + * // - It may require correct/in-range values for request initialization. |
| 1213 | + * // - It may require specifying regional endpoints when creating the service client as shown in |
| 1214 | + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library |
| 1215 | + * try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = |
| 1216 | + * AutoscalingPolicyServiceClient.create()) { |
| 1217 | + * TestIamPermissionsRequest request = |
| 1218 | + * TestIamPermissionsRequest.newBuilder() |
| 1219 | + * .setResource( |
| 1220 | + * AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( |
| 1221 | + * "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") |
| 1222 | + * .toString()) |
| 1223 | + * .addAllPermissions(new ArrayList<String>()) |
| 1224 | + * .build(); |
| 1225 | + * ApiFuture<TestIamPermissionsResponse> future = |
| 1226 | + * autoscalingPolicyServiceClient.testIamPermissionsCallable().futureCall(request); |
| 1227 | + * // Do something. |
| 1228 | + * TestIamPermissionsResponse response = future.get(); |
| 1229 | + * } |
| 1230 | + * }</pre> |
| 1231 | + */ |
| 1232 | + public final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> |
| 1233 | + testIamPermissionsCallable() { |
| 1234 | + return stub.testIamPermissionsCallable(); |
| 1235 | + } |
| 1236 | + |
1014 | 1237 | @Override |
1015 | 1238 | public final void close() { |
1016 | 1239 | stub.close(); |
|
0 commit comments